Created
January 15, 2020 19:46
-
-
Save Ze1598/93a0fa1b0c821e8a8418ab9d86bbd5e0 to your computer and use it in GitHub Desktop.
Matplotlib intro: scatter plots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib import pyplot as plt | |
x_coords = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] | |
fav_nums = [9, 37, 45, 32, 46, 56, 28, 9, 16, 68, 64, 100, 25, 1, 59, 50, 31, 96, 13, 76] | |
plt.scatter(x_coords, fav_nums, marker="x", color="red") | |
plt.ylabel("Favorite number") | |
plt.xticks([]) | |
plt.title("Favorite number of twenty individuals") | |
plt.tight_layout() | |
plt.savefig("scatter_plot_demo.png") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment