Dot graph express scatter stripplot Scatter plot express scatter scatterplot Bubble chart express scatter with color and size attributes scatterplot with size attribute Radar chart express line_polar matplotlib.pyplot figure Pictogram graph_objects Figure having Scatter with marker attribute matplotlib.pyplot...
ax.scatter(y=df.index, x=df.cty, s=75, color='firebrick', alpha=0.7) # Title, Label, Ticks and Ylim ax.set_title('Dot Plot for Highway Mileage', fontdict={'size': 22}) ax.set_xlabel('Miles Per Gallon') ax.set_yticks(df.index) ax.set_yticklabels(df.manufacturer.str.title(...
ax.plot(x, y, 's') fig.show() 1. 2. 3. 4. 5. 6. 7. 8. 更直观的写法是用scatter() import matplotlib.pyplot as plt fig, ax = plt.subplots() x=[0, 1, 2, 3, 4] y=[0, 3, 1, 5, 2] ax.scatter(x, y, marker='s') fig.show() 1. 2. 3. 4. 5. 6. 7. 8....
plt.gca().set(xlim=(0.0,0.1),ylim=(0,90000),xlabel='Area',ylabel='Population')plt.xticks(fontsize=12);plt.yticks(fontsize=12)plt.title("Scatterplot of Midwest Area vs Population",fontsize=22)plt.legend(fontsize=12)plt.show() 复制 2. 气泡图 有时您想要显示边界内的一组点以强调它们...
直接使用plot()函数画图,是对于一般的简单数据。我们可以采用直接调用plot()函数对列表数据进行直接画图。初期学习直接使用plot()函数能便于我们对后面图形学习奠定函数的参数及基础。 matplotlib图的组成: Figure (画布) Axes (坐标系) Axis (坐标轴) 图形(plot(),scatter(),bar(),...) ...
plt.plot? out: Signature: plt.plot(*args, scalex=True, scaley=True, data=None, **kwargs) Docstring: Plot y versus x as lines and/or markers. Call signatures:: plot([x], y, [fmt], *, data=None, **kwargs) plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)...
scatter(y=i, x='cty', data=df_median.loc[df_median.index == make, :], s=75, c='#dc2624') # Annotate ax.text(33, 13, "$red \; dots \; are \; the \: median$", fontdict={'size': 12}, color='#dc2624') # Decorations red_patch = plt.plot([], [], marker="o", ...
scatter 散点图或气泡图 stackplot 面积图 polar 雷达图 boxplat 箱形图 imshow 热力图 1.1.4绘图选项 设置标题 plt.title('上年开销',loc='right') #设置标题并靠右,缺省center 填充色 plt.fill(x,y,color=’r’) #使用指定颜色填充区域 c2线 ...
plt.scatter(X[:, 0], X[:, 1], c=labels, cmap='viridis')centers = kmeans.cluster_centers_plt.scatter(centers[:, 0], centers[:, 1], c='red', marker='x', label='Cluster Centers')plt.title('K-means Clustering')plt.xlabel('Feature 1')plt.ylabel('Feature 2')plt.legend()plt....
# Plot the different class distributions for i, l in enumerate(np.unique(y)): _x1 = x1[y == l] _x2 = x2[y == l] _y = y[y == l] class_distr.append(plt.scatter(_x1, _x2, color=colors[i])) # Add a legend