-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
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
commit c811acb37c758c50eef218fbdb80b9a3e1a99273
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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() | ||
|
||
self._bbox_inches_restore = bbox_inches_restore | ||
|
||
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.