August 2017
Beginner to intermediate
334 pages
8h 22m
English
We often want to change the marker sizes so as to make them clearer to read from a slideshow. Sometimes we need to adjust the markers to have a different numerical value of markersize to:
import numpy as npimport matplotlib.pyplot as pltimport matplotlib.ticker as ticker# Prepare 5 linesx = np.linspace(0,20,10)y1 = xy2 = x*2y3 = x*3y4 = x*4y5 = x*5# Plot lines with different marker sizesplt.plot(x,y1,label = 'x', lw=2, marker='s', ms=10) # square size 10plt.plot(x,y2,label = '2x', lw=2, marker='^', ms=12) # triangle size 12plt.plot(x,y3,label = '3x', lw=2, marker='o', ms=10) # circle size 10plt.plot(x,y4,label = '4x', lw=2, marker='D', ms=8) # diamond size 8plt.plot(x,y5,label = '5x', lw=2, marker='P', ms=12) # filled ...
Read now
Unlock full access