0

I have a very simple code of displaying an Excel value table as a graph in Jupyter Notebook.

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()

where the output is a simple line. I want to add on the graph the exact values ​​in the form of dots. (add on not to replace).

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • I've removed your last sentence, as it was another issue. Please create a separate question for that. – mkrieger1 Dec 19 '21 at 13:02

1 Answers1

0

I guess you are asking how to add marker in plt.plot().

Try this -

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()

If the above does not work, you can read more here

indraneel
  • 66
  • 3