How to hold different constellations using scatterhistogram?

4 ビュー (過去 30 日間)
Louis Tomczyk
Louis Tomczyk 2022 年 7 月 29 日
編集済み: Adam Danz 2022 年 8 月 1 日
Dear all,
I hope the title is explicit enough, does anyone have an idea?
Thanks in advance.
Best regards,
louis
Example of code:
% signal vector
X = rand(1,1e3)+1i*rand(1,1e3);
% power in signal
PX= mean(abs(X).^2);
% noise of variance power in signal/10
B = PX/10*(randn(1,1e3)+1i*randn(1,1e3));
% signal + noise
Y = X+B;
% plot
hold all
scatterhistogram(real(X),imag(X))
Error using scatterhistogram
Adding ScatterHistogramChart to axes is not supported. Turn hold off.
scatterhistogram(real(Y),imag(Y))

採用された回答

Adam Danz
Adam Danz 2022 年 7 月 29 日
編集済み: Adam Danz 2022 年 7 月 29 日
scatterhistogram produces a ScatterHistogramChart object within a figure. When you call hold on, an axes is created if it doesn't already exist, and the axes is prepared to accept new objects. scatterhistogram tells you that you cannot assign the ScatterHistogramChart object to the axes.
Remove hold on so scatterhistogram can create the plot in a figure. Scatterhistogram() is not set up to combine two ScatterHistogramChart objects within the same set of axes.
  2 件のコメント
Louis Tomczyk
Louis Tomczyk 2022 年 8 月 1 日
Yes I misplaced the 'hold on' line.
That's really a pity that we cannot combine more scatterhistograms charts.
Best,
louis
Adam Danz
Adam Danz 2022 年 8 月 1 日
編集済み: Adam Danz 2022 年 8 月 1 日
@Louis Tomczyk, you can, however, group your data together in a table and use a grouping variable to plot multiple sets of data into the same scatterhistogram chart. There are some examples in the documentation: scatterhistogram.
load patients
tbl = table(LastName,Diastolic,Systolic,Smoker)
tbl = 100×4 table
LastName Diastolic Systolic Smoker ____________ _________ ________ ______ {'Smith' } 93 124 true {'Johnson' } 77 109 false {'Williams'} 83 125 false {'Jones' } 75 117 false {'Brown' } 80 122 false {'Davis' } 70 121 false {'Miller' } 88 130 true {'Wilson' } 82 115 false {'Moore' } 78 115 false {'Taylor' } 86 118 false {'Anderson'} 77 114 false {'Thomas' } 68 115 false {'Jackson' } 74 127 false {'White' } 95 130 true {'Harris' } 79 114 false {'Martin' } 92 130 true
s = scatterhistogram(tbl,'Diastolic','Systolic','GroupVariable','Smoker');

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by