Skip to content

seaborn.tsplot and matplotlib's "Curve lines and axes parameters" editor #4323

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

Closed
anntzer opened this issue Apr 10, 2015 · 9 comments · Fixed by #4411
Closed

seaborn.tsplot and matplotlib's "Curve lines and axes parameters" editor #4323

anntzer opened this issue Apr 10, 2015 · 9 comments · Fixed by #4411

Comments

@anntzer
Copy link
Contributor

anntzer commented Apr 10, 2015

Currently, trying to edit curve lines and axes parameters (the checkbox with a green tick on the matplotlib toolbar) for a seaborn.tsplot fails with the following traceback:

$ ipython --pylab
Python 3.4.3 (default, Mar 25 2015, 17:13:50) 
Type "copyright", "credits" or "license" for more information.

IPython 3.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
romUsing matplotlib backend: Qt5Agg
Using matplotlib backend: Qt5Agg
 se
In [1]: from seaborn import *; tsplot([1, 2])
Out[1]: <matplotlib.axes._subplots.AxesSubplot at 0x7f0262043d30>
# <------ click on green tick
In [2]: Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/matplotlib/backends/backend_qt5.py", line 653, in edit_parameters
    figureoptions.figure_edit(axes, self)
  File "/usr/lib/python3.4/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 146, in figure_edit
    apply=apply_callback)
  File "/usr/lib/python3.4/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 510, in fedit
    dialog = FormDialog(data, title, comment, icon, parent, apply)
  File "/usr/lib/python3.4/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 416, in __init__
    parent=self)
  File "/usr/lib/python3.4/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 389, in __init__
    if len(data[0]) == 3:
IndexError: list index out of range

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

It is not clear to me whether the issue is on matplotlib's side or on seaborn's side, so this is crossposted as mwaskom/seaborn#508.

@tacaswell
Copy link
Member

Does the tick mark work on qt5 with an empty plot?

@anntzer
Copy link
Contributor Author

anntzer commented Apr 10, 2015

Yes.

@anntzer
Copy link
Contributor Author

anntzer commented May 6, 2015

After some investigation it seems that seaborn is using _nolegend_ to, well, set no legend to certain elements, and matplotlib doesn't like this at all. While this could be argued to be an internal feature of matplotlib, I don't think the following (which is independent of seaborn) should break:

In [1]: plot([1, 2], label="_nolegend_")
# clicking on the green tick leads to the same error.

Any reason why you can't use label=None as a marker instead? Anyways, there's a few ways to fix this I think: change how datalist is created in figure_options.figure_edit (checking has_curve is wrong, we should check that curves is not empty instead), and/or change FormTabWidget.__init__ to add a tab only if data is not empty.

@tacaswell
Copy link
Member

This is a bug in the edit widget, 'nolabel' is the documented way to
suppress artists from being included inv the legend.

On Wed, May 6, 2015, 03:18 Antony Lee notifications@github.com wrote:

After some investigation it seems that seaborn is using nolegend to,
well, set no legend to certain elements, and matplotlib doesn't like this
at all. While this could be argued to be an internal feature of matplotlib,
I don't think the following (which is independent of seaborn) should break:

In [1]: plot([1, 2], label="nolegend")

clicking on the green tick leads to the same error.

Any reason why you can't use label=None as a marker instead? Anyways,
there's a few ways to fix this I think: change how datalist is created in
figure_options.figure_edit (checking has_curve is wrong, we should check
that curves is not empty instead), and/or change FormTabWidget.init
to add a tab only if data is not empty.


Reply to this email directly or view it on GitHub
#4323 (comment)
.

tacaswell added a commit to tacaswell/matplotlib that referenced this issue May 6, 2015
If there are lines on the Axes, but they are all labeled
'_nolegend_', treat as if there are no lines on the Axes.

Closes matplotlib#4323
@tacaswell tacaswell added this to the next point release milestone May 6, 2015
@tacaswell tacaswell self-assigned this May 6, 2015
@anntzer
Copy link
Contributor Author

anntzer commented May 6, 2015

"Documented" is a bit a strong word for this, neither the legend guide nor the legend API mention this (confirmed by grepping the sources).

@tacaswell
Copy link
Member

fair enough @anntzer Can you add it to one or the other (or both)?

@anntzer
Copy link
Contributor Author

anntzer commented May 6, 2015

If I get it correctly anything starting with an underscore is invisible and that's why line names default to "_lineXXX"? Am I missing anything else?

@tacaswell
Copy link
Member

I believe so.

@pelson was the last person to touch the legend stuff in any great detail.

@anntzer
Copy link
Contributor Author

anntzer commented May 6, 2015

A quick glance doesn't show any good place to add this, except perhaps to the docstring of legend (after "Labels are [also fix to "is"] is a sequence of strings"). Thoughts?

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

Successfully merging a pull request may close this issue.

3 participants