How to plot two trimesh plots together with different colour maps?
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
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
figure
trimesh(T,nodes(:,1),nodes(:,2), real(pressure))
hold on
colormap spring %Changing colour of second plot
trimesh(T,nodes(:,1),nodes(:,2), exct)
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:
figure
plot(nodes(:,1),nodes(:,1).^3,'r')
hold on
plot(nodes(:,1),nodes(:,1).^3+5, 'b')
which produces the following.
Any help would be great!
0 Kommentare
Antworten (1)
Gouri Chennuru
am 20 Jul. 2020
Hi Kieran,
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 !
0 Kommentare
Siehe auch
Kategorien
Mehr zu Blue finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!