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!