Which graph is recommended?

조회 수: 2 (최근 30일)
Cside
Cside 2020년 4월 16일
답변: Star Strider 2020년 4월 16일
Hi, I have a matrix (attached) and each row constitutes a 2 unique numbers that I would like to plot (coloumn order matters). For example, if the row is [1 4], I would like to plot for all the [1 4] together. At first, I thought of using a scatterplot but it would not be able to show me how many [1 4] there are when i plot column 1 as x axis, and column 2 as y axis as the points stack onto each other. The goal is to create a visual representation of how many rows fit the criteria when column 1 is plotted as x axis, and column 2 is plotted as y axis, sort of like a heat map, without the timestamps. For example, if there are 4 rows that have [1 4], the graph should depict that there are 4 of them. Are there any specific graphs that i can consider to achieve this? Histogram2 works but I would prefer a 2D graph.
Many thanks!

답변 (1개)

Star Strider
Star Strider 2020년 4월 16일
I would do something like this for the plot:
D = load('localcombi.mat');
localcombi = D.localcombi;
[Ur,~,ix] = unique(localcombi, 'rows'); % Unique Rows
k = accumarray(ix,1); % Counts
Counts = table(Ur,k,'VariableNames',{'Unique_Rows','Count'}); % Results Table
figure
stem3(Ur(:,1), Ur(:,2), k) % Results Using ‘stem3’
grid on
xlabel('Column 1')
ylabel('Column 2')
zlabel('Count')
I am not certain what you want for the plot. This is the only way I can think of (other than scatter3) to present the column coordinates and the numbers of each unique pair.
.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by