MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_dash_offset_patch_draw

Function test_dash_offset_patch_draw

lib/matplotlib/tests/test_patches.py:203–233  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

201
202@check_figures_equal()
203def test_dash_offset_patch_draw(fig_test, fig_ref):
204 ax_test = fig_test.add_subplot()
205 ax_ref = fig_ref.add_subplot()
206
207 loc = (0.1, 0.1)
208 width, height = (0.8, 0.8)
209 rect_ref = Rectangle(loc, width, height, linewidth=3, edgecolor='b',
210 linestyle=(0, [6, 6]))
211 # fill the line gaps using a linestyle (0, [0, 6, 6, 0]), which is
212 # equivalent to (6, [6, 6]) but has 0 dash offset
213 rect_ref2 = Rectangle(loc, width, height, linewidth=3, edgecolor='r',
214 linestyle=(0, [0, 6, 6, 0]))
215 assert rect_ref.get_linestyle() == (0, [6, 6])
216 assert rect_ref2.get_linestyle() == (0, [0, 6, 6, 0])
217
218 ax_ref.add_patch(rect_ref)
219 ax_ref.add_patch(rect_ref2)
220
221 # Check that the dash offset of the rect is the same if we pass it in the
222 # init method and if we create two rects with appropriate onoff sequence
223 # of linestyle.
224
225 rect_test = Rectangle(loc, width, height, linewidth=3, edgecolor='b',
226 linestyle=(0, [6, 6]))
227 rect_test2 = Rectangle(loc, width, height, linewidth=3, edgecolor='r',
228 linestyle=(6, [6, 6]))
229 assert rect_test.get_linestyle() == (0, [6, 6])
230 assert rect_test2.get_linestyle() == (6, [6, 6])
231
232 ax_test.add_patch(rect_test)
233 ax_test.add_patch(rect_test2)
234
235
236def test_negative_rect():

Callers

nothing calls this directly

Calls 4

RectangleClass · 0.90
add_subplotMethod · 0.80
add_patchMethod · 0.80
get_linestyleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…