Skip to content

Errorbars accept marker_options and follow prop_cycle #9952

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2018

Conversation

as691454
Copy link
Contributor

@as691454 as691454 commented Dec 7, 2017

#9920 #9922
Errorbars now

  1. accept marker options, such as mfc (used to crash)
  2. follows prop_cycle (used to ignore it and always draw solid line)

The first one is important for making black and white plots (clear and filled squares) - cheaper to publish than color graphs. Property cycle fix is nice for plotting several lines at once from pandas DataFrame, for instance.

import matplotlib.pyplot as plt
plt.rc(["xtick","ytick"],labelsize=16)
plt.rc("lines", lw=3, markersize=12, markeredgewidth=3)
plt.rc("errorbar", capsize=5)
plt.rc("axes", prop_cycle="cycler(ls=['--',':'],marker=['s','s'],mfc=['k','w'])")
plt.errorbar(x=[2,4,10],y=[3,2,4],yerr=0.5)
plt.errorbar(x=[2,4,10],y=[6,4,2],yerr=0.5)
plt.show()

test

@story645 story645 changed the title My branch Errorbars accept marker_options and follow prop_cycle #9920 #9922 Dec 7, 2017
@dstansby dstansby added this to the v2.2 milestone Dec 7, 2017
@jklymak jklymak changed the title Errorbars accept marker_options and follow prop_cycle #9920 #9922 Errorbars accept marker_options and follow prop_cycle Dec 7, 2017
@jklymak
Copy link
Member

jklymak commented Dec 7, 2017

This really needs a test... If you need help, let us know. http://matplotlib.org/devdocs/devel/testing.html

@jklymak
Copy link
Member

jklymak commented Dec 7, 2017

... and probably an example, API change note...

@phobson
Copy link
Member

phobson commented Dec 10, 2017

PEP8 D'oh! I'll fix that and add the example + changeling entry tomorrow

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just needs the test image changing to the latest style, thanks a lot @as691454 for this!

@@ -2815,6 +2815,16 @@ def test_errobar_nonefmt():
assert np.all(errbar.get_color() == mcolors.to_rgba('C0'))


@image_comparison(baseline_images=['errorbar_with_prop_cycle'],
extensions=['png'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this get a style=mpl20 argument so it uses the new style?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. thanks for the nudge. i can't the docs to build properly on my machine at home so this has stalled out a bit.

@jklymak jklymak self-requested a review January 20, 2018 05:01
@jklymak jklymak merged commit 407a460 into matplotlib:master Jan 20, 2018
@jklymak
Copy link
Member

jklymak commented Jan 20, 2018

Thanks all, it was a team effort but we got it done! (PS hope its OK that I merged - my commits only changed the style of the test to mpl20 and remove_text=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants