I am trying to make a boxplot using Seaborn and my x-axis includes numerical values and not categories. When I use the following code, I am losing information about the exponents. All the x-axis values are *E13. Cannot seem to add it even with ticker labels & scientific notation.
fig=plt.figure(dpi=600)
ax=sns.boxplot(y='Y',x='X', data=df_new,palette="colorblind",width=.5,whis=1.5)
ax.xaxis.set_major_locator(ticker.MultipleLocator(3))
ax.xaxis.set_major_formatter(ticker.ScalarFormatter()) plt.tight_layout()
See the output figure here:
Also the x-axis values seem incorrect as the values go till 5E13 and it doesn't show up. Following is one set of data.
X Y
0 0.0 0.0
1 0.0 0.0
2 0.0 0.0
3 0.0 0.0
4 0.0 0.0
5 0.0 0.0
6 0.0 0.0
7 1281250000000.0 2.17e-05
8 2800000000000.0 0.003213235
9 4450000000000.0 0.171645861
10 6118750000000.001 0.898827775
11 7750000000000.0 2.066164133
12 9375000000000.0 3.3495570389999996
13 11000000000000.002 4.569949722
14 12562500000000.0 5.657290564
15 14125000000000.0 6.602228919
16 15750000000000.0 7.416413887
17 17375000000000.002 8.147655987
18 19062500000000.0 8.873699614
19 20875000000000.004 9.567954739
20 22687500000000.0 10.18507194
21 24625000000000.004 10.69537502
22 26562500000000.0 11.10099437
23 28562500000000.004 11.41167819
24 30625000000000.0 11.63932739
25 32687500000000.0 11.79669911
26 34812500000000.004 11.89577136
27 36937500000000.0 11.9426608
28 39062500000000.01 11.94661993
29 41250000000000.01 11.91209701
30 43437500000000.01 11.84470038
31 45625000000000.01 11.7506115
32 47875000000000.0 11.63069121
33 50125000000000.0 11.49003632
Any help would be appreciated. Thanks!
Not sure what you are trying to do with those two lines:
ax.xaxis.set_major_locator(ticker.MultipleLocator(10**12))
ax.xaxis.set_major_formatter(ticker.ScalarFormatter())
I would just remove them and use an axis label rotation instead:
plt.xticks(rotation=90)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.