Bar chart with error bars?

novalidaddress at nurfuerspam.de novalidaddress at nurfuerspam.de
Wed Jul 16 16:28:34 CDT 2008


Henry, many thanks for your reply!

I have tried that. Then there is no bar chart anymore.

Here is a snippet of my code:

array=dlmread("testfile2.csv",",") % there are 2 rows and 6 columns of example data
% data in columns, cols 1,3,5 are the values to be plotted as bars, 
% cols 2,4,6 contain dy for the error bars
columns=[]
bars=[]

for i=1:3
columns=[columns,array(:,2*i-1)] % isolate data for bars
bars=[bars,array(:,2*i)]         % isolate data for error bars
endfor

newplot()
colormap winter;

%bar([columns])
errorbar([columns],[bars])
title('Title XYZ','Fontsize',16);
ylim([0,10]) % yaxis neu setzen
xlim([0,10])
legend('condition 1','condition 2','condition 3')
ylabel('arbitrary units')


when the % before "bar" is removed (and the "errorbars" line is commented out), then a bar chart with 2 sets of bars (3 bars per set)
is displayed. If the code is run as shows, I get 3x2 plotted points with errer bars.
When both lines are executed, first I see a plot with the axes messed up (xlim and ylim are ignored), then I see another plot with correct axes, but no columns (as when the bar command is not run at all)

Any clues?

Wolfgang

when
-------- Original-Nachricht --------
> Datum: Wed, 16 Jul 2008 11:38:27 -0700
> Von: "Henry F. Mollet" <mollet at pacbell.net>
> An: Wolfgang Schechinger <hubahopp at gmx.de>, Octave_post <help-octave at octave.org>
> Betreff: Re: Bar chart with error bars?

> octave-3.0.1:4> help -i bar
> warning: please use `doc' instead of `help -i'
> 
>      form is
> 
>           errorbar (Y, EY)
> 
>      where the first argument is taken as the set of Y coordinates and
>      the second argument EY is taken as the errors of the Y values. X
>      coordinates are taken to be the indices of the elements, starting
>      with 1.
> 
>      If more than two arguments are given, they are interpreted as
> 
>           errorbar (X, Y, ..., FMT, ...)
> 
>      where after X and Y there can be up to four error parameters such
>      as EY, EX, LY, UY etc., depending on the plot type. Any number of
>      argument sets may appear, as long as they are separated with a
>      format string FMT.
> 
>      If Y is a matrix, X and error parameters must also be matrices
>      having same dimensions. The columns of Y are plotted versus the
>      corresponding columns of X and errorbars are drawn from the
>      corresponding columns of error parameters.
> 
>      If FMT is missing, yerrorbars ("~") plot style is assumed.
> 
>      If the FMT argument is supplied, it is interpreted as in normal
>      plots. In addition the following plot styles are supported by
>      errorbar:
> 
> Above might be starting point to get errorbars with a bar chart.
> Henry
> 
> 
> on 7/16/08 1:31 AM, Wolfgang Schechinger at hubahopp at gmx.de wrote:
> 
> > Dear experts, 
> > 
> > I would like to generate a series of bar charts with error bars upon the
> > columns. Anyone wanting to share some example code or give me hints how
> to get
> > the error bars on the bars?
> > 
> > Many thanks!
> > 
> > Wolfgang
> 

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the Help-octave mailing list