Which graph is recommended?

2 次查看(过去 30 天)
Cside
Cside 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