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

Function test_tickedstroke

lib/matplotlib/tests/test_patheffects.py:140–187  ·  view source on GitHub ↗
(text_placeholders)

Source from the content-addressed store, hash-verified

138
139@image_comparison(['tickedstroke.png'], remove_text=True, style='mpl20')
140def test_tickedstroke(text_placeholders):
141 fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(12, 4))
142 path = Path.unit_circle()
143 patch = patches.PathPatch(path, facecolor='none', lw=2, path_effects=[
144 path_effects.withTickedStroke(angle=-90, spacing=10,
145 length=1)])
146
147 ax1.add_patch(patch)
148 ax1.axis('equal')
149 ax1.set_xlim(-2, 2)
150 ax1.set_ylim(-2, 2)
151
152 ax2.plot([0, 1], [0, 1], label='C0',
153 path_effects=[path_effects.withTickedStroke(spacing=7,
154 angle=135)])
155 nx = 101
156 x = np.linspace(0.0, 1.0, nx)
157 y = 0.3 * np.sin(x * 8) + 0.4
158 ax2.plot(x, y, label='C1', path_effects=[path_effects.withTickedStroke()])
159
160 ax2.legend()
161
162 nx = 101
163 ny = 105
164
165 # Set up survey vectors
166 xvec = np.linspace(0.001, 4.0, nx)
167 yvec = np.linspace(0.001, 4.0, ny)
168
169 # Set up survey matrices. Design disk loading and gear ratio.
170 x1, x2 = np.meshgrid(xvec, yvec)
171
172 # Evaluate some stuff to plot
173 g1 = -(3 * x1 + x2 - 5.5)
174 g2 = -(x1 + 2 * x2 - 4)
175 g3 = .8 + x1 ** -3 - x2
176
177 cg1 = ax3.contour(x1, x2, g1, [0], colors=('k',))
178 cg1.set(path_effects=[path_effects.withTickedStroke(angle=135)])
179
180 cg2 = ax3.contour(x1, x2, g2, [0], colors=('r',))
181 cg2.set(path_effects=[path_effects.withTickedStroke(angle=60, length=2)])
182
183 cg3 = ax3.contour(x1, x2, g3, [0], colors=('b',))
184 cg3.set(path_effects=[path_effects.withTickedStroke(spacing=7)])
185
186 ax3.set_xlim(0, 4)
187 ax3.set_ylim(0, 4)
188
189
190@image_comparison(['spaces_and_newlines.png'], remove_text=True, style='mpl20')

Callers

nothing calls this directly

Calls 10

unit_circleMethod · 0.80
add_patchMethod · 0.80
subplotsMethod · 0.45
axisMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45
plotMethod · 0.45
legendMethod · 0.45
contourMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…