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

Skip to content

MixedModeRenderer non-72-dpi fixes & Pgf mixed rendering #1975

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 2 commits into from
May 27, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixes on MixedModeRenderer for non-72dpi figures
  • Loading branch information
pwuertz committed May 25, 2013
commit c811acb37c758c50eef218fbdb80b9a3e1a99273
12 changes: 8 additions & 4 deletions lib/matplotlib/backends/backend_mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, figure, width, height, dpi, vector_renderer,
# the figure dpi before and after the rasterization. Although
# this looks ugly, I couldn't find a better solution. -JJL
self.figure=figure
self._figdpi = figure.get_dpi()
Copy link
Member

Choose a reason for hiding this comment

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

Just spotted this one too.


self._bbox_inches_restore = bbox_inches_restore

Expand Down Expand Up @@ -121,16 +122,19 @@ def stop_rasterizing(self):
image.is_grayscale = False
image.flipud_out()
gc = self._renderer.new_gc()
# TODO: If the mixedmode resolution differs from the figure's
# dpi, the image must be scaled (dpi->_figdpi). Not all
# backends support this.
Copy link
Member

Choose a reason for hiding this comment

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

And this too. (#1185 (comment))

self._renderer.draw_image(
gc,
float(l)/self.dpi*72.,
(float(height) - b - h)/self.dpi*72.,
float(l) / self.dpi * self._figdpi,
(float(height)-b-h) / self.dpi * self._figdpi,
image)
self._raster_renderer = None
self._rasterizing = False

# restore the figure dpi.
self.figure.set_dpi(72)
# restore the figure dpi.
self.figure.set_dpi(self._figdpi)

if self._bbox_inches_restore: # when tight bbox is used
r = process_figure_for_rasterizing(self.figure,
Expand Down