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
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
2020년 10월 20일
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
2020년 10월 20일
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
2020년 10월 20일
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
2020년 10월 20일
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
2020년 10월 20일
0 개 추천
댓글 수: 2
KSSV
2020년 10월 20일
No that will not help....do you have triangle coordinates?
Farshad Daraei Ghadikolaei
2020년 10월 20일
카테고리
도움말 센터 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!