FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

searborn adaptation need for Matptotlib-2.2.0rc1 · Issue #10585 · matplotlib/matplotlib · GitHub

Repository navigation

searborn adaptation need for Matptotlib-2.2.0rc1 #10585

Closed

Description

Bug report

Bug summary

My historic Seaborn example doesn't seem to work anymore with Matplotlib-2.2.0rc1. is it a volontary change ?

# Seaborn
# for more examples, see http://stanford.edu/~mwaskom/software/seaborn/examples/index.html
import seaborn as sns
sns.set()
df = sns.load_dataset("iris")
sns.pairplot(df, hue="species", size=1.5)

Actual outcome

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-78e2f3db95aa> in <module>()
      4 sns.set()
      5 df = sns.load_dataset("iris")
----> 6 sns.pairplot(df, hue="species", size=1.5)

C:\WinPython\bd35\buildQt5\winpython-32bit-3.5.x.2\python-3.5.4\lib\site-packages\seaborn\axisgrid.py in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, size, aspect, dropna, plot_kws, diag_kws, grid_kws)
   2058     if grid.square_grid:
   2059         if diag_kind == "hist":
-> 2060             grid.map_diag(plt.hist, **diag_kws)
   2061         elif diag_kind == "kde":
   2062             diag_kws["legend"] = False

C:\WinPython\bd35\buildQt5\winpython-32bit-3.5.x.2\python-3.5.4\lib\site-packages\seaborn\axisgrid.py in map_diag(self, func, **kwargs)
   1333                     diag_ax = ax._make_twin_axes(sharex=ax,
   1334                                                  sharey=diag_axes[0],
-> 1335                                                  frameon=False)
   1336                 else:
   1337                     diag_ax = ax._make_twin_axes(sharex=ax, frameon=False)

C:\WinPython\bd35\buildQt5\winpython-32bit-3.5.x.2\python-3.5.4\lib\site-packages\matplotlib\axes\_subplots.py in _make_twin_axes(self, *kl, **kwargs)
    174         from matplotlib.projections import process_projection_requirements
    175         if 'sharex' in kwargs and 'sharey' in kwargs:
--> 176             raise ValueError("Twinned Axes may share only one axis.")
    177         kl = (self.get_subplotspec(),) + kl
    178         projection_class, kwargs, key = process_projection_requirements(

ValueError: Twinned Axes may share only one axis.

Matplotlib version

  • Operating system: windows10
  • Matplotlib version: 2.2.0rc1 of feb 18th cgohlke
  • Matplotlib backend (print(matplotlib.get_backend())):module://ipykernel.pylab.backend_inline
  • Python version: 3.5.4
  • Jupyter version (if applicable): Jupyterlab-0.31.8
  • Other libraries:

Activity

  1. stonebig commented on Feb 24, 2018

    ContributorAuthor

    so it comes from this change:
    #10033

    how should we rewrite an old code like :

    ax._make_twin_axes(sharex=ax,
     sharey=diag_axes[0],
     frameon=False)
    

    is it ?:

    ax._make_twin_axes(# don't ax me twice sharex=ax,
     sharey=diag_axes[0],
     frameon=False)
    
  2. changed the title [-]searborn failure with Matptotlib-2.2.0rc1 ?[/-] [+]searborn adaptation need for Matptotlib-2.2.0rc1[/+] on Feb 24, 2018
  3. tacaswell commented on Feb 24, 2018

    Member

    attn @efiring

    I think was was intentional to account for interactions between twin, shared axes, and fixed aspect ratio.

  4. stonebig commented on Feb 24, 2018

    ContributorAuthor

    ok, I patched seaborn for my need. seaborn maintainer ask if this internal breakage could be avoided:
    mwaskom/seaborn#1378 (comment)

  5. jklymak commented on Feb 24, 2018

    Member

    Can you distill to a non-seaborn example? I’m still not sure what seaborn is trying to do that breaks, but I haven’t read the source.

  6. stonebig commented on Feb 24, 2018

    ContributorAuthor

    Similar examples would come from holoviews (replace 'bokeh' per 'matplotlib'):

  7. stonebig commented on Feb 24, 2018

    ContributorAuthor

    more similar would be with hv.Histogram, yet more verbose than compact seaborn

    from bokeh.sampledata.iris import flowers
    from holoviews.operation import gridmatrix
    ds = hv.Dataset(flowers)
    grouped_by_species = ds.groupby('species', container_type=hv.NdOverlay)
    grid = gridmatrix(grouped_by_species, diagonal_type=hv.Histogram)
    
  8. jklymak commented on Feb 24, 2018

    Member

    I meant can you trigger the error using matplotlib only?

  9. stonebig commented on Feb 24, 2018

    ContributorAuthor

    hum, it's not an internal error of Matplotlib-2.2.0rc1, if that is your question.

  10. jklymak commented on Feb 24, 2018

    Member

    So I'm confused; is this a matplotlib problem (i.e. something that worked pre #10033)? If so, then it must be triggerable with just matplotlib calls.

  11. stonebig commented on Feb 25, 2018

    ContributorAuthor

    seaborn was using an "internal API", functions starting per the undescore characters:

    • there has been a change there,
    • and seaborn is no longer actively maintained.
  12. efiring commented on Feb 25, 2018

    Member

    The change in _make_twin_axes was deliberate. Under what circumstances does it make sense to share both axes with twin axes? The point of twin axes is to share one axis and have the other one differ.

  13. stonebig commented on Feb 25, 2018

    ContributorAuthor

    ok. I agree it was probably a functional bug of seaborn.

  14. mwaskom commented on Feb 27, 2018

    @efiring

    The change in _make_twin_axes was deliberate. Under what circumstances does it make sense to share both axes with twin axes? The point of twin axes is to share one axis and have the other one differ.

    seaborn shouldn't have been using a private method here, but if the issue is just redundancy, is there any reason matplotlib needs to raise on getting sharex and sharey when one of the shared axes is self?

  15. 15 remaining items

  16. dopplershift commented on Feb 27, 2018

    Contributor

    Speaking as a matplotlib dev with no attachment to the APIs in question, I'm sensitive to the idea that we not break one of the more prominent downstream libraries. So I'm ok with getting in a change to avoid this breakage before we cut 2.2.

    I'm also pretty damned irritated that we have to work around this prominent library using an internal API; especially since it seems that this downstream library has made no effort whatsoever in getting a public version of this API. (Please correct me if I'm wrong on this.) So I'm also tempted to say that unless a seaborn dev is willing to put some skin in the game and propose a PR to get a public API that serves their purpose, we don't do a thing. THIS is literally the reason that as a developer of another project, YOU DON'T USE SOMEONE ELSE'S INTERNAL APIS.

  17. jklymak commented on Feb 27, 2018

    Member

    OK, fair enough - tracing through all the twin code is difficult. I did reopen and remilestone so this will at least get discussion before 2.2 drops.

    1. I'm still not clear why you want twin axes versus just clearing the diagonal axes and resetting the share properties. But no doubt I'm not following exactly what PairGrid etc are doing.
    2. Again, the changes implimented in Improve handling of shared axes with specified aspect ratio #10033 fix a lot of other critical bugs. So, if you can figure out how to fix seaborn w/o breaking Improve handling of shared axes with specified aspect ratio #10033, I think that PR would be great.

    EDIT: Ooops, crossing comments....

  18. mwaskom commented on Feb 27, 2018

    Thanks @dopplershift for the constructive contributions.

  19. mwaskom commented on Feb 27, 2018

    My proposal is literally to change

    if 'sharex' in kwargs and 'sharey' in kwargs:
        raise ValueError("Twinned Axes may share only one axis.")

    to

    if 'sharex' in kwargs and 'sharey' in kwargs:
        if kwargs["sharex"] is not self and kwargs["sharey"] is not self:
            raise ValueError("Twinned Axes may share only one axis.")
  20. mwaskom commented on Feb 27, 2018

    We can also have a conversation about a public API for twinned, shared axes (which I've proposed above), but that shouldn't be a blocker for 2.2. And, as noted, fixing this error check would be a precondition for making that possible.

  21. dstansby commented on Feb 27, 2018

    Member

    @mwaskom is it not possible write (or just copy the old code in _make_twin_axes) a method to do what you want to do instead of relying on our private one, and then putting out a patch release of seaborn with that fix?

  22. mwaskom commented on Feb 27, 2018

    No.

  23. dstansby commented on Feb 27, 2018

    Member

    Why not?

  24. dopplershift commented on Feb 28, 2018

    Contributor

    That doesn't solve the problem of all the existing installs being broken.

  25. jklymak commented on Feb 28, 2018

    Member

    Note that @lkjell took a crack at adding share/unshare in #9923. I think that is what would be useful for the seaborn use case...

  26. jklymak commented on Feb 28, 2018

    Member

    Closed #10622

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL