Commit 8713125
committed
Fix get_canvas_width_height() for pgf backend.
The pgf backend's get_canvas_width_height returns the canvas size in
inches, but it should return it in display units ("pixels", or
inches*dpi) instead.
get_canvas_width_height is actually barely used (only in text.py for
some backends (not pgf), in collections.py as an optimization, and in
BboxImage -- the only really relevant case), so to show the failure,
apply
diff --git i/examples/text_labels_and_annotations/demo_text_path.py w/examples/text_labels_and_annotations/demo_text_path.py
index 47ed5dd..d45a922f4 100644
--- i/examples/text_labels_and_annotations/demo_text_path.py
+++ w/examples/text_labels_and_annotations/demo_text_path.py
@@ -61,6 +61,7 @@ class PathClippedImagePatch(mpatches.PathPatch):
if __name__ == "__main__":
+ import matplotlib; matplotlib.use("pgf")
usetex = plt.rcParams["text.usetex"]
fig = plt.figure()
@@ -156,4 +157,5 @@ if __name__ == "__main__":
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)
+ plt.savefig("/tmp/test.pdf")
plt.show()
and observe that the image is incorrectly drawn before the patch, but
correctly after.1 parent d1941a7 commit 8713125
2 files changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
736 | 736 | | |
737 | 737 | | |
738 | 738 | | |
739 | | - | |
| 739 | + | |
| 740 | + | |
740 | 741 | | |
741 | 742 | | |
742 | 743 | | |
| |||
0 commit comments