August 2017
Beginner to intermediate
334 pages
8h 22m
English
The cap of dashes can be rounded by setting the dash_capstyle parameter if we want to create a softer image such as in promotion:
import numpy as npimport matplotlib.pyplot as plt# Prepare 6 linesx = np.linspace(0,200,100) y1 = x*0.5y2 = xy3 = x*2y4 = x*3y5 = x*4y6 = x*5# Plot lines with different dash cap stylesplt.plot(x,y1,label = '0.5x', lw=5, ls=':',dash_capstyle='butt')plt.plot(x,y2,label = 'x', lw=5, ls='--',dash_capstyle='butt')plt.plot(x,y3,label = '2x', lw=5, ls=':',dash_capstyle='projecting')plt.plot(x,y4,label = '3x', lw=5, ls='--',dash_capstyle='projecting')plt.plot(x,y5,label = '4x', lw=5, ls=':',dash_capstyle='round')plt.plot(x,y6,label = '5x', lw=5, ls='--',dash_capstyle='round')plt.show()
Looking ...
Read now
Unlock full access