Skip to content

Setting style defaults for errrobar in rcParams #8071

Closed as not planned
Closed as not planned

Description

@jmccormac01

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.

Activity

  1. added this to the milestone on Feb 13, 2017
  2. jmccormac01 commented on Feb 22, 2017

    @jmccormac01
    Author

    Awesome, thanks!

  3. tacaswell commented on Feb 22, 2017

    @tacaswell
    Member

    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 is also related to one of the problem that cycler was written to solve (http://matplotlib.org/cycler/ )

  4. modified the milestones: , on Sep 24, 2017
  5. github-actions commented on Apr 7, 2023

    @github-actions

    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!

  6. added
    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.
    on May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featurestatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: rcparams

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions