Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Scipy2013 Sprint: Cleaning examples of api example#2181
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
Closed
Uh oh!
There was an error while loading.Please reload this page.
Closed
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
73b263a
Add a bar plot with errors example
gabraganca444eecd
Remove unecessary variable
gabragancab0f85e7
Clen bar plot demo
gabragancadf4da45
Improved docstring of barplot example
gabragancadb76ed3
Move bar plot demos to statistics folder
gabragancafcc48f5
Clean two scaled y-axis demo.
gabraganca01a5e99
Change according @tonysyu suggestions and run PEP8
gabragancaFile 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
There are no files selected for viewing
39 changes: 0 additions & 39 deletionsexamples/api/barchart_demo.py
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
27 changes: 0 additions & 27 deletionsexamples/api/fahrenheit_celsius_scales.py
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
13 changes: 13 additions & 0 deletionsexamples/statistics/barchart_demo.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,13 @@ | ||
""" | ||
Demo of multiple bar plots. | ||
""" | ||
import matplotlib.pyplot as plt | ||
values = (20, 35, 30, 35, 27) | ||
pos = (0, 1, 2, 3, 4) | ||
plt.bar(left=pos, height=values, width=0.5, color='r') | ||
plt.title('Example of bar plots') | ||
plt.show() |
14 changes: 14 additions & 0 deletionsexamples/statistics/barchart_demo_error.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,14 @@ | ||
""" | ||
Demo of multiple bar plot with errorbars | ||
""" | ||
import matplotlib.pyplot as plt | ||
values = (20, 35, 30, 35, 27) | ||
errors = (2, 3, 4, 1, 2) | ||
pos = (0, 1, 2, 3, 4) | ||
plt.bar(left=pos, height=values, width=0.5, color='r', yerr=errors) | ||
plt.title("Bar plot with errors") | ||
plt.show() |
37 changes: 37 additions & 0 deletionsexamples/subplots_axes_and_figures/fahrenheit_celsius_scales.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,37 @@ | ||
""" | ||
Demo of how to display two scales on the left and right y axis. | ||
This example uses the Fahrenheit and Celsius scales. | ||
""" | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
def fahrenheit2celsius(temp): | ||
""" | ||
Returns temperature in Celsius. | ||
""" | ||
return (5. / 9.) * (temp - 32) | ||
def convert_ax_c_to_celsius(ax_f): | ||
""" | ||
Update second axis according with first axis. | ||
""" | ||
y1, y2 = ax_f.get_ylim() | ||
ax_c.set_ylim(fahrenheit2celsius(y1), fahrenheit2celsius(y2)) | ||
ax_c.figure.canvas.draw() | ||
fig, ax_f = plt.subplots() | ||
ax_c = ax_f.twinx() | ||
# automatically update ylim of ax2 when ylim of ax1 changes. | ||
ax_f.callbacks.connect("ylim_changed", convert_ax_c_to_celsius) | ||
ax_f.plot(np.linspace(-40, 120, 100)) | ||
ax_f.set_xlim(0, 100) | ||
ax_f.set_title('Two scales: Fahrenheit and Celsius') | ||
ax_f.set_ylabel('Fahrenheit') | ||
ax_c.set_ylabel('Celsius') | ||
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.