100 days of code: Day 25 - scatter

Last modified on 2020-07-03

Source: 100-days-of-code.

New day new graph. Set against a dark background, I use my mpl_squares.py program with the scatter() method to plot square numbers on a graph as individual data points instead of a line …

# Using built-in styles. Find styles with `plt.style.available`.


# plot() assumes the first data point corresponds to an x-coordinate
# value of 0, but in this case our first x-value is 1. Override default
# by assigning the input and output values used.
#ax.plot(inputs, squares, linewidth=3) 
# Plot as individual points
ax.scatter(inputs, squares, s=100, marker='o', facecolors='none', 

Yesterday’s line graph …


Scatter point graph …


Happy hacking!