| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Fixed errorbars in polar plots | ||
| ------------------------------ | ||
| Caps and error lines are now drawn with respect to polar coordinates, | ||
| when plotting errorbars on polar plots. | ||
|
|
||
| .. figure:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_error_caps_001.png | ||
| :target: ../../gallery/pie_and_polar_charts/polar_error_caps.html | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| """ | ||
| ================================= | ||
| Error bar rendering on polar axis | ||
| ================================= | ||
|
|
||
| Demo of error bar plot in polar coordinates. | ||
| Theta error bars are curved lines ended with caps oriented towards the | ||
| center. | ||
| Radius error bars are straight lines oriented towards center with | ||
| perpendicular caps. | ||
| """ | ||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
|
|
||
| theta = np.arange(0, 2 * np.pi, np.pi / 4) | ||
| r = theta / np.pi / 2 + 0.5 | ||
|
|
||
| fig = plt.figure(figsize=(10, 10)) | ||
| ax = fig.add_subplot(projection='polar') | ||
| ax.errorbar(theta, r, xerr=0.25, yerr=0.1, capsize=7, fmt="o", c="seagreen") | ||
| ax.set_title("Pretty polar error bars") | ||
| plt.show() | ||
|
|
||
| ############################################################################# | ||
| # Please acknowledge that large theta error bars will be overlapping. | ||
| # This may reduce readability of the output plot. See example figure below: | ||
|
|
||
| fig = plt.figure(figsize=(10, 10)) | ||
| ax = fig.add_subplot(projection='polar') | ||
| ax.errorbar(theta, r, xerr=5.25, yerr=0.1, capsize=7, fmt="o", c="darkred") | ||
| ax.set_title("Overlapping theta error bars") | ||
| plt.show() | ||
|
|
||
| ############################################################################# | ||
| # On the other hand, large radius error bars will never overlap, they just | ||
| # lead to unwanted scale in the data, reducing the displayed range. | ||
|
|
||
| fig = plt.figure(figsize=(10, 10)) | ||
| ax = fig.add_subplot(projection='polar') | ||
| ax.errorbar(theta, r, xerr=0.25, yerr=10.1, capsize=7, fmt="o", c="orangered") | ||
| ax.set_title("Large radius error bars") | ||
| plt.show() | ||
|
|
||
|
|
||
| ############################################################################# | ||
| # | ||
| # .. admonition:: References | ||
| # | ||
| # The use of the following functions, methods, classes and modules is shown | ||
| # in this example: | ||
| # | ||
| # - `matplotlib.axes.Axes.errorbar` / `matplotlib.pyplot.errorbar` | ||
| # - `matplotlib.projections.polar` |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIf this works, great! (not sure it will, but my ignorance of sphinx is relatively vast)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI just mimicked it from this what's new message, but it does not seem to work properly in the built documentation, so I am not sure it is worth the try.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.