Skip to content

Combobox improvements in qt figure options editor #5341

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 Oct 28, 2015 · 7 comments
Closed

Combobox improvements in qt figure options editor #5341

anntzer opened this issue Oct 28, 2015 · 7 comments

Comments

@anntzer
Copy link
Contributor

anntzer commented Oct 28, 2015

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.
@mdboom
Copy link
Member

mdboom commented Oct 28, 2015

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?

@tacaswell tacaswell added this to the unassigned milestone Oct 28, 2015
anntzer added a commit to anntzer/matplotlib that referenced this issue Oct 28, 2015
@anntzer
Copy link
Contributor Author

anntzer commented Oct 28, 2015

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...

@tacaswell
Copy link
Member

You can use svg/png for that purpose.

@anntzer
Copy link
Contributor Author

anntzer commented Oct 29, 2015

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?

@mdboom
Copy link
Member

mdboom commented Oct 29, 2015

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.

@anntzer
Copy link
Contributor Author

anntzer commented Oct 29, 2015

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?

anntzer added a commit to anntzer/matplotlib that referenced this issue Nov 12, 2015
anntzer added a commit to anntzer/matplotlib that referenced this issue Nov 12, 2015
anntzer added a commit to anntzer/matplotlib that referenced this issue Jul 10, 2016
@anntzer
Copy link
Contributor Author

anntzer commented Feb 28, 2021

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

@anntzer anntzer closed this as completed Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants