Home > Blockchain >  How to manually assign x-axis value using pandas?
How to manually assign x-axis value using pandas?

Time:09-20

enter image description hereI have a CSV file with 12 columns and 4,00,020 rows, I want to plot these columns in separate graphs. I want to manually give x-axis values. x- axis = 0, 0.2, 0.4, 0.6 ..., 2

How can I give the x-axis manually? I tried the below code but didn't work. Kindly help. Thanks in advance.

import matplotlib.pyplot as plt

x= np.arange(0,2,0.2)
df.plot(x, y = 'column1')
plt.show()

I want the output something similar to the image above.

CodePudding user response:

df.plot(xlim=(0.2,2), xticks=np.arange(0,2,0.2), subplots=True)

check out the documentation

CodePudding user response:

try:

import matplotlib.pyplot as plt
x = [1, 2, 3, 4] 
y = [6, 10, 15, 4] #or your column
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')

plt.show()

  • Related