How to make a 2D pseudocolor (pcolor) plot in triangle shapes instead of a square shape with triangle cordinates data?

9 visualizzazioni (ultimi 30 giorni)
I have the coordinates of 8 closed triangles that intersect at the same points and third data. How to fill these triangles with third data similar to 2D pcolor figure, i.e., with colour bars ?
load('data1.mat')
plot(a1,b1)

Risposta accettata

Voss
Voss il 13 Ott 2022
load('data1.mat')
x = reshape(a1(1:end-1),3,[])
x = 3×8
0.4500 0.4500 0.4500 0.4500 0.4500 0.4500 0.4500 0.4500 0.9101 1.0037 1.1725 1.1731 1.2391 1.2686 1.2719 1.2698 1.0037 1.1725 1.1731 1.2391 1.2686 1.2719 1.2698 0.7696
y = reshape(b1(1:end-1),3,[])
y = 3×8
0.9272 0.9272 0.9272 0.9272 0.9272 0.9272 0.9272 0.9272 1.0886 1.1161 1.1373 1.1364 0.9762 0.8198 0.6920 0.6851 1.1161 1.1373 1.1364 0.9762 0.8198 0.6920 0.6851 0.5299
patch(x,y,c1)
colorbar

Più risposte (1)

Bjorn Gustavsson
Bjorn Gustavsson il 13 Ott 2022
This sounds like a task for trisurf. Check the help and documentation to that function. If you want the pcolor rather than the surf layout, you achieve that by either setting the inputs to the z-coordinates to zero or simply by setting the view from above:
view(0,90)
HTH

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by