Plt.title('Line Chart') Matplotlib line chart The following example shows how to use plot() to draw a line chart. colorbar() will display the color bar on the right. jet is a name of a built-in color map in Matplotlib. In the 3rd and 4th examples, we use scatter() to draw the chart instead. The value of colors will be in the interval, which will correspond to the distribution in the color map. Plt.title('Scatter Chart') Matplotlib grouping scatter chart Plt.title('Scatter Chart') plt.scatter('x', 'y', data=df, c=colors, cmap='jet', sizes=sizes, alpha=0.3) Plt.scatter(x, y, c=colors, cmap='jet', sizes=sizes, alpha=0.3) The following example shows how to use scatter() to draw a scatter chart. The second example shows how to use the parameter data. When passing a DataFrame to the parameter data, we only need to pass column names to the parameters x and y. xlabel() and ylabel() can set the title of the x-axis and y-axis. And title() sets the title of the chart. In the first example, we use plot() to draw (x, y), the parameter label can set the label in the legend, and call legend() to display the legend. Plt.title('Scatter Chart') Matplotlib scatter chart The following example shows how to use plot() to draw a scatter chart.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |