Choosing the shape of markers

There are dozens of available markers to denote data points. They are grouped into unfilled markers and the bolder filled_markers. Here are a few examples:

  • 'o': Circle
  • 'x': Cross
  • '+': Plus sign
  • 'P': Filled plus sign
  • 'D': Filled diamond
  • 's': Square
  • '^': Triangle

We can access the keys and names of all available marker shapes under mpl.lines.Line2D.markers. The following is a code snippet for an overview of all our marker shapes:

import matplotlib.pyplot as plt
from matplotlib.lines import Line2D

for i,marker in enumerate(Line2D.markers):
plt.scatter(i%10,i,marker=marker,s=100) # plot each of the markers in size of 100
plt.show()

Here is the graphical output of the markers:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.24.98