# HG changeset patch
# User Michael D. Godfrey <michaeldgodfrey@gmail.com>
# Date 1436300731 -3600
#      Tue Jul 07 21:25:31 2015 +0100
# Node ID ed33efc02f9d3233a172c9ab575eece2dfeb908d
# Parent  85b2874751960ba18d5ab3feedc47623d396b5c8
use fltk for plots in Manual

diff -r 85b287475196 -r ed33efc02f9d doc/interpreter/plot.txi
--- a/doc/interpreter/plot.txi	Tue Jul 07 15:18:36 2015 -0400
+++ b/doc/interpreter/plot.txi	Tue Jul 07 21:25:31 2015 +0100
@@ -205,6 +205,7 @@
 
 @example
 polar (0:0.1:10*pi, 0:0.1:10*pi);
+set (gca, 'rtick', [0:10:40]);
 @end example
 
 @noindent
@@ -914,31 +915,6 @@
 @end tex
 @end float
 
-A complete example showing the capabilities of the extended text is
-
-@example
-@group
-x = 0:0.01:3;
-plot (x, erf (x));
-hold on;
-plot (x,x,"r");
-axis ([0, 3, 0, 1]);
-text (0.65, 0.6175, strcat ('\leftarrow x = @{2/\surd\pi',
-' @{\fontsize@{16@}\int_@{\fontsize@{8@}0@}^@{\fontsize@{8@}x@}@}',
-' e^@{-t^2@} dt@} = 0.6175'))
-@end group
-@end example
-
-@ifnotinfo
-@noindent
-The result of which can be seen in @ref{fig:extendedtext}
-
-@float Figure,fig:extendedtext
-@center @image{extended,4in}
-@caption{Example of inclusion of text with the @TeX{} interpreter}
-@end float
-@end ifnotinfo
-
 @node Printing and Saving Plots
 @subsection Printing and Saving Plots
 @cindex plotting, saving and printing plots
@@ -963,12 +939,49 @@
 saves the current figure to an encapsulated PostScript file called
 @file{foo.eps}.
 
-The different graphic toolkits have different print capabilities.  In
-particular, the OpenGL based toolkits such as @code{fltk} do not support
-the @qcode{"interpreter"} property of text objects.  This means special
+The current graphic toolkits have differing print capabilities.  In
+particular, the OpenGL based toolkits such as @code{fltk} and @code{qt} do not support
+the @qcode{"interpreter"} property of text objects.  This means that when
+using OpenGL toolkits special
 symbols drawn with the @qcode{"tex"} interpreter will appear correctly
-on-screen but will be rendered with interpreter @qcode{"none"} when printing.
-Switch graphics toolkits for printing if this is a concern.
+on-screen but will be rendered with interpreter @qcode{"none"} when printing
+unless one of the @qcode{standalone} (see below) modes is used. These modes provide
+access to the pdflatex processor and therefore allow full use of LaTeX commands.
+
+A complete example showing the capabilities of text printing using the
+@code{-dpdflatexstandalone} option is
+
+@example
+@group
+x = 0:0.01:3;
+fig7=figure();
+plot (x,erf(x));
+hold on;
+plot (x,x,"r");
+axis ([0, 3, 0, 1]);
+text (0.65, 0.6175, strcat ('$\leftarrow x = @{2/\sqrt@{\pi@}',
+        '@{\int_@{0@}^@{x@}@}e^@{-t^2@} dt@} = 0.6175$'));
+xlabel ("x");
+ylabel ("erf (x)");
+title ("erf (x) with text annotation");
+figure (fig7,"visible","off")
+print (fig7, 'plot15_7.pdf', '-dpdflatexstandalone')
+system ('pdflatex plot15_7');
+system ('acroread plot15_7.pdf&');
+@end group
+@end example
+
+@ifnotinfo
+@noindent
+The result of which can be seen in @ref{fig:extendedtext}
+
+@float Figure,fig:extendedtext
+@center @image{extended,4in}
+@caption{Example of inclusion of text with use of @code{-dpdflatexstandalone}}
+@end float
+@end ifnotinfo
+
+
 
 @DOCSTRING(print)
 
diff -r 85b287475196 -r ed33efc02f9d doc/interpreter/plotimages.m
--- a/doc/interpreter/plotimages.m	Tue Jul 07 15:18:36 2015 -0400
+++ b/doc/interpreter/plotimages.m	Tue Jul 07 21:25:31 2015 +0100
@@ -17,7 +17,7 @@
 ## <http://www.gnu.org/licenses/>.
 
 function plotimages (d, nm, typ)
-  graphics_toolkit ("gnuplot");
+  graphics_toolkit ("fltk");
   set_print_size ();
   hide_output ();
   outfile = fullfile (d, strcat (nm, ".", typ));
@@ -60,6 +60,7 @@
     print (outfile, d_typ);
   elseif (strcmp (nm, "polar"))
     polar (0:0.1:10*pi, 0:0.1:10*pi);
+    set (gca, 'rtick', [0:10:40]);
     title ("Example polar plot from 0 to 10*pi");
     print (outfile, d_typ);
   elseif (strcmp (nm, "mesh"))
@@ -89,12 +90,22 @@
     hold on;
     plot (x,x,"r");
     axis ([0, 3, 0, 1]);
-    text (0.65, 0.6175, ['\leftarrow x = {2/\surd\pi {\fontsize{16}' ...
-          '\int_{\fontsize{8}0}^{\fontsize{8}x}} e^{-t^2} dt} = 0.6175']);
+    if ( strcmp(typ, "pdf"))
+      text (0.65, 0.6175, strcat ('$\leftarrow x = {2/\sqrt{\pi}',
+            '{\int_{0}^{x}}e^{-t^2} dt} = 0.6175$'));
+    else
+      text (0.65, 0.6175, ['\leftarrow x = {2/\surd\pi {\fontsize{16}' ...
+            '\int_{\fontsize{8}0}^{\fontsize{8}x}} e^{-t^2} dt} = 0.6175']);
+    endif
     xlabel ("x");
     ylabel ("erf (x)");
     title ("erf (x) with text annotation");
+    if ( strcmp(typ, "pdf"))
+      print (outfile, '-dpdflatexstandalone');
+      system (['pdflatex ' nm '']);
+    else
     print (outfile, d_typ);
+    endif
   else
     error ("unrecognized plot requested");
   endif
