surface

Mixing surface and scatterplot in a single 3D plot

倖福魔咒の 提交于 2019-12-03 14:09:12
问题 I am studying the patterns of distribution of whales around specific seabed structures. I am trying to create an interactive 3D plot showing at the same time: bathymetry as a surface ( x = longitude, y = latitude, z = depth), and geographic location of whale groups ( x = longitude, y = latitude, z = fixed depth -30 meters for example). Coordinates are projected in a UTM coordinate system. I usually work with R and the ggplot2 package for producing figures. Here, the plotly package seemed like

Area covered by a point cloud with R

限于喜欢 提交于 2019-12-03 12:28:36
I have a cloud of points scattered in a 2D Euclidean space. I would like to calculate the area inside the polygon linking the most extreme (=peripheral) points of the cloud. In other words, I would like to estimate the area covered by the cloud in this space. Is there a formula in R? Thanks a lot for any response Julien This is called the convex-hull problem; R built-in chull function should do the work. To count area, you may use a formula from here . EDIT: Even better; splancs package has areapl function. So the function solving your problem should look like this: cha<-function(x,y){ chull(x

Surface and 3d contour in matplotlib

只谈情不闲聊 提交于 2019-12-03 07:08:28
I would like to plot a surface with a colormap, wireframe and contours using matplotlib . Something like this: Notice that I am not asking about the contours that lie in the plane parallel to xy but the ones that are 3D and white in the image. If I go the naïve way and plot all these things I cannot see the contours (see code and image below). import numpy as np from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection="3d") X, Y = np.mgrid[-1:1:30j, -1:1:30j] Z = np.sin(np.pi*X)*np.sin(np.pi*Y) ax.plot_surface(X, Y, Z, cmap

Algorithm for simplifying 3d surface?

南楼画角 提交于 2019-12-03 06:08:37
I have a set of 3d points that approximate a surface. Each point, however, are subject to some error. Furthermore, the set of points contain a lot more points than is actually needed to represent the underlying surface. What I am looking for is an algorithm to create a new (much smaller) set of points representing a simplified, smoother version of the surface (pardon for not having a better definition than "simplified, smoother"). The underlying surface is not a mathematical one so I'm not hoping to fit the data set to some mathematical function. Instead of dealing with it as a point cloud, I

How to plot 3D trajectory behind a surface?

狂风中的少年 提交于 2019-12-02 16:42:22
问题 I'm trying to plot the trajectory of a photon orbiting a black hole. I'd like the photon to go behind the black hole and then in front of it (stable circular orbit). However I can't plot that, my photon is either in the foreground or in the background. I've tried using zorder but it didn't work fig = plt.figure() ax = fig.add_subplot(111, projection="3d") ax.set_aspect('equal') # black surface u = np.linspace(0, 2*np.pi, 100) v = np.linspace(0, 2*np.pi, 100) x = rs * np.outer(np.cos(u), np

Fit a cylinder to scattered 3D XYZ point data

你说的曾经没有我的故事 提交于 2019-12-02 12:03:35
问题 As in the title, I want to fit a cylinder to a group of 3D points with Python. This is a nice solution with MATLAB. How can we do it with Python? 回答1: There is paper at David Eberly site "Fitting 3D Data with a Cylinder" that describes math basics and shows pseudocode. You can also refer to C++ code in Geometric Tools Engine at the same site. I think that some auxiliary math functions like matrix inverse etc could be implemented in NymPy. 回答2: Using scipy.optimize.leastsq, we can create an

How to plot 3D trajectory behind a surface?

只谈情不闲聊 提交于 2019-12-02 11:38:33
I'm trying to plot the trajectory of a photon orbiting a black hole. I'd like the photon to go behind the black hole and then in front of it (stable circular orbit). However I can't plot that, my photon is either in the foreground or in the background. I've tried using zorder but it didn't work fig = plt.figure() ax = fig.add_subplot(111, projection="3d") ax.set_aspect('equal') # black surface u = np.linspace(0, 2*np.pi, 100) v = np.linspace(0, 2*np.pi, 100) x = rs * np.outer(np.cos(u), np.sin(v)) y = rs * np.outer(np.sin(u), np.sin(v)) z = rs * np.outer(np.ones(np.size(u)), np.cos(v)) # plot

Creating a Surface of Revolution

◇◆丶佛笑我妖孽 提交于 2019-12-02 09:04:28
问题 I have a 3d plot of a disk, here is the code: ri = 100 ra = 300 h=20 # input xy coordinates xy = np.array([[ri,0],[ra,0],[ra,h],[ri,h],[ri,0]]) # radial component is x values of input r = xy[:,0] # angular component is one revolution of 30 steps phi = np.linspace(0, 2*np.pi, 50) # create grid R,Phi = np.meshgrid(r,phi) # transform to cartesian coordinates X = R*np.cos(Phi) Y = R*np.sin(Phi) # Z values are y values, repeated 30 times Z = np.tile(xy[:,1],len(Y)).reshape(Y.shape) fig = plt

Creating a Surface of Revolution

人走茶凉 提交于 2019-12-02 05:09:43
I have a 3d plot of a disk, here is the code: ri = 100 ra = 300 h=20 # input xy coordinates xy = np.array([[ri,0],[ra,0],[ra,h],[ri,h],[ri,0]]) # radial component is x values of input r = xy[:,0] # angular component is one revolution of 30 steps phi = np.linspace(0, 2*np.pi, 50) # create grid R,Phi = np.meshgrid(r,phi) # transform to cartesian coordinates X = R*np.cos(Phi) Y = R*np.sin(Phi) # Z values are y values, repeated 30 times Z = np.tile(xy[:,1],len(Y)).reshape(Y.shape) fig = plt.figure() ax = fig.add_subplot(1, 1, 1, projection='3d') ax.set_zlim(0,200) ax.plot_surface(X, Y, Z, alpha=0

Matlab - surf and contour3, clipping order?

孤街浪徒 提交于 2019-12-02 04:59:27
问题 I am plotting data as a surface in matlab. I have three data matrices, x,y,z. The values of z may not be outside the range 0~1. I generate plots with the following: surf(x,y,z); [c,h] = contour3(x,y,z,'LevelList',[0 : 0.1 : 1],'Color','k'); clabel(c,h,[0 : 0.1 : 1]); I also do some modifications to the surface, such as setting shading interp . As you can see, the result image clips the contours with the underlying surface. How can I ensure that the contour and labels are plotted above the