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

I'd like to see axes.get_label() when clicking on 'Edit curves lines and axes parameters' after plt.show() #2593

Closed
rtrwalker opened this issue Nov 15, 2013 · 4 comments

Comments

@rtrwalker
Copy link
Contributor

when I do plt.show() on some plot and then click on 'Edit curves lines and axes parameters' button, I'd like to see the label I've applied using ax.set_label('my_label'). Digging around in matplotlib\backends\backend_qt4.py. I found the following code as part of the NavigationToolbar2QT class:

                    title = axes.get_title()
                    ylabel = axes.get_ylabel()
                    if title:
                        fmt = "%(title)s"
                        if ylabel:
                            fmt += ": %(ylabel)s"
                        fmt += " (%(axes_repr)s)"
                    elif ylabel:
                        fmt = "%(axes_repr)s (%(ylabel)s)"
                    else:
                        fmt = "%(axes_repr)s"
                    titles.append(fmt % dict(title = title,
                                         ylabel = ylabel,
                                         axes_repr = repr(axes)))

Could an extra elif be added? It would only kick it if there was no title and no ylabel:

                    title = axes.get_title()
                    ylabel = axes.get_ylabel()
                    label = axes.get_label()
                    if title:
                        fmt = "%(title)s"
                        if ylabel:
                            fmt += ": %(ylabel)s"
                        fmt += " (%(axes_repr)s)"
                    elif ylabel:
                        fmt = "%(axes_repr)s (%(ylabel)s)"
                    elif label:
                        fmt = "%(axes_repr)s (%(label)s)"
                    else:
                        fmt = "%(axes_repr)s"
                    titles.append(fmt % dict(title = title,
                                         ylabel = ylabel, label=label
                                         axes_repr = repr(axes)))
@tacaswell
Copy link
Member

can you put that in a pull request?

@twmr
Copy link
Contributor

twmr commented Nov 15, 2013

This could be integrated in #2112

@tacaswell
Copy link
Member

I think there is a preference for more smaller PRs. The smaller the changes, the easier it is to review.

@pelson
Copy link
Member

pelson commented Dec 5, 2013

Sounds like a good idea @rtrwalker. I'm going to close the issue in the hope that you will submit a PR which I will happily merge.

Cheers!

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