Triangular plot, Plotting, MATLAB, Ternary plot, color plot, Contour map

40 views (last 30 days)
Still no one could help me with this question. I have a .csv file with 3 columns of different range of data. Each column contains 500,000 rows including some duplicate numbers. I am trying to plot a color plot like the one I attached here. A triangular color plot, like conotur map.
  1 Comment
Onkar Khadke
Onkar Khadke on 26 Aug 2021
Hello Farshad,
I am too looking for getting a triangular plot. Did you made any more progress on that, if so then kindly share the script for my reference. Your help is appreciated Thank you

Sign in to comment.

Answers (2)

KSSV
KSSV on 20 Oct 2020
Let A be your m*3 column array. Try this:
x = A(:,1) ; y = A(:,2) ; z = A(:,3) ;
%%structured
xi = unique(x) ; yi = unique(y) ;
[X,Y] = meshgrid(xi,yi) ;
Z = reshape(z,size(X)) ;
figure
surf(X,Y,Z)
%%unstructured
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
figure
trisurf(tri,x,y,z)
%% USe Interpoaltion
m = 100 ; n = 100 ;
xi = linspace(min(x),max(x),m) ;
yi = linspace(min(y),max(y),n) ;
[X,Y] = meshgrid(xi,yi) ;
Z = griddata(x,y,z,X,Y) ;
pcolor(X,Y,Z)
shading interp
colorbar
  6 Comments
Farshad Daraei Ghadikolaei
Thank you KSS for your time. Your code gave me the attached graph (The one with colorbar). But it is not something that I am trying to have. I also attached the plot that I wish to have. Is it possible to have this type of graph based on my dada?
KSSV
KSSV on 20 Oct 2020
If you know the triangular dimension.......make the vertices....use inpolygon and pick only the points inside this triangle and plot.

Sign in to comment.


Farshad Daraei Ghadikolaei
How about make the data normalize? Then each triangle's sides will be betwee 0 to 1. But I am not sure how to code this.
  2 Comments
Farshad Daraei Ghadikolaei
What do you mean by triangle coordinates? I need to plot those 3 columns together as a colorplot, then the graph will be in triangle shape, same as attached plot.

Sign in to comment.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!