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

allow kwargs `transform` to work for axvspan, axhspan, axvline, axhline by kaufman · Pull Request #91 · matplotlib/matplotlib · GitHub

Repository navigation

allow kwargs transform to work for axvspan, axhspan, axvline, axhline - #91

Closed
kaufman wants to merge 323 commits into
matplotlib:masterfrom
kaufman:ax_span_line_transform
Closed

kaufman wants to merge 323 commits into
matplotlib:masterfrom
kaufman:ax_span_line_transform

Conversation

kaufman commented Apr 24, 2011

Copy link
Copy Markdown
Contributor

This patch removes the prohibition on using the 'transform' option for axhline and axvline and changes the code order so that a user-passed transform option will work with axhspan and axvspan.

efiring and others added 30 commits August 27, 2010 07:13
…n Granger

svn path=/trunk/matplotlib/; revision=8664
…tion draw was putting data in the saved sequence, which needed to be removed. Also, handle the case where there is no saved sequence. Make sure to disconnect signals for first draw, otherwise saving the movie will start the animation.

svn path=/trunk/matplotlib/; revision=8665
svn path=/trunk/matplotlib/; revision=8666
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8652 | efiring | 2010-08-21 13:49:53 -0400 (Sat, 21 Aug 2010) | 2 lines
  
  Axis.set_view_interval: when updating, respect original orientation
........
  r8667 | leejjoon | 2010-08-28 11:54:32 -0400 (Sat, 28 Aug 2010) | 1 line
  
  fix gridspec bug that location is wrongly calculated for non-square grid
........

svn path=/trunk/matplotlib/; revision=8668
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8673 | efiring | 2010-09-01 09:44:36 -1000 (Wed, 01 Sep 2010) | 2 lines
  
  [3054467] fix bug in PatchCollection; restore attribute access to Patch.fill
........

svn path=/trunk/matplotlib/; revision=8674
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8675 | efiring | 2010-09-01 13:39:49 -1000 (Wed, 01 Sep 2010) | 2 lines
  
  PatchCollection: handle linestyles correctly; patch by Thomas Robitaille
........

svn path=/trunk/matplotlib/; revision=8676
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8677 | efiring | 2010-09-04 11:17:58 -1000 (Sat, 04 Sep 2010) | 2 lines
  
  doc patch by Christoph Gohlke
........

svn path=/trunk/matplotlib/; revision=8678
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8679 | efiring | 2010-09-04 14:38:45 -1000 (Sat, 04 Sep 2010) | 2 lines
  
  [3024007] Fix ancient bug in hist inherited from numpy, fixed in numpy 1.5
........

svn path=/trunk/matplotlib/; revision=8680
The changeset includes refactoring to consolidate all Axes
tracking in a single data structure.

svn path=/trunk/matplotlib/; revision=8681
svn path=/trunk/matplotlib/; revision=8682
svn path=/trunk/matplotlib/; revision=8695
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8690 | mdboom | 2010-09-08 09:32:17 -0500 (Wed, 08 Sep 2010) | 2 lines
  
  [3058804] part of a line is not drawn
........
  r8691 | mdboom | 2010-09-08 10:51:18 -0500 (Wed, 08 Sep 2010) | 2 lines
  
  Another pass at fixing simplification.
........
  r8696 | ryanmay | 2010-09-11 14:02:38 -0500 (Sat, 11 Sep 2010) | 1 line
  
  Fix typo in griddata().
........
  r8697 | ryanmay | 2010-09-11 14:03:52 -0500 (Sat, 11 Sep 2010) | 1 line
  
  Handle multple calls to GTKTimer.start() by stopping any existing gtk timer id.
........

svn path=/trunk/matplotlib/; revision=8698
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8699 | mdboom | 2010-09-14 11:21:21 -0400 (Tue, 14 Sep 2010) | 2 lines
  
  Fix semi-transparent Gouraud triangle rendering in SVG backend.
........
  r8700 | mdboom | 2010-09-14 11:53:59 -0400 (Tue, 14 Sep 2010) | 2 lines
  
  Fix mismatched opening/closing group.
........

svn path=/trunk/matplotlib/; revision=8701
svn path=/trunk/matplotlib/; revision=8702
svn path=/trunk/matplotlib/; revision=8703
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8704 | weathergod | 2010-09-16 11:45:43 -0500 (Thu, 16 Sep 2010) | 3 lines
  
  change pointer offset from type int to size_t, which caused problems with showing very high res images.
  This fixes bug ID 3054444.
........

svn path=/trunk/matplotlib/; revision=8705
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8706 | efiring | 2010-09-16 16:46:04 -1000 (Thu, 16 Sep 2010) | 5 lines
  
  include Python.h first in extension code; patch by Jason Grout.
  This cleans up the preprocessor directives and allows compilation on Solaris.
  A preprocessor directive is added to keep png.h from failing on Linux
  because Python.h has caused setjmp.h to be included.
........

svn path=/trunk/matplotlib/; revision=8707
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8708 | efiring | 2010-09-16 20:41:34 -1000 (Thu, 16 Sep 2010) | 2 lines
  
  including Python.h and png.h: a second try, special case for linux
........

svn path=/trunk/matplotlib/; revision=8709
svn path=/trunk/matplotlib/; revision=8710
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8711 | mdboom | 2010-09-20 12:58:14 -0400 (Mon, 20 Sep 2010) | 2 lines
  
  Fix clipped text in example.
........
  r8712 | mdboom | 2010-09-21 16:13:25 -0400 (Tue, 21 Sep 2010) | 2 lines
  
  If a font file is looked up in the cache, but that font file no longer exists on disk, rebuild the cache.
........

svn path=/trunk/matplotlib/; revision=8713
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8714 | mdboom | 2010-09-21 15:18:48 -0500 (Tue, 21 Sep 2010) | 2 lines
  
  Bug #
........
  r8715 | jdh2358 | 2010-09-22 07:46:38 -0500 (Wed, 22 Sep 2010) | 1 line
  
  added Bartosz Telenczuk's artist demo
........

svn path=/trunk/matplotlib/; revision=8716
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8717 | jdh2358 | 2010-09-24 04:54:34 +0900 (Fri, 24 Sep 2010) | 1 line
  
  added citation faq
........
  r8718 | jdh2358 | 2010-09-24 05:07:12 +0900 (Fri, 24 Sep 2010) | 1 line
  
  wrap the mpl citation abstract
........
  r8720 | leejjoon | 2010-09-27 10:30:19 +0900 (Mon, 27 Sep 2010) | 1 line
  
  fix bezier.get_parallerls to handle parallel input lines
........

svn path=/trunk/matplotlib/; revision=8721
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint

........
  r8722 | efiring | 2010-09-27 08:51:05 -1000 (Mon, 27 Sep 2010) | 2 lines
  
  Clarify docstrings for autoscale_view and relim.
........
  r8723 | efiring | 2010-10-03 10:45:38 -1000 (Sun, 03 Oct 2010) | 2 lines
  
  docs: in event_handling, note that weak references to callbacks are used.
........
  r8724 | efiring | 2010-10-03 11:04:10 -1000 (Sun, 03 Oct 2010) | 2 lines
  
  errorbar bugfix: plot everything regardless of the Axes hold state
........
  r8725 | efiring | 2010-10-03 11:17:39 -1000 (Sun, 03 Oct 2010) | 2 lines
  
  bugfix: applied patch by Stan West to fix error in colormap reversal
........

svn path=/trunk/matplotlib/; revision=8726
…G files.

svn path=/trunk/matplotlib/; revision=8727
svn path=/trunk/matplotlib/; revision=8728
…de to make contains() not cause a traceback if draw() has not been called.

svn path=/trunk/matplotlib/; revision=8730
svn path=/trunk/matplotlib/; revision=8731
svn path=/trunk/matplotlib/; revision=8733
mdboom and others added 25 commits April 1, 2011 12:08
…ot_directive

Conflicts:
	lib/matplotlib/sphinxext/plot_directive.py
…nor_doc_fixes

Conflicts:
	lib/matplotlib/sphinxext/plot_directive.py
…into mdboom-minor_doc_fixes

Conflicts:
	.gitignore
	CHANGELOG
	doc/faq/installing_faq.rst
	doc/sphinxext/inheritance_diagram.py
	doc/users/recipes.rst
Comment thread lib/matplotlib/axes.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

My preferred idiom would be:
kwargs.setdefault('transform', trans)
Then you don't need the comment above it. If this line immediately follows the definition of trans, then you don't need the comment above that, either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

right, I guess that makes it obvious that I'm still a python newbie.

efiring commented Apr 24, 2011

Copy link
Copy Markdown
Member

Apart from the stylistic suggestion in the line note, I am ambivalent about the change. The essence of these methods is in their blended transform; they exist to provide easy access to that advanced feature. This is stated right at the start of the docstring. Allowing a transform kwarg subverts that essence. Is the motivation that you want to be able to give the both sets of coordinates in axes units? In the spirit of these methods as convenience methods, hiding the transform complexity from the user, you could do that with a kwarg, e.g.,
ax.axhspan(0.1, 0.2, yunits='axes') # default would be 'data'
and then modify the docstring accordingly and code.
If this is not a common enough need, then anyone who knows how to set a Line2D transform kwarg probably also knows how to generate the desired result with two lines of code (make a line, add it to the axes) and doesn't need the convenience method at all.

On the positive side, I can see taking the point of view that the change is harmless because anyone who puts in a transform kwarg presumably understands how it is overriding the normal behavior; and anyone who does not put in the kwarg will never know the difference. Suitably condensed, the change slightly simplifies the code while expanding its capabilities.

Now I see another problem, however: the scalex,scaley logic is based on the assumption that the default transform is being used. Yes, you could fix that; but it seems to me like just one more indication that it would be better to leave the methods alone, or possibly use the kwarg approach. In other words, there is a good reason these methods disallow passing an arbitrary transform.

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.


Back | FazBrowse Home | New Git URL