Issue
I want plot values in ascending order for both x and y axis
Code
color_dict = dict({'1':'orange',
'2':'steelblue',
'3':'lightgreen',
'4': 'purple'
})
sns.set_style("whitegrid", {'grid.linestyle': '-'})
plt.figure(figsize=(12,8))
ax1=sns.scatterplot(data=df2, x="x", y="y", hue="result",markers= 'x',s=950, palette= color_dict )
#ax1.set(xlabel=None, ylabel=None, xticklabels=[], yticklabels=[])
#ax1.set_yticks((0, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5), minor=0)
#ax1.set_xticks([0, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.6], minor=False)
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
plt.setp(ax1.get_legend().get_texts(), fontsize='14') # for legend text
ax1.plot()
Plot
Goal
Solution
Change data type to int
or float
df['x'] = df['x'].astype(int)
df['y'] = df['y'].astype(int)
Answered By - user15212564
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.