Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Introduction
This tutorial is a complete re-imagining of how one should teach users
``This tutorial is a complete re-imagining of how one should teach users
the matplotlib library. Hopefully, this tutorial may serve as inspiration
for future restructuring of the matplotlib documentation. Plus, I have some
ideas of how to improve this tutorial.
ideas of how to improve this tutorial.``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason for putting this paragraph in code?


Please fork and contribute back improvements! Feel free to use this tutorial
for conferences and other opportunities for training.
Expand Down
2 changes: 2 additions & 0 deletions solutions/1.1-subplots_and_basic_plotting.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# import required libraries
import numpy as np
import matplotlib.pyplot as plt

Expand All @@ -11,4 +12,5 @@
ax.plot(x, y, color='black')
ax.set(xticks=[], yticks=[], title=name)

#printing plot in IDE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This neither prints, nor uses an IDE, so I don't know what this comment means.

plt.show()
7 changes: 5 additions & 2 deletions solutions/2.1-bar_and_fill_between.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#import required libraries
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(1)
np.random.seed(1) # generates exact same random values as they are here inside .seed(value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I suppose the comment is mainly useful for absolute beginners, and this carries a bit of ambiguity (.seed does not generate anything, where is "here" (this line or this tutorial?)) an alternative would maybe be

 # Fix the random state to have the same numbers created whenever this code is being run.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using what we use in Matplotlib examples:

# Fixing random state for reproducibility
np.random.seed(19680801)


# Generate data...
# Generate Random data...
y_raw = np.random.randn(1000).cumsum() + 15
x_raw = np.linspace(0, 24, y_raw.size)

Expand All @@ -23,8 +24,10 @@

# Now you're on your own!

#making sublots
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment does not really add anything.

fig, ax = plt.subplots()

#Styling the Plot a little ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't just style; it does the actual plotting too. So this comment needs to be expanded a bit more.

ax.plot(x_raw, y_raw, color=linecolor)
ax.bar(x_pos, y_avg, width=bar_width, color=barcolor, yerr=y_err,
ecolor='gray', edgecolor='gray')
Expand Down