Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Cleanup backend_cairo.#10204
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Cleanup backend_cairo.#10204
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
28 changes: 11 additions & 17 deletionslib/matplotlib/backends/backend_cairo.py
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 |
---|---|---|
@@ -29,26 +29,25 @@ | ||
import numpy as np | ||
# cairocffi is more widely compatible than pycairo (in particular pgi only | ||
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. This note should prob end up in some docs if it hasn't already... | ||
# works with cairocffi) so try it first. | ||
try: | ||
import cairocffi as cairo | ||
except ImportError: | ||
try: | ||
import cairo | ||
except ImportError: | ||
raise ImportError("cairo backend requires that cairocffi or pycairo " | ||
"is installed") | ||
else: | ||
HAS_CAIRO_CFFI = False | ||
else: | ||
HAS_CAIRO_CFFI = True | ||
if cairo.version_info < (1, 4, 0): | ||
raise ImportError("cairo {} is installed; " | ||
"cairo>=1.4.0 is required".format(cairo.version)) | ||
backend_version = cairo.version | ||
from matplotlib.backend_bases import ( | ||
_Backend, FigureCanvasBase, FigureManagerBase, GraphicsContextBase, | ||
@@ -113,14 +112,14 @@ def __init__(self, dpi): | ||
def set_ctx_from_surface(self, surface): | ||
self.gc.ctx = cairo.Context(surface) | ||
# Although it may appear natural to automatically call | ||
# `self.set_width_height(surface.get_width(), surface.get_height())` | ||
# here (instead of having the caller do so separately), this would fail | ||
# for PDF/PS/SVG surfaces, which have no way to report their extents. | ||
def set_width_height(self, width, height): | ||
self.width = width | ||
self.height = height | ||
def _fill_and_stroke(self, ctx, fill_c, alpha, alpha_overrides): | ||
if fill_c is not None: | ||
@@ -314,11 +313,6 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle): | ||
ctx.restore() | ||
def get_canvas_width_height(self): | ||
return self.width, self.height | ||
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.