octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #46972] errorbar() example code is incorrect


From: anonymous
Subject: [Octave-bug-tracker] [bug #46972] errorbar() example code is incorrect
Date: Mon, 25 Jan 2016 22:07:02 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?46972>

                 Summary: errorbar() example code is incorrect
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 25 Jan 2016 10:07:01 PM UTC
                Category: Documentation
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Documentation
                  Status: None
             Assigned to: None
         Originator Name: DoubleDeepIndent
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.2
        Operating System: Any

    _______________________________________________________

Details:

Relevant documentation page:
https://www.gnu.org/software/octave/doc/interpreter/Two_002dDimensional-Plots.html

The example code for errorbar() appears to be incorrect.


x = 0:0.1:10;
y = sin (x);
yp =  0.1 .* randn (size (x));
ym = -0.1 .* randn (size (x));
errorbar (x, sin (x), ym, yp);


should be:


x = 0:0.1:10;
y = sin (x);
yp = 0.1 .* rand (size(x));
ym = 0.1 .* rand (size(x));
errorbar (x, y, ym, yp);


to produce the provided plot.

Per the help docs (which are correct), when plotting lower- and upper-side
errors in this way, errorbars are drawn from DATA(n)-LERR(n) to
DATA(n)+UERR(n) rather than DATA(n)+LERR(n) to DATA(n)+UERR(n) as the current
example code assumes.

Also notice that rand(), rather than randn(), must be used to avoid random
positive and negative numbers (not what we want).

Plots produced by the two versions on Octave 3.8.2 are attached.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 25 Jan 2016 10:07:01 PM UTC  Name: errorbar-bad.png  Size: 29kB  
By: None
error-bad.png: current documentation example code output; error-good.png:
corrected code output
<http://savannah.gnu.org/bugs/download.php?file_id=36164>
-------------------------------------------------------
Date: Mon 25 Jan 2016 10:07:01 PM UTC  Name: errorbar-good.png  Size: 29kB  
By: None
error-bad.png: current documentation example code output; error-good.png:
corrected code output
<http://savannah.gnu.org/bugs/download.php?file_id=36165>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?46972>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]