python点图
The dot plot is a type of data representation in which each data-point in the figure is represented as a dot. Dot plot underlies discrete functions unlike a continuous function in a line plot. Each value could be correlated but cannot be connected. Matplotlib.pyplot provides a feature of dot plots. Dot plots are majorly used in clustering data analysis.
点图是一种数据表示形式,其中图中的每个数据点都表示为一个点。 与线图中的连续函数不同,点图是离散函数的基础。 每个值可以关联但不能连接。 Matplotlib.pyplot提供了点图功能。 点图主要用于聚类数据分析。
Application: In examples like classifier machine learning algorithms, we often see a dot plot or a scatter plot. It is reasonably good for visualizing clusters using dot plots or scatter plot instead of using line plots.
应用:在分类器机器学习算法之类的示例中,我们经常看到点图或散点图。 对于使用点图或散点图而不是线图可视化群集,这是相当不错的。
Syntax:
句法:
plt.plot([4,7,3,6,1,8,9,2,3], 'ro')
ro - This is the command used for the Red Dot plot. In more words, _o is for dot plot and r_ is for Red. We can change the color of the dot with replacing r with g for green and y for yellow and there are numbers of colors available in the matplotlib library package.
ro-这是用于红点图的命令。 换句话说, _o代表点图, r_代表Red。 我们可以通过将r替换为g代表绿色,将y替换为黄色来改变点的颜色,并且matplotlib库包中提供了多种颜色。
Python代码演示点图示例 (Python code to demonstrate example of dot plot)
# Data Visualization using Python
# Dot Plot
import matplotlib.pyplot as plt
# plotting using plt.pyplot()
plt.plot([4,7,3,6,1,8,9,2,3], 'ro')
# axis labeling
plt.xlabel('numbers')
plt.ylabel('values')
# figure name
plt.title('Dot Plot : Red Dots')
##########################################
##########################################
plt.figure()
# function for a different figure
# plotting using plt.pyplot() Figure 2
plt.plot([1,7,3,6,8,42,34,62],[1,8,9,3,10,11,12,13], 'go')
# axis labeling
plt.xlabel('numbers')
plt.ylabel('values')
# figure name
plt.title('Dot Plot : Green Dot')
##########################################
##########################################
plt.figure()
# function for a different figure
# plotting using plt.pyplot() Figure 2
plt.plot([1,7,3,6,8,42,34,62],[1,8,9,3,10,11,12,13], 'yo')
# axis labeling
plt.xlabel('numbers')
plt.ylabel('values')
# figure name
plt.title('Dot Plot : Yellow Dot')
Output:
输出:
Output is as figure
翻译自: https://www.includehelp.com/python/dot-plot.aspx
python点图