Is it possible to make surface plot with two grouping variables?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi!:)
I want to use surf function with two grouping variables meaning in addition to the z value I want to add another value, is it posssible with surf function?
( I cant use gscatter as I dont have the add on tool box)
댓글 수: 0
답변 (1개)
Narvik
2024년 9월 5일
Hi Muazma Ali,
As per my understanding, you want to visualize additional information (like a grouping variable) on a surface plot.
To visualize an additional grouping variable on a surface plot using "surf" function, map the grouping variable to color.
Refer to the following documentation link for more information on "surf" function:
Refer to the following sample code to visualize additional grouping variable on surface plot:
% sample data
[x, y] = meshgrid(-5:0.5:5, -5:0.5:5);
z = sin(sqrt(x.^2 + y.^2));
g = x + y; % grouping variable
% create surface plot
figure;
surf(x, y, z, g, 'EdgeColor', 'none'); % using g for color data
colormap(jet);
colorbar;
% labels
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
title('Surface Plot with Grouping Variable');
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!