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

Function _generate_complete_test_figure

lib/matplotlib/tests/test_pickle.py:50–103  ·  view source on GitHub ↗
(fig_ref)

Source from the content-addressed store, hash-verified

48
49
50def _generate_complete_test_figure(fig_ref):
51 fig_ref.set_size_inches((10, 6))
52 plt.figure(fig_ref)
53
54 plt.suptitle('Can you fit any more in a figure?')
55
56 # make some arbitrary data
57 x, y = np.arange(8), np.arange(10)
58 data = u = v = np.linspace(0, 10, 80).reshape(10, 8)
59 v = np.sin(v * -0.6)
60
61 # Ensure lists also pickle correctly.
62 plt.subplot(3, 3, 1)
63 plt.plot(list(range(10)))
64 plt.ylabel("hello")
65
66 plt.subplot(3, 3, 2)
67 plt.contourf(data, hatches=['//', 'ooo'])
68 plt.colorbar()
69
70 plt.subplot(3, 3, 3)
71 plt.pcolormesh(data)
72
73 plt.subplot(3, 3, 4)
74 plt.imshow(data)
75 plt.ylabel("hello\nworld!")
76
77 plt.subplot(3, 3, 5)
78 plt.pcolor(data)
79
80 ax = plt.subplot(3, 3, 6)
81 ax.set_xlim(0, 7)
82 ax.set_ylim(0, 9)
83 plt.streamplot(x, y, u, v)
84
85 ax = plt.subplot(3, 3, 7)
86 ax.set_xlim(0, 7)
87 ax.set_ylim(0, 9)
88 plt.quiver(x, y, u, v)
89
90 plt.subplot(3, 3, 8)
91 plt.scatter(x, x ** 2, label='$x^2$')
92 plt.legend(loc='upper left')
93
94 plt.subplot(3, 3, 9)
95 plt.errorbar(x, x * -0.5, xerr=0.2, yerr=0.4, label='$-.5 x$')
96 plt.legend(draggable=True)
97
98 # Ensure subfigure parenting works.
99 subfigs = fig_ref.subfigures(2)
100 subfigs[0].subplots(1, 2)
101 subfigs[1].subplots(1, 2)
102
103 fig_ref.align_ylabels() # Test handling of _align_label_groups Groupers.
104
105
106@mpl.style.context("default")

Callers 2

test_completeFunction · 0.85

Calls 15

set_size_inchesMethod · 0.80
figureMethod · 0.80
suptitleMethod · 0.80
pcolormeshMethod · 0.80
imshowMethod · 0.80
pcolorMethod · 0.80
subfiguresMethod · 0.80
align_ylabelsMethod · 0.80
plotMethod · 0.45
contourfMethod · 0.45
colorbarMethod · 0.45
set_xlimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…