Filter löschen
Filter löschen

Plot symbols the size of error

3 Ansichten (letzte 30 Tage)
Lucas Warwaruk
Lucas Warwaruk am 1 Okt. 2019
Kommentiert: Star Strider am 1 Okt. 2019
Hi folks,
I'm wondering if there's a way to plot a distribution with markers that are sized to correlate with your datas absolute uncertainty.
Say for example you have the following script:
x = rand(1,5)*10
err_x = rand(1,5)
y = rand(1,5)*10
err_y = rand(1,5)
figure()
errorbar(x, y, err_x, err_x, err_y, err_y)
I'm looking to replace the errorbar function with plot and a marker size that correlates to the size of the uncertainty.
I'd prefer not to plot the errorbars first and manually adjust the marker size. This method also requires a constant uncertainty across all values in a data set.
I'd greatly appreciate the insight.

Akzeptierte Antwort

Star Strider
Star Strider am 1 Okt. 2019
I am not certain what you want as a result.
The scatter function is an option:
figure
scatter(x, y, err_x*100)
grid
If you want to plot the errors as ellipses:
a = linspace(0, 2*pi, 10);
elps = [cos(a); sin(a)];
for k = 1:numel(x)
mrkrs(:,:,k) = [err_x(k).*elps(1,:)+x(k); err_y(k).*elps(2,:)+y(k)];
end
figure
scatter(x, y, '+')
hold all
for k = 1:size(mrkrs,3)
plot(mrkrs(1,:,k), mrkrs(2,:,k))
end
hold off
grid
axis equal
Experiment to get the result you want.
  2 Kommentare
Lucas Warwaruk
Lucas Warwaruk am 1 Okt. 2019
This is pretty intriguing. I think the scatter function will suffice. The ellipses are perfect for showing the unique errors between x and y dimensions.
Ultimately, I was hoping for a way to use the default markers in matlab and somehow size them to match the quantitative errors in different dimensions.
Star Strider
Star Strider am 1 Okt. 2019
Thank you!
I am not aware that it is possible to alter the shapes of the built-in markers, only their sizes.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by