-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Offsetbox default arguments #24652
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
Offsetbox default arguments #24652
Changes from all commits
85e7c89
58dc0d6
895c861
5b3397e
8b8b539
a1ba0cd
ca9bc4a
0f1f182
4d1272c
c8c1f87
f09389d
ad9fc5f
8009e09
bfbb4b0
cd6ecaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
|
||
from matplotlib.offsetbox import ( | ||
AnchoredOffsetbox, AnnotationBbox, AnchoredText, DrawingArea, OffsetBox, | ||
OffsetImage, TextArea, _get_packed_offsets, HPacker, VPacker) | ||
OffsetImage, PaddedBox, TextArea, _get_packed_offsets, HPacker, VPacker) | ||
|
||
|
||
@image_comparison(['offsetbox_clipping'], remove_text=True) | ||
|
@@ -347,8 +347,9 @@ def test_packers(align): | |
r1 = DrawingArea(x1, y1) | ||
r2 = DrawingArea(x2, y2) | ||
|
||
hpacker = HPacker(children=[r1, r2], pad=0, sep=0, align=align) | ||
vpacker = VPacker(children=[r1, r2], pad=0, sep=0, align=align) | ||
hpacker = HPacker(children=[r1, r2], align=align) | ||
vpacker = VPacker(children=[r1, r2], align=align) | ||
|
||
renderer = fig.canvas.get_renderer() | ||
|
||
# HPacker | ||
|
@@ -378,3 +379,12 @@ def test_packers(align): | |
x_height = (x2 - x1) / 2 | ||
# x-offsets, y-offsets | ||
assert_allclose([(x_height, 0), (0, -y2)], offset_pairs) | ||
|
||
|
||
def test_paddedbox(): | ||
# smoke test paddedbox for correct default value | ||
fig, ax = plt.subplots() | ||
at = AnchoredText("foo", 'upper left') | ||
pb = PaddedBox(at, patch_attrs={'facecolor': 'r'}, draw_frame=True) | ||
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 test passes on main as well. (As the fact that pad is None is not a problem until later on.) You need to do:
If you can also add a similar thing for one of the packers that would be great! Can go in the same test/figure. There is a previous test for the packers that you can just copy the relevant code from, but leave the pad and sep arguments out. |
||
ax.add_artist(pb) | ||
fig.draw_without_rendering() |
Uh oh!
There was an error while loading. Please reload this page.