October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following code block plots a decaying exponential function. First, we define the font dictionary with all the required attributes, and then we apply the same to every text element on the graph, including the title and the x and y labels. This ensures that the text on the graph looks and feels consistent:
font = {'family': 'DejaVu Sans', 'name': 'Times New Roman', 'style': 'italic', 'color': 'orange', 'weight': 'bold', 'size': 16}
t = np.linspace(0.0, 5.0, 100)y = np.sin(2*np.pi*t) * np.exp(-t/2)plt.plot(t, y, 'm')
Read now
Unlock full access