@@ 44-64 (lines=21) @@ | ||
41 | ||
42 | return fig |
|
43 | ||
44 | ||
45 | @pytest.mark.mpl_image_compare(tolerance={'1.4': 2.81}.get(MPL_VERSION, 0.003), |
|
46 | savefig_kwargs={'dpi': 300}, remove_text=True) |
|
47 | def test_stationplot_clipping(): |
|
48 | """Test the that clipping can be enabled as a default parameter.""" |
|
49 | fig = plt.figure(figsize=(9, 9)) |
|
50 | ||
51 | # testing data |
|
52 | x = np.array([1, 5]) |
|
53 | y = np.array([2, 4]) |
|
54 | ||
55 | # Make the plot |
|
56 | sp = StationPlot(fig.add_subplot(1, 1, 1), x, y, fontsize=16, clip_on=True) |
|
57 | sp.plot_barb([20, 0], [0, -50]) |
|
58 | sp.plot_text('E', ['KOKC', 'ICT'], color='blue') |
|
59 | sp.plot_parameter('NW', [10.5, 15] * units.degC, color='red') |
|
60 | sp.plot_symbol('S', [5, 7], high_clouds, color='green') |
|
61 | ||
62 | sp.ax.set_xlim(1, 5) |
|
63 | sp.ax.set_ylim(1.75, 4.25) |
|
64 | ||
65 | return fig |
|
66 | ||
67 | ||
@@ 21-41 (lines=21) @@ | ||
18 | ||
19 | MPL_VERSION = matplotlib.__version__[:3] |
|
20 | ||
21 | ||
22 | @pytest.mark.mpl_image_compare(tolerance={'1.5': 0.04625, '1.4': 4.1}.get(MPL_VERSION, 0.0033), |
|
23 | savefig_kwargs={'dpi': 300}, remove_text=True) |
|
24 | def test_stationplot_api(): |
|
25 | """Test the StationPlot API.""" |
|
26 | fig = plt.figure(figsize=(9, 9)) |
|
27 | ||
28 | # testing data |
|
29 | x = np.array([1, 5]) |
|
30 | y = np.array([2, 4]) |
|
31 | ||
32 | # Make the plot |
|
33 | sp = StationPlot(fig.add_subplot(1, 1, 1), x, y, fontsize=16) |
|
34 | sp.plot_barb([20, 0], [0, -50]) |
|
35 | sp.plot_text('E', ['KOKC', 'ICT'], color='blue') |
|
36 | sp.plot_parameter('NW', [10.5, 15] * units.degC, color='red') |
|
37 | sp.plot_symbol('S', [5, 7], high_clouds, color='green') |
|
38 | ||
39 | sp.ax.set_xlim(0, 6) |
|
40 | sp.ax.set_ylim(0, 6) |
|
41 | ||
42 | return fig |
|
43 | ||
44 | ||
@@ 44-64 (lines=21) @@ | ||
41 | ||
42 | return fig |
|
43 | ||
44 | ||
45 | @pytest.mark.mpl_image_compare(tolerance={'1.4': 2.81}.get(MPL_VERSION, 0.003), |
|
46 | savefig_kwargs={'dpi': 300}, remove_text=True) |
|
47 | def test_stationplot_clipping(): |
|
48 | """Test the that clipping can be enabled as a default parameter.""" |
|
49 | fig = plt.figure(figsize=(9, 9)) |
|
50 | ||
51 | # testing data |
|
52 | x = np.array([1, 5]) |
|
53 | y = np.array([2, 4]) |
|
54 | ||
55 | # Make the plot |
|
56 | sp = StationPlot(fig.add_subplot(1, 1, 1), x, y, fontsize=16, clip_on=True) |
|
57 | sp.plot_barb([20, 0], [0, -50]) |
|
58 | sp.plot_text('E', ['KOKC', 'ICT'], color='blue') |
|
59 | sp.plot_parameter('NW', [10.5, 15] * units.degC, color='red') |
|
60 | sp.plot_symbol('S', [5, 7], high_clouds, color='green') |
|
61 | ||
62 | sp.ax.set_xlim(1, 5) |
|
63 | sp.ax.set_ylim(1.75, 4.25) |
|
64 | ||
65 | return fig |
|
66 | ||
67 |