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

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 件のコメント

Onkar Khadke
Onkar Khadke 2021 年 8 月 26 日
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

サインインしてコメントする。

回答 (2 件)

KSSV
KSSV 2020 年 10 月 20 日

0 投票

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 件のコメント

Farshad Daraei Ghadikolaei
Farshad Daraei Ghadikolaei 2020 年 10 月 20 日
Thanks KSSV for your answer. I ran your code and got this following erroe and run stoped at this stage:
Error using meshgrid (line 59)
Subscripting into a table using one subscript (as in t(i)) or three or more subscripts (as in t(i,j,k)) is not supported. Always
specify a row subscript and a variable subscript, as in t(rows,vars).
KSSV
KSSV 2020 年 10 月 20 日
It is a mistake with class of variables. Attach your data here. You should read the data into matrix. I think you are reading it as a table.
Farshad Daraei Ghadikolaei
Farshad Daraei Ghadikolaei 2020 年 10 月 20 日
Please see attach my data.
KSSV
KSSV 2020 年 10 月 20 日
You read the data like below:
A = xlsread("4b2_Combine.csv") ;
% remove outliers
x(x>100) = [] ;
y(y>100) = [] ;
z(z>100) = [];
% USe griddata
m = 1000 ; n = 1000 ;
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
Farshad Daraei Ghadikolaei
Farshad Daraei Ghadikolaei 2020 年 10 月 20 日
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 2020 年 10 月 20 日
If you know the triangular dimension.......make the vertices....use inpolygon and pick only the points inside this triangle and plot.

サインインしてコメントする。

Farshad Daraei Ghadikolaei
Farshad Daraei Ghadikolaei 2020 年 10 月 20 日

0 投票

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 件のコメント

KSSV
KSSV 2020 年 10 月 20 日
No that will not help....do you have triangle coordinates?
Farshad Daraei Ghadikolaei
Farshad Daraei Ghadikolaei 2020 年 10 月 20 日
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.

サインインしてコメントする。

カテゴリ

製品

リリース

R2019b

質問済み:

2020 年 10 月 20 日

コメント済み:

2021 年 8 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by