8000 svg engine broken: fails with default tick labels on colorbar by mdboom · Pull Request #540 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

svg engine broken: fails with default tick labels on colorbar #540

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

Merged
merged 1 commit into from
Dec 31, 2011

Conversation

mdboom
Copy link
Member
@mdboom mdboom commented Oct 21, 2011

From Launchpad bug #877519.

from pylab import *
figimage([1])
jet()
h=colorbar()
h.set_label('$wer$')
savefig('tmpbug.svg',format='svg')
  File "lp877519.py", line 4, in <module>
    h=colorbar()
  File "/home/mdroe/ports/lib/python2.7/site-packages/matplotlib/pyplot.py", line 1688, in colorbar
    ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
  File "/home/mdroe/ports/lib/python2.7/site-packages/matplotlib/figure.py", line 1197, in colorbar
    cb = cbar.Colorbar(cax, mappable, **kw)
  File "/home/mdroe/ports/lib/python2.7/site-packages/matplotlib/colorbar.py", line 718, in __init__
    mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'NoneType' object has no attribute 'autoscale_None'

@mdboom
Copy link
Member Author
mdboom commented Oct 21, 2011

The "SVG" part is a red herring. This happens with all backends.

The issue here is that figimage doesn't set the current image (that returned by gci()), therefore colorbar() doesn't have an image to work with.

Raising an error inside colorbar() when there is no gci() seems like a good thing to do, since it avoids the inscrutable traceback above.

However, there is the question as to why figimage doesn't set the current image. There is a comment in figimage():

    #sci(ret)  # JDH figimage should not set current image -- it is not mappable, etc

but it does seem to work to set the current image with a figure image. @jdh2358: any thoughts?

@mdboom
Copy link
Member Author
mdboom commented Nov 8, 2011

@jdh2358: Ping.

efiring added a commit that referenced this pull request Dec 31, 2011
Raise a useful error message when there is no current image
@efiring efiring merged commit bdc427a into matplotlib:v1.1.x Dec 31, 2011
@efiring
Copy link
Member
efiring commented Dec 31, 2011
79D6

No point in holding this up waiting for an answer or action on the question about figimage and gci.

@mdboom mdboom deleted the issue540 branch March 3, 2015 18:44
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
0