Getting python draw a scatter plot

import matplotlib.pyplot as plt

x_values = list(range(1,1001))
y_values = [x**2 for x in x_values]
plt.scatter(x_values, y_values,c=y_values,cmap=plt.cm.Blues, edgecolor='none', s=40)

# Set the chart title, and to a coordinate axis labeled
plt.title ( "Squares Numbers", fontSize = 24)
plt.xlabel ( "the Value", fontSize = 14)
plt.ylabel ( "Square of value", fontSize = 14)

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

# Set the range of each axis
plt.axis ([0,1100,0,1100000])
plt.show ()
plt.savefig ( 'squares_plot.png', bbox_inches = '' tight ')

Guess you like

Origin www.cnblogs.com/medik/p/11374870.html