python点图_Python | 点图
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 Plotimport 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點圖
總結
以上是生活随笔為你收集整理的python点图_Python | 点图的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: Matlab(将2维图片显示成3维图形)
 - 下一篇: linux怎么将一个文件移动到另一个目录