Skip to content
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

Error when saving rasterized figure to PDF #3651

Closed
divenex opened this issue Oct 16, 2014 · 2 comments
Closed

Error when saving rasterized figure to PDF #3651

divenex opened this issue Oct 16, 2014 · 2 comments

Comments

@divenex
Copy link

divenex commented Oct 16, 2014

import numpy as np
from matplotlib import pyplot as plt

n = 100
x = np.random.random(n)
y = np.random.random(n)
fig = plt.figure()
plt.scatter(y, x, rasterized=True)
fig.savefig('test.pdf')

Causes an error using Matplotlib 1.4.0

File "c:\python\lib\site-packages\matplotlib\tight_bbox.py", line 86, 
        in process_figure_for_rasterizing
    r = adjust_bbox(figure, bbox_inches, fixed_dpi)
NameError: global name 'figure' is not defined

This is due to the variable "figure" being undefined. Replacing "figure" with "fig" in the function process_figure_for_rasterizing fixes the problem.

@jenshnielsen
Copy link
Member

Could you test this with the 1.4.1 release candidate? I think this might be fixed in since 1.4.0

@WeatherGod
Copy link
Member

This was fixed and is in the v1.4.1 release candidate and in master.

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

No branches or pull requests

3 participants