Skip to content

Commit 47dc553

Browse files
authored
Merge pull request astropy#12630 from dstansby/wcs-pix-ticklbl
2 parents 9977974 + 4764bbd commit 47dc553

11 files changed

Lines changed: 97 additions & 52 deletions

File tree

‎astropy/tests/figures/py39-test-image-mpl311.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_plot_line": "0961332a596c87b6530a74f54c6dfccbcfbc994f443cbda926bded233a24fb98",
2020
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_changed_axis_units": "d0ad181b8c9a2f19ec19ee014f4bfd0fcc792802f7f9ae1a9826c2868515db6f",
2121
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_minor_ticks": "13d0d00d253a8ef745e7363bf340f2ba75ef1a0228cb6972c12a7d0255a03c08",
22-
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_ticks_labels": "608e440c8feeff5fb0d129c6fd15fb33b22f0a1fa553172b95a4f6ce5e025555",
22+
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_ticks_labels": "1688775dad979fd22a6cbbe22f2a5c0121d2b2353d5d6ca1b78609d01f63b747",
2323
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_rcparams": "13aa853ceaa8d52aa7e8fedf708ae9555fd492de3ab5840a459241462ee4ad51",
2424
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_tick_angles": "c249e6c4299472c8e4c9712e786ba8327f6a0bd8eaa6281982c2a67724322f48",
2525
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_tick_angles_non_square_axes": "ee3801f0e974737f665b963ee3a8f6e3f16134a6c0660f1dd15805385549f14e",

‎astropy/tests/figures/py39-test-image-mpldev.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_plot_line": "93f19f790da326940ced49147021fc9700c587bd9662eb156d10372faa156693",
2020
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_changed_axis_units": "e1e2d787ac997ec3e1e27aedd7486f311d81a5cc88251a36e1fd4c0c3c5ee49f",
2121
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_minor_ticks": "8498a992eb4d5e66a486fc5c59e195d5424e7ccfbc08a472ae7671b491a0be08",
22-
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_ticks_labels": "1af606bf4080c5c63549b02891322f9f9980833008792ebd2bf8b9e2cec2cbe3",
22+
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_ticks_labels": "093ad85f2e30d30bf2b56957ca6094b9c019e1409d1c3f14cd555e1b5263ebd1",
2323
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_rcparams": "4d47fdf0616a87c85e729ae25ab89ddde39d88c6862e95827ef2bb73777f3fe7",
2424
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_tick_angles": "edce883e1e89c3b4fc188c0d4aa81fffd63847d38782c798ba6f80df2b803c14",
2525
"astropy.visualization.wcsaxes.tests.test_images.TestBasic.test_tick_angles_non_square_axes": "b1b5349ebc0a1c206a09b0354d79c20cc0a672a884dab5390f8ab2d20cbc209e",

‎astropy/visualization/wcsaxes/coordinate_helpers.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,6 @@ def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2,
785785
frac = (t - w1[imin]) / (w2[imin] - w1[imin])
786786
x_data_i = spine.data[imin, 0] + frac * (spine.data[imax, 0] - spine.data[imin, 0])
787787
y_data_i = spine.data[imin, 1] + frac * (spine.data[imax, 1] - spine.data[imin, 1])
788-
x_pix_i = spine.pixel[imin, 0] + frac * (spine.pixel[imax, 0] - spine.pixel[imin, 0])
789-
y_pix_i = spine.pixel[imin, 1] + frac * (spine.pixel[imax, 1] - spine.pixel[imin, 1])
790788
delta_angle = tick_angle[imax] - tick_angle[imin]
791789
if delta_angle > 180.:
792790
delta_angle -= 360.
@@ -819,7 +817,7 @@ def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2,
819817
# it's faster to format many ticklabels at once outside
820818
# of the loop
821819
self.lblinfo.append(dict(axis=axis,
822-
pixel=(x_pix_i, y_pix_i),
820+
data=(x_data_i, y_data_i),
823821
world=world,
824822
angle=spine.normal_angle[imin],
825823
axis_displacement=imin + frac))

‎astropy/visualization/wcsaxes/tests/test_frame.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def update_spines(self):
3535

3636
class TestFrame(BaseImageTests):
3737

38-
@pytest.mark.remote_data(source='astropy')
38+
@pytest.mark.remote_data
3939
@pytest.mark.mpl_image_compare(tolerance=0, style={})
4040
def test_custom_frame(self):
4141

@@ -75,7 +75,7 @@ def test_custom_frame(self):
7575

7676
return fig
7777

78-
@pytest.mark.remote_data(source='astropy')
78+
@pytest.mark.remote_data
7979
@pytest.mark.mpl_image_compare(tolerance=0, style={})
8080
def test_update_clip_path_rectangular(self, tmpdir):
8181

@@ -100,7 +100,7 @@ def test_update_clip_path_rectangular(self, tmpdir):
100100

101101
return fig
102102

103-
@pytest.mark.remote_data(source='astropy')
103+
@pytest.mark.remote_data
104104
@pytest.mark.mpl_image_compare(tolerance=0, style={})
105105
def test_update_clip_path_nonrectangular(self, tmpdir):
106106

@@ -123,7 +123,7 @@ def test_update_clip_path_nonrectangular(self, tmpdir):
123123

124124
return fig
125125

126-
@pytest.mark.remote_data(source='astropy')
126+
@pytest.mark.remote_data
127127
@pytest.mark.mpl_image_compare(tolerance=0, style={})
128128
def test_update_clip_path_change_wcs(self, tmpdir):
129129

‎astropy/visualization/wcsaxes/tests/test_images.py‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def teardown_method(self, method):
4444

4545
class TestBasic(BaseImageTests):
4646

47-
@pytest.mark.remote_data(source='astropy')
47+
@pytest.mark.remote_data
4848
@pytest.mark.mpl_image_compare(tolerance=0, style={})
4949
def test_image_plot(self):
5050
# Test for plotting image and also setting values of ticks
@@ -55,7 +55,7 @@ def test_image_plot(self):
5555
ax.coords[0].set_ticks([-0.30, 0., 0.20] * u.degree, size=5, width=1)
5656
return fig
5757

58-
@pytest.mark.remote_data(source='astropy')
58+
@pytest.mark.remote_data
5959
@pytest.mark.mpl_image_compare(tolerance=0, style={})
6060
def test_axes_off(self):
6161
# Test for turning the axes off
@@ -65,7 +65,7 @@ def test_axes_off(self):
6565
ax.set_axis_off()
6666
return fig
6767

68-
@pytest.mark.remote_data(source='astropy')
68+
@pytest.mark.remote_data
6969
@pytest.mark.mpl_image_compare(tolerance=1.5, style={})
7070
@pytest.mark.parametrize('axisbelow', [True, False, 'line'])
7171
def test_axisbelow(self, axisbelow):
@@ -93,7 +93,7 @@ def test_axisbelow(self, axisbelow):
9393

9494
return fig
9595

96-
@pytest.mark.remote_data(source='astropy')
96+
@pytest.mark.remote_data
9797
@pytest.mark.mpl_image_compare(tolerance=0, style={})
9898
def test_contour_overlay(self):
9999
# Test for overlaying contours on images
@@ -126,7 +126,7 @@ def test_contour_overlay(self):
126126

127127
return fig
128128

129-
@pytest.mark.remote_data(source='astropy')
129+
@pytest.mark.remote_data
130130
@pytest.mark.mpl_image_compare(tolerance=0, style={})
131131
def test_contourf_overlay(self):
132132
# Test for overlaying contours on images
@@ -159,7 +159,7 @@ def test_contourf_overlay(self):
159159

160160
return fig
161161

162-
@pytest.mark.remote_data(source='astropy')
162+
@pytest.mark.remote_data
163163
@pytest.mark.mpl_image_compare(tolerance=0, style={})
164164
def test_overlay_features_image(self):
165165

@@ -196,7 +196,7 @@ def test_overlay_features_image(self):
196196

197197
return fig
198198

199-
@pytest.mark.remote_data(source='astropy')
199+
@pytest.mark.remote_data
200200
@pytest.mark.mpl_image_compare(tolerance=0, style={})
201201
def test_curvilinear_grid_patches_image(self):
202202

@@ -228,7 +228,7 @@ def test_curvilinear_grid_patches_image(self):
228228

229229
return fig
230230

231-
@pytest.mark.remote_data(source='astropy')
231+
@pytest.mark.remote_data
232232
@pytest.mark.mpl_image_compare(tolerance=0, style={})
233233
def test_cube_slice_image(self):
234234

@@ -256,7 +256,7 @@ def test_cube_slice_image(self):
256256

257257
return fig
258258

259-
@pytest.mark.remote_data(source='astropy')
259+
@pytest.mark.remote_data
260260
@pytest.mark.mpl_image_compare(tolerance=0, style={})
261261
def test_cube_slice_image_lonlat(self):
262262

@@ -282,7 +282,7 @@ def test_cube_slice_image_lonlat(self):
282282

283283
return fig
284284

285-
@pytest.mark.remote_data(source='astropy')
285+
@pytest.mark.remote_data
286286
@pytest.mark.mpl_image_compare(tolerance=0, style={})
287287
def test_plot_coord(self):
288288
fig = plt.figure(figsize=(6, 6))
@@ -307,7 +307,7 @@ def test_plot_coord(self):
307307

308308
return fig
309309

310-
@pytest.mark.remote_data(source='astropy')
310+
@pytest.mark.remote_data
311311
@pytest.mark.mpl_image_compare(tolerance=0, style={})
312312
def test_scatter_coord(self):
313313
from matplotlib.collections import PathCollection
@@ -353,7 +353,7 @@ def test_plot_line(self):
353353

354354
return fig
355355

356-
@pytest.mark.remote_data(source='astropy')
356+
@pytest.mark.remote_data
357357
@pytest.mark.mpl_image_compare(tolerance=0, style={})
358358
def test_changed_axis_units(self):
359359
# Test to see if changing the units of axis works
@@ -382,7 +382,7 @@ def test_changed_axis_units(self):
382382

383383
return fig
384384

385-
@pytest.mark.remote_data(source='astropy')
385+
@pytest.mark.remote_data
386386
@pytest.mark.mpl_image_compare(tolerance=0, style={})
387387
def test_minor_ticks(self):
388388
# Test for drawing minor ticks
@@ -410,7 +410,7 @@ def test_minor_ticks(self):
410410

411411
return fig
412412

413-
@pytest.mark.remote_data(source='astropy')
413+
@pytest.mark.remote_data
414414
@pytest.mark.mpl_image_compare(tolerance=0, style={})
415415
def test_ticks_labels(self):
416416
fig = plt.figure(figsize=(6, 6))
@@ -438,7 +438,7 @@ def test_ticks_labels(self):
438438

439439
return fig
440440

441-
@pytest.mark.remote_data(source='astropy')
441+
@pytest.mark.remote_data
442442
@pytest.mark.mpl_image_compare(tolerance=0, style={})
443443
def test_rcparams(self):
444444

@@ -482,7 +482,7 @@ def test_rcparams(self):
482482
ax.coords[1].set_ticklabel(exclude_overlapping=True)
483483
return fig
484484

485-
@pytest.mark.remote_data(source='astropy')
485+
@pytest.mark.remote_data
486486
@pytest.mark.mpl_image_compare(tolerance=0, style={})
487487
def test_tick_angles(self):
488488
# Test that tick marks point in the correct direction, even when the
@@ -508,7 +508,7 @@ def test_tick_angles(self):
508508
ax.coords[0].set_format_unit(u.degree)
509509
return fig
510510

511-
@pytest.mark.remote_data(source='astropy')
511+
@pytest.mark.remote_data
512512
@pytest.mark.mpl_image_compare(tolerance=0, style={})
513513
def test_tick_angles_non_square_axes(self):
514514
# Test that tick marks point in the correct direction, even when the
@@ -535,7 +535,7 @@ def test_tick_angles_non_square_axes(self):
535535
ax.coords[0].set_format_unit(u.degree)
536536
return fig
537537

538-
@pytest.mark.remote_data(source='astropy')
538+
@pytest.mark.remote_data
539539
@pytest.mark.mpl_image_compare(tolerance=0, style={})
540540
def test_set_coord_type(self):
541541
# Test for setting coord_type
@@ -553,7 +553,7 @@ def test_set_coord_type(self):
553553
ax.coords[1].set_ticklabel(exclude_overlapping=True)
554554
return fig
555555

556-
@pytest.mark.remote_data(source='astropy')
556+
@pytest.mark.remote_data
557557
@pytest.mark.mpl_image_compare(tolerance=0, style={})
558558
def test_ticks_regression(self):
559559
# Regression test for a bug that caused ticks aligned exactly with a
@@ -576,7 +576,7 @@ def test_ticks_regression(self):
576576
ax.coords[1].set_ticklabel_position('all')
577577
return fig
578578

579-
@pytest.mark.remote_data(source='astropy')
579+
@pytest.mark.remote_data
580580
@pytest.mark.mpl_image_compare(savefig_kwargs={'bbox_inches': 'tight'},
581581
tolerance=0, style={})
582582
def test_axislabels_regression(self):
@@ -593,7 +593,7 @@ def test_axislabels_regression(self):
593593
ax.coords[1].ticklabels.set_visible(False)
594594
return fig
595595

596-
@pytest.mark.remote_data(source='astropy')
596+
@pytest.mark.remote_data
597597
@pytest.mark.mpl_image_compare(savefig_kwargs={'bbox_inches': 'tight'},
598598
tolerance=0, style={})
599599
def test_noncelestial_angular(self, tmpdir):
@@ -631,7 +631,7 @@ def test_noncelestial_angular(self, tmpdir):
631631

632632
return fig
633633

634-
@pytest.mark.remote_data(source='astropy')
634+
@pytest.mark.remote_data
635635
@pytest.mark.mpl_image_compare(savefig_kwargs={'bbox_inches': 'tight'},
636636
tolerance=0, style={})
637637
def test_patches_distortion(self, tmpdir):
@@ -693,7 +693,7 @@ def test_patches_distortion(self, tmpdir):
693693

694694
return fig
695695

696-
@pytest.mark.remote_data(source='astropy')
696+
@pytest.mark.remote_data
697697
@pytest.mark.mpl_image_compare(tolerance=0, style={})
698698
def test_quadrangle(self, tmpdir):
699699
# Test that Quadrangle can have curved edges while Rectangle does not
@@ -720,7 +720,7 @@ def test_quadrangle(self, tmpdir):
720720

721721
return fig
722722

723-
@pytest.mark.remote_data(source='astropy')
723+
@pytest.mark.remote_data
724724
@pytest.mark.mpl_image_compare(tolerance=0, style={})
725725
def test_elliptical_frame(self):
726726

@@ -732,7 +732,7 @@ def test_elliptical_frame(self):
732732
fig.add_axes([0.2, 0.2, 0.6, 0.6], projection=wcs, frame_class=EllipticalFrame)
733733
return fig
734734

735-
@pytest.mark.remote_data(source='astropy')
735+
@pytest.mark.remote_data
736736
@pytest.mark.mpl_image_compare(tolerance=0, style={})
737737
def test_hms_labels(self):
738738
# This tests the apparance of the hms superscripts in tick labels
@@ -745,7 +745,7 @@ def test_hms_labels(self):
745745
ax.coords[0].set_ticks(spacing=0.2 * 15 * u.arcsec)
746746
return fig
747747

748-
@pytest.mark.remote_data(source='astropy')
748+
@pytest.mark.remote_data
749749
@pytest.mark.mpl_image_compare(tolerance=0, style={'text.usetex': True})
750750
def test_latex_labels(self):
751751
fig = plt.figure(figsize=(3, 3))
@@ -757,7 +757,7 @@ def test_latex_labels(self):
757757
ax.coords[0].set_ticks(spacing=0.2 * 15 * u.arcsec)
758758
return fig
759759

760-
@pytest.mark.remote_data(source='astropy')
760+
@pytest.mark.remote_data
761761
@pytest.mark.mpl_image_compare(tolerance=0, style={})
762762
def test_tick_params(self):
763763

@@ -841,7 +841,7 @@ def wave_wcs_1d():
841841
return wcs
842842

843843

844-
@pytest.mark.remote_data(source='astropy')
844+
@pytest.mark.remote_data
845845
@pytest.mark.mpl_image_compare(tolerance=0, style={})
846846
def test_1d_plot_1d_wcs(wave_wcs_1d):
847847
fig = plt.figure()
@@ -854,7 +854,7 @@ def test_1d_plot_1d_wcs(wave_wcs_1d):
854854
return fig
855855

856856

857-
@pytest.mark.remote_data(source='astropy')
857+
@pytest.mark.remote_data
858858
@pytest.mark.mpl_image_compare(tolerance=0, style={})
859859
def test_1d_plot_1d_wcs_format_unit(wave_wcs_1d):
860860
"""
@@ -881,7 +881,7 @@ def spatial_wcs_2d():
881881
return wcs
882882

883883

884-
@pytest.mark.remote_data(source='astropy')
884+
@pytest.mark.remote_data
885885
@pytest.mark.mpl_image_compare(tolerance=0, style={})
886886
def test_1d_plot_2d_wcs_correlated(spatial_wcs_2d):
887887
fig = plt.figure()
@@ -918,7 +918,7 @@ def spatial_wcs_2d_small_angle():
918918
# Remember SLLWCS takes slices in array order
919919
(np.s_[0, :], 'custom:pos.helioprojective.lon'),
920920
(np.s_[:, 0], 'custom:pos.helioprojective.lat')])
921-
@pytest.mark.remote_data(source='astropy')
921+
@pytest.mark.remote_data
922922
@pytest.mark.mpl_image_compare(tolerance=0, style={})
923923
def test_1d_plot_1d_sliced_low_level_wcs(spatial_wcs_2d_small_angle, slices, bottom_axis):
924924
"""
@@ -939,7 +939,7 @@ def test_1d_plot_1d_sliced_low_level_wcs(spatial_wcs_2d_small_angle, slices, bot
939939
@pytest.mark.parametrize("slices, bottom_axis", [
940940
(('x', 0), 'hpln'),
941941
((0, 'x'), 'hplt')])
942-
@pytest.mark.remote_data(source='astropy')
942+
@pytest.mark.remote_data
943943
@pytest.mark.mpl_image_compare(tolerance=0, style={})
944944
def test_1d_plot_put_varying_axis_on_bottom_lon(spatial_wcs_2d_small_angle, slices, bottom_axis):
945945
"""
@@ -963,7 +963,7 @@ def test_1d_plot_put_varying_axis_on_bottom_lon(spatial_wcs_2d_small_angle, slic
963963
return fig
964964

965965

966-
@pytest.mark.remote_data(source='astropy')
966+
@pytest.mark.remote_data
967967
@pytest.mark.mpl_image_compare(tolerance=0, style={})
968968
def test_allsky_labels_wrap():
969969

‎astropy/visualization/wcsaxes/tests/test_transform_coord_meta.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def inverted(self):
5656

5757
class TestTransformCoordMeta(BaseImageTests):
5858

59-
@pytest.mark.remote_data(source='astropy')
59+
@pytest.mark.remote_data
6060
@pytest.mark.mpl_image_compare(tolerance=0, style={})
6161
def test_coords_overlay(self):
6262

@@ -104,7 +104,7 @@ def test_coords_overlay(self):
104104

105105
return fig
106106

107-
@pytest.mark.remote_data(source='astropy')
107+
@pytest.mark.remote_data
108108
@pytest.mark.mpl_image_compare(tolerance=0, style={})
109109
def test_coords_overlay_auto_coord_meta(self):
110110

@@ -127,7 +127,7 @@ def test_coords_overlay_auto_coord_meta(self):
127127

128128
return fig
129129

130-
@pytest.mark.remote_data(source='astropy')
130+
@pytest.mark.remote_data
131131
@pytest.mark.mpl_image_compare(tolerance=0, style={})
132132
def test_direct_init(self):
133133

0 commit comments

Comments
 (0)