x=np.linspace(0,10,100)y1=np.sin(x)y2=np.cos(x)y3=np.tan(x)plt.figure(figsize=(10,6))plt.plot(x,y1,linestyle='--',label='Dashed')plt.plot(x,y2,linestyle=':',label='Dotted')plt.plot(x,y3,linestyle='-.',label='Dash-dot')plt.title('Different line styles - how2matplotl...
100)y=np.linspace(-3,3,100)X,Y=np.meshgrid(x,y)Z=X**2+Y**2# 绘制自定义样式的等高线图plt.figure(figsize=(10,8))contour=plt.contour(X,Y,Z,levels=[0.5,1,2,4,8],colors=['r','g','b','c','m'],linestyles=['solid','dashed','dashdot','dotted','solid'],linewidths=[1...
Line Styles You can choose any of these styles: StyleOr 'solid' (default)'-'Try it » 'dotted'':'Try it » 'dashed''--'Try it » 'dashdot''-.'Try it » 'None''' or ' 'Try it » Line Color You can use the keyword argumentcoloror the shortercto set the color of ...
'-.' dash-dot line style ':' dotted line style Example format strings: 'b' # blue markers with default shape 'or' # red circles '-g' # green solid line '--' # dashed line with default color '^k:' # black triangle_up markers connected by a dotted line plt.plot(x, x+0, '...
虚线有两种一种是点虚线一种是全虚线。英文叫做dashed line 和dash-dot line。...线条通过参数linestyle来设置,我们先来看看全虚线,两个短线表示全虚线。如果是一根短线表示实线,也就是默认的style。 ? 2K20 点击加载更多 扫码 添加站长 进交流群 领取专属 10元无门槛券 手把手带您无忧上云...
plt.plot(x, x +2, linestyle='dashdot') plt.plot(x, x +3, linestyle='dotted'); # 还可以用形象的符号代表线条风格 plt.plot(x, x +4, linestyle='-')# 实线 plt.plot(x, x +5, linestyle='--')# 虚线 plt.plot(x, x +6, linestyle=...
``'-.'`` dash-dot line style ``':'`` dotted line style === === **Colors** The supported color abbreviations are the single letter codes === === # 颜色也可以是16进制的颜色代码 character color === === ``'b'`` blue ``'g'`` green ``'r'`` red ``'c'`` cyan ``'...
'-'solid line style '--'dashed line style '-.'dash-dot line style ':'dotted line style 折线图还可以又标记来凸显实际的数据点,matplotlib 创建一个连续的折线图,插入点之间有时分辨不出。标记可以是样式字符串的一部分,样式字符串中的线类型,标记类型必须在颜色后面。
plt.plot(x, x + 2, linestyle='dashdot') plt.plot(x, x + 3, linestyle='dotted'); # 还可以用形象的符号代表线条风格 plt.plot(x, x + 4, linestyle='-') # 实线 plt.plot(x, x + 5, linestyle='--') # 虚线 plt.plot(x, x + 6, linestyle='-.') # 长短点虚线 ...
formatting like color, markerandlinestyle. It's a shortcut string notation described in the *Notes* section below. >>> plot(x, y) # plot x and y using default line style and color >>> plot(x, y, 'bo') # plot x and y using blue circle markers ...