Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa2a0d6

Browse files
authored
Merge pull request #10728 from jinshifen33/bugfix-for-issue-5742
Set data limits for Axes3DSubplot.plot when zdir=y or zdir=x #5742
2 parents c85b029 + d37407c commit fa2a0d6

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,7 @@ def plot(self, xs, ys, *args, **kwargs):
15681568
for line in lines:
15691569
art3d.line_2d_to_3d(line, zs=zs, zdir=zdir)
15701570

1571+
xs, ys, zs = art3d.juggle_axes(xs, ys, zs, zdir)
15711572
self.auto_scale_xyz(xs, ys, zs, had_data)
15721573
return lines
15731574

55.3 KB
Loading

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,17 @@ def test_scatter3d_color():
175175
color='b', marker='s')
176176

177177

178+
@image_comparison(baseline_images=['plot_3d_from_2d'], remove_text=True,
179+
extensions=['png'])
180+
def test_plot_3d_from_2d():
181+
fig = plt.figure()
182+
ax = fig.add_subplot(111, projection='3d')
183+
xs = np.arange(0, 5)
184+
ys = np.arange(5, 10)
185+
ax.plot(xs, ys, zs=0, zdir='x')
186+
ax.plot(xs, ys, zs=0, zdir='y')
187+
188+
178189
@image_comparison(baseline_images=['surface3d'], remove_text=True)
179190
def test_surface3d():
180191
fig = plt.figure()

0 commit comments

Comments
 (0)