Multiple trisurf plots with different colours
11 views (last 30 days)
Show older comments
Good day,
I have made two plots using Matlab's trisurf command:
trisurf(tri1,X1,Y1,Z1);
hold on
trisurf(tri2,X2,Y2,Z2);
hold off
The second plot is located much lower on the grid compared to the first plot.
When I only plot the X1,Y1,Z1 data, the graph looks fine. However, when the second plot is added, the colours of the first plot change. Now I like to add the second plot (X2,Y2,Z2) without influencing the colours of the first plot (X1,Y1,Z1).
So summarised, I want to use the trisurf plot twice on the same screen but I do not want one plot to influence the other (that is the colours).
Thank you in advance!
0 Comments
Answers (1)
Thomas
on 17 Apr 2013
You can set your color range to manual to prevent auto-scaling:
caxis manual
after the first before the second surf. However if Z2 is completely out of range of Z1 colors may not fit.
2 Comments
Thomas
on 17 Apr 2013
I am unsure what you want to achieve. Normally, there is one color scale that maps a range of values to colors. The 4th parameter in trisurf, C, tells matlab how to find the colors for your surface(points). In your case C is Z1 for the first and Z2 for the second surface plot. So, the smaller a value in Z1 (or Z2) is, the more bluish it gets and the larger it is the more reddish(for the default jet colormap).
You have complete freedom in passing other values as C to adjust your colors. For example, if the values in Z1 range from 0 to 100 and the ones in Z2 range from 0 to 10 you could do a
trisurf(tri1,X1,Y1,Z1);
hold on
trisurf(tri2,X2,Y2,*10*Z2*);
hold off
to put the color values for the second plot in the same range as the first ones (0...100).
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!