Python 3.x 如何更改X轴以使其反映数据点

Python 3.x 如何更改X轴以使其反映数据点,python-3.x,pandas,matplotlib,Python 3.x,Pandas,Matplotlib,我想更改x轴,使其实际反映我的数据,并重新格式化,使股票代码间距以20为增量。“波长”范围为100-320,但在实际图形上,它是从0-400。我尝试了xlim函数,它似乎刚刚放大了 import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.pyplot import figure Data_06 = pd

我想更改x轴,使其实际反映我的数据,并重新格式化,使股票代码间距以20为增量。“波长”范围为100-320,但在实际图形上,它是从0-400。我尝试了xlim函数,它似乎刚刚放大了

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.pyplot import figure


Data_06 = pd.read_csv('/Users/....')
Data_06 = Data_06.transpose()
Data_06['Average'] = Data_06.mean(axis=1)
Data_06.reset_index(drop=False, inplace=True)
Data_06.rename(columns={'index':'Wavelength'}, inplace=True)

Data_06_Average = Data_06['Average']
Data_06_Average.plot(x=Data_06['Wavelength'],y=Data_06['Average'])
fig = plt.gcf()
fig.set_size_inches(10.5,5.5)
fig.savefig('test2png.png', dpi=100)


plt.ylabel('Intensity')
plt.xlabel("Wavelength (nm)")
plt.show()


检查
df.plot
@ImportanceOfBeingErnest的正确语法我也尝试了scalex和ax.setxticks参数,但似乎没有任何效果。。。。我对Python相当陌生,已经在这个简单的任务上呆了好几天了:(我非常感谢任何额外的输入!谢谢。在这种情况下,请检查其他人如何使用
df.plot
。没有任何现有的脚本使用类似
df.plot(x=df[“col1”],y=df[“col2”])