How to plot two trimesh plots together with different colour maps?
12 views (last 30 days)
Show older comments
KieranSQ on 17 Jul 2020
Answered: Gouri Chennuru on 20 Jul 2020
I am trying to use trimesh to plot two meshes onto one plot to compare the values, so I can visually see the areas\times where my numerical scheme might break etc. To do this I would find it very useful to change the colour of one of the plots.
Essentially I want to do the following:
T = delaunay(nodes(:,1),nodes(:,2));
nodes = [1:10', 1:10']
%Pressure and exct are column vectors
colormap spring %Changing colour of second plot
but annoyingly the above doesn't work. I can see that I can change the colour of the faces, but this isn't to helpful when I am trying to compare elements.
To help illustrate what I am after I have an example 1D plot and code:
which produces the following.
Any help would be great!
Gouri Chennuru on 20 Jul 2020
Colormap sets the colormap for the current figure to one of the predefined colormaps. If you set the colormap for the figure, then axes and charts in the figure use the same colormap.
A colormap is matrix of values between 0 and 1 that define the colors for graphics objects such as surface, image, and patch objects. Each row in the matrix defines one color using an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0, 1]. A value of 0 indicates no color and a value of 1 indicates full intensity.
As a possible workaround you can try
colormap([1 0 0;0 1 0]); % red and green color
Instead of colormap spring.
If colormap spring is used, colormap got overwritten in the target figure.so, the output isn’t reflecting as expected.
you can also check what is the existing color map by executing the command
cmap = colormap
Hope this Helps !
Find more on Triangulation Representation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!