8000 [Sprint] Added a test for 3d plots in PDF backend by tbekolay · Pull Request #2163 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

[Sprint] Added a test for 3d plots in PDF backend #2163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added a test for 3d plots in PDF backend
- This failed at one point (see issue #1933)
- Seems to work now
  • Loading branch information
tbekolay committed Jun 28, 2013
commit 8c37423a9fe192eb0eb416a221a589bd0d4c8b8c
15 changes: 14 additions & 1 deletion lib/matplotlib/tests/test_backend_pdf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- encoding: utf-8 -*-

from matplotlib import rcParams
import numpy as np

from matplotlib import cm, rcParams
from matplotlib import pyplot as plt
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup

Expand Down Expand Up @@ -34,3 +36,14 @@ def test_type42():
ax = fig.add_subplot(111)
ax.plot([1,2,3])
fig.savefig(io.BytesIO())

def test_3d():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WeatherGod - do we have any other mplot3d tests? If so, are they proper image tests?

import io
from mpl_toolkits.mplot3d import Axes3D
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to import this at the top of the module.

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d')
ax.view_init(elev=None, azim= -15)
X, Y = np.meshgrid(np.arange(3), np.arange(3))
Fs = X * Y
ax.plot_surface(X, Y, Fs, cmap=cm.jet, lw=0, antialiased=False)
plt.savefig(io.BytesIO())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So my preference would be to turn this into a visual test so that we can not only test that this is still working, but that the plot looks as it should. We have a visual test system to simplify this process but I don't believe there are yet any other mplot3d plots being tested. In that case this would be a landmark test so nice work!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, if mplot3d isn't being tested now we should do that! I'll make some tests and move this plot to there. Would test_mplot3d.py make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #2135 which allows for starting to test the toolkits (at least the ones that ship with mpl)

0