Dafsa
Dafsa

Reputation: 1

Matlab different linewith of marker and errorbar

I would like to set different linewidth for marker and for error bar. Is there a set call for that or maybe a custom functon? The documentation only says that markersize affects the error bar width as weel.

here's a fraction of my code:

s = subplot(1,5,r);
if any(imDATA(r,1,1))
errorbar(imDATA(r,19:26,1), imDATA(r,3:10,1), imDATA(r,27:34,1),'-'k','MarkerSize',e,'LineWidth',w)
hold on;

Thanks!

Upvotes: 0

Views: 763

Answers (1)

Gunther Struyf
Gunther Struyf

Reputation: 11168

errorbar returns a handle to the created objects, you can change those if you want later on. The handle is a group containing both the errorbars as the plot of the data (eg connecting line).

Inspect this handle with get and you'll see that you can change them individually:

x = 0:pi/3:pi;
y = sin(x);
h=errorbar(x,y,e,'rx:')
hchildren = get(h,'children');
set(hchildren(1), 'LineWidth', 1, 'Color', 'b')
set(hchildren(2), 'LineWidth', 3, 'Color', 'g');

enter image description here

Upvotes: 1

Related Questions