Set variable point size in Matplotlib

MatplotlibServer Side ProgrammingProgramming

To set the variable point size in matplotlib, we can take the following steps−

  • Initialize the coordinates of the point.
  • Make a variable to store the point size.
  • Plot the point using scatter method, with marker=o, color=red, s=point_size.To display the figure, use show() method.


from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
xy = (3, 4)
point_size = 100
plt.scatter(x=xy[0], y=xy[1], marker='o', c='red', s=point_size)


Updated on 06-May-2021 12:53:39