Skip to content
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

Stepfilled color cycle for background and edge different #6493

Closed
Carreau opened this issue May 28, 2016 · 8 comments
Closed

Stepfilled color cycle for background and edge different #6493

Carreau opened this issue May 28, 2016 · 8 comments
Milestone

Comments

@Carreau
Copy link
Contributor

Carreau commented May 28, 2016

I just realized that stepfilled (http://matplotlib.org/devdocs/examples/statistics/histogram_demo_multihist.html)
has edge color cycle different from background color (which looks weird) didn't found any issues about that , so asking the question, as 2.x will change default style is is too late to change that ? (or is that a bug)

Matplotlib 1.5 and 2.0b

# %matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

n_bins = 10
x = np.random.randn(1000, 3)

fig, ax = plt.subplots(nrows=1, ncols=1)
ax.hist(x, n_bins, histtype='step', stacked=True, fill=True)

plt.show()

Note that in attached example it's even weirder as the green as a gree edge, while the blue as a red edge and red has a blue edge.
joz7rxkid5aaaaabjru5erkjggg

@tacaswell tacaswell added this to the 2.0 (style change major release) milestone May 28, 2016
@tacaswell
Copy link
Member

Going to go with that is just a bug, and old one at that http://matplotlib.org/1.4.0/examples/statistics/histogram_demo_multihist.html

image

@tacaswell
Copy link
Member

And this is not some strange overlay/aliasing bug, the colors really are different:

In [23]: patches[0][0].get_edgecolor()
Out[26]: (0.12156862745098039, 0.4666666666666667, 0.7058823529411765, 1.0)

In [27]: patches[0][0].get_facecolor()
Out[27]: (0.17254901960784313, 0.6274509803921569, 0.17254901960784313, 1.0)

@tacaswell
Copy link
Member

Very old: http://matplotlib.org/1.2.1/examples/pylab_examples/histogram_demo_extended.html (and that is as far back as we have built docs on the website)

image

@Carreau
Copy link
Contributor Author

Carreau commented May 28, 2016

From a quick test I would say the edge colors and facecolors are just in reverse order of each other.

@Carreau
Copy link
Contributor Author

Carreau commented May 28, 2016

quick investigating:

# axes/_axes.py Line 6170
            if fill:
                # add patches in reverse order so that when stacking,
                # items lower in the stack are plottted on top of
                # items higher in the stack

                ## Could change for reversed(color) here for consistency, but that's when filled = False, so does not really matter, except to keep the order of colors the same.
                for x, y, c in reversed(list(zip(xvals, yvals, color))):
                    patches.append(self.fill(
                        x, y,
                        closed=True,
                        facecolor=c))
            else:
                 ## change for reversed(color) here
                for x, y, c in reversed(list(zip(xvals, yvals, reversed(color)))):
                    split = 2 * len(bins)
                    patches.append(self.fill(
                        x[:split], y[:split],
                        closed=False, edgecolor=c,
                        fill=False))

@Carreau Carreau changed the title Stepfield color cycle for background and edge different? Stepfilled color cycle for background and edge different May 28, 2016
Carreau added a commit to Carreau/matplotlib that referenced this issue May 28, 2016
Carreau added a commit to Carreau/matplotlib that referenced this issue May 28, 2016
Carreau added a commit to Carreau/matplotlib that referenced this issue May 28, 2016
@QuLogic QuLogic changed the title Stepfilled color cycle for background and edge different Stepfield color cycle for background and edge different? May 28, 2016
@Carreau
Copy link
Contributor Author

Carreau commented May 29, 2016

QuLogic changed the title from Stepfilled color cycle for background and edge different to Stepfield color cycle for background and edge different? an hour ago

Stepfilled to Stepfield ? Is that autocorrect being overzealous as it was when I submitted the issue ? Or did I miss something ?

Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
@QuLogic QuLogic changed the title Stepfield color cycle for background and edge different? Stepfilled color cycle for background and edge different May 29, 2016
@QuLogic
Copy link
Member

QuLogic commented May 29, 2016

Sorry, I think that was waffle.io being buggy. I'm pretty sure I didn't change the title here. It also added needs_revision here instead of the PR...

Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
Closes matplotlib#6493

Expand the test to try the 6 histype/fill combinations, and in
particular change yaxis min limit to see if the paths are closed or not.
Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
Closes matplotlib#6493

Expand the test to try the 6 histype/fill combinations, and in
particular change yaxis min limit to see if the paths are closed or not.
Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
Closes matplotlib#6493

Expand the test to try the 8 histype/fill combinations, and in
particular change yaxis min limit to see if the paths are closed or not.
Carreau added a commit to Carreau/matplotlib that referenced this issue May 29, 2016
@jenshnielsen
Copy link
Member

Closed by #6494

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

No branches or pull requests

4 participants