I am trying to plot a graph where there are two conditions and each condition must have different markers and different shades of the same color. But I am getting error
ValueError: Unrecognized marker style [‘o’, ‘X’]. How to troubleshoot this?
Here is the code:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.markers as mrk
from matplotlib.colors import to_rgb, to_rgba
data_PB1 = pd.read_csv("....csv")
data_PB1.head()
nameOrder = ['200nt','400nt', '800nt']
color_dict = {'NoNS2': to_rgba('#0173b2', 0.3),
'NS2': to_rgba('#0173b2', 0.8)}
palette = [color_dict[hue] for hue in ['NoNS2', 'NS2']]
marker_dict={'NoNS2':'o', 'NS2':'X'}
marker=[marker_dict[hue] for hue in ['NoNS2', 'NS2']]
ax = sns.stripplot(data=data_PB1, x='Target', y='Value', edgecolor='black',
jitter=True, dodge=True, linewidth=1.2, s=13, hue="Condition",
hue_order=['NoNS2', 'NS2'], palette=palette, alpha= 0.8,marker=marker)
sns.despine()
ax.legend( ['-NS2','+NS2'], bbox_to_anchor=(0.85, 1), loc=2, fontsize = 12, borderaxespad=0.,frameon=False)
plt.ylim(0,7)
plt.yticks(fontsize=12)
plt.xticks(fontsize=12)
for legend_handle in ax.get_legend().legendHandles:
legend_handle.set_edgecolor('black')
plt.savefig('Figures/PB1_Segment.pdf', format='pdf', bbox_inches = "tight")