# HG changeset patch # User Michael D. Godfrey # Date 1487685334 -3600 # Node ID 76a894168fe5e6b1676ba9713017c5014b368e89 # Parent b8a186a9760ba793a23723e6d33da335ec1ff717 doc: provide complete examples in plotting documentation (bug #44263) * doc/interpreter/plot.txi: The plotting example codes were given in a truncated form. To be honest with the users, the full examples are provieded without being too verbose. diff -r b8a186a9760b -r 76a894168fe5 doc/interpreter/plot.txi --- a/doc/interpreter/plot.txi Mon Feb 20 18:11:02 2017 +0100 +++ b/doc/interpreter/plot.txi Tue Feb 21 14:55:34 2017 +0100 @@ -89,6 +89,9 @@ @group x = -10:0.1:10; plot (x, sin (x)); +xlabel ("x"); +ylabel ("sin (x)"); +title ("Simple 2-D Plot"); @end group @end example @@ -123,13 +126,19 @@ @example @group +randn ("state", 1); hist (randn (10000, 1), 30); +xlabel ("Value"); +ylabel ("Count"); +title ("Histogram of 10,000 normally distributed random numbers"); @end group @end example @noindent produces the histogram of 10,000 normally distributed random numbers -shown in @ref{fig:hist}. +shown in @ref{fig:hist}. Note that, @code{randn ("state", 1);} sets +the start value for @code{randn} so that the returned values are +always the same as shown. @float Figure,fig:hist @center @image{hist,4in} @@ -177,11 +186,16 @@ @example @group +rand ("state", 2); x = 0:0.1:10; y = sin (x); lerr = 0.1 .* rand (size (x)); uerr = 0.1 .* rand (size (x)); errorbar (x, y, lerr, uerr); +axis ([0, 10, -1.1, 1.1]); +xlabel ("x"); +ylabel ("sin (x)"); +title ("Errorbar plot of sin (x)"); @end group @end example @@ -207,6 +221,7 @@ @example polar (0:0.1:10*pi, 0:0.1:10*pi); +title ("Example polar plot from 0 to 10*pi"); @end example @noindent @@ -318,6 +333,10 @@ r = sqrt (xx .^ 2 + yy .^ 2) + eps; tz = sin (r) ./ r; mesh (tx, ty, tz); +xlabel ("tx"); +ylabel ("ty"); +zlabel ("tz"); +title ("3-D Sombrero plot"); @end group @end example @@ -343,7 +362,11 @@ t = 0:0.1:10*pi; r = linspace (0, 1, numel (t)); z = linspace (0, 1, numel (t)); -plot3 (r.*sin(t), r.*cos(t), z); +plot3 (r.*sin (t), r.*cos (t), z); +xlabel ("r.*sin (t)"); +ylabel ("r.*cos (t)"); +zlabel ("z"); +title ("plot3 display of 3-D helix"); @end group @end example