FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Legend refactor by leejjoon · Pull Request #26 · matplotlib/matplotlib · GitHub

Repository navigation

Legend refactor - #26

Merged
9 commits merged into
matplotlib:masterfrom
leejjoon:legend_refactor
Mar 17, 2011
Merged

9 commits merged into
matplotlib:masterfrom
leejjoon:legend_refactor

Conversation

leejjoon commented Mar 2, 2011

Copy link
Copy Markdown
Contributor

This is to improve the functionality of legend.
The two biggest changes are

  • Drawing of legend is delegated to "legend handlers".
  • Introduces a new "Container" class. This is primarily to support
    legend of complex plots (e.g., bar, errorbar, etc).

Some more details can be found in the updated legend guide.

http://goo.gl/DhGej

Copy link
Copy Markdown
Member

I am doing some testing on this branch and I found a broken example: legend_scatter.py now has missing markers in its legend.

Copy link
Copy Markdown
Member

An interesting bug with respect to hist(). For regular histograms, I think everything is fine. However, for any other type, if the label is provided through the legend() function, the artist for that histogram is skipped and the label goes to the next available artist. However, it works perfectly if the label is provided through the "label" kwarg to hist().

Note that before this, either approaches worked for histograms.

Copy link
Copy Markdown
Member

Another bug (or at least a difference in behavior)... for a dragable legend, if I click but not hold down the button, the legend will move with my mouse until I click again. Note that there is also a separate bug where doing this throws a "TypeError: 'instancemethod' object is not iterable", but that doesn't prevent you from continuing and this bug occurs in master as well.

Copy link
Copy Markdown
Member

Note that cherrypicking the recent commit to fix draggable legends fixed both problems I just reported.

leejjoon commented Mar 3, 2011

Copy link
Copy Markdown
Contributor Author

The first issue should be solved by commit 1b17994.

Can you provide an example code for the second issue?

Copy link
Copy Markdown
Member

I am using a modified version of histogram_demo_extended.py. After investigating a little further, it appears that the problem occurs for any histogram type that is not patch-based.

I am linking to two versions of the script, one that uses the labels kwarg:
http://dl.dropbox.com/u/7325604/histogram_demo_extended_using_labels.py

and one that uses the legend() function:
http://dl.dropbox.com/u/7325604/histogram_demo_extended_using_legend.py

In particular, figures 1 and 3 are impacted.

Copy link
Copy Markdown
Member

Ok, I think I have exhausted all scripts I can find that involves legends and I can only find one other issue (and it isn't new). Stem plots cause a problem because they attach both the dots and the line to the list of collections for legends. So, if I do two stem plots in an axes, and then call legend with two labels, the first label gets black dots, and the second label gets the line for the first stem plot.

However, this is nothing new...

I have not done a code review yet, but in terms of backwards compatibility, it appears that we are (mostly) golden.

leejjoon commented Mar 6, 2011

Copy link
Copy Markdown
Contributor Author

Regarding the second issue, I think it is related with the current buggy(?) behavior of legend (and the "hist" command relying on this buggy behavior). I posted a related message in the devel-list. The modification of this pull request depends on how this issue is addressed.

richbwood mentioned this pull request Dec 19, 2012
magnunor pushed a commit to magnunor/matplotlib that referenced this pull request Dec 5, 2013
lib/drawing/image.py
BUG-FIX: before plotting and image, check if the dtype is complex.
         if so, plot log(abs(data))
         one could argue whether plotting the 'log' or not...

lib/io/dm3_data_plugin.py
MOVE: some 'print' statements commented out
swfiua pushed a commit to swfiua/matplotlib that referenced this pull request Mar 17, 2017
eric now opens code for current widget
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL