Home > Enterprise >  Errorbar formatting in octave
Errorbar formatting in octave

Time:11-25

I was plotting some two dimensional plot in Octave my code is given below

A=dlmread('data.txt');
x=A(:,1);
y=A(:,2);
err=A(:,3);
errorbar(x,y,err,'or','markerfacecolor','r','markersize',5)

and the issue is that the markerfacecolor is not working and markersize is also not working. How could I solve this issue ? The error shown in command window is as follows

error: errorbar: data argument 5 must be numeric
error: called from
__errplot__ at line 44 column 7
errorbar at line 184 column 10
rbar at line 5 column 1

and this code plots fine if I remove markerfacecolor and markersize. I mean it gives an output without markerfacecolor , markersize rather than showing errror in command window. Please help The file data.txt is of this form
1.0 3.1 0.21
2.0 4.1 0.29
3.1 5.2 0.42
4.0 6.1 0.53
4.9 7.7 0.63
6.0 8.0 0.72
6.0 9.0 0.75
7.0 13.1 0.21
8.0 23.1 0.21
9.0 29.3 0.21
10.0 30.1 8.21
11.1 28.7 2.1
12.0 23.1 2.2
13.1 18.1 1.61

CodePudding user response:

You can set markerfacecolor and markersize after drawing your errorbars. i.e.

h = errorbar(x,y,err,'or');
set(h,'markerfacecolor','r','markersize',5);

Result:

  • Related