1.折线图 import matplotlib.pyplot as plt input_values = [1,2,3,4,5] squares = [1,4,9,16,25] plt.plot(input_values,squares,linewidth = 5) #线条粗细为5 plt.title("Square Numbers",fontsize = 24) #图标标题,字体大小 plt.xlabel("Value",fontsize = 14) #横坐标,字体大小 plt.ylabel...
plt.plot([1,2,3],[4,5,6],marker='$\circledR$', markersize=15, color='r', alpha = 0.5 ,label='非常规marker') plt.plot([1.5,2.5,3.5],[1.25,2.1,6.5],marker='$\heartsuit$', markersize=15, color='#f19790', alpha=0.5,label='非常规marker') plt.plot([1,2,3],[2.5,6.2,8]...
#lines.linestyle: -#默认线性为实心线'-'#lines.marker: None#默认线上无marker#axes.grid: False#默认无网格线#默认绘图颜色修改#axes.prop_cycle cycler('color', ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17...
plot() supports an optional third argument that contains a format string for each pair of X, Y arguments in the form of: plt.plot(X, Y, '<format>', ...) plot通过第三个string参数可以用来指定,Colors,Line styles,Marker styles 线的颜色, 线的style, Marker的style 可以用string format单独或...
plot([1.8,2.8,3.8],[1,2,3],marker='2', markersize=15, color='#ec2d7a',label='常规marker') #非常规marker使用 #注意使用两个$符号包围名称 plt.plot([1,2,3],[4,5,6],marker='$\circledR$', markersize=15, color='r', alpha=0.5,label='非常规marker') plt.plot([1.5,2.5,3.5],[...
3.自定义marker import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['SimHei'] # 用于显示中文 plt.rcParams['axes.unicode_minus'] = False # 用于显示中文 plt.figure(dpi=200) #常规marker使用 plt.plot([1,2,3],[1,2,3],marker=4, markersize=15, color='lightblue',label='常...
plot([x], y, [fmt], data=None, **kwargs) plot([x], y, [fmt], [x2], y2, [fmt2], …, **kwargs) 其中可选参数[fmt]是一个字符串,用于定义图的基本属性:颜色(color)、点型(marker)、线型(linestyle) 具体形式为:fmt = [color][marker][linestyle],注意这里的三个属性只能是每个属性的...
plt.plot(x,color='g') plt.plot(x+1,color='0.5') plt.plot(x+2,color='#FF00FF') plt.plot(x+3,color=(0.1,0.2,0.3)) plt.show() 具体实现效果: 7. 切换线条样式-marker 如果想改变线条的样式,我们可以使用修改 plot() 绘图接口中 mark 参数,具体实现效...
plt.plot(x, y, label = "test", linewidth = '1', color=' red ', linestyle=':', marker='|') 该函数的作用是:将y与x绘制为直线或标记。 x:点的横坐标,可迭代对象 y:点的纵坐标,可迭代对象 linewidth:设置线的粗细 label:设置图例,需要调用 plt 或子图的 legend 方法 color:颜色 linestyle:线...
如果想改变线条的样式,我们可以使用修改 plot 绘图接口中 mark 参数,具体实现效果: plt.plot(x+ 1,marker= '>') #显示坐标轴,plt.axis,4个数字分别代表x轴和y…