How to change scatter plot shapes for multiple y variables to help differentiate them?

10 次查看(过去 30 天)
Hello,
I am new to coding and managed to get this far. I am trying to clean up this plot a little and help differentiate the y axis variables(Gain,PAE,PLRF_dBm). I can not seem to figure out how to change the shapes of the y variables. Any help would be greatly appeciated. I have read everything I could find but nothing works if I have more than one variable. Thanks!
Pswpdata = readtable('csv_file.csv');
scatter(Pswpdata,'Frequency',{'Gain','PAE','PLRF_dBm'},'filled')
legend
title('GT,PAE & Pout (dB)')

采纳的回答

Mario Malic
Mario Malic 2023-10-12
编辑:Mario Malic 2023-10-12
You can check outboxchart too, It might be a little confusing at first, but this makes a clearer comparison. You'll need a newer version of MATLAB, I don't know when GroupByColor is introduced.
I think this bar example could be a better approach but I think you would have to restructure your data a bit https://uk.mathworks.com/help/matlab/ref/bar.html#bug9u7m-1
Pswpdata = readtable('csv_file.csv');
numVars = 3;
numElements = numel(Pswpdata.Gain);
varNames = ["Gain", "PAE", "PLRF_dBm"];
varNames = repmat(varNames, [numElements, 1]);
varNames = reshape(varNames, [], 1);
cats = categorical(Pswpdata.Frequency);
cats = repmat(cats, [1, numVars]);
cats = reshape(cats, [], 1);
data = reshape([Pswpdata.Gain, Pswpdata.PAE, Pswpdata.PLRF_dBm], [], 1);
boxchart(cats, data, "GroupByColor", varNames)
grid on
legend
title('GT,PAE & Pout (dB)')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by