python - How to label and change the scale of Seaborn kdeplot's axes -
here's code
import numpy np numpy.random import randn import pandas pd scipy import stats import matplotlib mpl import matplotlib.pyplot plt import seaborn sns fig = sns.kdeplot(treze, shade=true, color=c1,cut =0, clip=(0,2000)) fig = sns.kdeplot(cjjardim, shade=true, color=c2,cut =0, clip=(0,2000)) fig.figure.suptitle("plot", fontsize = 24) plt.xlabel('purchase amount', fontsize=18) plt.ylabel('distribution', fontsize=16)
, results in following plot:
i want 2 things:
1) change scale of y-axis multiplying values 10000 and, if it's possible, add % sign numbers. in other words, want y-axis values shown in above plot 0%, 5%, 10%, 15%, 20%, 25%, , 30%.
2) add more values x-axis. i'm particularly interested in showing data in intervals of 200. in other words, want x-axis values shown in plot 0, 200, 400, 600,... , on.
1) looking combination of get_yticks() , set_yticks:
plt.yticks(fig.get_yticks(), fig.get_yticks() * 100) plt.ylabel('distribution [%]', fontsize=16)
note: mwaskom commenting times 10000 , % sign mathematically incorrect.
2) can specify want ticks via xticks function. have more ticks , data easier read. not more data way.
plt.xticks([0, 200, 400, 600]) plt.xlabel('purchase amount', fontsize=18)
note: if wanted limit view specified x-values might have glimpse @ plt.xlim() , reduce figure interesting range.
Comments
Post a Comment