我有一个非常简单的代码,可以在木星笔记本中将Excel值表显示为图形。
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_excel("file name")
plt.plot(df["viscosity"], df['D'])
plt.xlabel('viscosity[]')
plt.ylabel('D [m^2/s]')
plt.title("The diffusion coeffcient as a function of the viscosity ")
plt.legend()
plt.show()其中输出是一个简单的行。我想用点的形式在图上加精确的值。(加起来不替换)。
发布于 2021-12-19 13:17:20
我想您是在问如何在marker中添加plt.plot()。
试试这个-
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_excel("file name")
plt.plot(df["viscosity"], df['D'], linestyle='--', marker='o', color='b', label='line with marker'))
plt.xlabel('viscosity[]')
plt.ylabel('D [m^2/s]')
plt.title("The diffusion coeffcient as a function of the viscosity ")
plt.legend()
plt.show()如果上面的内容不起作用,您可以使用read more here
https://stackoverflow.com/questions/70411583
复制相似问题