11import matplotlib .pyplot as plt
22from matplotlib .testing .decorators import check_figures_equal
33from matplotview .tests .utils import plotting_test , matches_post_pickle
4- from matplotview import view , view_wrapper , inset_zoom_axes , \
5- DEFAULT_RENDER_DEPTH , ViewSpecification
4+ from matplotview import view , inset_zoom_axes , ViewSpecification
5+ from matplotview . _view_axes import DEFAULT_RENDER_DEPTH , view_wrapper
66import numpy as np
77
88
@@ -38,7 +38,7 @@ def test_getters_and_setters(fig_test, fig_ref):
3838 assert ax1 in ax3 .view_specifications
3939 assert ax3 .view_specifications [ax1 ].image_interpolation == "nearest"
4040 assert ax3 .get_max_render_depth () == DEFAULT_RENDER_DEPTH
41- assert ax3 .view_specifications [ax1 ].scale_lines == True
41+ assert ax3 .view_specifications [ax1 ].scale_lines is True
4242 assert ax3 .view_specifications [ax1 ].filter_set is None
4343
4444 # Attempt setting to different values...
@@ -62,6 +62,7 @@ def test_getters_and_setters(fig_test, fig_ref):
6262 ax3 .set_xlim (0 , 30 )
6363 ax3 .set_ylim (0 , 30 )
6464
65+
6566@plotting_test ()
6667def test_subplot_view_pickle (fig_test ):
6768 np .random .seed (1 )
@@ -74,14 +75,15 @@ def test_subplot_view_pickle(fig_test):
7475 ax_test1 .add_patch (plt .Circle ((3 , 3 ), 1 , ec = "black" , fc = "blue" ))
7576 ax_test1 .text (10 , 10 , "Hello World!" , size = 14 )
7677 ax_test1 .imshow (im_data , origin = "lower" , cmap = "Blues" , alpha = 0.5 ,
77- interpolation = "nearest" )
78+ interpolation = "nearest" )
7879 ax_test2 = view (ax_test2 , ax_test1 )
7980 ax_test2 .set_aspect (ax_test1 .get_aspect ())
8081 ax_test2 .set_xlim (ax_test1 .get_xlim ())
8182 ax_test2 .set_ylim (ax_test1 .get_ylim ())
8283
8384 assert matches_post_pickle (fig_test )
8485
86+
8587@plotting_test ()
8688def test_zoom_plot_pickle (fig_test ):
8789 np .random .seed (1 )
@@ -106,6 +108,7 @@ def test_zoom_plot_pickle(fig_test):
106108
107109 assert matches_post_pickle (fig_test )
108110
111+
109112@plotting_test ()
110113def test_3d_view_pickle (fig_test ):
111114 X = Y = np .arange (- 5 , 5 , 0.25 )
@@ -122,4 +125,28 @@ def test_3d_view_pickle(fig_test):
122125 ax2_test .set_ylim (- 10 , 10 )
123126 ax2_test .set_zlim (- 2 , 2 )
124127
125- assert matches_post_pickle (fig_test )
128+ assert matches_post_pickle (fig_test )
129+
130+
131+ @plotting_test ()
132+ def test_multiplot_pickle (fig_test ):
133+ ax_test1 , ax_test2 , ax_test3 = fig_test .subplots (1 , 3 )
134+
135+ ax_test1 .add_patch (plt .Circle ((1 , 1 ), 1.5 , ec = "black" , fc = (0 , 0 , 1 , 0.5 )))
136+ ax_test3 .add_patch (plt .Circle ((3 , 1 ), 1.5 , ec = "black" , fc = (1 , 0 , 0 , 0.5 )))
137+
138+ for ax in (ax_test1 , ax_test3 ):
139+ ax .set_aspect (1 )
140+ ax .relim ()
141+ ax .autoscale_view ()
142+
143+ ax_test2 = view (
144+ view (ax_test2 , ax_test1 , scale_lines = False ),
145+ ax_test3 , scale_lines = False
146+ )
147+
148+ ax_test2 .set_aspect (1 )
149+ ax_test2 .set_xlim (- 0.5 , 4.5 )
150+ ax_test2 .set_ylim (- 0.5 , 2.5 )
151+
152+ assert matches_post_pickle (fig_test )
0 commit comments