@@ -22,10 +22,21 @@ keys(m::LazyPyModule) = keys(PyObject(m))
22
22
const axes3D = LazyPyModule (" mpl_toolkits.mplot3d.axes3d" )
23
23
const art3D = LazyPyModule (" mpl_toolkits.mplot3d.art3d" )
24
24
25
+ """
26
+ using3D()
27
+
28
+ This function ensures that the `mplot3d` module is loaded for 3d
29
+ plotting. This occurs automatically if you call any of the
30
+ 3d plotting functions like `plot3D` or `surf`, but it may be
31
+ necessary to call this function manually if you are passing
32
+ `projection="3d"` explicitly to axes or subplot objects.
33
+ """
34
+ using3D () = (PyObject (axes3D); nothing )
35
+
25
36
# ##########################################################################
26
37
# 3d plotting functions from mplot3d
27
38
28
- export art3D, Axes3D, surf, mesh, bar3D, contour3D, contourf3D, plot3D, plot_surface, plot_trisurf, plot_wireframe, scatter3D, text2D, text3D, zlabel, zlim, zscale, zticks
39
+ export art3D, Axes3D, using3D, surf, mesh, bar3D, contour3D, contourf3D, plot3D, plot_surface, plot_trisurf, plot_wireframe, scatter3D, text2D, text3D, zlabel, zlim, zscale, zticks
29
40
30
41
const mplot3d_funcs = (:bar3d , :contour3D , :contourf3D , :plot3D , :plot_surface ,
31
42
:plot_trisurf , :plot_wireframe , :scatter3D ,
@@ -34,7 +45,7 @@ const mplot3d_funcs = (:bar3d, :contour3D, :contourf3D, :plot3D, :plot_surface,
34
45
for f in mplot3d_funcs
35
46
fs = string (f)
36
47
@eval @doc LazyHelp (axes3D," Axes3D" , $ fs) function $f (args... ; kws... )
37
- PyObject (axes3D ) # make sure mplot3d is loaded
48
+ using3D ( ) # make sure mplot3d is loaded
38
49
ax = gca (projection= " 3d" )
39
50
pycall (ax[$ fs], PyAny, args... ; kws... )
40
51
end
@@ -50,7 +61,7 @@ const zlabel_funcs = (:zlabel, :zlim, :zscale, :zticks)
50
61
for f in zlabel_funcs
51
62
fs = string (" set_" , f)
52
63
@eval @doc LazyHelp (axes3D," Axes3D" , $ fs) function $f (args... ; kws... )
53
- PyObject (axes3D ) # make sure mplot3d is loaded
64
+ using3D ( ) # make sure mplot3d is loaded
54
65
ax = gca (projection= " 3d" )
55
66
pycall (ax[$ fs], PyAny, args... ; kws... )
56
67
end
0 commit comments