contour

3D Contour plot from data using Mayavi / Python

十年热恋 提交于 2019-12-02 17:48:06
I would like to do a 3D contour plot using Mayavi in exactly the same way as the third figure on this page (a hydrogen electron cloud model) : http://www.sethanil.com/python-for-reseach/5 I have a set of data points which I created using my own model which I would like to use. The data points are stored in a multi-dimensional numpy array like so: XYZV = [[1, 2, 3, 4], [6, 7, 8, 9], ... [4, 5, 6, 7]] The data points are not uniformly spread in XYZ space and not stored in any particular order. I think the example uses a meshgrid to generate the data points - I have looked this up but totally don

Create contour map

百般思念 提交于 2019-12-02 16:51:14
Given a set of (x, y, z) coordinates, how would I go about creating a contour map? Would be nice to know how to implement in d3 but wouldn't mind trying to implement it myself if I had some direction. For d3 users, can I create a contour map using d3.geom.contour() and jasondavies' conrec.js: https://github.com/jasondavies/conrec.js Essentially, I'd like to replicate this contour map using d3.js: http://beaugunderson.com/routes/ It looks like this would be very easy with conrec.js . If you pass the data in the form that you have it, you can get a list of paths by calling .contourList() on the

Plot 3D Contour from an Image using extent with Matplotlib

冷暖自知 提交于 2019-12-02 11:29:18
As I present here (in 2D), I'm wondering if how I could "scale" an image input to be plotted to a range in the plot. To be more clear, this is what I need: I have a 400 * 400 image that is generated based on a function which interval is -1..1. So, I do a translate to save this data, like this: x = Utils.translate(pos_x, 0, self.width, -1, 1) y = Utils.translate(pos_y, 0, self.height, -1, 1) data = Utils.map_position_to_function(x, y) I.e, first I map its position to my range and then I calculate de f(x, y) based on this "new position" and save the data. Also, as I save this image, I do a

Pyplot contour is flipped along xy

允我心安 提交于 2019-12-02 11:18:53
I have a lot of data on a scatter graph- the end result will have several million points. This is too many to make sense of on a scatter graph- I want to turn it into a 2D histogram, and plot a contour plot, as described here https://micropore.wordpress.com/2011/10/01/2d-density-plot-or-2d-histogram/ This is similar to the code I'm using, and has the same problem import numpy import matplotlib.pyplot as pyplot def convert_edges_to_centres(edges): centres = numpy.empty(len(edges)-1) for i in range(len(centres)): centres[i] = (edges[i+1] - edges[i])/2 + edges[i] return centres x = numpy.random

How to do a contour plot from x,y,z coordinates in matplotlib? (plt.contourf or plt.contour)

无人久伴 提交于 2019-12-02 11:04:21
问题 These meshgrid is a little confusing to use for me. I'm trying to do a scatter plot with the x and y coordinates with a contour plot overlaid on the scatter with a continuous spread for the z coordinates. Similar to an elevation map. If I use meshgrid with the x,y, and z coordinates then I get 3D array for each which is still the incorrect input. df_xyz = pd.read_table("https://pastebin.com/raw/f87krHFK", sep="\t", index_col=0) x = df_xyz.iloc[:,0].values y = df_xyz.iloc[:,1].values z = df

contour is not equal to contour[i]?

不想你离开。 提交于 2019-12-02 09:59:31
This is based from this question , which is focusing more on OpenCV C++ so I decided to make this question. This is one part of my program: vector<vector<Point> > contours; vector<vector<Point> > largest_contours; double largest_area = 0; for(int i= 0; i < contours.size(); i++){ double area = contourArea(contours[i]); if(area >= largest_area){ largest_area = area; largest_contours = contours[i]; <---THIS is the problem } } Basically the program will do: Scans every contours detected in the image sequences/video Labels the contours as contours[i] Calculates the area of every contours Compares

Shift the z -value of contour plot in Matlab 2014b

跟風遠走 提交于 2019-12-02 08:22:21
问题 I'm trying to make a figure of a surface plot, and beneath the surface I wish to show the contour lines, but I want the contour to be at z = -1 instead of at the default value 0 . I found a previous post about this problem here, but when I try the solution the contour is still at z = 0 . Maybe it has something to do with the version of MATLAB I'm using, which is 2014b? Any ideas on how to make it work? The code I tried: %# plot surface and contour Z = peaks; surf(Z), hold on [~,h] = contourf

How to plot 4D contour lines (XYZ-V) in MATLAB?

只愿长相守 提交于 2019-12-02 06:18:56
问题 I have dataset of XYZ as the coordinates and V as the value at each point (100x4 matrix). I plot the 3D surface using patch. (by faces & vertices) How can I plot the contour lines of V (NOT Z) over the 3D surface !? ( The Contour3 function plots 3D contour lines of Z ; But I need contour lines of V. ) Actually I want something like this or this. Thanks a billion for your help. Well actually I found out that the isosurface command is exactly what I want. However, this command requires the V

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

OpenCV how to smooth contour, reducing noise

不羁岁月 提交于 2019-12-02 04:00:35
问题 I extracted the contours of an image, that you can see here: However, it has some noise. How can I smooth the noise? I did a close up to make clearer what I want to meant Original image that I've used: Code: rMaskgray = cv2.imread('redmask.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE) (thresh, binRed) = cv2.threshold(rMaskgray, 50, 255, cv2.THRESH_BINARY) Rcontours, hier_r = cv2.findContours(binRed,cv2.RETR_CCOMP,cv2.CHAIN_APPROX_SIMPLE) r_areas = [cv2.contourArea(c) for c in Rcontours] max_rarea = np