In python an example of drawing scatter plot with scatter

  • 2021-07-09 08:51:30
  • OfStack

As shown below:


# coding=utf-8
import matplotlib.pyplot as plt

x_values=[1,2,3,4,5]
y_values=[1,4,9,16,25]
# s Is the size of the point 
plt.scatter(x_values,y_values,s=100)

#  Set chart title and label coordinate axis 
plt.title("Scatter pic",fontsize=24)
plt.xlabel("Value",fontsize=14)
plt.ylabel("Scatter of Value",fontsize=14)

#  Set the size of the tick mark 
plt.tick_params(axis='both',which='major',labelsize=14)

plt.show()

Related articles: