Skip to content

Combobox improvements in qt figure options editor #5341

Closed

Description

@anntzer

Some ideas:

  • Drop the duplicate "nothing" entries in the marker style combo box (at least present in 1.5.0rc3).
  • Sort the entries alphabetically.
  • Add an icon with a representation of the marker/line style.

Activity

  1. mdboom commented on Oct 28, 2015

    @mdboom
    Member

    Cc: @jrevans, @mfitzp as recent contributors to the Qt editor.

    I think these are all good ideas. Are you offering to develop pull requests, or just making suggestions?

  2. added this to the milestone on Oct 28, 2015
  3. anntzer commented on Oct 28, 2015

    @anntzer
    ContributorAuthor

    I need some help to generate QImages with representations of the marker/line styles in order to address my 3rd point. It'll probably also involve fiddling more with fomrlayout...

  4. tacaswell commented on Oct 29, 2015

    @tacaswell
    Member

    You can use svg/png for that purpose.

  5. anntzer commented on Oct 29, 2015

    @anntzer
    ContributorAuthor

    Sure, but I also need to figure out where to put the plot, what size to use and so on. How are the representations in legends created, for example?

  6. mdboom commented on Oct 29, 2015

    @mdboom
    Member

    The little keys in the legend are produced by the "legend handlers" in legend_handler.py. There is a mapping from each Artist class to a handler class (the mapping itself can be obtained from a Legend object) and the handler class takes care of creating the right artist to draw in the legend.

  7. anntzer commented on Oct 29, 2015

    @anntzer
    ContributorAuthor

    I'm going to need some more help:

    from matplotlib import pyplot as plt
    from matplotlib.backends.backend_agg import RendererAgg
    from matplotlib.legend import Legend
    from matplotlib.lines import Line2D
    
    from PyQt4.QtGui import QImage
    
    
    p = Legend(plt.gca(), [Line2D([], [], marker="*")], [""]).get_frame()
    n = 50; dpi = 72
    r = RendererAgg(n, n, dpi)
    p.draw(r)
    s = r._renderer.tostring_bgra() # endianness, same as backend_qt5agg.py
    q = QImage(s, r.width, r.height, QImage.Format_ARGB32)
    q.save("/tmp/test.png")
    

    This seems to save an empty image, even though s seems to contain a nontrivial pattern (not just a bunch of \x00\xff\xff\xff but also some other pixels). Any hint of what I'm doing wrong?

  8. anntzer commented on Feb 28, 2021

    @anntzer
    ContributorAuthor

    Icons is probably too complex to implement to be worth it; the other parts have been implemented already.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions