Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1329 from mdboom/wiggles
Add a "sketch" path filter for XKCD style graphics.
- Loading branch information
Showing
37 changed files
with
2,372 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
with plt.xkcd(): | ||
# Based on "Stove Ownership" from XKCD by Randall Monroe | ||
# http://xkcd.com/418/ | ||
|
||
fig = plt.figure() | ||
ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) | ||
ax.spines['right'].set_color('none') | ||
ax.spines['top'].set_color('none') | ||
plt.xticks([]) | ||
plt.yticks([]) | ||
ax.set_ylim([-30, 10]) | ||
|
||
data = np.ones(100) | ||
data[70:] -= np.arange(30) | ||
|
||
plt.annotate( | ||
'THE DAY I REALIZED\nI COULD COOK BACON\nWHENEVER I WANTED', | ||
xy=(70, 1), arrowprops=dict(arrowstyle='->'), xytext=(15, -10)) | ||
|
||
plt.plot(data) | ||
|
||
plt.xlabel('time') | ||
plt.ylabel('my overall health') | ||
fig.text( | ||
0.5, 0.05, | ||
'"Stove Ownership" from xkcd by Randall Monroe', | ||
ha='center') | ||
|
||
# Based on "The Data So Far" from XKCD by Randall Monroe | ||
# http://xkcd.com/373/ | ||
|
||
fig = plt.figure() | ||
ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) | ||
ax.bar([-0.125, 1.0-0.125], [0, 100], 0.25) | ||
ax.spines['right'].set_color('none') | ||
ax.spines['top'].set_color('none') | ||
ax.xaxis.set_ticks_position('bottom') | ||
ax.set_xticks([0, 1]) | ||
ax.set_xlim([-0.5, 1.5]) | ||
ax.set_ylim([0, 110]) | ||
ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT']) | ||
plt.yticks([]) | ||
|
||
plt.title("CLAIMS OF SUPERNATURAL POWERS") | ||
|
||
fig.text( | ||
0.5, 0.05, | ||
'"The Data So Far" from xkcd by Randall Monroe', | ||
ha='center') | ||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.