Skip to content

Modifying ticks in the Figure options window #1543

Closed as not planned
Closed as not planned

Description

@nilswagner01

AFAIK it is currently not possible to modify the ticks of a plot
within the "Figure options" window. Is it planned to add this feature
to the "Figure options" window ?

Activity

  1. added this to the milestone on Aug 17, 2014
  2. petehuang commented on Dec 31, 2016

    @petehuang
    Contributor

    Is this specific to one type of backend? Qt?

  3. efiring commented on Dec 31, 2016

    @efiring
    Member

    Yes, I think the Figure Options window exists only for the Qt backend. Personally, I think it may have been a mistake to add it at all; unlike the subplots gui, it doesn't strike me as a very useful tool for working with a plot. I'm going to close this with my opinion that no, we do not plan to add tick modification as an option to that window. This does not in any way prevent someone from submitting a PR to do so, of course.

  4. tacaswell commented on Dec 31, 2016

    @tacaswell
    Member

    I disagree it was a mistake, I think it is one of the more compelling reasons to use the qt backends over the others. Anecdotally, users at my day-job love it!

    @anntzer has been working on that window quite a bit (I assume mostly scratching itches).

  5. anntzer commented on Dec 31, 2016

    @anntzer
    Contributor

    I personally think it is extraordinarily useful to be able to interactively modify a plot after it has been made -- either because you don't want to re-run a slow-ish script, or because you are (perhaps as @tacaswell mentions) distributing your code for use by non-programmers.

    I don't think making the tickers settable via the UI is an unreasonable request (at least it should be possible to set it to a FixedFormatter), so I'm going to reopen this.

    Note that in order to provide the Figure Options UI for other backends, one "only" needs to reimplement the formlayout API (which abstracts away the Qt layer). If some GTK/Tk expert is interested in reimplementing such an abstraction layer for another toolkit, I can also share another similar API that I have written for personal use (currently Qt-only too), which I personally prefer :-).

  6. tacaswell commented on Dec 31, 2016

    @tacaswell
    Member

    @newville has implemented something similar in wx (https://newville.github.io/wxmplot/).

  7. anntzer commented on Jan 1, 2017

    @anntzer
    Contributor

    Indeed, I gave it a try and it looks very nice. @newville, would you be interested in working together on unifying as much as possible the Qt and Wx interfaces and implementations?

  8. newville commented on Jan 1, 2017

    @newville
    Contributor

    @anntzer Yeah, I think that would be great! I'm not fluent in Qt, but I'm willing to learn it better. Wxmplot tries to use matplotlib as much as possible (say, for event handling) so that, aside from the obvious GUI forms, there isn't really that much wx-specific code. It's also old enough (much of it predates matplotlib 1.0) that some parts of the "plot configuration" could almost certainly be done better.

    Anyway, I think making a library like this for both Qt and Wx (and possibly part of matplotlib?) would be really useful for many matplotlib users.

  9. anntzer commented on Jan 1, 2017

    @anntzer
    Contributor

    Great! I'm a bit busy with many things right now but I'll try to list what wxmplot offers (I assume the examples cover all the functionalities?) and see how it can be integrated with the existing codebase or whether we should start something from scratch integrating the capabilities of the current Qt interface and of wxmplot.

  10. anntzer commented on Jan 3, 2017

    @anntzer
    Contributor

    It looks like a few features from wxmplot can easily be adapted into the Qt editor: exposing artist zorder, toggling the legend (I think making the legend "active" for toggling artist visibility is better provided as a callback recipe), changing the image normalization class.

    A few other features are already present (in 2.0): changing image smoothing and changing image normalization bounds.

    I don't think auto-contrasting is suitable for the core library.

    Anything else I'm missing?

  11. newville commented on Jan 3, 2017

    @newville
    Contributor

    @anntzer I should probably look into what the Qt editor does.

    When you say "present (in 2.0)", do you mean in matplotlib itself or exposed easily through a GUI to the end-user?

  12. anntzer commented on Jan 3, 2017

    @anntzer
    Contributor

    The Qt5 backend provides this GUI by default.

  13. anntzer commented on Jan 4, 2017

    @anntzer
    Contributor

    @newville Can you have a look at guidata (https://pythonhosted.org/guidata/examples.html#basic-example)? Do you think it would be reasonable to base a new matplotlib UI on it and let you or others add a wx compatibility layer? (If you know a similar package that is based on wx I can look into adding a Qt compatibility layer as well, of course.)

  14. newville commented on Jan 4, 2017

    @newville
    Contributor
  15. anntzer commented on Jan 5, 2017

    @anntzer
    Contributor

    I'm still trying to understand your message from 2 or 3 days ago. Sorry,
    but I am not familiar with the Qt backend, nor very familiar with
    matplotlib 2. I'm not sure why would changing image smoothing and
    normalization bounds would be OK (perhaps already included?) while allowing
    auto-contrast would be unsuitable. Why is that?

    Because the first two directly map to methods or attributes on the image class (or its attributes), whereas the last one involves data-specific "logic", which I'd rather avoid (if you manage to convince the core devs that the image class needs an auto_contrast method (which I'd disagree) then it can go to the UI as well of course).

    The guidata library looks nice, but seems to be Qt only - is that
    correct? Traits is sort of similar, depending on what you're looking for,
    and I believe it supports both Qt and wx.

    traitsui would indeed be an alternative, but it is a much bigger dependency to pull in (as a comparison point, formlayout (https://github.com/PierreRaybaut/formlayout), which is currently the basis of the Qt figure options, is a single file). @tacaswell @Tillsten (who participated in the gitter discussion) Thoughts?

    I think it would useful to figure out what the goals are first. What is
    desirable for better matplotlib backend GUI(s)? I may have come in late to
    this conversation or missed other conversations about what is being done on
    the Qt backend. Can you give me an overview of what you'd like to see?

    These are screenshots of what the Qt backend currently provides:

    screenshot_20170105_130912
    screenshot_20170105_130921
    screenshot_20170105_130930

  16. Tillsten commented on Jan 5, 2017

    @Tillsten
    Contributor

    While being slightly verbose the simplest solution would be properly to write such a dialogue directly in the other toolkits, as dialog itself is not very complicated and its only real interaction is to apply settings, something which can be resused. Mpl also does not have to promise feature equivalence between the gui-backends. Traits(ui) is definitely too big of a dependency.

  17. newville commented on Jan 6, 2017

    @newville
    Contributor
  18. anntzer commented on Jan 7, 2017

    @anntzer
    Contributor

    I do not share the desire to avoid data-specific methods in the API.
    Wxmplot definitely allows adjusting the display thresholds for images,
    including sliders to set the min/max values, defaulting to the data
    range. If the UI already provides a way for the user to set upper/lower
    display levels, why not also have methods to help the user do this? All
    "auto contrast" does is set the display min/max to
    np.percentile(image_data, [p, 100-p]) where p defaults to 1.0. It's a
    pretty common technique, and for much of the data I deal with, it makes a
    big difference.

    This subsumes into the question of what the goals of this work are. My point of view is simply that matplotlib currently ships by default a much better config UI for the Qt backends than for the other backends, so it would be nice if the other backends could share the same UI. Yes, it may even be better if all backends could share an even better UI, but the one that Qt has is already widely used, so I would say that its features have shown themselves useful.

    Hm. You brought up guidata and asked for comparisons based of features. I
    tried to answer. You responded about a completely separate consideration -
    some notion of "dependency size". Then, in order to argue about this newly
    important attribute (size), you discuss a different library because it is
    apparently better (smaller). Sorry, but two textbook fallacies at one time
    is too much for me.

    I do not know if traitsui is a "bigger dependency" than guidata. What is
    dependency size anyway? Unless I'm in the wrong conversation, we're talking
    about supporting both Qt and wxPython in matplotlib.

    Anyway, I don't have a preference for which additional libraries might be
    used. I'm still trying to figure out "what", not "how". But this part of
    the conversation has definitely dampened my enthusiasm.

    I do not see why you would want to take this personally, as my considerations are purely technical. formlayout, on which the Qt config dialog is currently based, is ~500 lines of pure Python, although it only supports one backend. I would say that adding a dependendency on 60,000 lines of Python and 4,000 lines of C (traits+traitsui) for supporting a second backend (not even all the interactive backends!) is quite a lot when all the use that will be made of it is to generate a config dialog.

    In fact I now tend to agree with @Tillsten's suggestion that it will probably be easier to just write the dialogs by hand.

    I think it would be useful for matplotlib to provide better UIs that helped
    users customize and interact with data after it is shown. I think that 2D
    line plotting as from pyplot.plot() is probably close to 50% of the use of
    matplotlib, so maybe we could think about better ways to interact with and
    customize these relatively simple plots. GUI forms for configuring axis
    labels, titles, colors, and basic Line2D properties (label, color,
    linewidth, marker, zorder) might be sufficient, or at least a good start.

    There is probably a fair amount of GUI-independent "configuration/control"
    code that could be shared to tie the matplotlib API calls to different GUI
    toolkits. It might take a few iterations to work out what that code
    should be, but it might also make for more uniform and richly-featured GUIs
    for several of the backends.

    As you can see, everything you mention is already there in the Qt dialog, with the exception of zorder, which could easily be added. As far as I can see they are also there in wxmplot, but with a somewhat different interface.

    Legend location could also be added.

    It might also be useful to think about cursor/mouse interaction, but
    perhaps that's for later discussion. I'm still trying to understand what
    the goal is, and whether this is something that I have energy for.

    You may want to have a look at https://github.com/joferkington/mpldatacursor or (self-plug) https://mplcursors.readthedocs.io/en/stable/ (specifically https://mplcursors.readthedocs.io/en/stable/#activation-by-environment-variable).

  19. newville commented on Jan 13, 2017

    @newville
    Contributor
  20. anntzer commented on Jan 13, 2017

    @anntzer
    Contributor
  21. modified the milestones: , on Oct 3, 2017
  22. github-actions commented on Feb 28, 2023

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  23. added
    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.
    on May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions