How to fill colors in contour circles in paraview? - triangulation

I have a triangulation surface, and there is a point data named rhoA on it. I plot rhoA in paraview and plot the contour with just one contour value. So you can see many circles on the surface.
But what I need is to fill red colors in the circles and don't show other parts. So how to do it in paraview?

Use the Clip filter and set the Clip Type to Scalar. Set the Scalars property to rhoA and set Value to your threshold value. This filter will cut cells, giving you a more precise surface than the Threshold filter will.
Here is an example of the results you can expect doing this:

You can either :
Use the banded countour filter from VTK, that you will need to expose with a XML only plugin first (hard but precise and efficient)
Use treshold filter (the cut will not be on the contour, whole cells will be extracted)

Related

ParaView: How to decide which contour filter is on top?

I load two data files into paraview and use on both one contour filter. The resulting contour lines overlap. What I want and tried is the following:
load data file 1 into paraview, apply contour filter 1 on it.
load data file 2 into paraview and apply contour filter 2 on it.
Now I would expect that the contour filter 2 is on top of the first one at the overlapping area. But this is not the case.
Contour filter 2 contains only the black line. The first contour filter contains all the others. In the image the green-yellow-ish contour line is on top of the black one from filter 2.
Hopefully someone can help me.
Thank you!
ParaView mostly relies on distance from the camera to determine what objects are rendered "on top". Probably the best way to make sure that the lines of one of the objects are rendered over the other is to displace one or both in the z direction. You can do that by modifying the Translation under the Transforming parameters of the display properties. I see in your screenshot that you have a 2D projection, so shifting the data in the Z direction should have no visible effect other than the distance to the camera.
You can achieve the same effect using the Transform filter.

MATLAB - Filling a map with a gradient of two colors based on city colors

I have a map where each city is classified somewhere between r=0 and r=1, which I have plotted in the following image using the color [r 0 1-r], which gives me a color between red and blue for each city. In this case, the circles are just for testing, and should not be visible in the final image. Currently the circle radius represents the amount of data available for each city. The country outline uses the borders data. Here's the result so far:
My goal is to fill the map with a non-linear gradient of red/blue, taking into account this data and extrapolating it.
(In this example the border seems pretty linear, but that's not always the case, hence the need for a non-linear gradient)
Can anyone point me in the right direction? Thank you!
What you're probably looking for is griddata, which lets you interpolate (unevenly) scattered data points using various interpolation methods. So you could evaluate the interpolation on a grid (which can be created using meshgrid or ndgrid) and then e.g. use surf to plot the interpolated function.

Contour Plot of own coordinates with attached scalar

I have the following coordinate system of (x,y) and attached z value to each coordinate. I need to keep the coordinates the same without using some linear fit function to change it into a grid system of some sort. Is there a way i can create a contour of that data using that data only and not using griddata or something.
x=[0.2,0.2,0.05,1.1,0.8,0.9,1.8,1.9,2.05];
y=[0,1.1,2.1,0.1,1.1,2.2,0.15,1.1,2.05];
z=[0,1,0,0,2,1,0,1,0;];
plot(x,y, 'bo')
The reason is i have another model with 540 thousand coordinate points that is a weird shape and if i start using the other functions it loses its shape and goes rectangular.
One option you have is to use fitto create a fit surface of your data, and then directly plot it. This also has the advantage to give you extra parameters to control the interpolation between your points.
f=fit([x',y'],z','linearinterp')
plot(f,'Style','Contour')
Will create something like:
And
f=fit([x',y'],z','cubicinterp')
plot(f,'Style','Contour')
Will smooth the interpolation into:
Please look here for more information on fit and fit plotting options
https://www.mathworks.com/help/curvefit/fit.html#inputarg_fitType
https://www.mathworks.com/help/curvefit/plot.html

MATLAB: Digitizing a plot with multiple variables and implementing the data

I have 8 plots which I want to implement in my Matlab code. These plots originate from several research papers, hence, I need to digitize them first in order to be able to use them.
An example of a plot is shown below:
This is basically a surface plot with three different variables. I know how to digitize a regular plot with just X and Y coordinates. However, how would one digitize a graph like this? I am quite unsure, hence, the question.
Also, If I would be able to obtain the data from this plot. How would you be able to utilize it in your code? Maybe with some interpolation and extrapolation between the given data points?
Any tips regarding this topic are welcome.
Thanks in advance
Here is what I would suggest:
Read the image in Matlab using imread.
Manually find the pixel position of the left bottom corner and the upper right corner
Using these pixels values and the real numerical value, it is simple to determine the x and y value of every pixel. I suggest you use meshgrid.
Knowing that the curves are in black, then remove every non-black pixel from the image, which leaves you only with the curves and the numbers.
Then use the function bwareaopen to remove the small objects (the numbers). Don't forget to invert the image to remove the black instead of the white.
Finally, by using point #3 and the result of point #6, you can manually extract the data of the graph. It won't be easy, but it will be feasible.
You will need the data for the three variables in order to create a plot in Matlab, which you can get either from the previous research or by estimating and interpolating values from the plot. Once you get the data though, there are two functions that you can use to make surface plots, surface and surf, surf is pretty much the same as surface but includes shading.
For interpolation and extrapolation it sounds like you might want to check out 2D interpolation, interp2. The interp2 function can also do extrapolation as well.
You should read the documentation for these functions and then post back with specific problems if you have any.

Drawing black areas in matlab contourf plot

I am generating a series of plots using matlab contourf. I need to do the following with the resulting figure. From this state:
Make this:
Important note: I know the coordinates of pixels which should be blackened.
The easiest way is possible to use ind2rgb, do the "blackening" manually, then use imagesc and deal with the axes propeerties. But using this I will lose the contourf graphics (e.g. the contour lines).
Any better ideas?
You can manipulate the figure colormap by adding black color to the one you use.
M=colormap;
M=[0,0,0 ; M];
colormap(M)
Now assign to the "should be black" pixels a value smaller than the minimum. This will map this value to the minimum color which is now black.
To assign the value efficiently use subs2ind