A demonstration of a python jupyter notebook plot, using the matplotlib library.
The basic idea is that you define the plot with successive commands, all of which together combine to make the image.
For the details, see the matplotlib docs and examples i.e. https://matplotlib.org/stable/gallery/index.html , or google for specific features i.e. "matplotlib title size" .
Note that this is just one of the several python libraries for doing numeric visualizations of various sorts. Here are links to several other options, all of which are installed on jupyter.bennington.college
# import plotting and numerical python libraries.
import matplotlib.pyplot as plt
import numpy as np
import random
# --- First define the plot limits, labels, and size.
figure = plt.figure(dpi=220, figsize=(4, 3)) # dots_per_inch and (width, height) in inches
axis = figure.add_subplot(111) # 111 indicates (rows,cols,number) i.e. 1x1 #1 .
axis.set(xlabel="the x axis", ylabel="sideways", title="not a plot of $\pi$")
# --- Next, set desired optional settings (comment these out to disable them).
# 1. Set x, y plot limits (rather than have them set automatically)
axis.set_xlim((0.02, 2*np.pi))
axis.set_ylim((0.9, 3.2))
# 2. Set log scale on either x or y axis or both
plt.xscale('log')
plt.yscale('log')
# Then add points or lines with multiple axis.plot(...), one feature at a time.
# --- Example 1 : some points, defined in arrays [x1, x2, x3, ...] and [y1, y2, y3, ...].
points_x = [1.5, 3.2, 5.1]
points_y = [2.5, 1.2, 2.9]
# put those on the plot.
axis.plot(points_x, points_y, marker="o", color="blue", linestyle="none", label="points")
# --- Example 2 : a sinusoidal curve
# (Curves are just closely spaces points, connected together.)
x_sin = np.linspace(0.01, 2*np.pi, 200) # 200 points from 0 to 2*pi ; a numpy.ndarray
y_sin = np.sin(x_sin) + 2.0 # numpy's sin() : take the sine of each
axis.plot(x_sin, y_sin, linewidth=1, color="green", label="sin(x)")
# --- Example 3 : a horizontal line.
x_line = [0.1, 6.0]
y_line = [2.0, 2.0]
axis.plot(x_line, y_line, linewidth=2, color="grey", label="horizontal")
# --- Example 4 : more points; this time with x's to mark them.
x_randoms = np.linspace(0.1, 6.0, 10)
y_randoms = [random.random() + 1.5 for x in x_randoms]
axis.plot(x_randoms, y_randoms, marker="x", color="red",
linestyle="none", markersize=2, label="randoms")
# --- If you want a "legende", using feature "label" entries, turn it on here.
axis.legend(fontsize=8, loc="lower left")
# --- And finally, display the image.
plt.show()