How to change the marker size with pandas.plot() in Matplotlib?

PythonServer Side ProgrammingProgramming

To change the marker size with pandas.plot(), we can take the following steps −

  • Set the figure size and adjust the padding between and around the subplots.
  • Create a Pandas dataframe with three columns, col1, col2 and col3.
  • Use pandas.plot() with marker="*" and markersize=15.
  • To display the figure, use show() method.


import matplotlib.pyplot as plt
import pandas as pd

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

df = pd.DataFrame([[2, 1, 4], [5, 2, 1], [4, 0, 1]], columns=['col1', 'col2', 'col3'])

df.plot(marker="*", markersize=15)


Published on 08-Jul-2021 10:57:02