Balash
Balash

Reputation: 67

python: Adjusting the values in the x axis of a plot

IM trying to create plots in python.the first 10 rows of the dataset named Psmc_dolphin looks like the below. the original file has 57 rows and 5 columns.

               0          1             2         3         4
0   0.000000e+00  11.915525    299.807861  0.000621  0.000040
1   4.801704e+03  11.915525    326.288712  0.000675  0.000311
2   1.003041e+04  11.915525    355.090418  0.000735  0.000497
3   1.572443e+04  11.915525    386.413025  0.000800  0.000548
4   2.192481e+04   0.583837   8508.130872  0.017613  0.012147
5   2.867635e+04   0.583837   9092.811889  0.018823  0.014021
6   3.602925e+04   0.466402  12111.617016  0.025073  0.019815
7   4.403533e+04   0.466402  12826.458632  0.026553  0.021989
8   5.275397e+04   0.662226   9587.887034  0.019848  0.017158
9   6.224833e+04   0.662226  10201.024439  0.021118  0.018877
10  7.258698e+04   0.991930   7262.773560  0.015035  0.013876

im trying to plot the column0 in x axis and column1 in y axis i get a plot with xaxis values 1000000,2000000,3000000,400000 etc. andthe codes i used are attached below.

i need to adjust the values in x axis so that the x axis should have values such as 1e+06,2e+06,3e+06 ... etc instead of 1000000,2000000,3000000,400000 etc .

# load the dataset 
Psmc_dolphin = pd.read_csv('Beluga_mapped_to_dolphin.0.txt', sep="\t",header=None)
plt.plot(Psmc_dolphin[0],Psmc_dolphin[1],color='green')

Any help or suggstion will be appreciated

Upvotes: 0

Views: 40

Answers (1)

Arihant Kamdar
Arihant Kamdar

Reputation: 124

Scaling the values might help you. Convert 1000000 to 1,2000000 to 2 and so on . Divide the values by 1000000. Or use some different scale like logarithmic scale. I am no expert just a newbie but i think this might help

Upvotes: 1

Related Questions