如何解决从Excel文件绘制对数图
我试图通过导入Excel文件来绘制对数图来绘制图形。
这是我的代码,但看来我做错了。
import matplotlib.pyplot as plt
import pandas as pd
df=pd.read_excel("C:\\users\mycomputer\\myfile.xlsx")
df.plot(x,y)
plt.show()
解决方法
这是一个简短的示例:
# from first cell in Jupyter notebook
import matplotlib.pyplot as plt
import pandas as pd
s = pd.Series(data=[1,10,100,1_000,10_000],index=[1,2,3,4,5])
# from second cell in Jupyter notebook
fig,ax = plt.subplots(figsize=(8,5))
ax.plot(s)
ax.set(xscale='log',yscale='log',xlabel='x-axis',ylabel='y-axis',title='Plot Title Here')
plt.show();
这里是Matplotlib的一个很好的参考:https://jakevdp.github.io/PythonDataScienceHandbook/04.00-introduction-to-matplotlib.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。