plt.rc('font', family='SimHei', size=13) # 第一块区域 fig = plt.figure() left, bottom, width, height = 0.1, 0.1, 0.8, 0.8 ax1 = fig.add_axes([left, bottom, width, height]) ax1.plot(df1['sepal_length'], 'r') ax1.set_title('area区域') # 第二块区域 left, bottom, wi...
df[:5].plot(style=':') # 虚线 df[:5].plot(style='-.') # 虚实相间 df[:5].plot(style='--') # 长虚线 df[:5].plot(style='-') # 实线(默认) df[:5].plot(style='.') # 点 df[:5].plot(style='*-') # 实线,数值为星星 df[:5].plot(style='^-') # 实线,数值为三角...
plt.rcParams['axes.unicode_minus']=False plot方法默认是折线图,而它还支持以下几类图表类型: ‘line’ : 折线图 (default) ‘bar’ : 柱状图 ‘barh’ : 条形图 ‘hist’ : 直方图 ‘box’ : 箱型图 ‘kde’ : 密度图 ‘density’ : 同密度图 ‘area’ : 面积图 ‘pie’ : 饼图 ‘scatter’ ...
df[:5].plot(legend=False) 可以反向排序图例: df[:5].plot(legend='reverse') 图形大小 figsize 参数传入一个元组,可以指定图形的宽高英寸值。 df[:5].plot.bar(figsize=(10.5,5)) 当然可以给出全局默认的图形大小: importmatplotlib.pyplotaspltplt.rcParams['figure.figsize']=(15.0,8.0)# 固定显示大小...
fig= plt.figure()#新建画布ax1 = fig.add_subplot(2,1,1)#选择子画布df.plot(ax=ax1)#在子画布上画图 返回值 matplotlib.axes.Axes或者 多个Axes的ndarray 通过这个返回值,我们可以对具体子图进行操作(如果通过subplots参数引入了话)。 假设我们有5列,并通过subplots参数将这5列单独绘制出来,那么就能用ax[i...
plt.figure(figsize=(10,0.2))plt.imshow(gradient,aspect='auto',cmap=cmap)plt.axis('off')plt.title(f'{cmap_item.capitalize()} Color Palette',loc='left',fontsize=9)plt.show() Viridis调色板。现在,我们将向数据透视表应用颜色渐变,以便可以使用Viridis调色板观察它的着色方式。在这种情况下,较浅的...
plot() 支持很多图像类型,包括bar, hist, box, density, area, scatter, hexbin, pie等,下面我们分别举例子来看下怎么使用。 bar df.iloc[5].plot(kind="bar"); 多个列的bar: df2 = pd.DataFrame(np.random.rand(10,4), columns=["a","b","c","d"]) ...
Figure - 画板 Title - 标题 X axis label - X轴标签 Y axis label - Y轴标签 Legend - 图例 Major tick label - 主刻度标签 Minor tick label - 次刻度标签 Grid - 网格 Line (line plot) - 线 Markers (scatter plot) - 标记 Major tick - 主刻度 ...
import seaborn as sns import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签plt.rcParams['axes.unicode_minus']=False #用来正常显示负号plt.figure(figsize=(10,6)) # 使用Seaborn绘制折线图 sns.lineplot(data=df, x='日期', y='销售数', color...
可以在一个plt.plot命令后继续加另一个plt.plot命令,可以在一张图上做另一条线。plt.figure(...