October 2018
Beginner to intermediate
676 pages
18h 30m
English
Just to demonstrate a few more style sheets, the following code block uses the same four plots as before, but applies a list of style sheets as specified in style_list.
Since the same code is to be repeated multiple times, we define a function and call it in a for loop with a different style parameter each time:
style_list = ['classic', 'dark_background', 'ggplot', 'grayscale', 'seaborn']def plot_the_graph(style): np.random.seed(0) fig, ax = plt.subplots(1, 4, figsize=(12,5)) fig.subplots_adjust(wspace=0.5) ax[0].hist(np.random.randn(1000)) for i in range(3): ax[1].plot(np.random.rand(10)) ax[1].legend(['a', 'b', 'c'], loc='lower left') ax[2].scatter(np.random.rand(100),np.random.rand(100), s=100*np.random.rand(100)*np.random.rand(100)) ...
Read now
Unlock full access