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

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



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.

Example

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)

plt.show()

Output

Updated on: 2021-07-08T10:59:32+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements