Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
MEP12: Example clean-up for reference#2474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
21 commits Select commitHold shift + click to select a range
8bec412
Remove she-bang line.
tonysyuc25ef1e
Use consistent imports
tonysyu7a59f9f
Remove unnecessary code comments.
tonysyu83dd0ea
Remove unnecessary calls to `show`
tonysyuece3c57
Rmove unused variable
tonysyu5099675
Split up hist examples into two sections.
tonysyu768500d
Remove use of `setp` in favor of keyword args.
tonysyu44a577b
Replace multiple figures with subplots
tonysyuc80897d
Change bin edges to make the example clearer.
tonysyubd2b13c
Add titles to clarify intent
tonysyu24aab97
Simplify example
tonysyufc2ab07
Split demo that tried to do too much
tonysyue57b5fc
Remove unnecessary second histogram
tonysyu1458aa8
Remove unnecessary parameters
tonysyuc3cce1c
PEP8 fixes
tonysyu6d1b8a2
Add example docstrings
tonysyuf7b2217
Simplify example.
tonysyua2b5dcd
Clarify title of plot
tonysyue62e51e
Move histogram examples to statistics directory
tonysyu2dc9a46
Fix example links.
tonysyuef51dc3
Shorten color names for better gallery build
tonysyuFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Split up hist examples into two sections.
The original example was trying to do too much in one place.
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit509967518ce5ce5ba31edf12486ffaa344e748f2
There are no files selected for viewing
35 changes: 1 addition & 34 deletions...pylab_examples/histogram_demo_extended.py → ...ylab_examples/histogram_demo_histtypes.py
This file contains hidden or 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
39 changes: 39 additions & 0 deletionsexamples/pylab_examples/histogram_demo_multihist.py
This file contains hidden or 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,39 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
mu, sigma = 200, 25 | ||
plt.figure() | ||
x = mu + sigma*np.random.randn(1000,3) | ||
n, bins, patches = plt.hist(x, 10, normed=1, histtype='bar', | ||
color=['crimson', 'burlywood', 'chartreuse'], | ||
label=['Crimson', 'Burlywood', 'Chartreuse']) | ||
plt.legend() | ||
plt.figure() | ||
n, bins, patches = plt.hist(x, 10, normed=1, histtype='bar', stacked=True) | ||
plt.figure() | ||
n, bins, patches = plt.hist(x, 10, histtype='step', stacked=True, fill=True) | ||
# Make a multiple-histogram of data-sets with different length. | ||
x0 = mu + sigma*np.random.randn(10000) | ||
x1 = mu + sigma*np.random.randn(7000) | ||
x2 = mu + sigma*np.random.randn(3000) | ||
w0 = np.ones_like(x0) | ||
w0[:len(x0)/2] = 0.5 | ||
w1 = np.ones_like(x1) | ||
w1[:len(x1)/2] = 0.5 | ||
w2 = np.ones_like(x2) | ||
w2[:len(x2)/2] = 0.5 | ||
plt.figure() | ||
n, bins, patches = plt.hist( [x0,x1,x2], 10, weights=[w0, w1, w2], histtype='bar') | ||
plt.show() |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.