8/15/2023 0 Comments Contour plot grapher![]() This is what motivated my answer, I wanted to address (2). But matplotlib cannot easily build a mesh from this method, so we cannot directly get a surface from it, instead we get plane curves in all directions. This post does not answer: (1) How to plot any implicit function F(x,y,z)=0? But does answer: (2) How to plot parametric surfaces (not all implicit functions, but some of them) using mesh with method has the advantage to be non parametric, therefore we can plot almost anything we want using contour method on each axe, it fully addresses (1). So I am sharing this another perspective. Late answer, I just needed to do the same and I found another way to do it at some extent. I left this one for whom is interested in plotting parametric 3D surfaces. Update: I finally have found an easy way to render 3D implicit surface with matplotlib and scikit-image, see my other answer. Return intersect(fn1, lambda *args:-fn2(*args)) Plot_implicit(hyp_part1, bbox=(-100.,100.))īonus: You can use python to functionally combine these implicit functions: def sphere(x,y,z): Here's how the OP's plot looks: def hyp_part1(x,y,z): You can make it easier to visualize by adding depth cues with creative colormapping: Here's the plot of the Goursat Tangle: def goursat_tangle(x,y,z): # to encompass all values in the contour. Otherwise matplotlib extends the plot limits # must set plot limits because the contour will likely extend # defines the only level to plot for this contour for this value of zįor y in B: # plot contours in the XZ planeĬset = ax.contour(X, Y+y, Z,, zdir='y')įor x in B: # plot contours in the YZ planeĬset = ax.contour(X+x, Y, Z,, zdir='x') Xmin, xmax, ymin, ymax, zmin, zmax = bbox*3Īx = fig.add_subplot(111, projection='3d')Ī = np.linspace(xmin, xmax, 100) # resolution of the contourī = np.linspace(xmin, xmax, 15) # number of slicesĪ1,A2 = np.meshgrid(A,A) # grid on which the contour is plottedįor z in B: # plot contours in the XY planeĬset = ax.contour(X, Y, Z+z,, zdir='z') the x,y,and z limits of plotted interval''' ''' create a plot of an implicit functionįn. You can repeat the process along the y and z axes as well for a more solid-looking shape. Just make a one-level contour plot of the equation for each z value within the desired limits. You can trick matplotlib into plotting implicit equations in 3D. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |