0

我尝试通过导入 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()
4

1 回答 1

1

这是一个简短的例子:

# 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

于 2020-08-15T14:22:59.670 回答