How to change scatter plot shapes for multiple y variables to help differentiate them?
3 次查看(过去 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)')
0 个评论
采纳的回答
Mario Malic
2023-10-12
编辑:Mario Malic
2023-10-12
You can specify the marker type https://uk.mathworks.com/help/matlab/ref/scatter.html#btrli6p-1_1
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 Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!