Skip to content

Commit 8953596

Browse files
author
Yi Wei
committed
FIX: Axis offset mispositioning in plot_surface
1 parent 0b8bd96 commit 8953596

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

lib/mpl_toolkits/mplot3d/axis3d.py

+1
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def draw_pane(self, renderer):
323323
@artist.allow_rasterization
324324
def draw(self, renderer):
325325
self.label._transform = self.axes.transData
326+
self.offsetText._transform = self.axes.transData
326327
renderer.open_group("axis3d", gid=self.get_gid())
327328

328329
ticks = self._update_ticks()

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

+15
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,21 @@ def test_surface3d():
588588
fig.colorbar(surf, shrink=0.5, aspect=5)
589589

590590

591+
@image_comparison(['surface3d_label_offset_tick_position.png'], style='mpl20')
592+
def test_surface3d_label_offset_tick_position():
593+
ax = plt.figure().add_subplot(projection="3d")
594+
595+
x, y = np.mgrid[0:6 * np.pi:0.25, 0:4 * np.pi:0.25]
596+
z = np.sqrt(np.abs(np.cos(x) + np.cos(y)))
597+
598+
ax.plot_surface(x * 1e5, y * 1e6, z * 1e8, cmap='autumn', cstride=2, rstride=2)
599+
ax.set_xlabel("X label")
600+
ax.set_ylabel("Y label")
601+
ax.set_zlabel("Z label")
602+
603+
ax.figure.canvas.draw()
604+
605+
591606
@mpl3d_image_comparison(['surface3d_shaded.png'], style='mpl20')
592607
def test_surface3d_shaded():
593608
fig = plt.figure()

0 commit comments

Comments
 (0)