Thanks to visit codestin.com
Credit goes to github.com

Skip to content

axvspan broken in PDF backend #2087

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
jacobmerson opened this issue May 29, 2013 · 4 comments
Closed

axvspan broken in PDF backend #2087

jacobmerson opened this issue May 29, 2013 · 4 comments
Labels
status: needs clarification Issues that need more information to resolve.

Comments

@jacobmerson
Copy link

When using the pdf backend adding an axvspan causes an error. The full traceback is below:

File "run.py", line 27, in
experiment.savePlots('/home/mersoj/Documents/', 'multiPlots')
File "/home/mersoj/Documents/Research/forceanalysis_update/experiment.py", line 175, in savePlots
bbox_inches='tight')
File "/usr/lib/python3.3/site-packages/matplotlib/figure.py", line 1371, in savefig
self.canvas.print_figure(_args, *_kwargs)
File "/usr/lib/python3.3/site-packages/matplotlib/backend_bases.py", line 2055, in print_figure
*_kwargs)
File "/usr/lib/python3.3/site-packages/matplotlib/backend_bases.py", line 1848, in print_pdf
return pdf.print_pdf(_args, *_kwargs)
File "/usr/lib/python3.3/site-packages/matplotlib/backends/backend_pdf.py", line 2301, in print_pdf
self.figure.draw(renderer)
File "/usr/lib/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, *_kwargs)
File "/usr/lib/python3.3/site-packages/matplotlib/figure.py", line 1007, in draw
func(_args)
File "/usr/lib/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, *_kwargs)
File "/usr/lib/python3.3/site-packages/matplotlib/axes.py", line 2088, in draw
a.draw(renderer)
File "/usr/lib/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, _args, *_kwargs)
File "/usr/lib/python3.3/site-packages/matplotlib/patches.py", line 442, in draw
renderer.draw_path(gc, tpath, affine, rgbFace)
File "/usr/lib/python3.3/site-packages/matplotlib/backends/backend_pdf.py", line 1520, in draw_path
self.file.output(self.gc.paint())
File "/usr/lib/python3.3/site-packages/matplotlib/backends/backend_pdf.py", line 2032, in paint
return Op.paint_path(False, self.fillp(), self.strokep())
File "/usr/lib/python3.3/site-packages/matplotlib/backends/backend_pdf.py", line 2002, in strokep
return (self._linewidth > 0 and self._alpha > 0 and
TypeError: unorderable types: str() > int()

@mdboom
Copy link
Member

mdboom commented May 29, 2013

Can you provide a simple, self-contained example that reproduces the error? For example, the following works for me:

import matplotlib.pyplot as plt

plt.axvspan(0.1, 0.2)
plt.savefig("test.pdf")

@jacobmerson
Copy link
Author

It seems that the error relates to parsing the arguments. For the other backends no errors were thrown when I used alpha as a string (I copied this from a tutorial somewhere). The pdf backend however does not accept the alpha as a string.

This works with other backends.

    import matplotlib.pyplot as plt
    plt.axvspan(0.1, 0.2, alpha='.5')

@efiring
Copy link
Member

efiring commented May 30, 2013

Alpha should be a number between 0 and 1; the tutorial where you found it given as a string is wrong. I have not been able to reproduce with master your reported behavior in which it is accepted as a string for some backends.

@mdboom
Copy link
Member

mdboom commented May 31, 2013

Ditto to what @efiring said, but like #2096 which is also about not validating inputs very well, I hope MEP13 can address these sorts of things in the long run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification Issues that need more information to resolve.
Projects
None yet
Development

No branches or pull requests

3 participants