Hi folks!
I had a look for reports about the function "errorbar". There seems to be quite a great need for a more advanced version of it, e.g. change in linestyle (currently there is none linestyle at all, right?), color (which seems to be altered by the system for each plot), etc
In my version 3.0.0 just the following yields any output at all:
errorbar(x_data1,y_data1,y_data1_err,"~");
If I want a solid line connecting all datapoints I have to do this:
errorbar(x_data1,y_data1,y_data1_err,"~");
h=get(gca,'children');
set (h, "color", "blue");
hold on;
plot(x_data1,y_data1,"*-b");
The problem here is, that the errorbars themselves dont change their color, e.g. I get a pretty mix of all colors in one line.
Do anyone know how to change this?
I tried to follow the trail of the data plotted by errorbar. I ended up in "__errplot__.m"
Unfortunately I am not sure where the actual lines (the bars the errorbars consist of) are plotted. Is this done using the "set (h, "xdata", (1:len)');" commands? Could I change the color of the errorbars here by doing something like set(h,"color","yellow"); ?
I tried this in _errplot__.m (see below) without success: The lines still appear in the color chosen, the errorbars dont.
So how do I start? I would really like to help as developer, but yet I dont understand this very basic funtions.
Cheers, David
__errplot__.m:
function h = __errplot__ (fstr, p, a1, a2, a3, a4, a5, a6)
if (nargin < 4 || nargin > 8) # at least two data arguments needed
print_usage ();
endif
[fmt, key] = __pltopt__ ("__errplot__", fstr);
[len, nplots] = size (a1);
for i = 1:nplots
## Set the plot type based on linestyle.
if (fmt.linestyle == "~")
ifmt = "yerr";
elseif (fmt.linestyle == ">")
ifmt = "xerr";
elseif (fmt.linestyle == "~>")
ifmt = "xyerr";
elseif (fmt.linestyle == "#")
ifmt = "box";
elseif (fmt.linestyle == "#~")
ifmt = "boxy";
elseif (fmt.linestyle == "#~>")
ifmt = "boxxy";
else
print_usage ();
endif
h = __line__ (p);
switch (nargin - 2)
case 2
set (h, "xdata", (1:len)');
set (h, "color", "yellow");
set (h, "ydata", a1(:,i));
set (h, "color", "yellow");
set (h, "ldata", a2(:,i));
set (h, "color", "yellow");
set (h, "udata", a2(:,i));
set (h, "color", "yellow");
case 3
set (h, "xdata", a1(:,i));
set (h, "color", "yellow");
set (h, "ydata", a2(:,i));
set (h, "color", "yellow");
set (h, "ldata", a3(:,i));
set (h, "color", "yellow");
set (h, "udata", a3(:,i));
set (h, "color", "yellow");
case 4
set (h, "xdata", a1(:,i));
set (h, "color", "yellow");
set (h, "ydata", a2(:,i));
set (h, "color", "yellow");
if (index (ifmt, "boxxy") || index (ifmt, "xyerr"))
set (h, "xldata", a3(:,i));
set (h, "color", "yellow");
set (h, "xudata", a3(:,i));
set (h, "color", "yellow");
set (h, "ldata", a4(:,i));
set (h, "color", "yellow");
set (h, "udata", a4(:,i));
set (h, "color", "yellow");
elseif (index (ifmt, "xerr"))
set (h, "xldata", a3(:,i));
set (h, "color", "yellow");
set (h, "xudata", a4(:,i));
set (h, "color", "yellow");
else
set (h, "ldata", a3(:,i));
set (h, "color", "yellow");
set (h, "color", "yellow");
set (h, "udata", a4(:,i));
set (h, "color", "yellow");
endif
case 5
error ("error plot requires 2, 3, 4 or 6 columns");
case 6
set (h, "xdata", a1(:,i));
set (h, "color", "yellow");
set (h, "ydata", a2(:,i));
set (h, "color", "yellow");
set (h, "xldata", a3(:,i));
set (h, "color", "yellow");
set (h, "xudata", a4(:,i));
set (h, "color", "yellow");
set (h, "ldata", a5(:,i));
set (h, "color", "yellow");
set (h, "udata", a6(:,i));
set (h, "color", "yellow");
endswitch
endfor
endfunction