I have a polydata file containing 3D coordinates of the mesh (as vtkPoints) and temperature at each point as an attribute. I want to plot the temperature as a slice plot (at three elevations) over the geometry. I managed to get the data slices at different elevation using vtkClipPolyData function. However, I am unable to find a good example showing how to interpolate the value at each of these points and plot the data. Really appreciate if someone can help me on this.
I tried to render the clipped data directly by increasing the point size from actor property,
actor.GetProperty().SetPointSize(5)
however, this gives a pixelated plot. See plot here
Related
I created a graph in MATLAB (see figure below) such that around every data point there is a data distribution plotted (grey area plots). The way I did it in MATLAB was to create a set of axes for every distribution curve and then plot the curves without showing those axes at every point of the data curve. I also used a command 'linkaxes' to set figure limits for all the curves at once.
I must say that this is far from an elegant solution and I had many troubles with saving this figure in the correct aspect ratio settings. All in all I couldn't find any other useful option in MATLAB.
Is there a more elegant solution for such types of graphs in Python? I am not that much interested in how to do the areas highlighted, but how to place a set of curves(distributions) exactly at the positions of the main data curve points.
Thank you!
I have an input data with each row having (x,y,z,data), i.e., each coordinate (x,y,z) has a value "data". I would like to make a slicing volumetric graph like below in python. I am new to python, any tips would be much appreciated. see here for the example graph
If you have your data organized as a 2D array (n-points x 4) [x,y,z,data] (this can also be refered to as a point-cloud representations) and you want to display it as a volume rendering. You have to first resample it as a 3D array (interpolate 3D volume with numpy and or scipy) and then create an isosurface using marching cubes (How to display a 3D plot of a 3D array isosurface in matplotlib mplot3D or similar?)
You can also plot the values using a 3D scatter plot which is much easier, but won't get you the kind of plot you asked for (https://matplotlib.org/examples/mplot3d/scatter3d_demo.html)
With the supporting of matplotlib basemap, I can draw my netCDF files in different kind of projection type.
We always see the figure is in rectangular showing like this:
But I also see some figures showing like:
For now, I have some weather simulation data and I want to represent it on the map with Lambert projection.
The temperature of on time slice shows like:
So, here is my question:
How to generate the figure which the borders of the canvas fit the lcc projection like the previous one using Basemap?
I am trying to use the coastline data provided by Natural Earth (in the form of shape files) within basemap. I am getting weird horizontal lines as shown in the figures below. When the plot is centered on 180 degree longitude, the number of such lines increases.
Looking at the location of these lines (which is where continents wrap around), I reckon the source of the problem must be related to how the polygons are defined in the shape file and the wrapping of the polygon around a longitude, but I don't see how I can go about fixing it. I would expect a mapping library like basemap to be able to handle this transparently. Any solution would very be helpful.
I am using the "ne_110m_coastline" data from Natural Earth and I have not modified it in any way. Here's a sample code that replicates the problem:
Map = Basemap(projection='eck4',lon_0=0, resolution='c')
a = Map.readshapefile("ne_110m_coastline", "coast")
I am attempting to do something similar to this:
sample ozone profile
Not necessarily over an orthographic projection - a cube over a map would suffice.
I'm able to plot the PolyCollection object produced by matplotlib.pyplot.pcolor, but cannot figure out if there's an accepted way of plotting the profile over an arbitrary lat/lon path.
The only thing I can think of right now is continuing to use pcolor() to get the face colors, then just modifying the vertices for each Poly object.
If you want to create a 3D projection, then you may use the plot_surface. It essentially draws a 2D array where the 3D coordinates of each vertex is given.
You might get some ideas by looking at this: Creating intersecting images in matplotlib with imshow or other function
The matplotlib solution there is essentially the same as using pcolor, but the 3D arithmetics is carried out by matplotlib. The suggestion to use mayavi is also something worth conisdering, as matplotlib is not at its strongest with 3D projected raster data.