You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Setting style defaults for errrobar in rcParams #8071
I have been trying to write a series of functions that set up default plotting styles for publication quality figures and I noticed something. It is not possible to set the default errorbar settings using rc. The errorbar styling is inherited from the line style (all except the errorbar end cap, which can be set independently). This makes sense if you do not want to plot the error bars differently to the data points. But if you do, it is not possible to explicitly set the defaults without altering the line properties.
For example, if I wish to plot data using black points with thinned lightgrey (de-emphasised) error bars and then over plot a thicker best-fitting line in red, I have to adjust the line parameters to correctly plot the error bar and then revert them back to plot the best fitting line.
I know the errorbar styling can be set in each call to errorbar but for many plots explicitly setting the default errorbar parameters seems cleaner. Another option a colleague suggested was to just wrap up errorbar in a few function.
I thought I'd point this out as some things (e.g. line and boxplot) have a full set of toggles in rc and others (e.g. scatter and errorbar) do not. I think it would be nice for them all to have independently adjustable settings. Of course feel free to ignore this :) Thanks.
Another option (that I use heavily) is to keep the style in local dictionaries like plot_style and scatter_style and then do ax.plot(x, y, **plot_style) etc. That seems far more elegant than relying on global state.
You can also use rcparam / style context managers to manage the setting/resetting.
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
jmccormac01 commentedon Feb 22, 2017
Awesome, thanks!
tacaswell commentedon Feb 22, 2017
Another option (that I use heavily) is to keep the style in local dictionaries like
plot_styleandscatter_styleand then doax.plot(x, y, **plot_style)etc. That seems far more elegant than relying on global state.You can also use rcparam / style context managers to manage the setting/resetting.
This is also related to one of the problem that
cyclerwas written to solve (http://matplotlib.org/cycler/ )github-actions commentedon Apr 7, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!