Is there a way to get a contour plot with different sections of a single contour line having different colors, based on some extra information other than X,Y,Z data?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Shini Bhatt
am 7 Mai 2016
Kommentiert: Walter Roberson
am 9 Mai 2016
I have to plot contour lines with X,Y,Z data and another data set W, which will decide what color that particular set of X,Y,Z data point in the contour should have.
Example:
level = [0 0];
contour(X,Y,Z,level)
% Here i don't want an isoline to have the same color all throughout.
I have an extra data set W of the same dimension as X,Y,Z. And depending on the value of W, I want to select a specific color for that particular point X,Y,Z in the contour line. How do I accomplish that?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 8 Mai 2016
Get it to return the contour matrix instead of drawing. The contour matrix is described at http://www.mathworks.com/help/matlab/ref/contour-properties.html#prop_ContourMatrix . Then use that contour matrix and your additional data to draw the lines you want.
You will probably want to use patch() to draw the contour lines, and use edgecolor 'flat' or 'interp', having written color information into CData or FaceVertexCData. Vertices will not necessarily be exactly pixel coordinates so you might want to use interp2 to look up values from your W matrix.
2 Kommentare
Walter Roberson
am 9 Mai 2016
You can use one of
or
http://www.mathworks.com/matlabcentral/fileexchange/38863-extract-contour-data-from-contour-matrix-c
to assist in extracting the data from the contour matrix.
For more about coloring the edges, see
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Contour Plots 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!