changeset 17572:7bb76a22cde1

maint: Split scripts/plot directory into 4 pieces. scripts/gui : user-interface functions scripts/plot/appearance : functions controlling plot appearance scripts/plot/draw : plotting functions which produce graphs scripts/plot/util : low-level plotting functions and utilities. * scripts/gui/guidata.m, scripts/gui/guihandles.m, scripts/gui/module.mk, scripts/gui/private/__file_filter__.m, scripts/gui/private/__fltk_file_filter__.m, scripts/gui/private/__is_function__.m, scripts/gui/private/__uigetdir_fltk__.m, scripts/gui/private/__uigetfile_fltk__.m, scripts/gui/private/__uiobject_split_args__.m, scripts/gui/private/__uiputfile_fltk__.m, scripts/gui/uicontextmenu.m, scripts/gui/uicontrol.m, scripts/gui/uigetdir.m, scripts/gui/uigetfile.m, scripts/gui/uimenu.m, scripts/gui/uipanel.m, scripts/gui/uipushtool.m, scripts/gui/uiputfile.m, scripts/gui/uiresume.m, scripts/gui/uitoggletool.m, scripts/gui/uitoolbar.m, scripts/gui/uiwait.m, scripts/gui/waitbar.m, scripts/gui/waitforbuttonpress.m: Moved from scripts/plot to scripts/gui * scripts/plot/appearance/__clabel__.m, scripts/plot/appearance/__getlegenddata__.m, scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m, scripts/plot/appearance/caxis.m, scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m, scripts/plot/appearance/diffuse.m, scripts/plot/appearance/grid.m, scripts/plot/appearance/gtext.m, scripts/plot/appearance/hidden.m, scripts/plot/appearance/legend.m, scripts/plot/appearance/orient.m, scripts/plot/appearance/pbaspect.m, scripts/plot/appearance/private/__axis_label__.m, scripts/plot/appearance/private/__axis_limits__.m, scripts/plot/appearance/shading.m, scripts/plot/appearance/specular.m, scripts/plot/appearance/text.m, scripts/plot/appearance/title.m, scripts/plot/appearance/view.m, scripts/plot/appearance/whitebg.m, scripts/plot/appearance/xlabel.m, scripts/plot/appearance/xlim.m, scripts/plot/appearance/ylabel.m, scripts/plot/appearance/ylim.m, scripts/plot/appearance/zlabel.m, scripts/plot/appearance/zlim.m: Moved from scripts/plot to subdir appearance. * scripts/plot/draw/area.m, scripts/plot/draw/bar.m, scripts/plot/draw/barh.m, scripts/plot/draw/colorbar.m, scripts/plot/draw/comet.m, scripts/plot/draw/comet3.m, scripts/plot/draw/compass.m, scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m, scripts/plot/draw/contourc.m, scripts/plot/draw/contourf.m, scripts/plot/draw/cylinder.m, scripts/plot/draw/ellipsoid.m, scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m, scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m, scripts/plot/draw/ezmeshc.m, scripts/plot/draw/ezplot.m, scripts/plot/draw/ezplot3.m, scripts/plot/draw/ezpolar.m, scripts/plot/draw/ezsurf.m, scripts/plot/draw/ezsurfc.m, scripts/plot/draw/feather.m, scripts/plot/draw/fill.m, scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m, scripts/plot/draw/isocolors.m, scripts/plot/draw/isonormals.m, scripts/plot/draw/isosurface.m, scripts/plot/draw/line.m, scripts/plot/draw/loglog.m, scripts/plot/draw/loglogerr.m, scripts/plot/draw/mesh.m, scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m, scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m, scripts/plot/draw/pcolor.m, scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m, scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m, scripts/plot/draw/plot3.m, scripts/plot/draw/plotmatrix.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__add_datasource__.m, scripts/plot/draw/private/__bar__.m, scripts/plot/draw/private/__contour__.m, scripts/plot/draw/private/__errcomm__.m, scripts/plot/draw/private/__errplot__.m, scripts/plot/draw/private/__ezplot__.m, scripts/plot/draw/private/__interp_cube__.m, scripts/plot/draw/private/__line__.m, scripts/plot/draw/private/__marching_cube__.m, scripts/plot/draw/private/__patch__.m, scripts/plot/draw/private/__pie__.m, scripts/plot/draw/private/__plt__.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/quiver.m, scripts/plot/draw/quiver3.m, scripts/plot/draw/rectangle.m, scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m, scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m, scripts/plot/draw/semilogx.m, scripts/plot/draw/semilogxerr.m, scripts/plot/draw/semilogy.m, scripts/plot/draw/semilogyerr.m, scripts/plot/draw/shrinkfaces.m, scripts/plot/draw/slice.m, scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m, scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m, scripts/plot/draw/stem3.m, scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m, scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m, scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m, scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m, scripts/plot/draw/waterfall.m: Moved from plot/ to subdir draw. * scripts/plot/util/__actual_axis_position__.m, scripts/plot/util/__default_plot_options__.m, scripts/plot/util/__gnuplot_drawnow__.m, scripts/plot/util/__next_line_color__.m, scripts/plot/util/__next_line_style__.m, scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/__pltopt__.m, scripts/plot/util/allchild.m, scripts/plot/util/ancestor.m, scripts/plot/util/axes.m, scripts/plot/util/cla.m, scripts/plot/util/clf.m, scripts/plot/util/close.m, scripts/plot/util/closereq.m, scripts/plot/util/colstyle.m, scripts/plot/util/copyobj.m, scripts/plot/util/figure.m, scripts/plot/util/findall.m, scripts/plot/util/findfigs.m, scripts/plot/util/findobj.m, scripts/plot/util/gca.m, scripts/plot/util/gcbf.m, scripts/plot/util/gcbo.m, scripts/plot/util/gcf.m, scripts/plot/util/gco.m, scripts/plot/util/ginput.m, scripts/plot/util/gnuplot_binary.in, scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hdl2struct.m, scripts/plot/util/hggroup.m, scripts/plot/util/hold.m, scripts/plot/util/isaxes.m, scripts/plot/util/isfigure.m, scripts/plot/util/ishghandle.m, scripts/plot/util/ishold.m, scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m, scripts/plot/util/meshgrid.m, scripts/plot/util/ndgrid.m, scripts/plot/util/newplot.m, scripts/plot/util/print.m, scripts/plot/util/printd.m, scripts/plot/util/private/__add_default_menu__.m, scripts/plot/util/private/__fltk_ginput__.m, scripts/plot/util/private/__fltk_print__.m, scripts/plot/util/private/__ghostscript__.m, scripts/plot/util/private/__gnuplot_get_var__.m, scripts/plot/util/private/__gnuplot_ginput__.m, scripts/plot/util/private/__gnuplot_has_feature__.m, scripts/plot/util/private/__gnuplot_has_terminal__.m, scripts/plot/util/private/__gnuplot_open_stream__.m, scripts/plot/util/private/__gnuplot_print__.m, scripts/plot/util/private/__gnuplot_version__.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/plot/util/private/__go_draw_figure__.m, scripts/plot/util/private/__print_parse_opts__.m, scripts/plot/util/private/__tight_eps_bbox__.m, scripts/plot/util/refresh.m, scripts/plot/util/refreshdata.m, scripts/plot/util/saveas.m, scripts/plot/util/shg.m, scripts/plot/util/struct2hdl.m, scripts/plot/util/subplot.m: Moved from plot to subdir util. * etc/HACKING: Updated directory structure info. * scripts/Makefile.am, scripts/plot/appearance/module.mk, scripts/plot/draw/module.mk, scripts/plot/util/module.mk: Added new directories to build system.
author Rik <rik@octave.org>
date Fri, 04 Oct 2013 17:09:08 -0700
parents 6e4ea5c8a4bb
children f749f432b019
files etc/HACKING scripts/Makefile.am scripts/gui/guidata.m scripts/gui/guihandles.m scripts/gui/module.mk scripts/gui/private/__file_filter__.m scripts/gui/private/__fltk_file_filter__.m scripts/gui/private/__is_function__.m scripts/gui/private/__uigetdir_fltk__.m scripts/gui/private/__uigetfile_fltk__.m scripts/gui/private/__uiobject_split_args__.m scripts/gui/private/__uiputfile_fltk__.m scripts/gui/uicontextmenu.m scripts/gui/uicontrol.m scripts/gui/uigetdir.m scripts/gui/uigetfile.m scripts/gui/uimenu.m scripts/gui/uipanel.m scripts/gui/uipushtool.m scripts/gui/uiputfile.m scripts/gui/uiresume.m scripts/gui/uitoggletool.m scripts/gui/uitoolbar.m scripts/gui/uiwait.m scripts/gui/waitbar.m scripts/gui/waitforbuttonpress.m scripts/plot/__gnuplot_drawnow__.m scripts/plot/__plt_get_axis_arg__.m scripts/plot/allchild.m scripts/plot/ancestor.m scripts/plot/appearance/__clabel__.m scripts/plot/appearance/__getlegenddata__.m scripts/plot/appearance/axis.m scripts/plot/appearance/box.m scripts/plot/appearance/caxis.m scripts/plot/appearance/clabel.m scripts/plot/appearance/daspect.m scripts/plot/appearance/diffuse.m scripts/plot/appearance/grid.m scripts/plot/appearance/gtext.m scripts/plot/appearance/hidden.m scripts/plot/appearance/legend.m scripts/plot/appearance/module.mk scripts/plot/appearance/orient.m scripts/plot/appearance/pbaspect.m scripts/plot/appearance/private/__axis_label__.m scripts/plot/appearance/private/__axis_limits__.m scripts/plot/appearance/shading.m scripts/plot/appearance/specular.m scripts/plot/appearance/text.m scripts/plot/appearance/title.m scripts/plot/appearance/view.m scripts/plot/appearance/whitebg.m scripts/plot/appearance/xlabel.m scripts/plot/appearance/xlim.m scripts/plot/appearance/ylabel.m scripts/plot/appearance/ylim.m scripts/plot/appearance/zlabel.m scripts/plot/appearance/zlim.m scripts/plot/area.m scripts/plot/axes.m scripts/plot/axis.m scripts/plot/bar.m scripts/plot/barh.m scripts/plot/box.m scripts/plot/caxis.m scripts/plot/cla.m scripts/plot/clabel.m scripts/plot/clf.m scripts/plot/close.m scripts/plot/closereq.m scripts/plot/colorbar.m scripts/plot/colstyle.m scripts/plot/comet.m scripts/plot/comet3.m scripts/plot/compass.m scripts/plot/contour.m scripts/plot/contour3.m scripts/plot/contourc.m scripts/plot/contourf.m scripts/plot/copyobj.m scripts/plot/cylinder.m scripts/plot/daspect.m scripts/plot/diffuse.m scripts/plot/draw/area.m scripts/plot/draw/bar.m scripts/plot/draw/barh.m scripts/plot/draw/colorbar.m scripts/plot/draw/comet.m scripts/plot/draw/comet3.m scripts/plot/draw/compass.m scripts/plot/draw/contour.m scripts/plot/draw/contour3.m scripts/plot/draw/contourc.m scripts/plot/draw/contourf.m scripts/plot/draw/cylinder.m scripts/plot/draw/ellipsoid.m scripts/plot/draw/errorbar.m scripts/plot/draw/ezcontour.m scripts/plot/draw/ezcontourf.m scripts/plot/draw/ezmesh.m scripts/plot/draw/ezmeshc.m scripts/plot/draw/ezplot.m scripts/plot/draw/ezplot3.m scripts/plot/draw/ezpolar.m scripts/plot/draw/ezsurf.m scripts/plot/draw/ezsurfc.m scripts/plot/draw/feather.m scripts/plot/draw/fill.m scripts/plot/draw/fplot.m scripts/plot/draw/hist.m scripts/plot/draw/isocolors.m scripts/plot/draw/isonormals.m scripts/plot/draw/isosurface.m scripts/plot/draw/line.m scripts/plot/draw/loglog.m scripts/plot/draw/loglogerr.m scripts/plot/draw/mesh.m scripts/plot/draw/meshc.m scripts/plot/draw/meshz.m scripts/plot/draw/module.mk scripts/plot/draw/pareto.m scripts/plot/draw/patch.m scripts/plot/draw/pcolor.m scripts/plot/draw/peaks.m scripts/plot/draw/pie.m scripts/plot/draw/pie3.m scripts/plot/draw/plot.m scripts/plot/draw/plot3.m scripts/plot/draw/plotmatrix.m scripts/plot/draw/plotyy.m scripts/plot/draw/polar.m scripts/plot/draw/private/__add_datasource__.m scripts/plot/draw/private/__bar__.m scripts/plot/draw/private/__contour__.m scripts/plot/draw/private/__errcomm__.m scripts/plot/draw/private/__errplot__.m scripts/plot/draw/private/__ezplot__.m scripts/plot/draw/private/__interp_cube__.m scripts/plot/draw/private/__line__.m scripts/plot/draw/private/__marching_cube__.m scripts/plot/draw/private/__patch__.m scripts/plot/draw/private/__pie__.m scripts/plot/draw/private/__plt__.m scripts/plot/draw/private/__quiver__.m scripts/plot/draw/private/__scatter__.m scripts/plot/draw/private/__stem__.m scripts/plot/draw/quiver.m scripts/plot/draw/quiver3.m scripts/plot/draw/rectangle.m scripts/plot/draw/ribbon.m scripts/plot/draw/rose.m scripts/plot/draw/scatter.m scripts/plot/draw/scatter3.m scripts/plot/draw/semilogx.m scripts/plot/draw/semilogxerr.m scripts/plot/draw/semilogy.m scripts/plot/draw/semilogyerr.m scripts/plot/draw/shrinkfaces.m scripts/plot/draw/slice.m scripts/plot/draw/sombrero.m scripts/plot/draw/sphere.m scripts/plot/draw/stairs.m scripts/plot/draw/stem.m scripts/plot/draw/stem3.m scripts/plot/draw/stemleaf.m scripts/plot/draw/surf.m scripts/plot/draw/surface.m scripts/plot/draw/surfc.m scripts/plot/draw/surfl.m scripts/plot/draw/surfnorm.m scripts/plot/draw/tetramesh.m scripts/plot/draw/trimesh.m scripts/plot/draw/triplot.m scripts/plot/draw/trisurf.m scripts/plot/draw/waterfall.m scripts/plot/ellipsoid.m scripts/plot/errorbar.m scripts/plot/ezcontour.m scripts/plot/ezcontourf.m scripts/plot/ezmesh.m scripts/plot/ezmeshc.m scripts/plot/ezplot.m scripts/plot/ezplot3.m scripts/plot/ezpolar.m scripts/plot/ezsurf.m scripts/plot/ezsurfc.m scripts/plot/feather.m scripts/plot/figure.m scripts/plot/fill.m scripts/plot/findall.m scripts/plot/findfigs.m scripts/plot/findobj.m scripts/plot/fplot.m scripts/plot/gca.m scripts/plot/gcbf.m scripts/plot/gcbo.m scripts/plot/gcf.m scripts/plot/gco.m scripts/plot/ginput.m scripts/plot/gnuplot_binary.in scripts/plot/graphics_toolkit.m scripts/plot/grid.m scripts/plot/gtext.m scripts/plot/guidata.m scripts/plot/guihandles.m scripts/plot/hdl2struct.m scripts/plot/hggroup.m scripts/plot/hidden.m scripts/plot/hist.m scripts/plot/hold.m scripts/plot/isaxes.m scripts/plot/isfigure.m scripts/plot/ishghandle.m scripts/plot/ishold.m scripts/plot/isocolors.m scripts/plot/isonormals.m scripts/plot/isosurface.m scripts/plot/isprop.m scripts/plot/legend.m scripts/plot/line.m scripts/plot/linkprop.m scripts/plot/loglog.m scripts/plot/loglogerr.m scripts/plot/mesh.m scripts/plot/meshc.m scripts/plot/meshgrid.m scripts/plot/meshz.m scripts/plot/ndgrid.m scripts/plot/newplot.m scripts/plot/orient.m scripts/plot/pareto.m scripts/plot/patch.m scripts/plot/pbaspect.m scripts/plot/pcolor.m scripts/plot/peaks.m scripts/plot/pie.m scripts/plot/pie3.m scripts/plot/plot.m scripts/plot/plot3.m scripts/plot/plotmatrix.m scripts/plot/plotyy.m scripts/plot/polar.m scripts/plot/print.m scripts/plot/printd.m scripts/plot/private/__actual_axis_position__.m scripts/plot/private/__add_datasource__.m scripts/plot/private/__add_default_menu__.m scripts/plot/private/__axes_limits__.m scripts/plot/private/__axis_label__.m scripts/plot/private/__bar__.m scripts/plot/private/__clabel__.m scripts/plot/private/__contour__.m scripts/plot/private/__default_plot_options__.m scripts/plot/private/__errcomm__.m scripts/plot/private/__errplot__.m scripts/plot/private/__ezplot__.m scripts/plot/private/__file_filter__.m scripts/plot/private/__fltk_file_filter__.m scripts/plot/private/__fltk_ginput__.m scripts/plot/private/__fltk_print__.m scripts/plot/private/__getlegenddata__.m scripts/plot/private/__ghostscript__.m scripts/plot/private/__gnuplot_get_var__.m scripts/plot/private/__gnuplot_ginput__.m scripts/plot/private/__gnuplot_has_feature__.m scripts/plot/private/__gnuplot_has_terminal__.m scripts/plot/private/__gnuplot_open_stream__.m scripts/plot/private/__gnuplot_print__.m scripts/plot/private/__gnuplot_version__.m scripts/plot/private/__go_draw_axes__.m scripts/plot/private/__go_draw_figure__.m scripts/plot/private/__interp_cube__.m scripts/plot/private/__is_function__.m scripts/plot/private/__line__.m scripts/plot/private/__marching_cube__.m scripts/plot/private/__next_line_color__.m scripts/plot/private/__next_line_style__.m scripts/plot/private/__patch__.m scripts/plot/private/__pie__.m scripts/plot/private/__plt__.m scripts/plot/private/__pltopt__.m scripts/plot/private/__print_parse_opts__.m scripts/plot/private/__quiver__.m scripts/plot/private/__scatter__.m scripts/plot/private/__stem__.m scripts/plot/private/__tight_eps_bbox__.m scripts/plot/private/__uigetdir_fltk__.m scripts/plot/private/__uigetfile_fltk__.m scripts/plot/private/__uiobject_split_args__.m scripts/plot/private/__uiputfile_fltk__.m scripts/plot/quiver.m scripts/plot/quiver3.m scripts/plot/rectangle.m scripts/plot/refresh.m scripts/plot/refreshdata.m scripts/plot/ribbon.m scripts/plot/rose.m scripts/plot/saveas.m scripts/plot/scatter.m scripts/plot/scatter3.m scripts/plot/semilogx.m scripts/plot/semilogxerr.m scripts/plot/semilogy.m scripts/plot/semilogyerr.m scripts/plot/shading.m scripts/plot/shg.m scripts/plot/shrinkfaces.m scripts/plot/slice.m scripts/plot/sombrero.m scripts/plot/specular.m scripts/plot/sphere.m scripts/plot/stairs.m scripts/plot/stem.m scripts/plot/stem3.m scripts/plot/stemleaf.m scripts/plot/struct2hdl.m scripts/plot/subplot.m scripts/plot/surf.m scripts/plot/surface.m scripts/plot/surfc.m scripts/plot/surfl.m scripts/plot/surfnorm.m scripts/plot/tetramesh.m scripts/plot/text.m scripts/plot/title.m scripts/plot/trimesh.m scripts/plot/triplot.m scripts/plot/trisurf.m scripts/plot/uicontextmenu.m scripts/plot/uicontrol.m scripts/plot/uigetdir.m scripts/plot/uigetfile.m scripts/plot/uimenu.m scripts/plot/uipanel.m scripts/plot/uipushtool.m scripts/plot/uiputfile.m scripts/plot/uiresume.m scripts/plot/uitoggletool.m scripts/plot/uitoolbar.m scripts/plot/uiwait.m scripts/plot/util/__actual_axis_position__.m scripts/plot/util/__default_plot_options__.m scripts/plot/util/__gnuplot_drawnow__.m scripts/plot/util/__next_line_color__.m scripts/plot/util/__next_line_style__.m scripts/plot/util/__plt_get_axis_arg__.m scripts/plot/util/__pltopt__.m scripts/plot/util/allchild.m scripts/plot/util/ancestor.m scripts/plot/util/axes.m scripts/plot/util/cla.m scripts/plot/util/clf.m scripts/plot/util/close.m scripts/plot/util/closereq.m scripts/plot/util/colstyle.m scripts/plot/util/copyobj.m scripts/plot/util/figure.m scripts/plot/util/findall.m scripts/plot/util/findfigs.m scripts/plot/util/findobj.m scripts/plot/util/gca.m scripts/plot/util/gcbf.m scripts/plot/util/gcbo.m scripts/plot/util/gcf.m scripts/plot/util/gco.m scripts/plot/util/ginput.m scripts/plot/util/gnuplot_binary.in scripts/plot/util/graphics_toolkit.m scripts/plot/util/hdl2struct.m scripts/plot/util/hggroup.m scripts/plot/util/hold.m scripts/plot/util/isaxes.m scripts/plot/util/isfigure.m scripts/plot/util/ishghandle.m scripts/plot/util/ishold.m scripts/plot/util/isprop.m scripts/plot/util/linkprop.m scripts/plot/util/meshgrid.m scripts/plot/util/module.mk scripts/plot/util/ndgrid.m scripts/plot/util/newplot.m scripts/plot/util/print.m scripts/plot/util/printd.m scripts/plot/util/private/__add_default_menu__.m scripts/plot/util/private/__fltk_ginput__.m scripts/plot/util/private/__fltk_print__.m scripts/plot/util/private/__ghostscript__.m scripts/plot/util/private/__gnuplot_get_var__.m scripts/plot/util/private/__gnuplot_ginput__.m scripts/plot/util/private/__gnuplot_has_feature__.m scripts/plot/util/private/__gnuplot_has_terminal__.m scripts/plot/util/private/__gnuplot_open_stream__.m scripts/plot/util/private/__gnuplot_print__.m scripts/plot/util/private/__gnuplot_version__.m scripts/plot/util/private/__go_draw_axes__.m scripts/plot/util/private/__go_draw_figure__.m scripts/plot/util/private/__print_parse_opts__.m scripts/plot/util/private/__tight_eps_bbox__.m scripts/plot/util/refresh.m scripts/plot/util/refreshdata.m scripts/plot/util/saveas.m scripts/plot/util/shg.m scripts/plot/util/struct2hdl.m scripts/plot/util/subplot.m scripts/plot/view.m scripts/plot/waitbar.m scripts/plot/waitforbuttonpress.m scripts/plot/waterfall.m scripts/plot/whitebg.m scripts/plot/xlabel.m scripts/plot/xlim.m scripts/plot/ylabel.m scripts/plot/ylim.m scripts/plot/zlabel.m scripts/plot/zlim.m
diffstat 416 files changed, 36493 insertions(+), 36203 deletions(-) [+]
line wrap: on
line diff
--- a/etc/HACKING	Fri Oct 04 16:56:42 2013 -0700
+++ b/etc/HACKING	Fri Oct 04 17:09:08 2013 -0700
@@ -271,6 +271,8 @@
 
     geometry         geometry algorithms
 
+    gui              User-Interface (UI) functions
+
     help             help subsystem functions
 
     image            image processing
@@ -318,15 +320,15 @@
 
     test_ .m         fixed tests for the interpreter
 
-    fntests.m        script to run function tests embedded in C++ and .m
-                     files
+    fntests.m        script to run function tests embedded in C++ and
+                     .m files
 
 ----
 John W. Eaton
 jwe@octave.org
 
+Last updated: Fri, 4 Oct 2013 16:58:52 PDT 
 
-Last updated: Wed, 15 May 2013 03:02:45 EDT
 
 
 ################################################################################
--- a/scripts/Makefile.am	Fri Oct 04 16:56:42 2013 -0700
+++ b/scripts/Makefile.am	Fri Oct 04 17:09:08 2013 -0700
@@ -47,6 +47,7 @@
 include elfun/module.mk
 include general/module.mk
 include geometry/module.mk
+include gui/module.mk
 include help/module.mk
 include image/module.mk
 include io/module.mk
@@ -56,7 +57,9 @@
 include optimization/module.mk
 include path/module.mk
 include pkg/module.mk
-include plot/module.mk
+include plot/appearance/module.mk
+include plot/draw/module.mk
+include plot/util/module.mk
 include polynomial/module.mk
 include prefs/module.mk
 include set/module.mk
@@ -112,6 +115,10 @@
 	$(srcdir)/mk-pkg-add $(srcdir) $(geometry_FCN_FILES) -- $(geometry_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
 
+gui/PKG_ADD: $(gui_FCN_FILES) $(gui_GEN_FCN_FILES) gui/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(gui_FCN_FILES) -- $(gui_GEN_FCN_FILES) > $@-t
+	mv $@-t $@
+
 help/PKG_ADD: $(help_FCN_FILES) $(help_GEN_FCN_FILES) help/$(octave_dirstamp) mk-pkg-add
 	$(srcdir)/mk-pkg-add $(srcdir) $(help_FCN_FILES) -- $(help_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
@@ -148,8 +155,16 @@
 	$(srcdir)/mk-pkg-add $(srcdir) $(pkg_FCN_FILES) -- $(pkg_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
 
-plot/PKG_ADD: $(plot_FCN_FILES) $(plot_GEN_FCN_FILES) plot/$(octave_dirstamp) mk-pkg-add
-	$(srcdir)/mk-pkg-add $(srcdir) $(plot_FCN_FILES) -- $(plot_GEN_FCN_FILES) > $@-t
+plot/appearance/PKG_ADD: $(plot_appearance_FCN_FILES) $(plot_appearance_GEN_FCN_FILES) plot/appearance/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(plot_appearance_FCN_FILES) -- $(plot_appearance_GEN_FCN_FILES) > $@-t
+	mv $@-t $@
+
+plot/draw/PKG_ADD: $(plot_draw_FCN_FILES) $(plot_draw_GEN_FCN_FILES) plot/draw/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(plot_draw_FCN_FILES) -- $(plot_draw_GEN_FCN_FILES) > $@-t
+	mv $@-t $@
+
+plot/util/PKG_ADD: $(plot_util_FCN_FILES) $(plot_util_GEN_FCN_FILES) plot/util/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(plot_util_FCN_FILES) -- $(plot_util_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
 
 polynomial/PKG_ADD: $(polynomial_FCN_FILES) $(polynomial_GEN_FCN_FILES) polynomial/$(octave_dirstamp) mk-pkg-add
@@ -222,6 +237,7 @@
 $(elfun_GEN_FCN_FILES): elfun/$(octave_dirstamp)
 $(general_GEN_FCN_FILES): general/$(octave_dirstamp)
 $(geometry_GEN_FCN_FILES): geometry/$(octave_dirstamp)
+$(gui_GEN_FCN_FILES): gui/$(octave_dirstamp)
 $(help_GEN_FCN_FILES): help/$(octave_dirstamp)
 $(image_GEN_FCN_FILES): image/$(octave_dirstamp)
 $(io_GEN_FCN_FILES): io/$(octave_dirstamp)
@@ -231,7 +247,9 @@
 $(optimization_GEN_FCN_FILES): optimization/$(octave_dirstamp)
 $(path_GEN_FCN_FILES): path/$(octave_dirstamp)
 $(pkg_GEN_FCN_FILES): pkg/$(octave_dirstamp)
-$(plot_GEN_FCN_FILES): plot/$(octave_dirstamp)
+$(plot_appearance_GEN_FCN_FILES): plot/appearance/$(octave_dirstamp)
+$(plot_draw_GEN_FCN_FILES): plot/draw/$(octave_dirstamp)
+$(plot_util_GEN_FCN_FILES): plot/util/$(octave_dirstamp)
 $(polynomial_GEN_FCN_FILES): polynomial/$(octave_dirstamp)
 $(prefs_GEN_FCN_FILES): prefs/$(octave_dirstamp)
 $(set_GEN_FCN_FILES): set/$(octave_dirstamp)
@@ -267,6 +285,9 @@
 geometry/$(octave_dirstamp):
 	$(MKDIR_P) geometry
 	: > geometry/$(octave_dirstamp)
+gui/$(octave_dirstamp):
+	$(MKDIR_P) gui
+	: > gui/$(octave_dirstamp)
 help/$(octave_dirstamp):
 	$(MKDIR_P) help
 	: > help/$(octave_dirstamp)
@@ -294,9 +315,15 @@
 pkg/$(octave_dirstamp):
 	$(MKDIR_P) pkg
 	: > pkg/$(octave_dirstamp)
-plot/$(octave_dirstamp):
-	$(MKDIR_P) plot
-	: > plot/$(octave_dirstamp)
+plot/appearance/$(octave_dirstamp):
+	$(MKDIR_P) plot/appearance
+	: > plot/appearance/$(octave_dirstamp)
+plot/draw/$(octave_dirstamp):
+	$(MKDIR_P) plot/draw
+	: > plot/draw/$(octave_dirstamp)
+plot/util/$(octave_dirstamp):
+	$(MKDIR_P) plot/util
+	: > plot/util/$(octave_dirstamp)
 polynomial/$(octave_dirstamp):
 	$(MKDIR_P) polynomial
 	: > polynomial/$(octave_dirstamp)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/guidata.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,67 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{data} =} guidata (@var{h})
+## @deftypefnx {Function File} {} guidata (@var{h}, @var{data})
+## Query or set user-custom GUI data.
+##
+## The GUI data is stored in the figure handle @var{h}.  If @var{h} is not a
+## figure handle then it's parent figure will be used for storage.
+##
+## @var{data} must be a single object which means it is usually preferable
+## for it to be a data container such as a cell array or struct so that
+## additional data items can be added easily.
+##
+## @seealso{getappdata, setappdata, get, set, getpref, setpref}
+## @end deftypefn
+
+## Author: goffioul
+
+function dataout = guidata (h, data)
+
+  if (nargin < 1 || nargin > 2)
+    print_usage ();
+  endif
+
+  if (! ishandle (h))
+    error ("guidata: H must be a valid object handle");
+  endif
+  h = ancestor (h, "figure");
+  if (isempty (h))
+    error ("guidata: no ancestor figure of H found");
+  endif
+
+  if (nargin == 1)
+    dataout = get (h, "__guidata__");
+  else
+    set (h, "__guidata__", data);
+    if (nargout == 1)
+      dataout = data;
+    endif
+  endif
+
+endfunction
+
+
+%% Test input validation
+%!error guidata ()
+%!error guidata (1,2,3)
+%!error <H must be a valid object handle> guidata ({1})
+%!error <no ancestor figure of H found> guidata (0)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/guihandles.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,80 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{hdata} =} guihandles (@var{h})
+## @deftypefnx {Function File} {@var{hdata} =} guihandles
+## Return a structure of object handles for the figure associated with
+## handle @var{h}.
+## 
+## If no handle is specified the current figure returned by @code{gcf} is used.
+##
+## The fieldname for each entry of @var{hdata} is taken from the @qcode{"tag"}
+## property of the graphic object.  If the tag is empty then the handle is not
+## returned.  If there are multiple graphic objects with the same tag then
+## the entry in @var{hdata} will be a vector of handles.  @code{guihandles}
+## includes all possible handles, including those for
+## which @qcode{"HandleVisibility"} is @qcode{"off"}.
+## @seealso{guidata, findobj, findall, allchild}
+## @end deftypefn
+
+## Author: goffioul
+
+function hdata = guihandles (h)
+
+  if (nargin > 2)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    if (! ishandle (h))
+      error ("guidata: H must be a valid object handle");
+    endif
+    h = ancestor (h, "figure");
+    if (isempty (h))
+      error ("guidata: no ancestor figure of H found");
+    endif
+  else
+    h = gcf ();
+  endif
+
+  hdata = __make_guihandles_struct__ (h, []);
+
+endfunction
+
+function hdata = __make_guihandles_struct__ (h, hdata)
+
+  tag = get (h, "tag");
+  if (! isempty (tag))
+    if (isfield (hdata, tag))
+      hdata.(tag) = [hdata.(tag), h];
+    else
+      try
+        hdata.(tag) = h;
+      catch
+      end_try_catch
+    endif
+  endif
+
+  kids = allchild (h);
+  for hkid = kids'
+    hdata = __make_guihandles_struct__ (hkid, hdata);
+  endfor
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/module.mk	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,35 @@
+FCN_FILE_DIRS += gui
+
+gui_PRIVATE_FCN_FILES = \
+  gui/private/__file_filter__.m \
+  gui/private/__fltk_file_filter__.m \
+  gui/private/__is_function__.m \
+  gui/private/__uigetdir_fltk__.m \
+  gui/private/__uigetfile_fltk__.m \
+  gui/private/__uiobject_split_args__.m \
+  gui/private/__uiputfile_fltk__.m
+
+gui_FCN_FILES = \
+  gui/guidata.m \
+  gui/guihandles.m \
+  gui/uicontextmenu.m \
+  gui/uicontrol.m \
+  gui/uigetdir.m \
+  gui/uigetfile.m \
+  gui/uimenu.m \
+  gui/uipanel.m \
+  gui/uipushtool.m \
+  gui/uiputfile.m \
+  gui/uiresume.m \
+  gui/uitoggletool.m \
+  gui/uitoolbar.m \
+  gui/uiwait.m \
+  gui/waitbar.m \
+  gui/waitforbuttonpress.m \
+  $(gui_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(gui_FCN_FILES)
+
+PKG_ADD_FILES += gui/PKG_ADD
+
+DIRSTAMP_FILES += gui/$(octave_dirstamp)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__file_filter__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,94 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __file_filter__ (@var{file_filter})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Kai Habel
+
+function [retval, defname, defdir] = __file_filter__ (file_filter, name)
+
+  revtal = {};
+  defname = "";
+  defdir = "";
+
+  if (iscell (file_filter))
+    [r, c] = size (file_filter);
+    if (c != 1 && c != 2)
+      error ("%s: invalid filter specification", name);
+    endif
+    if (c == 1)
+      retval = cell (r, 2);
+      for i = 1:r
+        retval{i, 1} = file_filter{i};
+        retval{i, 2} = __default_filtername__ (file_filter{i});
+      endfor
+    else
+      retval = file_filter;
+      for i = 1:r
+        if (isempty (retval{i, 2}))
+          retval{i, 2} = __default_filtername__ (retval{i, 1});
+        endif
+      endfor
+    endif
+  elseif (ischar (file_filter))
+    [defdir, fname, fext] = fileparts (file_filter);
+    if (! strcmp (fname, "*"))
+      defname = strcat (fname, fext);
+    endif
+    if (length (fext) > 0)
+      fext = strcat ("*", fext);
+      retval = {fext, __default_filtername__(fext)};
+    endif
+  endif
+
+  retval(end+1,:) = {"*", __default_filtername__("*")};
+
+endfunction
+
+function name = __default_filtername__ (filterext)
+
+  name = "";
+
+  switch (filterext)
+    case "*"
+      name = "All Files";
+    case "*.m"
+      name = "Octave Source Files";
+    case "*.c"
+      name = "C Source Files";
+    case {"*.cc" "*.c++" "*.cpp"}
+      name = "C++ Source Files";
+    case "*.oct"
+      name = "Octave Compiled Files";
+  endswitch
+
+  if (isempty (name))
+    extlist = ostrsplit (filterext, ";");
+    extlist = strrep (extlist, "*.", "");
+    extlist = toupper (extlist);
+    extlist(end+1, :) = repmat ({","}, 1, length (extlist));
+    extlist = strcat (extlist{:});
+    extlist = extlist(1:end-1);
+    name = strcat (extlist, "-Files");
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__fltk_file_filter__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,65 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{filterspec} =} __fltk_file_filter__ (@var{filter})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function retval = __fltk_file_filter__ (file_filter)
+
+  retval = "";
+  [r, c] = size (file_filter);
+  if ((c == 0) || (c > 2))
+    error ("expecting 1 or to 2 columns for file filter cell");
+  endif
+  fltk_str = "";
+  for idx = 1 : r
+
+    curr_ext = file_filter{idx, 1};
+    curr_ext = ostrsplit (curr_ext, ";");
+
+    if (length (curr_ext) > 1)
+      curr_ext = regexprep (curr_ext, '\*\.', ',');
+      curr_ext = strcat (curr_ext{:})(2 : end);
+      curr_ext = strcat ("*.{", curr_ext, "}");
+    else
+      curr_ext = curr_ext{:};
+    endif
+
+    curr_desc = strcat (curr_ext(3:end), "-Files");
+
+    if (c == 2)
+      curr_desc = file_filter{idx, 2};
+      curr_desc = regexprep (curr_desc, '\(', '<');
+      curr_desc = regexprep (curr_desc, '\)', '>');
+    endif
+
+    if (length (fltk_str) > 0)
+      fltk_str = strcat (fltk_str, "\t", curr_desc, " (", curr_ext, ")");
+    else
+      fltk_str = strcat (curr_desc, " (", curr_ext, ")");
+    endif
+
+  endfor
+  retval = fltk_str;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__is_function__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,32 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{result} =} __is_function__ (@var{func})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function result = __is_function__ (func)
+
+  existval = exist (func);
+  result = (existval == 2 || existval == 3 || existval == 5 || existval == 6);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uigetdir_fltk__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,35 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{dirname} =} __uigetdir_fltk__ (@var{start_path}, @var{dialog_title})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function dirname = __uigetdir_fltk__ (start_path, dialog_title)
+
+  if (exist ("__fltk_uigetfile__") != 3)
+    error ("uigetdir: fltk graphics toolkit required");
+  endif
+
+  dirname = __fltk_uigetfile__ ("", dialog_title, start_path, [240, 120], "dir");
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uigetfile_fltk__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,39 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uigetfile_fltk__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function [retval, retpath, retindex] = __uigetfile_fltk__ (filters, title, defval, position, multiselect, defdir)
+
+  if (exist ("__fltk_uigetfile__") != 3)
+    error ("uigetfile: fltk graphics toolkit required");
+  endif
+
+  filters = __fltk_file_filter__ (filters);
+  if (length (defdir) > 0)
+    defval = fullfile (defdir, defval);
+  endif
+  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, multiselect);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uiobject_split_args__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,67 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{args}, @var{parent_type}, @var{use_gcf})
+## @end deftypefn
+
+## Author: goffioul
+
+function [parent, args] = __uiobject_split_args__ (who, in_args, parent_type = {}, use_gcf = 1)
+
+  parent = [];
+  args = {};
+  offset = 1;
+
+  if (! isempty (in_args))
+    if (ishandle (in_args{1}))
+      parent = in_args{1};
+      offset = 2;
+    elseif (! ischar (in_args{1}))
+      error ("%s: invalid parent handle.", who);
+    endif
+
+    args = in_args(offset:end);
+  endif
+
+  if (rem (length (args), 2))
+    error ("%s: expecting PROPERTY/VALUE pairs", who);
+  endif
+
+  if (! isempty (args))
+    i = find (strcmpi (args(1:2:end), "parent"), 1, "first");
+    if (! isempty (i) && length (args) >= 2*i)
+      parent = args{2*i};
+      if (! ishandle (parent))
+        error ("%s: invalid parent handle.", who);
+      endif
+      args([2*i-1, 2*i]) = [];
+    endif
+  endif
+
+  if (! isempty (parent))
+    if (! isempty (parent_type) && isempty (find (strcmpi (get (parent, "type"), parent_type))))
+      error ("%s: invalid parent, the parent type must be: %s", ...
+             who, sprintf ("%s, ", parent_type{:})(1:end-2));
+    endif
+  elseif (use_gcf)
+    parent = gcf ();
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uiputfile_fltk__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,39 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uiputfile_fltk__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function [retval, retpath, retindex] = __uiputfile_fltk__ (filters, title, defval, position, tag, defdir)
+
+  if (exist ("__fltk_uigetfile__") != 3)
+    error ("uiputfile: fltk graphics toolkit required");
+  endif
+
+  filters = __fltk_file_filter__ (filters);
+  if (length (defdir) > 0)
+    defval = fullfile (defdir, defval);
+  endif
+  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, tag);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uicontextmenu.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,31 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{handle} =} uicontextmenu ("Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uicontextmenu (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uicontextmenu", varargin, {"figure"});
+  handle = __go_uicontextmenu__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uicontrol.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,37 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uicontrol ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uicontrol (@var{parent}, "Name", value, @dots{})
+## @deftypefnx {Function File} {} uicontrol (@var{handle})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uicontrol (varargin)
+
+  if (nargin == 1 && ishandle (varargin{1}) && strcmpi (get (varargin{1}, "type"), "uicontrol"))
+    error ("uicontrol focusing not implemented yet.");
+  else
+    [h, args] = __uiobject_split_args__ ("uicontrol", varargin, {"figure", "uipanel", "uibuttongroup"});
+    handle = __go_uicontrol__ (h, args{:});
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uigetdir.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,81 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{dirname} =} uigetdir ()
+## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path})
+## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path}, @var{dialog_name})
+## Open a GUI dialog for selecting a directory.  If @var{init_path} is not
+## given the current working directory is used.  @var{dialog_name} may be
+## used to customize the dialog title.
+## @seealso{uigetfile, uiputfile}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function dirname = uigetdir (init_path = pwd, dialog_name = "Select Directory to Open")
+
+  if (! __octave_link_enabled__ ())
+    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
+    funcname = ["__uigetdir_", defaulttoolkit, "__"];
+    functype = exist (funcname);
+    if (! __is_function__ (funcname))
+      funcname = "__uigetdir_fltk__";
+      if (! __is_function__ (funcname))
+        error ("uigetdir: fltk graphics toolkit required");
+      elseif (! strcmp (defaulttoolkit, "gnuplot"))
+        warning ("uigetdir: no implementation for toolkit '%s', using 'fltk' instead",
+                 defaulttoolkit);
+      endif
+    endif
+  endif
+
+  if (nargin > 2)
+    print_usage ();
+  endif
+
+  if (!ischar (init_path) || !ischar (dialog_name))
+    error ("uigetdir: INIT_PATH and DIALOG_NAME must be string arguments");
+  endif
+
+  if (!isdir (init_path))
+    init_path = fileparts (init_path);
+  endif
+
+  if (__octave_link_enabled__ ())
+    file_filter = cell (0, 2);
+    default_file_name = "";
+    dialog_position = [240, 120];
+    dialog_mode = "dir";
+
+    [filename, dirname, filterindex] ...
+      = __octave_link_file_dialog__ (file_filter, dialog_name,
+                                     default_file_name, dialog_position,
+                                     dialog_mode, init_path);
+  else
+    dirname = feval (funcname, init_path, dialog_name);
+  endif
+endfunction
+
+
+%!demo
+%! uigetdir (pwd, 'Select Directory');
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uigetfile.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,203 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uigetfile ()
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt})
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name})
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name}, @var{default_file})
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "Position", [@var{px} @var{py}])
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "MultiSelect", @var{mode})
+##
+## Open a GUI dialog for selecting a file and return the filename @var{fname},
+## the path to this file @var{fpath}, and the filter index @var{fltidx}.
+## @var{flt} contains a (list of) file filter string(s) in one of the following
+## formats:
+##
+## @table @asis
+## @item @qcode{"/path/to/filename.ext"}
+## If a filename is given then the file extension is extracted and used as
+## filter.  In addition, the path is selected as current path and the filename
+## is selected as default file.  Example: @code{uigetfile ("myfun.m")}
+##
+## @item A single file extension @qcode{"*.ext"}
+## Example: @code{uigetfile ("*.ext")}
+##
+## @item A 2-column cell array
+## containing a file extension in the first column and a brief description
+## in the second column.
+## Example: @code{uigetfile (@{"*.ext", "My Description";"*.xyz",
+## "XYZ-Format"@})}
+##
+## The filter string can also contain a semicolon separated list of filter
+## extensions.
+## Example: @code{uigetfile (@{"*.gif;*.png;*.jpg", "Supported Picture
+## Formats"@})}
+## @end table
+##
+## @var{dialog_name} can be used to customize the dialog title.
+## If @var{default_file} is given then it will be selected in the GUI dialog.
+## If, in addition, a path is given it is also used as current path.
+##
+## The screen position of the GUI dialog can be set using the
+## @qcode{"Position"} key and a 2-element vector containing the pixel
+## coordinates.  Two or more files can be selected when setting the
+## @qcode{"MultiSelect"} key to @qcode{"on"}.  In that case @var{fname} is a
+## cell array containing the files.
+## @seealso{uiputfile, uigetdir}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function [retfile, retpath, retindex] = uigetfile (varargin)
+
+  if (! __octave_link_enabled__ ())
+    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
+    funcname = ["__uigetfile_", defaulttoolkit, "__"];
+    functype = exist (funcname);
+    if (! __is_function__ (funcname))
+      funcname = "__uigetfile_fltk__";
+      if (! __is_function__ (funcname))
+        error ("uigetfile: fltk graphics toolkit required");
+      elseif (! strcmp (defaulttoolkit, "gnuplot"))
+        warning ("uigetfile: no implementation for toolkit '%s', using 'fltk' instead",
+               defaulttoolkit);
+      endif
+    endif
+  endif
+  
+  if (nargin > 7)
+    error ("uigetfile: number of input arguments must be less than eight");
+  endif
+
+  defaultvals = {cell(0, 2),         # File Filter
+                 "Open File",        # Dialog Title
+                 "",                 # Default file name
+                 [240, 120],         # Dialog Position (pixel x/y)
+                 "off",              # MultiSelect on/off
+                 pwd};               # Default directory
+
+  outargs = cell (6, 1);
+  for i = 1 : 6
+    outargs{i} = defaultvals{i};
+  endfor
+
+  idx1 = idx2 = [];
+  if (length (varargin) > 0)
+    for i = 1 : length (varargin)
+      val = varargin{i};
+      if (ischar (val))
+        val = tolower (val);
+        if (strcmp (val, "multiselect"))
+          idx1 = i;
+        elseif (strcmp (val, "position"))
+          idx2 = i;
+        endif
+      endif
+    endfor
+  endif
+
+  stridx = [idx1, idx2, 0];
+  if (length (stridx) > 1)
+    stridx = min (stridx(1 : end - 1));
+  endif
+
+  args = varargin;
+  if (stridx)
+    args = varargin(1 : stridx - 1);
+  endif
+
+  len = length (args);
+  if (len > 0)
+    file_filter = args{1};
+    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
+    if (length (defdir) > 0)
+      outargs{6} = defdir;
+    endif
+  else
+    outargs{1} = __file_filter__ (outargs{1});
+  endif
+
+  if (len > 1)
+    if (ischar (args{2}))
+      if (length (args{2}) > 0)
+        outargs{2} = args{2};
+      endif
+    elseif (! isempty (args{2}))
+      print_usage ();
+    endif
+  endif
+
+  if (len > 2)
+    if (ischar (args{3}))
+      [fdir, fname, fext] = fileparts (args{3});
+      if (length (fdir) > 0)
+        outargs{6} = fdir;
+      endif
+      if (length (fname) > 0 || length (fext) > 0)
+        outargs{3} = strcat (fname, fext);
+      endif
+    elseif (! isempty (args{3}))
+      print_usage ();
+    endif
+  endif
+
+  if (stridx)
+    ## we have string arguments ("position" or "multiselect")
+
+    ## check for even number of remaining arguments, prop/value pair(s)
+    if (rem (nargin - stridx + 1, 2))
+      error ("uigetfile: expecting property/value pairs");
+    endif
+
+    for i = stridx : 2 : nargin
+      prop = varargin{i};
+      val = varargin{i + 1};
+      if (strcmpi (prop, "position"))
+        if (ismatrix (val) && length (val) == 2)
+          outargs{4} = val;
+        else
+          error ("uigetfile: expecting 2-element vector for position argument");
+        endif
+      elseif (strcmpi (prop, "multiselect"))
+        if (ischar (val))
+          outargs{5} = tolower (val);
+        else
+          error ("uigetfile: expecting string argument (on/off) for multiselect");
+        endif
+      else
+        error ("uigetfile: unknown argument");
+      endif
+    endfor
+  endif
+
+  if (__octave_link_enabled__ ())
+    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
+  else
+    [retfile, retpath, retindex] = feval (funcname, outargs{:});
+  endif
+
+endfunction
+
+
+%!demo
+%! uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uimenu.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,147 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} uimenu (@var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} uimenu (@var{h}, @var{property}, @var{value}, @dots{})
+## Create a uimenu object and return a handle to it.  If @var{h} is omitted
+## then a top-level menu for the current figure is created.  If @var{h}
+## is given then a submenu relative to @var{h} is created.
+##
+## uimenu objects have the following specific properties:
+##
+## @table @asis
+## @item @qcode{"accelerator"}
+## A string containing the key combination together with CTRL to execute this
+## menu entry (e.g., @qcode{"x"} for CTRL+x).
+##
+## @item @qcode{"callback"}
+## Is the function called when this menu entry is executed.  It can be either a
+## function string (e.g., @qcode{"myfun"}), a function handle (e.g., @@myfun)
+## or a cell array containing the function handle and arguments for the
+## callback function (e.g., @{@@myfun, arg1, arg2@}).
+##
+## @item @qcode{"checked"}
+## Can be set @qcode{"on"} or @qcode{"off"}.  Sets a mark at this menu entry.
+##
+## @item @qcode{"enable"}
+## Can be set @qcode{"on"} or @qcode{"off"}.  If disabled the menu entry
+## cannot be selected and it is grayed out.
+##
+## @item @qcode{"foregroundcolor"}
+## A color value setting the text color for this menu entry.
+##
+## @item @qcode{"label"}
+## A string containing the label for this menu entry.  A @qcode{"&"}-symbol
+## can be used to mark the @qcode{"accelerator"} character (e.g.,
+## @nospell{@qcode{"E&xit"}})
+##
+## @item @qcode{"position"}
+## An scalar value containing the relative menu position.  The entry with the
+## lowest value is at the first position starting from left or top.
+##
+## @item @qcode{"separator"}
+## Can be set @qcode{"on"} or @qcode{"off"}.  If enabled it draws a separator
+## line above the current position.  It is ignored for top level entries.
+##
+## @end table
+##
+## Examples:
+##
+## @example
+## @group
+## f = uimenu ("label", "&File", "accelerator", "f");
+## e = uimenu ("label", "&Edit", "accelerator", "e");
+## uimenu (f, "label", "Close", "accelerator", "q", ...
+##            "callback", "close (gcf)");
+## uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ...
+##            "callback", "grid (gca)");
+## @end group
+## @end example
+## @seealso{figure}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function hui = uimenu (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uimenu", varargin, {"figure", "uicontextmenu", "uimenu"});
+
+  tmp = __go_uimenu__ (h, args{:});
+
+  if (nargout > 0)
+    hui = tmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! surfl (peaks);
+%! colormap (copper (64));
+%! shading ('interp');
+%! f = uimenu ('label', '&File', 'accelerator', 'f');
+%! e = uimenu ('label', '&Edit', 'accelerator', 'e');
+%! uimenu (f, 'label', 'Close', 'accelerator', 'q', 'callback', 'close (gcf)');
+%! uimenu (e, 'label', 'Toggle &Grid', 'accelerator', 'g', 'callback', 'grid (gca)');
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ui = uimenu ("label", "mylabel");
+%!   assert (findobj (hf, "type", "uimenu"), ui);
+%!   assert (get (ui, "label"), "mylabel");
+%!   assert (get (ui, "checked"), "off");
+%!   assert (get (ui, "separator"), "off");
+%!   assert (get (ui, "enable"), "on");
+%!   assert (get (ui, "position"), 9);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%% check for top level menus file, edit, and help
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   uif = findall (hf, "label", "&file");
+%!   assert (ishghandle (uif));
+%!   uie = findall (hf, "label", "&edit");
+%!   assert (ishghandle (uie));
+%!   uih = findall (hf, "label", "&help");
+%!   assert (ishghandle (uih));
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   uie = findall (hf, "label", "&edit");
+%!   myui = uimenu (uie, "label", "mylabel");
+%!   assert (ancestor (myui, "uimenu", "toplevel"), uie);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uipanel.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,32 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uipanel ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uipanel (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uipanel (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uipanel", varargin, {"figure", "uipanel", "uibuttongroup"});
+  handle = __go_uipanel__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uipushtool.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,40 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uipushtool ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uipushtool (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uipushtool (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uipushtool", varargin, {"uitoolbar"}, 0);
+  if (isempty (h))
+    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
+    if (isempty (h))
+      h = uitoolbar ();
+    else
+      h = h(1);
+    endif
+  endif
+  handle = __go_uipushtool__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uiputfile.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,136 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile ()
+## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt})
+## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name})
+## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name}, @var{default_file})
+## Open a GUI dialog for selecting a file.  @var{flt} contains a (list of) file
+## filter string(s) in one of the following formats:
+##
+## @table @asis
+## @item @qcode{"/path/to/filename.ext"}
+## If a filename is given the file extension is extracted and used as filter.
+## In addition the path is selected as current path and the filename is
+## selected as default file.  Example: @code{uiputfile ("myfun.m")}
+##
+## @item @qcode{"*.ext"}
+## A single file extension.
+## Example: @code{uiputfile ("*.ext")}
+##
+## @item @code{@{"*.ext", "My Description"@}}
+## A 2-column cell array containing the file extension in the 1st column and
+## a brief description in the 2nd column.
+## Example: @code{uiputfile (@{"*.ext","My Description";"*.xyz",
+## "XYZ-Format"@})}
+## @end table
+##
+## The filter string can also contain a semicolon separated list of filter
+## extensions.
+## Example: @code{uiputfile (@{"*.gif;*.png;*.jpg",
+## "Supported Picture Formats"@})}
+##
+## @var{dialog_name} can be used to customize the dialog title.
+## If @var{default_file} is given it is preselected in the GUI dialog.
+## If, in addition, a path is given it is also used as current path.
+## @seealso{uigetfile, uigetdir}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function [retfile, retpath, retindex] = uiputfile (varargin)
+
+  if (! __octave_link_enabled__ ())
+    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
+    funcname = ["__uiputfile_", defaulttoolkit, "__"];
+    functype = exist (funcname);
+    if (! __is_function__ (funcname))
+      funcname = "__uiputfile_fltk__";
+      if (! __is_function__ (funcname))
+        error ("uiputfile: fltk graphics toolkit required");
+      elseif (! strcmp (defaulttoolkit, "gnuplot"))
+        warning ("uiputfile: no implementation for toolkit '%s', using 'fltk' instead",
+               defaulttoolkit);
+      endif
+    endif
+  endif
+
+  if (nargin > 3)
+    print_usage ();
+  endif
+
+  defaultvals = {cell(0, 2),     # File Filter
+                 "Save File",    # Dialog Title
+                 "",             # Default file name
+                 [240, 120],     # Dialog Position (pixel x/y)
+                 "create",
+                 pwd};           # Default directory
+
+  outargs = cell (6, 1);
+  for i = 1 : 6
+    outargs{i} = defaultvals{i};
+  endfor
+
+  if (nargin > 0)
+    file_filter = varargin{1};
+    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
+    if (length (defdir) > 0)
+      outargs{6} = defdir;
+    endif
+  else
+    outargs{1} = __file_filter__ (outargs{1});
+  endif
+
+  if (nargin > 1)
+    if (ischar (varargin{2}))
+      outargs{2} = varargin{2};
+    elseif (! isempty (varargin{2}))
+      print_usage ();
+    endif
+  endif
+
+  if (nargin > 2)
+    if (ischar (varargin{3}))
+      [fdir, fname, fext] = fileparts (varargin{3});
+      if (! isempty (fdir))
+        outargs{6} = fdir;
+      endif
+      if (! isempty (fname) || ! isempty (fext))
+        outargs{3} = strcat (fname, fext);
+      endif
+    elseif (! isempty (varargin{3}))
+      print_usage ();
+    endif
+  endif
+
+  if (__octave_link_enabled__ ())
+    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
+  else
+    [retfile, retpath, retindex] = feval (funcname, outargs{:});
+  endif
+
+endfunction
+
+
+%!demo
+%! uiputfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uiresume.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,46 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} uiresume (@var{h})
+## Resume program execution suspended with @code{uiwait}.  The handle @var{h}
+## must be the same as the on specified in @code{uiwait}.  If the handle
+## is invalid or there is no @code{uiwait} call pending for the figure
+## with handle @var{h}, this function does nothing.
+## @seealso{uiwait}
+## @end deftypefn
+
+## Author: goffioul
+
+function uiresume (h)
+
+  if (! isfigure (h))
+    error ("uiresume: invalid figure handle H");
+  endif
+
+  try
+    uiwait_state = get (h, "__uiwait_state__");
+    if (strcmp (uiwait_state, "active"))
+      set (h, "__uiwait_state__", "triggered");
+    endif
+  catch
+    ## Ignore exception
+  end_try_catch
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uitoggletool.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,40 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uitoggletool ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uitoggletool (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uitoggletool (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0);
+  if (isempty (h))
+    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
+    if (isempty (h))
+      h = uitoolbar ();
+    else
+      h = h(1);
+    endif
+  endif
+  handle = __go_uitoggletool__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uitoolbar.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,32 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uitoolbar ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uitoolbar (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uitoolbar (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uitoolbar", varargin, {"figure"});
+  handle = __go_uitoolbar__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uiwait.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,81 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} uiwait
+## @deftypefnx {Function File} {} uiwait (@var{h})
+## @deftypefnx {Function File} {} uiwait (@var{h}, @var{timeout})
+## Suspend program execution until the figure with handle @var{h} is
+## deleted or @code{uiresume} is called.  When no figure handle is specified,
+## this function uses the current figure.
+##
+## If the figure handle is invalid or there is no current figure, this
+## functions returns immediately.
+##
+## When specified, @var{timeout} defines the number of seconds to wait
+## for the figure deletion or the @code{uiresume} call.  The timeout value
+## must be at least 1.  If a smaller value is specified, a warning is issued
+## and a timeout value of 1 is used instead.  If a non-integer value is
+## specified, it is truncated towards 0.  If @var{timeout} is not specified,
+## the program execution is suspended indefinitely.
+## @seealso{uiresume, waitfor}
+## @end deftypefn
+
+## Author: goffioul
+
+function uiwait (varargin)
+
+  h = [];
+  timeout = [];
+
+  if (nargin == 0)
+    h = get (0, "currentfigure");
+  else
+    h = varargin{1};
+    if (! isfigure (h))
+      error ("uiwait: invalid figure handle H");
+    endif
+    if (nargin > 1)
+      timeout = varargin{2};
+    endif
+  endif
+
+  if (! isempty (h))
+    unwind_protect
+      try
+        addproperty ("__uiwait_state__", h, "radio", "none|{active}|triggered");
+      catch
+        if (! strcmp (get (h, "__uiwait_state__"), "none"))
+          error ("uiwait: an active uiwait call for this figure already exists");
+        endif
+        set (h, "__uiwait_state__", "active");
+      end_try_catch
+      waitfor_args = {h, "__uiwait_state__", "triggered"};
+      if (! isempty (timeout))
+        waitfor_args(end+1:end+2) = {"timeout", timeout};
+      endif
+      waitfor (waitfor_args{:});
+    unwind_protect_cleanup
+      if (ishandle (h) && isprop (h, "__uiwait_state__"))
+        set (h, "__uiwait_state__", "none");
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/waitbar.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,199 @@
+## Copyright (C) 2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} waitbar (@var{frac})
+## @deftypefnx {Function File} {@var{h} =} waitbar (@var{frac}, @var{msg})
+## @deftypefnx {Function File} {@var{h} =} waitbar (@dots{}, "FigureProperty", "Value", @dots{})
+## @deftypefnx {Function File} {} waitbar (@var{frac})
+## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar})
+## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar}, @var{msg})
+## Return a handle @var{h} to a new waitbar object.
+##
+## The waitbar is filled to fraction @var{frac} which must be in the range
+## [0, 1].  The optional message @var{msg} is centered and displayed above the
+## waitbar.  The appearance of the waitbar figure window can be configured by
+## passing property/value pairs to the function.
+## 
+## When called with a single input the current waitbar, if it exists, is
+## updated to the new value @var{frac}.  If there are multiple outstanding
+## waitbars they can be updated individually by passing the handle @var{hwbar}
+## of the specific waitbar to modify.
+## @end deftypefn
+
+## Author: jwe
+
+function h = waitbar (varargin)
+
+  persistent curr_waitbar;
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  frac = varargin{1};
+  varargin(1) = [];
+
+  if (! (isnumeric (frac) && isscalar (frac) && frac >= 0 && frac <= 1))
+    error ("waitbar: FRAC must be between 0 and 1");
+  endif
+
+  ## Use existing waitbar if it still points to a valid graphics handle.
+  if (nargin == 1 && ishandle (curr_waitbar))
+    hf = curr_waitbar;
+  else
+    hf = false;
+  endif
+
+  if (! isempty (varargin) && isnumeric (varargin{1}))
+    hf = varargin{1};
+    varargin(1) = [];
+    if (! isfigure (hf) || ! strcmp (get (hf, "tag"), "waitbar"))
+      error ("waitbar: H must be a handle to a waitbar object");
+    endif
+  endif
+
+  msg = false;
+
+  if (! isempty (varargin))
+    msg = varargin{1};
+    varargin(1) = [];
+    if (! (ischar (msg) || iscellstr (msg)))
+      error ("waitbar: MSG must be a character string or cell array of strings");
+    endif
+  endif
+
+  if (rem (numel (varargin), 2) != 0)
+    error ("waitbar: invalid number of property/value pairs");
+  endif
+
+  if (hf)
+    gd = get (hf, "__guidata__");
+    ## Get the cached handles.
+    ax = gd(1);
+    hp = gd(2);
+
+    set (hp, "xdata", [0; frac; frac; 0]);
+
+    if (ischar (msg) || iscellstr (msg))
+      th = get (ax, "title");
+      curr_msg = get (th, "string");
+      ## graphics handles always store data as column vectors
+      if (iscellstr (msg))
+        msg = msg(:);  
+      endif
+      cmp = strcmp (msg, curr_msg);
+      if (! all (cmp(:)))
+        set (th, "string", msg);
+      endif
+    endif
+  else
+    ## Save and restore current figure
+    cf = get (0, "currentfigure");
+
+    hf = figure ("position", [250, 500, 400, 100],
+                 "numbertitle", "off",
+                 "menubar", "none", "toolbar", "none",
+                 "integerhandle", "off",
+                 "handlevisibility", "callback",
+                 "tag", "waitbar",
+                 varargin{:});
+
+    ax = axes ("parent", hf,
+               "xtick", [], "ytick", [],
+               "xlim", [0, 1], "ylim", [0, 1],
+               "position", [0.1, 0.3, 0.8, 0.2]);
+
+    hp = patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]);
+
+    ## Cache the axes and patch handles.
+    set (hf, "__guidata__", [ax hp]);
+
+    if (! (ischar (msg) || iscellstr (msg)))
+      msg = "Please wait...";
+    endif
+    title (ax, msg);
+
+    if (! isempty (cf))
+      set (0, "currentfigure", cf);
+    endif
+  endif
+
+  drawnow ();
+
+  if (nargout > 0)
+    h = hf;
+  endif
+
+  ## If there were no errors, update current waitbar.
+  curr_waitbar = hf;
+
+endfunction
+
+
+%!demo
+%! h = waitbar (0, '0.00%');
+%! for i = 0:0.01:1
+%!   waitbar (i, h, sprintf ('%.2f%%', 100*i));
+%! end
+%! close (h);
+
+%!demo
+%! h = waitbar (0, 'please wait...');
+%! for i = 0:0.01:0.6
+%!   waitbar (i);
+%! end
+%! i = 0.3;
+%! waitbar (i, h, 'don''t you hate taking a step backward?');
+%! pause (0.5);
+%! for i = i:0.005:0.7
+%!   waitbar (i, h);
+%! end
+%! waitbar (i, h, 'or stalling?');
+%! pause (1);
+%! for i = i:0.003:0.8
+%!   waitbar (i, h, 'just a little longer now');
+%! end
+%! for i = i:0.001:1
+%!   waitbar (i, h, 'please don''t be impatient');
+%! end
+%! close (h);
+
+%!demo
+%! h1 = waitbar (0, 'Waitbar #1');
+%! h2 = waitbar (0, 'Waitbar #2');
+%! h2pos = get (h2, 'position');
+%! h2pos(1) = h2pos(1) + (h2pos(3) + 50);
+%! set (h2, 'position', h2pos);
+%! pause (0.5);
+%! for i = 1:4
+%!   waitbar (i/4, h1);
+%!   pause (0.5);
+%!   waitbar (i/4, h2);
+%!   pause (0.5);
+%! end
+%! pause (0.5);
+%! close (h1);
+%! close (h2);
+
+%% Test input validation
+%!error <FRAC must be between 0 and 1> waitbar (-0.5)
+%!error <FRAC must be between 0 and 1> waitbar (1.5)
+%!error <MSG must be a character string> waitbar (0.5, struct ())
+%!error <invalid number of property/value pairs> waitbar (0.5, "msg", "Name")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/waitforbuttonpress.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,55 @@
+## Copyright (C) 2004-2012 Petr Mikulik
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} waitforbuttonpress ()
+## @deftypefnx {Function File} {@var{a} =} waitforbuttonpress ()
+## Wait for mouse click or key press over the current figure window.
+##
+## The return value of @var{b} is 0 if a mouse button was pressed or 1 if a
+## key was pressed.
+## @seealso{waitfor, ginput, kbhit}
+## @end deftypefn
+
+## The original version of this code bore the copyright
+## Author: Petr Mikulik
+## License: public domain
+
+function b = waitforbuttonpress ()
+
+  if (nargin != 0 || nargout > 1)
+    print_usage ();
+  endif
+
+  [x, y, k] = ginput (1);
+
+  if (nargout == 1)
+    if (k <= 5)
+      b = 0;
+    else
+      b = 1;
+    endif
+  endif
+
+endfunction
+
+
+%% Test input validation
+%!error waitforbuttonpress (1)
+%!error [a,b,c] = waitforbuttonpress ()
+
--- a/scripts/plot/__gnuplot_drawnow__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,410 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __gnuplot_drawnow__ (@var{h}, @var{term}, @var{file}, @var{mono}, @var{debug_file})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function __gnuplot_drawnow__ (h, term, file, mono = false, debug_file)
-
-  if (nargin < 1 || nargin > 5 || nargin == 2)
-    print_usage ();
-  endif
-
-  if (nargin >= 3 && nargin <= 5)
-    ## Produce various output formats, or redirect gnuplot stream to a
-    ## debug file.
-    plot_stream = [];
-    fid = [];
-    default_plot_stream = get (h, "__plot_stream__");
-    unwind_protect
-      plot_stream = __gnuplot_open_stream__ (2, h);
-      gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream);
-      if (gnuplot_supports_term)
-        enhanced = gnuplot_set_term (plot_stream(1), true, h, term, file);
-        __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
-        if (nargin == 5)
-          fid = fopen (debug_file, "wb");
-          enhanced = gnuplot_set_term (fid, true, h, term, file);
-          __go_draw_figure__ (h, fid, enhanced, mono);
-        endif
-      else
-        error ('__gnuplot_drawnow__: the gnuplot terminal, "%s", is not available',
-               gnuplot_trim_term (term));
-      endif
-    unwind_protect_cleanup
-      set (h, "__plot_stream__", default_plot_stream);
-      if (! isempty (plot_stream))
-        pclose (plot_stream(1));
-        if (numel (plot_stream) > 1)
-          pclose (plot_stream(2));
-        endif
-        if (numel (plot_stream) > 2)
-          waitpid (plot_stream(3));
-        endif
-      endif
-      if (! isempty (fid))
-        fclose (fid);
-      endif
-    end_unwind_protect
-  else  # nargin == 1
-    ##  Graphics terminal for display.
-    plot_stream = get (h, "__plot_stream__");
-    if (isempty (plot_stream))
-      plot_stream = __gnuplot_open_stream__ (2, h);
-      new_stream = true;
-    else
-      new_stream = false;
-    endif
-    term = gnuplot_default_term (plot_stream);
-    if (strcmp (term, "dumb"))
-      ## popen2 eats stdout of gnuplot, use temporary file instead
-      dumb_tmp_file = tmpnam ();
-      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h,
-                                   term, dumb_tmp_file);
-    else
-      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h, term);
-    endif
-    __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
-    fflush (plot_stream(1));
-    if (strcmp (term, "dumb"))
-      fid = -1;
-      while (fid < 0)
-        pause (0.1);
-        fid = fopen (dumb_tmp_file, 'r');
-      endwhile
-      ## reprint the plot on screen
-      [a, count] = fscanf (fid, '%c', Inf);
-      fclose (fid);
-      if (count > 0)
-        if (a(1) == 12)
-          a = a(2:end);  # avoid ^L at the beginning
-        endif
-        puts (a);
-      endif
-      unlink (dumb_tmp_file);
-    endif
-  endif
-
-endfunction
-
-function enhanced = gnuplot_set_term (plot_stream, new_stream, h, term, file)
-  ## Generate the gnuplot "set terminal <term> ..." command.
-  ## When "term" originates from print.m, it may include other options.
-  if (nargin < 4)
-    ## This supports the gnuplot graphics toolkit.
-    term = gnuplot_default_term (plot_stream);
-    opts_str = "";
-  else
-    ## Get the one word terminal id and save the remaining as options to be
-    ## passed on to gnuplot.  The terminal may respect the graphics toolkit.
-    [term, opts_str] = gnuplot_trim_term (term);
-    term = lower (term);
-    if (strcmp (term, "lua"))
-      ## Replace "lua tikz" with just "tikz"
-      term = "tikz";
-      opts_str = strrep (opts_str, "tikz", "");
-    endif
-  endif
-
-  if (strfind (opts_str, "noenhanced"))
-    enhanced = false;
-  else
-    enhanced = gnuplot_is_enhanced_term (plot_stream, term);
-  endif
-
-  ## Set the terminal.
-  if (! isempty (term))
-
-    if (enhanced)
-      enh_str = "enhanced";
-    else
-      enh_str = "";
-    endif
-
-    if (! isempty (h) && isfigure (h))
-
-      ## Generate gnuplot title string for plot windows.
-      if (output_to_screen (term) && ! strcmp (term, "dumb"))
-        fig.numbertitle = get (h, "numbertitle");
-        fig.name = strrep (get (h, "name"), '"', '\"');
-        if (strcmp (get (h, "numbertitle"), "on"))
-          title_str = sprintf ("Figure %d", h);
-        else
-          title_str = "";
-        endif
-        if (! isempty (fig.name) && ! isempty (title_str))
-          title_str = sprintf ("%s: %s", title_str, fig.name);
-        elseif (! isempty (fig.name) && isempty (title_str))
-          title_str = fig.name;
-        endif
-        if (! isempty (title_str))
-          title_str = sprintf ('title "%s"', title_str);
-        endif
-        if (strcmp (term, "aqua"))
-          ## Adjust axes-label and tick-label spacing.
-          opts_str = sprintf ('%s font "%s,%d"', opts_str,
-                              get (0, "defaultaxesfontname"),
-                              get (0, "defaultaxesfontsize") / 1.5);
-        endif
-      else
-        title_str = "";
-      endif
-
-      if (! (any (strfind (opts_str, " size ") > 0)
-          || any (strfind (opts_str, "size ") == 1)))
-        ## Get figure size in pixels.  Rely on listener to handle coversion.
-        units = get (h, "units");
-        unwind_protect
-          set (h, "units", "pixels");
-          position_in_pixels = get (h, "position");
-        unwind_protect_cleanup
-          set (h, "units", units);
-        end_unwind_protect
-        gnuplot_pos = position_in_pixels(1:2);
-        gnuplot_size = position_in_pixels(3:4);
-        if (! (output_to_screen (term)
-               || any (strcmp (term, {"canvas", "emf", "gif", "jpeg", ...
-                                      "pbm", "png", "pngcairo", "svg"}))))
-          ## Convert to inches
-          gnuplot_pos = gnuplot_pos / 72;
-          gnuplot_size = gnuplot_size / 72;
-        endif
-        if (all (gnuplot_size > 0))
-          terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
-                                 "gif", "jpeg", "latex", "pbm", "pdf", ...
-                                 "pdfcairo", "postscript", "png", ...
-                                 "pngcairo", "pstex", "pslatex", "svg", "tikz"};
-          if (__gnuplot_has_feature__ ("windows_figure_position"))
-            terminals_with_size{end+1} = "windows";
-          endif
-          if (__gnuplot_has_feature__ ("x11_figure_position"))
-            terminals_with_size{end+1} = "x11";
-          endif
-          if (__gnuplot_has_feature__ ("wxt_figure_size"))
-            terminals_with_size{end+1} = "wxt";
-          endif
-          switch (term)
-            case terminals_with_size
-              size_str = sprintf ("size %.12g,%.12g", gnuplot_size);
-            case "tikz"
-              size_str = sprintf ("size %gin,%gin", gnuplot_size);
-            case "dumb"
-              new_stream = 1;
-              if (!isempty (getenv ("COLUMNS")) && !isempty (getenv ("LINES")))
-                ## Let dumb use full text screen size (minus prompt lines).
-                n = sprintf ("%i", -2 - length (find (sprintf ("%s", PS1) == "\n")));
-                ## n = the number of times \n appears in PS1
-                size_str = ["size " getenv("COLUMNS") "," getenv("LINES") n];
-              else
-                ## Use the gnuplot default.
-                size_str = "";
-              endif
-            case {"aqua", "fig", "corel"}
-              size_str = sprintf ("size %g %g", gnuplot_size);
-            case "dxf"
-              size_str = "";
-            otherwise
-              size_str = "";
-          endswitch
-          if ((strcmp (term, "x11")
-               && __gnuplot_has_feature__ ("x11_figure_position"))
-              || (strcmpi (term, "windows")
-                  && __gnuplot_has_feature__ ("windows_figure_position")))
-            ## X11/Windows allows the window to be positioned as well.
-            units = get (0, "units");
-            unwind_protect
-              set (0, "units", "pixels");
-              screen_size = get (0, "screensize")(3:4);
-            unwind_protect_cleanup
-              set (0, "units", units);
-            end_unwind_protect
-            if (all (screen_size > 0))
-              ## For X11/Windows, set the figure positon as well as the size
-              ## gnuplot position is UL, Octave's is LL (same for screen/window)
-              gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2);
-              gnuplot_pos = max (gnuplot_pos, 1);
-              size_str = sprintf ("%s position %d,%d", size_str,
-                                  gnuplot_pos(1), gnuplot_pos(2));
-            endif
-          endif
-        else
-          size_str = "";
-          warning ("gnuplot_set_term: size is zero");
-        endif
-      else
-        ## A specified size take priority over the figure properies.
-        size_str = "";
-      endif
-    else
-      if (isempty (h))
-        disp ("gnuplot_set_term: figure handle is empty");
-      elseif (! isfigure (h))
-        disp ("gnuplot_set_term: not a figure handle");
-      endif
-      title_str = "";
-      size_str = "";
-    endif
-
-    ## Set the gnuplot terminal (type, enhanced, title, options & size).
-    term_str = ["set terminal " term];
-    if (! isempty (enh_str))
-      term_str = [term_str " " enh_str];
-    endif
-    if (! isempty (title_str))
-      term_str = [term_str " " title_str];
-    endif
-    if (isempty (strfind (term, "corel")))
-      if (! isempty (size_str) && new_stream)
-        ## size_str comes after other options to permit specification of
-        ## the canvas size for terminals cdr/corel.
-        term_str = [term_str " " size_str];
-      endif
-      if (nargin > 3 && ischar (opts_str))
-        ## Options must go last.
-        term_str = [term_str " " opts_str];
-      endif
-    else
-      if (nargin > 3 && ischar (opts_str))
-        ## Options must go last.
-        term_str = [term_str " " opts_str];
-      endif
-      if (! isempty (size_str) && new_stream)
-        ## size_str comes after other options to permit specification of
-        ## the canvas size for terminals cdr/corel.
-        term_str = [term_str " " size_str];
-      endif
-    endif
-    if (! __gnuplot_has_feature__ ("has_termoption_dashed"))
-      ## If "set termoption dashed" isn't available add "dashed" option
-      ## to the "set terminal ..." command, if it is supported.
-      if (any (strcmp (term, {"aqua", "cgm", "eepic", "emf", "epslatex", ...
-                              "fig", "pcl5", "mp", "next", "openstep", "pdf", ...
-                              "pdfcairo", "pngcairo", "postscript", ...
-                              "pslatex", "pstext", "svg", "tgif", "x11"})))
-        term_str = [term_str " dashed"];
-      endif
-    endif
-    if (any (strcmp (term, {"aqua", "wxt"})))
-      term_str = [term_str, " ", "dashlength 1"];
-    elseif (any (strcmp (term, {"epslatex", "postscript", "pslatex"})))
-      term_str = [term_str, " ", "dashlength 2"];
-    endif
-
-    ## Work around the gnuplot feature of growing the x11 window and
-    ## flickering window (x11, windows, & wxt) when the mouse and
-    ## multiplot are set in gnuplot.
-    fputs (plot_stream, "unset multiplot;\n");
-    flickering_terms = {"x11", "windows", "wxt", "dumb"};
-    if (! any (strcmp (term, flickering_terms))
-        || have_non_legend_axes (h)
-        || numel (findall (h, "type", "image")) > 0)
-      fprintf (plot_stream, "%s\n", term_str);
-      if (nargin == 5)
-        if (! isempty (file))
-          fprintf (plot_stream, "set output '%s';\n", file);
-        endif
-      endif
-      fputs (plot_stream, "set multiplot;\n");
-    elseif (any (strcmp (term, flickering_terms)))
-      fprintf (plot_stream, "%s\n", term_str);
-      if (nargin == 5)
-        if (! isempty (file))
-          fprintf (plot_stream, "set output '%s';\n", file);
-        endif
-      endif
-    endif
-    if (__gnuplot_has_feature__ ("has_termoption_dashed"))
-      fprintf (plot_stream, "set termoption dashed\n")
-    endif
-  else
-    ## gnuplot will pick up the GNUTERM environment variable itself
-    ## so no need to set the terminal type if not also setting the
-    ## figure title, enhanced mode, or position.
-  endif
-
-endfunction
-
-function term = gnuplot_default_term (plot_stream)
-  term = lower (getenv ("GNUTERM"));
-  ## If not specified, guess the terminal type.
-  if (isempty (term) || ! __gnuplot_has_terminal__ (term, plot_stream))
-    if (isguirunning () && __gnuplot_has_terminal__ ("qt", plot_stream))
-      term = "qt";
-    elseif (ismac ())
-      term = "aqua";
-    elseif (! isunix ())
-      term = "windows";
-    elseif (! isempty (getenv ("DISPLAY")))
-      term = "x11";
-    else
-      term = "dumb";
-    endif
-  endif
-endfunction
-
-function [term, opts] = gnuplot_trim_term (string)
-  ## Extract the terminal type and terminal options (from print.m)
-  string = strtrim (string);
-  [term, opts] = strtok (string, ' ');
-  if (! isempty (opts))
-    opts(1) = "";  # trim extra space from strtok
-  endif
-endfunction
-
-function have_enhanced = gnuplot_is_enhanced_term (plot_stream, term)
-  ## Don't include pstex, pslatex or epslatex here as the TeX commands
-  ## should not be interpreted in that case.
-  persistent enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", ...
-                                   "jpeg", "pdf", "pdfcairo", "pm", "png", ...
-                                   "pngcairo", "postscript", "qt", "svg",  ...
-                                   "windows", "wxt", "x11"};
-
-  if (nargin < 2)
-    ## Determine the default gnuplot terminal.
-    term = gnuplot_default_term (plot_stream);
-  endif
-  have_enhanced = any (strcmp (term, enhanced_terminals));
-endfunction
-
-function ret = output_to_screen (term)
-  ret = any (strcmpi (term, 
-                     {"aqua", "dumb", "pm", "qt", "windows", "wxt", "x11"}));
-endfunction
-
-function retval = have_non_legend_axes (h)
-  retval = false;
-  all_axes = findall (h, "type", "axes");
-  if (! isempty (all_axes))
-    n_all_axes = numel (all_axes);
-    all_axes_tags = get (all_axes, "tag");
-    legend_axes = strcmp (all_axes_tags, "legend");
-    if (! isempty (legend_axes))
-      n_legend_axes = sum (legend_axes);
-      retval = (n_all_axes - n_legend_axes) > 1;
-    endif
-  endif
-endfunction
-
-
-## No test needed for internal helper function.
-%!assert (1)
-
--- a/scripts/plot/__plt_get_axis_arg__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{h}, @var{varargin}, @var{narg}] =} __plt_get_axis_arg__ (@var{caller}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin)
-
-  h = [];
-  parent = find (strcmpi (varargin, "parent"), 1);
-  
-
-  ## Look for a scalar which is a graphics handle but not the
-  ## Root Figure (0) or an ordinary figure (integer).
-  if (numel (varargin) > 0 && numel (varargin{1}) == 1
-      && ishandle (varargin{1}) && varargin{1} != 0 && ! isfigure (varargin{1}))
-    htmp = varargin{1};
-    if (! isaxes (htmp))
-      error ("%s: expecting first argument to be axes handle", caller);
-    endif
-    if (! strcmp (get (htmp, "tag"), "legend"))
-      h = htmp;
-      varargin(1) = [];
-    endif
-  ## Look for "parent"/axis prop/value pair
-  elseif (numel (varargin) > 1 && ! isempty (parent))
-    if (parent < numel (varargin) && ishandle (varargin{parent+1}))
-      htmp = varargin{parent+1};
-      if (isaxes (htmp) && ! strcmp (get (htmp, "tag"), "legend"))
-        h = htmp;
-        varargin(parent:parent+1) = [];
-      else
-        ## 'parent' property for some other type like hggroup
-        h = ancestor (htmp, "axes");
-      endif
-    else
-      error ("%s: expecting parent value to be axes handle", caller);
-    endif
-  endif
-
-  narg = length (varargin);
-
-endfunction
-
-
-## No test needed for internal helper function.
-%!assert (1)
-
--- a/scripts/plot/allchild.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-## Copyright (C) 2008-2012 Bill Denney
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} allchild (@var{handles})
-## Find all children, including hidden children, of a graphics object.
-##
-## This function is similar to @code{get (h, "children")}, but also returns
-## hidden objects (HandleVisibility = @qcode{"off"}).  If @var{handles} is a
-## scalar, @var{h} will be a vector.  Otherwise, @var{h} will be a cell
-## matrix of the same size as @var{handles} and each cell will contain a
-## vector of handles.
-## @seealso{findall, findobj, get, set}
-## @end deftypefn
-
-## Author: Bill Denney <bill@denney.ws>
-
-function h = allchild (handles)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  shh = get (0, "showhiddenhandles");
-  unwind_protect
-    set (0, "showhiddenhandles", "on");
-    h = get (handles, "children");
-  unwind_protect_cleanup
-    set (0, "showhiddenhandles", shh);
-  end_unwind_protect
-
-endfunction
-
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   kids = allchild (hf);
-%!   assert (get (kids, "type"), {"axes"; "uimenu"; "uimenu"; "uimenu"});
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
-%!error allchild ()
-%!error allchild (1, 2)
-
--- a/scripts/plot/ancestor.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{parent} =} ancestor (@var{h}, @var{type})
-## @deftypefnx {Function File} {@var{parent} =} ancestor (@var{h}, @var{type}, "toplevel")
-## Return the first ancestor of handle object @var{h} whose type matches
-## @var{type}, where @var{type} is a character string.  If @var{type} is a
-## cell array of strings, return the first parent whose type matches
-## any of the given type strings.
-##
-## If the handle object @var{h} itself is of type @var{type}, return @var{h}.
-##
-## If @qcode{"toplevel"} is given as a third argument, return the highest
-## parent in the object hierarchy that matches the condition, instead
-## of the first (nearest) one.
-## @seealso{findobj, findall, allchild}
-## @end deftypefn
-
-function p = ancestor (h, type, toplevel)
-
-  if (nargin < 2 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (ischar (type))
-    type = { type };
-  elseif (! iscellstr (type))
-    error ("ancestor: TYPE must be a string or cell array of strings");
-  endif
-
-  find_first = true;
-  if (nargin == 3)
-    if (ischar (toplevel) && strcmpi (toplevel, "toplevel"))
-      find_first = false;
-    else
-      error ('ancestor: third argument must be "toplevel"');
-    endif
-  endif
-
-  if (isempty (h))
-    p = [];
-  else
-    p = cell (numel (h), 1);
-    h = num2cell (h);
-    for nh = 1:numel (h)
-      while (true)
-        if (isempty (h{nh}) || ! ishandle (h{nh}))
-          break;
-        endif
-        if (any (strcmpi (get (h{nh}, "type"), type)))
-          p{nh} = h{nh};
-          if (find_first)
-            break;
-          endif
-        endif
-        h{nh} = get (h{nh}, "parent");
-      endwhile
-    endfor
-    if (nh == 1)
-      p = p{1};
-    endif
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   hl = line;
-%!   assert (ancestor (hl, "axes"), gca);
-%!   assert (ancestor (hl, "figure"), hf);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!    hg1 = hggroup ("parent", gca);
-%!    hg2 = hggroup ("parent", hg1);
-%!    hl = line ("parent", hg2);
-%!    assert (ancestor (hl, "line"), hl);
-%!    assert (ancestor (hl, "axes"), gca);
-%!    assert (ancestor (hl, "figure"), hf);
-%!    assert (ancestor (hl, "hggroup"), hg2);
-%!    assert (ancestor (hl, "hggroup", "toplevel"), hg1);
-%!    assert (ancestor (hl, {"hggroup", "axes"}), hg2);
-%!    assert (ancestor (hl, {"hggroup", "axes"}, "toplevel"), gca);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!assert (ancestor ([], "axes"), [])
-
-%!error ancestor ()
-%!error ancestor (1,2,3)
-%!error <TYPE must be a string> ancestor (1,2)
-%!error <third argument must be "toplevel"> ancestor (1, "axes", "foo")
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/__clabel__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,129 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __clabel__ (@var{c}, @var{v}, @var{hparent}, @var{label_spacing}, @var{z}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+function h = __clabel__ (c, v, hparent, label_spacing, z, varargin)
+
+  hax = ancestor (hparent, "axes");
+  units = get (hax, "units");
+  set (hax, "units", "points");
+  axpos = get (hax, "position");
+  set (hax, "units", units);
+  lims = axis ();
+  xspacing = axpos(3) / (lims(2) - lims (1));
+  yspacing = axpos(4) / (lims(4) - lims (3));
+
+  if (isscalar (hparent) && ishandle (hparent)
+      && strcmp (get (hparent, "type"), "hggroup"))
+    x = get (hparent, "xdata");
+    xmin = min (x(:));
+    xmax = max (x(:));
+    y = get (hparent, "ydata");
+    ymin = min (y(:));
+    ymax = max (y(:));
+  else
+    xmin = xmax = ymin = ymax = NaN;
+    i = 1;
+    while (i < length (c))
+      clen = c(2,i);
+      data = c(:, i+(1:clen));
+
+      xmin = min ([xmin, data(1,:)]);
+      xmax = max ([xmax, data(1,:)]);
+      ymin = min ([ymin, data(2,:)]);
+      ymax = max ([ymax, data(2,:)]);
+
+      i += clen+1;
+    endwhile
+  endif
+
+  ## Decode contourc output format and place labels.
+  h = [];
+  i = 1;
+  while (i < length (c))
+    clev = c(1,i);
+    clen = c(2,i);
+
+    if (! isempty (v) && ! any (v == clev))
+      i += clen+1;
+      continue;
+    endif
+
+    p = bsxfun (@times, c(:, i+(1:clen)), [xspacing; yspacing]);
+    d = sqrt (sumsq (diff (p, 1, 2)));
+    cumd = cumsum (d);
+    td = cumd(end);
+    ntag = ceil (td / label_spacing);
+
+    if (all (c(:,i+1) == c(:,i+clen)))
+      ## Closed contour
+      ## FIXME: This spreads the tags uniformly around the contour which
+      ## looks nice, but it does not respect the label_spacing attribute.
+      ## Should we follow user input, which can result in two labels being
+      ## quite close to each other?
+      spacing = td / ntag;
+      pos = spacing/2 + spacing*[0:ntag-1];
+    else
+      ## Open contour
+      pos = zeros (1, ntag);
+      pos(1) = (td - label_spacing*(ntag - 1)) / 2;
+      pos(2:ntag) = pos(1) + label_spacing*[1:ntag-1];
+    endif
+
+    tlabel = sprintf ("%.5g", clev);
+
+    for tagpos = pos
+
+      j = find (cumd > tagpos, 1);
+      if (isempty (j))
+        j = clen;
+      endif
+      tpos = sum (c(:,i+j-1:i+j), 2) / 2;
+
+      if (   tpos(1) != xmin && tpos(1) != xmax
+          && tpos(2) != ymin && tpos(2) != ymax)
+        trot = 180 / pi * atan2 (diff (c(2,i+j-1:i+j)),
+                                 diff (c(1,i+j-1:i+j)));
+        if (abs (trot) > 90)
+          trot += 180;
+        endif
+        if (ischar (z))
+          ht = text (tpos(1), tpos(2), clev, tlabel, "rotation", trot,
+                     "horizontalalignment", "center", "userdata", clev,
+                     "parent", hparent, varargin{:});
+        elseif (! isempty (z))
+          ht = text (tpos(1), tpos(2), z, tlabel, "rotation", trot,
+                     "horizontalalignment", "center", "userdata", clev,
+                     "parent", hparent, varargin{:});
+        else
+          ht = text (tpos(1), tpos(2), tlabel, "rotation", trot,
+                     "horizontalalignment", "center", "userdata", clev,
+                     "parent", hparent, varargin{:});
+        endif
+        h = [h; ht];
+      endif
+    endfor
+    i += clen+1;
+  endwhile
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/__getlegenddata__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,61 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{hplots}, @var{strings}]} = __getlegenddata__ (@var{h})
+## Undocumented internal function.
+## @end deftypefn
+
+function [hplots, text_strings] = __getlegenddata__ (hlegend)
+
+  hplots = [];
+  text_strings = {};
+  ca = getfield (get (hlegend, "userdata"), "handle");
+  if (numel (ca) == 1)
+    kids = get (ca, "children");
+  else
+    kids = [get(kids, "children"){:}];
+  endif
+
+  for i = numel (kids):-1:1
+    typ = get (kids(i), "type");
+    if (any (strcmp (typ, {"line", "patch", "surface", "hggroup"})))
+      if (strcmp (typ, "hggroup"))
+        hgkids = get (kids(i), "children");
+        for j = 1 : length (hgkids)
+          try
+            dname = get (hgkids(j), "DisplayName");
+            if (! isempty (dname))
+              hplots(end+1) = hgkids(j);
+              text_strings(end+1) = dname;
+              break;  # break from j-loop over hgkids
+            endif
+          end_try_catch
+        endfor
+      else
+        dname = get (kids(i), "DisplayName");
+        if (! isempty (dname))
+          hplots(end+1) = kids(i);
+          text_strings(end+1) = dname;
+        endif
+      endif
+    endif
+  endfor
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/axis.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,627 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} axis ()
+## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi])
+## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi])
+## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi @var{z}_lo @var{z}_hi])
+## @deftypefnx {Function File} {} axis (@var{option})
+## @deftypefnx {Function File} {} axis (@dots{}, @var{option})
+## @deftypefnx {Function File} {} axis (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{limits} =} axis ()
+## Set axis limits and appearance.
+##
+## The argument @var{limits} should be a 2-, 4-, or 6-element vector.  The
+## first and second elements specify the lower and upper limits for the
+## x-axis.  The third and fourth specify the limits for the y-axis, and the
+## fifth and sixth specify the limits for the z-axis.
+##
+## Without any arguments, @code{axis} turns autoscaling on.
+##
+## With one output argument, @code{@var{limits} = axis} returns the current
+## axis limits.
+##
+## The vector argument specifying limits is optional, and additional
+## string arguments may be used to specify various axis properties.  For
+## example,
+##
+## @example
+## axis ([1, 2, 3, 4], "square");
+## @end example
+##
+## @noindent
+## forces a square aspect ratio, and
+##
+## @example
+## axis ("tic", "labely");
+## @end example
+##
+## @noindent
+## turns tic marks on for all axes and tic mark labels on for the y-axis
+## only.
+##
+## @noindent
+## The following options control the aspect ratio of the axes.
+##
+## @table @asis
+## @item @qcode{"square"}
+## Force a square aspect ratio.
+##
+## @item @qcode{"equal"}
+## Force x distance to equal y-distance.
+##
+## @item @qcode{"normal"}
+## Restore default aspect ratio.
+## @end table
+##
+## @noindent
+## The following options control the way axis limits are interpreted.
+##
+## @table @asis
+## @item @qcode{"auto"}
+## Set the specified axes to have nice limits around the data
+## or all if no axes are specified.
+##
+## @item @qcode{"manual"}
+## Fix the current axes limits.
+##
+## @item @qcode{"tight"}
+## Fix axes to the limits of the data.
+##
+## @item @qcode{"image"}
+## Equivalent to @qcode{"tight"} and @qcode{"equal"}.
+## @end table
+##
+## @noindent
+## The following options affect the appearance of tic marks.
+##
+## @table @asis
+## @item @qcode{"on"}
+## Turn tic marks and labels on for all axes.
+##
+## @item @qcode{"off"}
+## Turn tic marks off for all axes.
+##
+## @item @qcode{"tic[xyz]"}
+## Turn tic marks on for all axes, or turn them on for the
+## specified axes and off for the remainder.
+##
+## @item @qcode{"label[xyz]"}
+## Turn tic labels on for all axes, or turn them on for the
+## specified axes and off for the remainder.
+##
+## @item @qcode{"nolabel"}
+## Turn tic labels off for all axes.
+## @end table
+##
+## Note, if there are no tic marks for an axis, there can be no labels.
+##
+## @noindent
+## The following options affect the direction of increasing values on the axes.
+##
+## @table @asis
+## @item @qcode{"ij"}
+## Reverse y-axis, so lower values are nearer the top.
+##
+## @item @qcode{"xy"}
+## Restore y-axis, so higher values are nearer the top.
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axes rather than the current axes returned by @code{gca}.
+##
+## @seealso{xlim, ylim, zlim, daspect, pbaspect, box, grid}
+## @end deftypefn
+
+## Author: jwe
+
+function limits = axis (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    if (nargin == 0)
+      limits = __axis__ (hax, varargin{:});
+    else
+      __axis__ (hax, varargin{:});
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+function limits = __axis__ (ca, ax, varargin)
+
+  if (nargin == 1)
+    if (nargout == 0)
+      set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
+    else
+      xlim = get (ca, "xlim");
+      ylim = get (ca, "ylim");
+      view = get (ca, "view");
+      if (view(2) == 90)
+        limits = [xlim, ylim];
+      else
+        zlim = get (ca, "zlim");
+        limits = [xlim, ylim, zlim];
+      endif
+    endif
+
+  elseif (ischar (ax))
+    len = length (ax);
+
+    ## 'matrix mode' to reverse the y-axis
+    if (strcmpi (ax, "ij"))
+      set (ca, "ydir", "reverse");
+    elseif (strcmpi (ax, "xy"))
+      set (ca, "ydir", "normal");
+
+      ## aspect ratio
+    elseif (strcmpi (ax, "image"))
+      __axis__ (ca, "equal");
+      __do_tight_option__ (ca);
+    elseif (strcmpi (ax, "square"))
+      set (ca, "plotboxaspectratio", [1, 1, 1]);
+    elseif (strcmp (ax, "equal"))
+      if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot"))
+        ## FIXME - gnuplot applies the aspect ratio activepostionproperty.
+        set (ca, "activepositionproperty", "position");
+        ## The following line is a trick used to trigger the recalculation of
+        ## aspect related magnitudes even if the aspect ratio is the same
+        ## (useful with the x11 gnuplot terminal after a window resize)
+        set (ca, "dataaspectratiomode", "auto");
+      endif
+      set (ca, "dataaspectratio", [1, 1, 1]);
+    elseif (strcmpi (ax, "normal"))
+      set (ca, "plotboxaspectratio", [1, 1, 1]);
+      set (ca, "plotboxaspectratiomode", "auto");
+
+      ## axis limits
+    elseif (len >= 4 && strcmpi (ax(1:4), "auto"))
+      if (len > 4)
+        if (any (ax == "x"))
+          set (ca, "xlimmode", "auto");
+        endif
+        if (any (ax == "y"))
+          set (ca, "ylimmode", "auto");
+        endif
+        if (any (ax == "z"))
+          set (ca, "zlimmode", "auto");
+        endif
+      else
+        set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
+      endif
+    elseif (strcmpi (ax, "manual"))
+      ## fixes the axis limits, like axis(axis) should;
+      set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual");
+    elseif (strcmpi (ax, "tight"))
+      ## sets the axis limits to the min and max of all data.
+      __do_tight_option__ (ca);
+      ## tic marks
+    elseif (strcmpi (ax, "on") || strcmpi (ax, "tic"))
+      set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto");
+      if (strcmpi (ax, "on"))
+        set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
+           "zticklabelmode", "auto");
+      endif
+      set (ca, "visible", "on");
+    elseif (strcmpi (ax, "off"))
+      set (ca, "xtick", [], "ytick", [], "ztick", []);
+      set (ca, "visible", "off");
+    elseif (len > 3 && strcmpi (ax(1:3), "tic"))
+      if (any (ax == "x"))
+        set (ca, "xtickmode", "auto");
+      else
+        set (ca, "xtick", []);
+      endif
+      if (any (ax == "y"))
+        set (ca, "ytickmode", "auto");
+      else
+        set (ca, "ytick", []);
+      endif
+      if (any (ax == "z"))
+        set (ca, "ztickmode", "auto");
+      else
+        set (ca, "ztick", []);
+      endif
+    elseif (strcmpi (ax, "label"))
+      set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
+           "zticklabelmode", "auto");
+    elseif (strcmpi (ax, "nolabel"))
+      set (ca, "xticklabel", "", "yticklabel", "", "zticklabel", "");
+    elseif (len > 5 && strcmpi (ax(1:5), "label"))
+      if (any (ax == "x"))
+        set (ca, "xticklabelmode", "auto");
+      else
+        set (ca, "xticklabel", "");
+      endif
+      if (any (ax == "y"))
+        set (ca, "yticklabelmode", "auto");
+      else
+        set (ca, "yticklabel", "");
+      endif
+      if (any (ax == "z"))
+        set (ca, "zticklabelmode", "auto");
+      else
+        set (ca, "zticklabel", "");
+      endif
+
+    else
+      warning ("unknown axis option '%s'", ax);
+    endif
+
+  elseif (isvector (ax))
+
+    len = length (ax);
+
+    if (len != 2 && len != 4 && len != 6)
+      error ("axis: expecting vector with 2, 4, or 6 elements");
+    endif
+
+    for i = 1:2:len
+      if (ax(i) >= ax(i+1))
+        error ("axis: limits(%d) must be less than limits(%d)", i, i+1);
+      endif
+    endfor
+
+    if (len > 1)
+      set (ca, "xlim", [ax(1), ax(2)]);
+    endif
+
+    if (len > 3)
+      set (ca, "ylim", [ax(3), ax(4)]);
+    endif
+
+    if (len > 5)
+      set (ca, "zlim", [ax(5), ax(6)]);
+    endif
+
+  else
+    error ("axis: expecting no args, or a vector with 2, 4, or 6 elements");
+  endif
+
+  if (! isempty (varargin))
+    __axis__ (ca, varargin{:});
+  endif
+
+endfunction
+
+function lims = __get_tight_lims__ (ca, ax)
+
+  ## Get the limits for axis ("tight").
+  ## AX should be one of "x", "y", or "z".
+  kids = findobj (ca, "-property", strcat (ax, "data"));
+  ## The data properties for hggroups mirror their children.
+  ## Exclude the redundant hgroup values.
+  hg_kids = findobj (kids, "type", "hggroup");
+  kids = setdiff (kids, hg_kids);
+  if (isempty (kids))
+    ## Return the current limits.
+    lims = get (ca, strcat (ax, "lim"));
+  else
+    data = get (kids, strcat (ax, "data"));
+    scale = get (ca, strcat (ax, "scale"));
+    if (! iscell (data))
+      data = {data};
+    endif
+    if (strcmp (scale, "log"))
+      tmp = data;
+      data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false);
+      n = cellfun ("isempty", data);
+      data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false);
+    endif
+    data = cellfun (@(x) x(isfinite (x)), data, "uniformoutput", false);
+    data = data(! cellfun ("isempty", data));
+    if (! isempty (data))
+      ## Change data from cell array of various sizes to a single column vector
+      data = cat (1, cellindexmat (data, ":"){:});
+      lims = [min(data), max(data)];
+    else
+      lims = [0, 1];
+    endif
+  endif
+
+endfunction
+
+function __do_tight_option__ (ca)
+
+  xlim = __get_tight_lims__ (ca, "x");
+  if (all (xlim == 0))
+    xlim = eps () * [-1 1];
+  elseif (diff (xlim == 0))
+    xlim = xlim .* (1 + eps () * [-1, 1]);
+  endif
+  ylim = __get_tight_lims__ (ca, "y");
+  if (all (ylim == 0))
+    ylim = eps () * [-1 1];
+  elseif (diff (ylim == 0))
+    ylim = ylim .* (1 + eps () * [-1, 1]);
+  endif
+  set (ca, "xlim", xlim, "ylim", ylim)
+  nd = __calc_dimensions__ (ca);
+  is3dview = (get (ca, "view")(2) != 90);
+  if (nd > 2 && is3dview)
+    zlim = __get_tight_lims__ (ca, "z");
+    if (all (zlim == 0))
+      zlim = eps () * [-1 1];
+    elseif (diff (zlim == 0))
+      zlim = zlim .* (1 + eps () * [-1, 1]);
+    endif
+    set (ca, "zlim", zlim);
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (221);
+%!  plot (t, x);
+%!  title ('normal plot');
+%!
+%! subplot (222);
+%!  plot (t, x);
+%!  title ('square plot');
+%!  axis ('square');
+%!
+%! subplot (223);
+%!  plot (t, x);
+%!  title ('equal plot');
+%!  axis ('equal');
+%!
+%! subplot (224);
+%!  plot (t, x);
+%!  title ('normal plot again');
+%!  axis ('normal');
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (121);
+%!  plot (t, x);
+%!  title ('ij plot');
+%!  axis ('ij');
+%!
+%! subplot (122);
+%!  plot (t, x);
+%!  title ('xy plot');
+%!  axis ('xy');
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (331);
+%!  plot (t, x);
+%!  title ('x tics and labels');
+%!  axis ('ticx');
+%!
+%! subplot (332);
+%!  plot (t, x);
+%!  title ('y tics and labels');
+%!  axis ('ticy');
+%!
+%! subplot (333);
+%!  plot (t, x);
+%!  title ('axis off');
+%!  axis ('off');
+%!
+%! subplot (334);
+%!  plot (t, x);
+%!  title ('x and y tics, x labels');
+%!  axis ('labelx','tic');
+%!
+%! subplot (335);
+%!  plot (t, x);
+%!  title ('x and y tics, y labels');
+%!  axis ('labely','tic');
+%!
+%! subplot (336);
+%!  plot (t, x);
+%!  title ('all tics but no labels');
+%!  axis ('nolabel','tic');
+%!
+%! subplot (337);
+%!  plot (t, x);
+%!  title ('x tics, no labels');
+%!  axis ('nolabel','ticx');
+%!
+%! subplot (338);
+%!  plot (t, x);
+%!  title ('y tics, no labels');
+%!  axis ('nolabel','ticy');
+%!
+%! subplot (339);
+%!  plot (t, x);
+%!  title ('all tics and labels');
+%!  axis ('on');
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (321);
+%!  plot (t, x);
+%!  title ('axes at [0 3 0 1]');
+%!  axis ([0,3,0,1]);
+%!
+%! subplot (322);
+%!  plot (t, x);
+%!  title ('auto');
+%!  axis ('auto');
+%!
+%! subplot (323);
+%!  plot (t, x, ';sine [0:2pi];'); hold on;
+%!  plot (-3:3,-3:3, ';line (-3,-3)->(3,3);'); hold off;
+%!  title ('manual');
+%!  axis ('manual');
+%!
+%! subplot (324);
+%!  plot (t, x, ';sine [0:2pi];');
+%!  title ('axes at [0 3 0 1], then autox');
+%!  axis ([0,3,0,1]);
+%!  axis ('autox');
+%!
+%! subplot (325);
+%!  plot (t, x, ';sine [0:2pi];');
+%!  title ('axes at [3 6 0 1], then autoy');
+%!  axis ([3,6,0,1]);
+%!  axis ('autoy');
+%!
+%! subplot (326);
+%!  plot (t, sin(t), t, -2*sin(t/2));
+%!  axis ('tight');
+%!  title ('tight');
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! plot (x, sin(x));
+%! axis image;
+%! title ({'image', 'equivalent to "tight" & "equal"'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x,y,z] = peaks (50);
+%! x1 = max (x(:));
+%! pcolor (x-x1, y-x1/2, z);
+%! hold on;
+%! [x,y,z] = sombrero ();
+%! s = x1 / max (x(:));
+%! pcolor (s*x+x1, s*y+x1/2, 5*z);
+%! axis tight;
+
+%!demo
+%! clf;
+%! x = -10:10;
+%! plot (x,x, x,-x);
+%! set (gca, 'yscale', 'log');
+%! legend ({'x >= 1', 'x <= 1'}, 'location', 'north');
+%! title ('ylim = [1, 10]');
+
+%!demo
+%! clf;
+%! loglog (1:20, '-s');
+%! axis tight;
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1 + abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'zero');
+%! set (gca, 'yaxislocation', 'zero');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = zero'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'zero');
+%! set (gca, 'yaxislocation', 'left');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = left'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! title ('no plot box');
+%! set (gca, 'xaxislocation', 'zero');
+%! set (gca, 'yaxislocation', 'right');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = right'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'bottom');
+%! set (gca, 'yaxislocation', 'zero');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = bottom, yaxislocation = zero'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'top');
+%! set (gca, 'yaxislocation', 'zero');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = top, yaxislocation = zero'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot (11:20, [21:24, NaN, -Inf, 27:30]);
+%!   hold all;
+%!   plot (11:20, 25.5 + rand (10));
+%!   axis tight;
+%!   assert (axis (), [11 20 21 30]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   loglog (a, -a);
+%!   axis tight;
+%!   assert (axis (), [1e-5, 10, -10, -1e-5]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Test 'axis tight' with differently oriented, differently numbered data vecs
+## Bug #40036.
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   Z = peaks (linspace (-3, 3, 49), linspace (-2, 2, 29));
+%!   surf (Z);
+%!   axis tight;
+%!   assert (axis (), [1 49 1 29 min(Z(:)) max(Z(:))]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/box.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,71 @@
+## Copyright (C) 2006-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} box on
+## @deftypefnx {Command} {} box off
+## @deftypefnx {Command} {} box
+## @deftypefnx {Function File} {} box (@var{hax}, @dots{})
+## Control display of the axis border.
+##
+## The argument may be either @qcode{"on"} or @qcode{"off"}.  If it is
+## omitted, the current box state is toggled.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{axis, grid}
+## @end deftypefn
+
+## Author: jwe
+
+function box (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("box", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (nargs == 0)
+    box_state = get (hax, "box");
+    if (strcmp (box_state, "on"))
+      box_state = "off";
+    else
+      box_state = "on";
+    endif
+  elseif (nargs == 1)
+    state = varargin{1};
+    if (ischar (state))
+      if (strcmpi (state, "off"))
+        box_state = "off";
+      elseif (strcmpi (state, "on"))
+        box_state = "on";
+      else
+        error ('box: argument must be "on" or "off"');
+      endif
+    else
+      error ('box: argument must be "on" or "off"');
+    endif
+  else
+    print_usage ();
+  endif
+
+  set (hax, "box", box_state);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/caxis.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,97 @@
+## Copyright (C)  2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} caxis ([cmin cmax])
+## @deftypefnx {Function File} {} caxis ("auto")
+## @deftypefnx {Function File} {} caxis ("manual")
+## @deftypefnx {Function File} {} caxis (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{limits} =} caxis ()
+## Query or set color axis limits for plots.
+##
+## The limits argument should be a 2-element vector specifying the
+## lower and upper limits to assign to the first and last value in the
+## colormap.  Data values outside this range are clamped to the first and last
+## colormap entries.
+##
+## If the @qcode{"auto"} option is given then automatic colormap limits are
+## applied.  The automatic algorithm sets @var{cmin} to the minimum data value
+## and @var{cmax} to the maximum data value.  If @qcode{"manual"} is specified
+## then the @qcode{"climmode"} property is set to @qcode{"manual"} and the
+## numeric values in the @qcode{"clim"} property are used for limits.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## Called without arguments the current color axis limits are returned.
+## @seealso{colormap}
+## @end deftypefn
+
+function limits = caxis (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("caxis", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    if (nargin == 0)
+      limits = __caxis__ (hax);
+    else
+      __caxis__ (hax, varargin{:});
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+function limits = __caxis__ (ca, ax, varargin)
+
+  if (nargin == 1)
+    limits = get (ca, "clim");
+  elseif (ischar (ax))
+    if (strcmpi (ax, "auto"))
+      set (ca, "climmode", "auto");
+    elseif (strcmpi (ax, "manual"))
+      set (ca, "climmode", "manual");
+    endif
+  elseif (isvector (ax))
+    len = length (ax);
+    if (len != 2)
+      error ("caxis: expecting vector with 2 elements");
+    endif
+
+    set (ca, "clim", [ax(1), ax(2)]);
+  else
+    error ("caxis: expecting no args, a string, or a 2 element vector");
+  endif
+
+  ## FIXME: Why should it be possible to call __caxis__ recursively?
+  if (nargin > 2)
+    __caxis__ (ca, varargin{:})';
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/clabel.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,153 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} clabel (@var{c}, @var{h})
+## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, @var{v})
+## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, "manual")
+## @deftypefnx {Function File} {} clabel (@var{c})
+## @deftypefnx {Function File} {} clabel (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} clabel (@dots{})
+## Add labels to the contours of a contour plot.
+##
+## The contour levels are specified by the contour matrix @var{c} which is
+## returned by @code{contour}, @code{contourc}, @code{contourf}, and
+## @code{contour3}.  Contour labels are rotated to match the local line 
+## orientation and centered on the line.  The position of labels along the
+## contour line is chosen randomly.
+##
+## If the argument @var{h} is a handle to a contour group object, then label
+## this plot rather than the one in the current axes returned by @code{gca}.
+##
+## By default, all contours are labeled.  However, the contours to label can be
+## specified by the vector @var{v}.  If the @qcode{"manual"} argument is
+## given then the contours to label can be selected with the mouse.
+##
+## Additional property/value pairs that are valid properties of text objects
+## can be given and are passed to the underlying text objects.  Moreover,
+## the contour group property @qcode{"LabelSpacing"} is available which
+## determines the spacing between labels on a contour to be specified.  The
+## default is 144 points, or 2 inches.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the text objects representing each label.
+## The @qcode{"userdata"} property of the text objects contains the numerical
+## value of the contour label.
+##
+## An example of the use of @code{clabel} is
+##
+## @example
+## @group
+## [c, h] = contour (peaks (), -4 : 6);
+## clabel (c, h, -4:2:6, "fontsize", 12);
+## @end group
+## @end example
+##
+## @seealso{contour, contourf, contour3, meshc, surfc, text}
+## @end deftypefn
+
+function h = clabel (c, varargin)
+
+  have_hg = false;
+  have_labelspacing = false;
+  label_spacing = 144;  # 2 inches in points
+
+  if (nargin < 1)
+    print_usage ();
+  elseif (nargin == 1)
+    hparent = gca ();
+  else
+    arg = varargin{1};
+    if (isscalar (arg) && ishandle (arg)
+        && strcmp (get (arg, "type"), "hggroup"))
+      try
+        get (arg, "contourmatrix");
+      catch
+        error ("clabel: H must be a handle to a contour group");
+      end_try_catch
+      have_hg = true;
+      hg = arg;
+      varargin(1) = [];
+    else
+      hparent = gca ();
+    endif
+  endif
+
+  if (length (varargin) > 0 && isnumeric (varargin{1}))
+    v = varargin{1}(:);
+    varargin(1) = [];
+  else
+    v = [];
+  endif
+
+  idx = strcmpi (varargin(1:2:end), "manual");
+  if (any (idx))
+    error ('clabel: "manual" contour mode is not supported');
+  endif
+
+  idx = find (strcmpi (varargin(1:2:end), "labelspacing"), 1);
+  if (! isempty (idx))
+    have_labelspacing = true;
+    label_spacing = varargin{2*idx};
+    varargin(2*idx+(-1:0)) = [];
+  endif    
+
+  if (have_hg)
+    if (! isempty (v))
+      if (have_labelspacing)
+        set (hg, "textlistmode", "manual", "textlist", v,
+                 "labelspacing", label_spacing, "showtext", "on");
+      else
+        set (hg, "textlistmode", "manual", "textlist", v, "showtext", "on");
+      endif
+    else
+      if (have_labelspacing)
+        set (hg, "showtext", "on", "labelspacing", label_spacing);
+      else
+        set (hg, "showtext", "on");
+      endif
+    endif
+    htmp = findobj (hg, "type", "text");
+    if (! isempty (varargin))
+      set (htmp, varargin{:});
+    endif
+  else
+    htmp =  __clabel__ (c, v, hparent, label_spacing, [], varargin{:});
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [c, h] = contour (peaks (), -4:6);
+%! clabel (c, h, -4:2:6, 'fontsize', 12);
+%! title ('clabel() labeling every other contour');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [c, h] = contourf (peaks (), -7:6);
+%! clabel (c, h, -6:2:6, 'fontsize', 12);
+%! title ('clabel() labeling every other contour');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/daspect.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,143 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{data_aspect_ratio} =} daspect ()
+## @deftypefnx {Function File} {} daspect (@var{data_aspect_ratio})
+## @deftypefnx {Function File} {} daspect (@var{mode})
+## @deftypefnx {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode")
+## @deftypefnx {Function File} {} daspect (@var{hax}, @dots{})
+## Query or set the data aspect ratio of the current axes.
+##
+## The aspect ratio is a normalized 3-element vector representing the span of
+## the x, y, and z-axis limits.
+## 
+## @code{(daspect (@var{mode}))}
+##
+## Set the data aspect ratio mode of the current axes.  @var{mode} is
+## either @qcode{"auto"} or @qcode{"manual"}.
+## 
+## @code{daspect (@qcode{"mode"})}
+##
+## Return the data aspect ratio mode of the current axes.
+## 
+## @code{daspect (@var{hax}, @dots{})}
+##
+## Operate on the axes in handle @var{hax} instead of the current axes.
+## 
+## @seealso{axis, pbaspect, xlim, ylim, zlim}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-01-26
+
+function daratio = daspect (varargin)
+
+  ## Grab axes handle if present
+  if (nargin > 0)
+    if (isscalar (varargin{1}) && isaxes (varargin{1}))
+      hax = varargin{1};
+      varargin = varargin(2:end);
+    else
+      hax = gca ();
+    endif
+  else
+    hax = gca ();
+  endif
+
+  nargin = numel (varargin);
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    daratio = get (hax, "dataaspectratio");
+  else
+    arg = varargin{1};
+    if (isreal (arg))
+      if (numel (arg) == 2)
+        set (hax, "dataaspectratio", [arg, 1]);
+      elseif (numel (arg) == 3)
+        set (hax, "dataaspectratio", arg);
+      else
+        error ("daspect: DATA_ASPECT_RATIO must be a 2 or 3 element vector");
+      endif
+    elseif (ischar (arg))
+      arg = tolower (arg);
+      switch (arg)
+        case "auto"
+          set (hax, "dataaspectratiomode", "auto");
+        case "manual"
+          set (hax, "dataaspectratiomode", "manual");
+        case "mode"
+          daratio = get (hax, "dataaspectratiomode");
+        otherwise
+          error ("daspect: Invalid mode <%s>", arg);
+      endswitch
+    else
+      print_usage ();
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! axis square;
+%! daspect ([1 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -2, 2]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos (x), x,sin (x));
+%! axis ([0 4 -1 1]);
+%! daspect ([2 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -1, 1]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! daspect ([1 2 1]);
+%! pbaspect ([2 1 1]);
+%! title ('2x1 plot box with axis limits [0, 4, -2, 2]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x, sin(x));
+%! axis square;
+%! set (gca, 'activepositionproperty', 'position');
+%! daspect ([1 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -2, 2]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! axis ([0 4 -1 1]);
+%! set (gca, 'activepositionproperty', 'position');
+%! daspect ([2 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -1, 1]');
+
+## FIXME: need some input validation tests
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/diffuse.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,59 @@
+## Copyright (C) 2009-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv})
+## Calculate diffuse reflection strength of a surface defined by the normal
+## vector elements @var{sx}, @var{sy}, @var{sz}.
+##
+## The light source location vector @var{lv} can be given as 2-element vector
+## [azimuth, elevation] in degrees or as 3-element vector [lx, ly, lz].
+## @seealso{specular, surfl}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function retval = diffuse (sx, sy, sz, lv)
+
+  if (nargin != 4)
+    print_usage ();
+  endif
+
+  ## check for normal vector
+  if (!size_equal (sx, sy, sz))
+    error ("diffuse: SX, SY, and SZ must have same size");
+  endif
+
+  ## check for light vector (lv) argument
+  if (length (lv) < 2 || length (lv) > 3)
+    error ("diffuse: light vector LV must be a 2- or 3-element vector");
+  elseif (length (lv) == 2)
+    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
+  endif
+
+  ## Normalize view and light vector.
+  if (sum (abs (lv)) > 0)
+    lv  /= norm (lv);
+  endif
+
+  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
+  retval = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
+  retval(retval < 0) = 0;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/grid.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,142 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} grid
+## @deftypefnx {Command} {} grid on
+## @deftypefnx {Command} {} grid off
+## @deftypefnx {Command} {} grid minor
+## @deftypefnx {Command} {} grid minor on
+## @deftypefnx {Command} {} grid minor off
+## @deftypefnx {Function File} {} grid (@var{hax}, @dots{})
+## Control the display of plot grid lines.
+##
+## The function state input may be either @qcode{"on"} or @qcode{"off"}.
+## If it is omitted, the current grid state is toggled.
+##
+## When the first argument is @qcode{"minor"} all subsequent commands
+## modify the minor grid rather than the major grid.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## To control the grid lines for an individual axis use the @code{set}
+## function.  For example:
+##
+## @example
+## set (gca, "ygrid", "on");
+## @end example
+## @seealso{axis, box}
+## @end deftypefn
+
+## Author: jwe
+
+function grid (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("grid", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (nargs > 2)
+    print_usage ();
+  endif
+
+  grid_on = (   strcmp (get (hax, "xgrid"), "on")
+             && strcmp (get (hax, "ygrid"), "on")
+             && strcmp (get (hax, "zgrid"), "on"));
+
+  minor_on = (   strcmp (get (hax, "xminorgrid"), "on")
+              && strcmp (get (hax, "yminorgrid"), "on")
+              && strcmp (get (hax, "zminorgrid"), "on"));
+
+  minor_auto = true;
+  if (nargs == 0)
+    grid_on = ! grid_on;
+  else
+    arg1 = varargin{1};
+    if (! ischar (arg1))
+      error ("grid: argument 1 must be an axis handle or a string");
+    endif
+    if (strcmpi (arg1, "off"))
+      grid_on = false;
+    elseif (strcmpi (arg1, "on"))
+      grid_on = true;
+    elseif (strcmpi (arg1, "minor"))
+      minor_auto = false;
+      if (nargs == 2)
+        arg2 = varargin{2};
+        if (strcmpi (arg2, "on"))
+          minor_on = true;
+          grid_on = true;
+        elseif (strcmpi (arg2, "off"))
+          minor_on = false;
+        else
+          print_usage ();
+        endif
+      else
+        minor_on = ! minor_on;
+        if (minor_on)
+          grid_on = true;
+        endif
+      endif
+    else
+      print_usage ();
+    endif
+  endif
+
+  if (grid_on)
+    set (hax, "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    if (minor_on)
+      set (hax, "xminorgrid", "on", "yminorgrid", "on", "zminorgrid", "on");
+    elseif (minor_auto)
+      xmg = ifelse (strcmp (get (hax, "xscale"), "log"), "on", "off");
+      ymg = ifelse (strcmp (get (hax, "yscale"), "log"), "on", "off");
+      zmg = ifelse (strcmp (get (hax, "zscale"), "log"), "on", "off");
+      set (hax, "xminorgrid", xmg, "yminorgrid", ymg, "zminorgrid", zmg);
+    else
+      set (hax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
+    endif
+  else
+    set (hax, "xgrid", "off", "ygrid", "off", "zgrid", "off",
+              "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! subplot (2,2,1);
+%!  plot (1:100);
+%!  grid off;
+%!  title ('no grid');
+%! subplot (2,2,2);
+%!  plot (1:100);
+%!  grid on;
+%!  title ('grid on');
+%! subplot (2,2,3);
+%!  plot (1:100);
+%!  grid minor;
+%!  title ('grid minor');
+%! subplot (2,2,4);
+%!  semilogy (1:100);
+%!  grid minor;
+%!  title ('grid minor');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/gtext.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,72 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} gtext (@var{s})
+## @deftypefnx {Function File} {} gtext (@{@var{s1}, @var{s2}, @dots{}@})
+## @deftypefnx {Function File} {} gtext (@{@var{s1}; @var{s2}; @dots{}@})
+## @deftypefnx {Function File} {} gtext (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} gtext (@dots{})
+## Place text on the current figure using the mouse.
+##
+## The text is defined by the string @var{s}.  If @var{s} is a cell string
+## organized as a row vector then each string of the cell array is written to a
+## separate line.  If @var{s} is organized as a column vector then one string
+## element of the cell array is placed for every mouse click.
+##
+## Optional property/value pairs are passed directly to the underlying text
+## objects.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## text object(s).
+## @seealso{ginput, text}
+## @end deftypefn
+
+function h = gtext (s, varargin)
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  if (! (ischar (s) || iscellstr (s)))
+    error ("gtext: S must be a string or cell array of strings");
+  endif
+
+  htmp = -1;
+  if (! isempty (s))
+    if (ischar (s) || isrow (s))
+      [x, y] = ginput (1);
+      htmp = text (x, y, s, varargin{:});
+    else
+      for i = 1:numel (s)
+        [x, y] = ginput (1);
+        htmp = text (x, y, s{i}, varargin{:});
+      endfor
+    endif
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/hidden.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,87 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} hidden
+## @deftypefnx {Command} {} hidden "on"
+## @deftypefnx {Command} {} hidden "off"
+## @deftypefnx {Function File} {@var{mode} =} hidden (@dots{})
+## Control mesh hidden line removal.
+##
+## When called with no argument the hidden line removal state is toggled.
+## When called with one of the modes @qcode{"on"} or @qcode{"off"} the state
+## is set accordingly.
+##
+## The optional output argument @var{mode} is the current state.
+##
+## Hidden Line Removal determines what graphic objects behind a mesh plot
+## are visible.  The default is for the mesh to be opaque and lines behind
+## the mesh are not visible.  If hidden line removal is turned off then
+## objects behind the mesh can be seen through the faces (openings) of the
+## mesh, although the mesh grid lines are still opaque.
+##
+## @seealso{mesh, meshc, meshz, ezmesh, ezmeshc, trimesh, waterfall}
+## @end deftypefn
+
+function state = hidden (mode = "toggle")
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 1)
+    if (! ischar (mode))
+      error ("hidden: expecting MODE to be a string");
+    elseif (! any (strcmpi (mode, {"on", "off"})))
+      error ('hidden: MODE must be "on" or "off"');
+    endif
+  endif
+
+  for h = (get (gca (), "children")).';
+    htype = get (h, "type");
+    htag = get (h, "tag");
+    if (strcmp (htype, "surface") || strcmp (htag, "trimesh"))
+      fc = get (h, "facecolor");
+      if ((! ischar (fc) && is_white (fc))
+          || (ischar (fc) && strcmp (fc, "none")))
+        switch (mode)
+          case "on"
+            set (h, "facecolor", "w");
+          case "off"
+            set (h, "facecolor", "none");
+          case "toggle"
+            if (ischar (fc))
+              set (h, "facecolor", "w");
+              mode = "on";
+            else
+              set (h, "facecolor", "none");
+              mode = "off";
+            endif
+        endswitch
+      endif
+    endif
+  endfor
+
+  if (nargout > 0)
+    state = mode;
+  endif
+
+endfunction
+
+function retval = is_white (color)
+  retval = all (color == 1);
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/legend.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,1595 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} legend (@var{str1}, @var{str2}, @dots{})
+## @deftypefnx {Function File} {} legend (@var{matstr})
+## @deftypefnx {Function File} {} legend (@var{cellstr})
+## @deftypefnx {Function File} {} legend (@dots{}, "location", @var{pos})
+## @deftypefnx {Function File} {} legend (@dots{}, "orientation", @var{orient})
+## @deftypefnx {Function File} {} legend (@var{hax}, @dots{})
+## @deftypefnx {Function File} {} legend (@var{hobjs}, @dots{})
+## @deftypefnx {Function File} {} legend (@var{hax}, @var{hobjs}, @dots{})
+## @deftypefnx {Function File} {} legend ("@var{option}")
+## @deftypefnx {Function File} {[@var{hleg}, @var{hleg_obj}, @var{hplot}, @var{labels}] =} legend (@dots{})
+##
+## Display a legend for the current axes using the specified strings as labels.
+##
+## Legend entries may be specified as individual character string arguments,
+## a character array, or a cell array of character strings.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.  If the handles,
+## @var{hobjs}, are not specified then the legend's strings will be associated
+## with the axes' descendants.  @code{legend} works on line graphs,
+## bar graphs, etc.  A plot must exist before legend is called.
+##
+## The optional parameter @var{pos} specifies the location of the legend
+## as follows:
+##
+## @multitable @columnfractions 0.06 0.14 0.80
+## @headitem @tab pos @tab location of the legend
+## @item @tab north @tab center top
+## @item @tab south @tab center bottom
+## @item @tab east @tab right center
+## @item @tab west @tab left center
+## @item @tab northeast @tab right top (default)
+## @item @tab northwest @tab left top
+## @item @tab southeast @tab right bottom
+## @item @tab southwest @tab left bottom
+## @item
+## @item @tab outside @tab can be appended to any location string
+## @end multitable
+##
+## The optional parameter @var{orient} determines if the key elements
+## are placed vertically or horizontally.  The allowed values are
+## @qcode{"vertical"} (default) or @qcode{"horizontal"}.
+##
+## The following customizations are available using @var{option}:
+##
+## @table @asis
+## @item @qcode{"show"}
+##   Show legend on the plot
+##
+## @item @qcode{"hide"}
+##   Hide legend on the plot
+##
+## @item @qcode{"toggle"}
+##   Toggles between @qcode{"hide"} and @qcode{"show"}
+##
+## @item @qcode{"boxon"}
+##   Show a box around legend (default)
+##
+## @item @qcode{"boxoff"}
+##   Hide the box around legend
+##
+## @item @qcode{"right"}
+##   Place label text to the right of the keys (default)
+##
+## @item @qcode{"left"}
+##   Place label text to the left of the keys
+##
+## @item @qcode{"off"}
+##   Delete the legend object
+## @end table
+##
+## The optional output values are
+##
+## @table @var
+## @item hleg
+##   The graphics handle of the legend object.
+##
+## @item hleg_obj
+##   Graphics handles to the text and line objects which make up the legend.
+##
+## @item hplot
+##   Graphics handles to the plot objects which were used in making the legend.
+##
+## @item labels
+##   A cell array of strings of the labels in the legend.
+## @end table
+##
+## The legend label text is either provided in the call to @code{legend} or
+## is taken from the DisplayName property of graphics objects.  If no
+## labels or DisplayNames are available, then the label text is simply
+## @qcode{"data1"}, @qcode{"data2"}, @dots{}, @nospell{@qcode{"dataN"}}.
+##
+## Implementation Note: A legend is implemented as an additional axes object
+## of the current figure with the @qcode{"tag"} set to @qcode{"legend"}.
+## Properties of the legend object may be manipulated directly by using
+## @code{set}.
+## @end deftypefn
+
+function [hleg, hleg_obj, hplot, labels] = legend (varargin)
+
+  if (nargin > 0
+      && (! ishandle (varargin{1})
+          || (strcmp (get (varargin{1}, "type"), "axes")
+              && ! strcmp (get (varargin{1}, "tag"), "legend"))))
+    [ca, varargin, nargin] = __plt_get_axis_arg__ ("legend", varargin{:});
+    if (isempty (ca))
+      ca = gca ();
+    endif
+    fig = get (ca, "parent");
+  else
+    fig = get (0, "currentfigure");
+    if (isempty (fig))
+      fig = gcf ();
+    endif
+    ca = gca ();
+  endif
+
+  ## Special handling for plotyy which has two axes objects
+  if (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
+    plty = get (ca, "__plotyy_axes__");
+    if (isscalar (plty) && ishandle (plty))
+      ca = [ca, plty];
+    elseif (iscell (plty))
+      ca = [ca, plty{:}];
+    elseif (all (ishandle (plty)))
+      ca = [ca, plty(:).'];
+    else
+      error ("legend.m: This should not happen. File a bug report.");
+    endif
+    ## Remove duplicates while preserving order
+    [~, n] = unique (ca);
+    ca = ca(sort (n));
+  endif
+
+  if (nargin > 0 && all (ishandle (varargin{1})))
+    kids = flipud (varargin{1}(:));
+    varargin(1) = [];
+  else
+    kids = ca;
+    kids(strcmp (get (ca, "tag"), "legend")) = [];
+    if (isscalar (kids))
+      kids = get (kids, "children")(:);
+    else
+      kids = flipud ([get(kids, "children"){:}](:));
+    endif
+  endif
+  nargs = numel (varargin);
+  nkids = numel (kids);
+
+  orientation = "default";
+  location = "default";
+  show = "create";
+  textpos = "default";
+  box = "default";
+
+  ## Process old way of specifying location with a number rather than a string.
+  if (nargs > 0)
+    pos = varargin{nargs};
+    if (isnumeric (pos) && isscalar (pos) && pos == fix (pos))
+      if (pos >= -1 && pos <= 4)
+        location = [{"northeastoutside", "best", "northeast",
+                     "northwest", "southwest", "southeast"}] {pos + 2};
+        nargs--;
+      else
+        error ("legend: invalid location specified");
+      endif
+    endif
+  endif
+
+  ## Find location and orientation property/value pairs
+  while (nargs > 1)
+    pos = varargin{nargs-1};
+    str = varargin{nargs};
+    if (strcmpi (pos, "location") && ischar (str))
+      location = lower (str);
+      nargs -= 2;
+    elseif (strcmpi (pos, "orientation") && ischar (str))
+      orientation = lower (str);
+      nargs -= 2;
+    else
+      break;
+    endif
+  endwhile
+
+  ## Validate the orientation
+  switch (orientation)
+    case {"vertical", "horizontal", "default"}
+      ## These are all accepted orientations.
+    otherwise
+      error ("legend: unrecognized legend orientation");
+  endswitch
+
+  ## Validate the location type
+  outside = false;
+  inout = strfind (location, "outside");
+  if (! isempty (inout))
+    outside = true;
+    location = location(1:inout-1);
+  else
+    outside = false;
+  endif
+
+  switch (location)
+    case {"north", "south", "east", "west", "northeast", "northwest", ...
+          "southeast", "southwest", "default"}
+    case "best"
+      warning ("legend: 'best' not yet implemented for location specifier\n");
+      location = "northeast";
+    otherwise
+      error ("legend: unrecognized legend location");
+  endswitch
+
+  ## Find any existing legend object on figure
+  hlegend = [];
+  fkids = get (fig, "children");
+  for i = 1 : numel (fkids)
+    if (   strcmp (get (fkids(i), "type"), "axes")
+        && strcmp (get (fkids(i), "tag"), "legend"))
+      udata = get (fkids(i), "userdata");
+      if (any (udata.handle == ca))
+        hlegend = fkids(i);
+        break;
+      endif
+    endif
+  endfor
+
+  if (nargs == 1)
+    arg = varargin{1};
+    if (ischar (arg))
+      if (rows (arg) == 1)
+        str = tolower (strtrim (arg));
+        switch (str)
+          case "off"
+            delete (hlegend);
+            return;
+          case "hide"
+            show = "off";
+            nargs--;
+          case "show"
+            if (! isempty (hlegend))
+              show = "on";
+            else
+              show = "create";
+              textpos = "right";
+            endif
+            nargs--;
+          case "toggle"
+            if (isempty (hlegend))
+              show = "create";
+              textpos = "right";
+            elseif (strcmp (get (hlegend, "visible"), "off"))
+              show = "on";
+            else
+              show = "off";
+            endif
+            nargs--;
+          case "boxon"
+            box = "on";
+            nargs--;
+          case "boxoff"
+            box = "off";
+            nargs--;
+          case "left"
+            textpos = "left";
+            nargs--;
+          case "right"
+            textpos = "right";
+            nargs--;
+        endswitch
+      else
+        ## Character matrix of labels
+        varargin = cellstr (arg);
+        nargs = numel (varargin);
+      endif
+    elseif (iscellstr (arg))
+      ## Cell array of labels
+      varargin = arg;
+      nargs = numel (varargin);
+    else
+      error ("legend: expecting argument to be a character string");
+    endif
+  elseif (nargs > 1 && iscellstr (varargin{1}))
+    ## Cell array of labels followed by property/value pairs
+    varargin = {varargin{1}{:}, varargin{2:end}};
+    nargs = numel (varargin);
+  endif
+
+  have_labels = (nargs > 0);
+
+  if (strcmp (show, "off"))
+    if (! isempty (hlegend))
+      set (findobj (hlegend), "visible", "off");
+      hlegend = [];
+    endif
+    hobjects = [];
+    hplots  = [];
+    text_strings = {};
+  elseif (strcmp (show, "on"))
+    if (! isempty (hlegend))
+      set (findobj (hlegend), "visible", "on");
+      ## NOTE - Matlab sets both "visible", and "box" to "on"
+      set (hlegend, "visible", get (hlegend, "box"));
+    else
+      hobjects = [];
+      hplots  = [];
+      text_strings = {};
+    endif
+  elseif (strcmp (box, "on"))
+    if (! isempty (hlegend))
+      set (hlegend, "box", "on", "visible", "on");
+    endif
+  elseif (strcmp (box, "off"))
+    if (! isempty (hlegend))
+      set (hlegend, "box", "off", "visible", "off");
+    endif
+  elseif (! have_labels && ! (strcmp (location, "default") &&
+                              strcmp (orientation, "default")))
+    ## Changing location or orientation of existing legend
+    if (! isempty (hlegend))
+      if (strcmp (location, "default"))
+        set (hlegend, "orientation", orientation);
+      elseif (strcmp (orientation, "default"))
+        if (outside)
+          set (hlegend, "location", [location "outside"]);
+        else
+          set (hlegend, "location", location);
+        endif
+      else
+        if (outside)
+          set (hlegend, "location", [location "outside"],
+                        "orientation", orientation);
+        else
+          set (hlegend, "location", location,
+                        "orientation", orientation);
+        endif
+      endif
+    endif
+  else
+    ## Create new legend
+    hobjects = [];
+    hplots  = [];
+    text_strings = {};
+
+    if (have_labels)
+      ## Check for valid data that can be labeled.
+      have_data = false;
+      have_dname = false;
+      for k = 1 : nkids
+        typ = get (kids(k), "type");
+        if (any (strcmp (typ, {"line", "patch", "surface", "hggroup"})))
+          have_data = true;
+          break;
+        endif
+      endfor
+
+      if (! have_data)
+        warning ("legend: plot data is empty; setting key labels has no effect");
+      endif
+    else
+      ## No labels.  Search for DisplayName property.
+      have_dname = false;
+      for k = 1 : nkids
+        hkid = kids(k);
+        typ = get (hkid, "type");
+        if (any (strcmp (typ, {"line", "patch", "surface"})))
+          if (! isempty (get (hkid, "displayname")))
+            have_dname = true;
+            break;
+          endif
+        elseif (strcmp (typ, "hggroup"))
+          hgkids = get (hkid, "children");
+          for j = 1 : length (hgkids)
+            try
+              dname = get (hgkids(j), "DisplayName");
+              if (! isempty (dname))
+                have_dname = true;
+                break;  # break from j-loop over hgkids
+              endif
+            end_try_catch
+          endfor
+          if (have_dname)
+            break;  # break from k loop over nkids
+          endif
+        endif  # elseif hggroup
+      endfor   # for loop k = 1 : nkids
+    endif      # else branch of if (have_labels)
+
+    if (have_labels || ! have_dname)
+      k = nkids;
+      if (! have_labels)
+        varargin = arrayfun (@(x) sprintf ("data%d", x), [1:nkids]',
+                             "uniformoutput", false);
+        have_labels = true;
+        nargs = nkids;
+      endif
+      for i = 1 : nargs
+        arg = varargin{i};
+        if (ischar (arg))
+          typ = get (kids(k), "type");
+          while (k > 0
+                 && ! any (strcmp (typ, {"line","patch","surface","hggroup"})))
+            typ = get (kids(--k), "type");
+          endwhile
+          if (k > 0)
+            if (strcmp (get (kids(k), "type"), "hggroup"))
+              hgkids = get (kids(k), "children");
+              for j = 1 : length (hgkids)
+                hgobj = get (hgkids(j));
+                if (isfield (hgobj, "displayname"))
+                  if (have_labels)
+                    set (hgkids(j), "displayname", arg);
+                  endif
+                  hplots(end+1) = hgkids(j);
+                  text_strings(end+1) = arg;
+                  break;
+                endif
+              endfor
+            else
+              if (have_labels)
+                set (kids(k), "displayname", arg);
+              endif
+              hplots(end+1) = kids(k);
+              text_strings(end+1) = arg;
+            endif
+
+            if (--k == 0)
+              break;
+            endif
+          else
+            break;  # k = 0, no further handles to process
+          endif
+        else
+          error ("legend: expecting argument to be a character string");
+        endif
+      endfor
+      if (have_labels && i < nargs)
+        warning ("legend: ignoring extra labels");
+      endif
+    else
+      ## No labels specified but objects have DisplayName property set.
+      k = nkids;
+      while (k > 0)
+        typ = get (kids(k), "type");
+        while (k > 1
+               && ! any (strcmp (typ, {"line","patch","surface","hggroup"})))
+          typ = get (kids(--k), "type");
+        endwhile
+        if (! any (strcmp (typ, {"line","patch","surface","hggroup"})))
+          break;
+        endif
+        if (k > 0)
+          if (strcmp (get (kids(k), "type"), "hggroup"))
+            hgkids = get (kids(k), "children");
+            for j = 1 : length (hgkids)
+              hgobj = get (hgkids(j));
+              if (isfield (hgobj, "displayname")
+                  && ! isempty (hgobj.displayname))
+                hplots(end+1) = hgkids(j);
+                text_strings(end+1) = hgobj.displayname;
+                break;
+              endif
+            endfor
+          else
+            if (! isempty (get (kids(k), "displayname")))
+              hplots(end+1) = kids(k);
+              text_strings(end+1) = get (kids(k), "displayname");
+            endif
+          endif
+          if (--k == 0)
+            break;
+          endif
+        endif
+      endwhile
+    endif
+
+    if (isempty (hplots))
+      if (! isempty (hlegend))
+        fkids = get (fig, "children");
+        delete (fkids(fkids == hlegend));
+        hlegend = [];
+        hobjects = [];
+        hplots  = [];
+        text_strings = {};
+      endif
+    else
+      ## Preserve the old legend if it exists
+      if (! isempty (hlegend))
+        if (strcmp (textpos, "default"))
+          textpos = get (hlegend, "textposition");
+        endif
+        if (strcmp (location, "default"))
+          location = get (hlegend, "location");
+          inout = strfind (location, "outside");
+          if (! isempty (inout))
+            outside = true;
+            location = location(1:inout-1);
+          else
+            outside = false;
+          endif
+        endif
+        if (strcmp (orientation, "default"))
+          orientation = get (hlegend, "orientation");
+        endif
+        box = get (hlegend, "box");
+      else
+        if (strcmp (textpos, "default"))
+          textpos = "right";
+        endif
+        if (strcmp (location, "default"))
+          location = "northeast";
+        endif
+        if (strcmp (orientation, "default"))
+          orientation = "vertical";
+        endif
+        box = "on";
+      endif
+
+      ## Get axis size and fontsize in points.
+      ## Rely on listener to handle coversion.
+      units = get (ca(1), "units");
+      unwind_protect
+        set (ca(1), "units", "points");
+        set (ca(1), "fontunits", "points");
+        if (isempty (hlegend) || ! isprop (hlegend, "unmodified_axes_position"))
+          unmodified_axes_position = get (ca(1), "position");
+          unmodified_axes_outerposition = get (ca(1), "outerposition");
+        else
+          unmodified_axes_position = get (hlegend, "unmodified_axes_position");
+          unmodified_axes_outerposition = get (hlegend, ...
+                                               "unmodified_axes_outerposition");
+        endif
+        ca_pos = unmodified_axes_position;
+        ca_outpos = unmodified_axes_outerposition;
+        tightinset = get (ca(1), "tightinset");
+        for i = 2 : numel (ca)
+          tightinset = max (tightinset, get (ca(i), "tightinset"));
+        endfor
+      unwind_protect_cleanup
+        set (ca(1), "units", units);
+      end_unwind_protect
+
+      ## Padding between legend entries horizontally and vertically
+      xpad = 2;
+      ypad = 2;
+
+      linelength = 15;
+
+      ## Create the axis first
+      curaxes = get (fig, "currentaxes");
+      unwind_protect
+        ud = ancestor (hplots, "axes");
+        if (! isscalar (ud))
+          ud = unique ([ud{:}]);
+        endif
+        if (isempty (hlegend))
+          addprops = true;
+          hlegend = axes ("tag", "legend", "userdata", struct ("handle", ud),
+                          "box", box,
+                          "xtick", [], "ytick", [],
+                          "xlim", [0, 1], "ylim", [0, 1],
+                          "visible", ifelse (strcmp (box, "on"), "on", "off"),
+                          "activepositionproperty", "position",
+                          "interpreter", "tex");
+          ## Inherit properties from current axis
+          ## "fontunits" shoud be first because it affects interpretation
+          ## of "fontsize" property
+          proplist = {"fontunits", "fontangle", "fontname", "fontsize", ...
+                      "fontweight"};
+          ca_props = get (ca(1), proplist); 
+          set (hlegend, proplist, ca_props);
+        else
+          addprops = false;
+          axes (hlegend);
+          delete (get (hlegend, "children"));
+        endif
+        if (addprops)
+          addproperty ("edgecolor", hlegend, "color", [0, 0, 0]);
+          addproperty ("textcolor", hlegend, "color", [0, 0, 0]);
+          locations = {"north", "south", "east", "west", ...
+                       "{northeast}", "southeast", "northwest", "southwest", ...
+                       "northoutside", "southoutside", ...
+                       "eastoutside", "westoutside", ...
+                       "northeastoutside", "southeastoutside", ...
+                       "northwestoutside", "southwestoutside"};
+          addproperty ("location", hlegend, "radio", strjoin (locations, "|"));
+          addproperty ("orientation", hlegend, "radio",
+                       "{vertical}|horizontal");
+          addproperty ("string", hlegend, "any", text_strings);
+          addproperty ("textposition", hlegend, "radio", "left|{right}");
+        endif
+        ## Inherit visual properties from legend object
+        fontunits = get (hlegend, "fontunits");
+        fontangle = get (hlegend, "fontangle");
+        fontname = get (hlegend, "fontname");
+        fontsize = get (hlegend, "fontsize");
+        fontweight = get (hlegend, "fontweight");
+        interpreter = get (hlegend, "interpreter");
+        textcolor = get (hlegend, "textcolor");
+        ## Add text label to the axis first, checking their extents
+        nentries = numel (hplots);
+        texthandle = [];
+        maxwidth = 0;
+        maxheight = 0;
+        for k = 1 : nentries
+          halign = ifelse (strcmp (textpos, "right"), "left", "right");
+          texthandle(end+1) = text (0, 0, text_strings{k},
+                                    "color", textcolor,
+                                    "horizontalalignment", halign,
+                                    "interpreter", interpreter,
+                                    "fontunits", fontunits,
+                                    "fontangle", fontangle,
+                                    "fontname", fontname,
+                                    "fontsize", fontsize,
+                                    "fontweight", fontweight,
+                                    "userdata", hplots(k));
+          units = get (texthandle(end), "units");
+          unwind_protect
+            set (texthandle(end), "units", "points");
+            extents = get (texthandle(end), "extent");
+            maxwidth = max (maxwidth, extents(3));
+            maxheight = max (maxheight, extents(4));
+          unwind_protect_cleanup
+            set (texthandle(end), "units", units);
+          end_unwind_protect
+        endfor
+
+        num1 = nentries;
+        if (strcmp (orientation, "vertical"))
+          height = nentries * (ypad + maxheight);
+          if (outside)
+            if (height > ca_pos(4))
+              ## Avoid shrinking the height of the axis to zero if outside
+              num1 = ca_pos(4) / (maxheight + ypad) / 2;
+            endif
+          else
+            if (height > 0.9 * ca_pos(4))
+              num1 = 0.9 * ca_pos(4) / (maxheight + ypad);
+            endif
+          endif
+        else
+          width = nentries * (ypad + maxwidth);
+          if (outside)
+            if (width > ca_pos(3))
+              ## Avoid shrinking the width of the axis to zero if outside
+              num1 = ca_pos(3) / (maxwidth + ypad) / 2;
+            endif
+          else
+            if (width > 0.9 * ca_pos(3))
+              num1 = 0.9 * ca_pos(3) / (maxwidth + ypad);
+            endif
+          endif
+        endif
+        num2 = ceil (nentries / num1);
+
+        xstep = 3 * xpad + (maxwidth + linelength);
+        if (strcmp (textpos, "right"))
+          xoffset = xpad;
+          txoffset = 2 * xpad + linelength;
+        else
+          xoffset = 2 * xpad + maxwidth;
+          txoffset = xpad + maxwidth;
+        endif
+        ystep = (ypad + maxheight);
+        yoffset = ystep / 2;
+
+        ## Place the legend in the desired location
+        if (strcmp (orientation, "vertical"))
+          lpos = [0, 0, num2 * xstep, num1 * ystep];
+        else
+          lpos = [0, 0, num1 * xstep, num2 * ystep];
+        endif
+
+        gnuplot = strcmp (get (fig, "__graphics_toolkit__"), "gnuplot");
+        if (gnuplot)
+          ## Gnuplot places the key (legend) at edge of the figure window.
+          ## OpenGL places the legend box at edge of the unmodified axes
+          ## position.
+          if (isempty (strfind (location, "east")))
+            gnuplot_offset = unmodified_axes_outerposition(1) ...
+                           + unmodified_axes_outerposition(3) ...
+                           - unmodified_axes_position(1) ...
+                           - unmodified_axes_position(3);
+          else
+            gnuplot_offset = unmodified_axes_position(1) ...
+                           - unmodified_axes_outerposition(1);
+          endif
+          ## FIXME: The "fontsize" is added to match the behavior of OpenGL.
+          ## This implies that a change in fontsize should trigger a listener
+          ## to update the legend.  The "2" was determined using a long legend
+          ## key in the absence of any subplots.
+          gnuplot_offset = gnuplot_offset - 2 * fontsize;
+        else
+          gnuplot_offset = 0;
+        endif
+
+        ## For legend's outside the associated axes postion,
+        ## align their edge to the unmodified_axes_outerpostion,
+        ## and adjust the axes postion accordingly.
+        switch (location)
+          case "north"
+            if (outside)
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_outpos(2) + ca_outpos(4) - lpos(4) - ypad, lpos(3), ...
+                      lpos(4)];
+
+              new_pos = [ca_pos(1), ca_pos(2), ca_pos(3), ca_pos(4) - lpos(4)];
+            else
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
+            endif
+          case "south"
+            if (outside)
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_outpos(2) + ypad, lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), lpos(2) + lpos(4) + 2 * ypad ...
+                      + tightinset(2), ca_pos(3), ...
+                         ca_pos(4) - lpos(4)];
+            else
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_pos(2) + ypad, lpos(3), lpos(4)];
+            endif
+          case "east"
+            if (outside)
+              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), ca_pos(2), ...
+                         lpos(1) - 2 * xpad - ca_pos(1) - tightinset(3), ...
+                         ca_pos(4)];
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
+            endif
+          case "west"
+            if (outside)
+              lpos = [ca_outpos(1) + ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, ...
+                      lpos(3), lpos(4)];
+              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
+                         ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
+              new_pos(1) = new_pos(1) - gnuplot_offset;
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) +  ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
+            endif
+          case "northeast"
+            if (outside)
+              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4), lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), ca_pos(2), ...
+                         lpos(1) - 2 * xpad - tightinset(3) - ca_pos(1), ...
+                         ca_pos(4)];
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
+            endif
+          case "northwest"
+            if (outside)
+              lpos = [ca_outpos(1) + ypad , ca_pos(2) + ca_pos(4) - lpos(4), ...
+                      lpos(3), lpos(4)];
+              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
+              ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
+              new_pos(1) = new_pos(1) - gnuplot_offset;
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ypad, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
+            endif
+          case "southeast"
+            if (outside)
+              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
+                      ca_pos(2), lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), ca_pos(2), ...
+                         lpos(1) - 2 * xpad - ca_pos(1) - tightinset(3), ...
+                         ca_pos(4)];
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + ypad, lpos(3), lpos(4)];
+            endif
+          case "southwest"
+            if (outside)
+              lpos = [ca_outpos(1) + ypad, ca_pos(2), lpos(3), lpos(4)];
+              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
+              ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
+              new_pos(1) = new_pos(1) - gnuplot_offset;
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ypad, ca_pos(2) + ypad, lpos(3), lpos(4)];
+            endif
+        endswitch
+
+        units = get (hlegend, "units");
+        unwind_protect
+          set (hlegend, "units", "points");
+          set (hlegend, "position", lpos);
+        unwind_protect_cleanup
+          set (hlegend, "units", units);
+        end_unwind_protect
+
+        ## Now write the line segments and place the text objects correctly
+        xk = 0;
+        yk = 0;
+        for k = 1 : numel (hplots)
+          hobjects(end+1) = texthandle(k);
+          switch (get (hplots(k), "type"))
+
+            case "line"
+              color = get (hplots(k), "color");
+              style = get (hplots(k), "linestyle");
+              if (! strcmp (style, "none"))
+                l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3),
+                           "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4),
+                           "color", color, "linestyle", style,
+                           "marker", "none",
+                           "userdata", hplots(k));
+                hobjects(end+1) = l1;
+              endif
+              marker = get (hplots(k), "marker");
+              if (! strcmp (marker, "none"))
+                l1 = line ("xdata", (xoffset + 0.5 * linelength  + xk * xstep) / lpos(3),
+                           "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4),
+                           "color", color, "linestyle", "none",
+                           "marker", marker,
+                           "markeredgecolor",get (hplots(k), "markeredgecolor"),
+                           "markerfacecolor",get (hplots(k), "markerfacecolor"),
+                           "markersize", get (hplots(k), "markersize"),
+                           "userdata", hplots(k));
+                hobjects(end+1) = l1;
+              endif
+
+              if (addprops)
+                addlistener (hplots(k), "color",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "linestyle",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "marker",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "markeredgecolor",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "markerfacecolor",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "markersize",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "displayname",
+                             {@updateline, hlegend, linelength, true});
+              endif
+
+            case "patch"
+              facecolor = get (hplots(k), "facecolor");
+              edgecolor = get (hplots(k), "edgecolor");
+              cdata = get (hplots(k), "cdata");
+              if (! strcmp (facecolor, "none") || ! strcmp (edgecolor, "none"))
+                p1 = patch ("xdata", ([0, linelength, linelength, 0] +
+                                      xoffset + xk * xstep) / lpos(3),
+                            "ydata", (lpos(4) - yoffset -
+                                      [yk-0.3, yk-0.3, yk+0.3, yk+0.3] .* ystep) / lpos(4),
+                           "facecolor", facecolor, "edgecolor", edgecolor,
+                           "cdata", cdata, "userdata", hplots(k));
+                hobjects(end+1) = p1;
+              endif
+              ## FIXME: Probably need listeners, as for line objects
+
+            case "surface"
+              facecolor = get (hplots(k), "facecolor");
+              edgecolor = get (hplots(k), "edgecolor");
+              cdata = sum (get (ca(1), "clim")) / 2;
+              if (! strcmp (facecolor, "none") || ! strcmp (edgecolor, "none"))
+                p1 = patch ("xdata", ([0, linelength, linelength, 0] +
+                                      xoffset + xk * xstep) / lpos(3),
+                            "ydata", (lpos(4) - yoffset -
+                                      [yk-0.3, yk-0.3, yk+0.3, yk+0.3] .* ystep) / lpos(4),
+                           "facecolor", facecolor, "edgecolor", edgecolor,
+                           "cdata", cdata, "userdata", hplots(k));
+                hobjects(end+1) = p1;
+              endif
+              ## FIXME: Probably need listeners, as for line objects
+
+          endswitch
+
+          set (texthandle(k), "position",
+                              [(txoffset + xk * xstep) / lpos(3), ...
+                               (lpos(4) - yoffset - yk * ystep) / lpos(4)]);
+          if (strcmp (orientation, "vertical"))
+            yk++;
+            if (yk > num1)
+              yk = 0;
+              xk++;
+            endif
+          else
+            xk++;
+            if (xk > num1)
+              xk = 0;
+              yk++;
+            endif
+          endif
+        endfor
+
+        ## Add an invisible text object to original axis
+        ## that when it is destroyed will remove the legend
+        props = {"parent", ca(1), "tag", "legend", ...
+                 "handlevisibility", "off", "visible", "off", ...
+                 "xliminclude", "off", "yliminclude", "off"};
+        t1 = findall (ca(1), "tag", "legend", "type", "text");
+        if (isempty (t1))
+          t1 = text (0, 0, "", props{:});
+          set (t1, "deletefcn", {@deletelegend1, hlegend});
+        endif
+        if (isprop (hlegend, "unmodified_axes_position"))
+          set (hlegend, "unmodified_axes_position",
+                         unmodified_axes_position,
+                        "unmodified_axes_outerposition",
+                         unmodified_axes_outerposition);
+        else
+          addproperty ("unmodified_axes_position", hlegend,
+                       "data", unmodified_axes_position);
+          addproperty ("unmodified_axes_outerposition", hlegend,
+                       "data", unmodified_axes_outerposition);
+        endif
+
+        ## Resize the axis that the legend is attached to if the legend is
+        ## "outside" the plot and create a listener to resize axis to original
+        ## size if the legend is deleted, hidden, or shown.
+        if (outside)
+          for i = 1 : numel (ca)
+            units = get (ca(i), "units");
+            unwind_protect
+              set (ca(i), "units", "points");
+              if (gnuplot && numel (ca) == 1)
+                ## Let Gnuplot handle the positioning of the keybox.
+                ## This violates strict Matlab compatibility, but reliably
+                ## renders an esthetic result.
+                set (ca(i), "position",  unmodified_axes_position);
+                set (ca(i), "activepositionproperty", "outerposition")
+              else
+                ## numel (ca) > 1 for axes overlays (like plotyy)
+                set (ca(i), "position", new_pos);
+              endif
+            unwind_protect_cleanup
+              set (ca(i), "units", units);
+            end_unwind_protect
+          endfor
+
+          set (hlegend, "deletefcn", {@deletelegend2, ca, ...
+                                      unmodified_axes_position, ...
+                                      unmodified_axes_outerposition, ...
+                                      t1, hplots});
+          addlistener (hlegend, "visible", {@hideshowlegend, ca, ...
+                                            unmodified_axes_position, ...
+                                            new_pos});
+        else
+          set (hlegend, "deletefcn", {@deletelegend2, ca, [], [], t1, hplots});
+        endif
+
+        if (! addprops)
+          ## Remove listeners on existing legend temporarily to stop recursion.
+          dellistener (hlegend, "location");
+          dellistener (hlegend, "orientation");
+          dellistener (hlegend, "string");
+          dellistener (hlegend, "textposition");
+        endif
+
+        if (! addprops)
+          set (hlegend, "string", text_strings);
+        endif
+
+        if (outside)
+          set (hlegend, "location", [location "outside"],
+                        "orientation", orientation, "textposition", textpos);
+        else
+          set (hlegend, "location", location, "orientation", orientation,
+                        "textposition", textpos);
+        endif
+
+        if (addprops)
+          addlistener (hlegend, "edgecolor", @updatelegendtext);
+          addlistener (hlegend, "fontangle", @updatelegendtext);
+          addlistener (hlegend, "fontname", @updatelegendtext);
+          addlistener (hlegend, "fontweight", @updatelegendtext);
+          addlistener (hlegend, "textcolor", @updatelegendtext);
+          ## Properties which could change size of box, such as fontsize,
+          ## require legend to be redrawn.
+          addlistener (hlegend, "fontsize", @updatelegend);
+          addlistener (hlegend, "fontunits", @updatelegend);
+          addlistener (hlegend, "interpreter", @updatelegend);
+          addlistener (hlegend, "location", @updatelegend);
+          addlistener (hlegend, "orientation", @updatelegend);
+          addlistener (hlegend, "string", @updatelegend);
+          addlistener (hlegend, "textposition", @updatelegend);
+          ## FIXME: need to add listeners for tightinset and position
+          ##        addlistener (ca, "tightinset", @update????);
+          ##        addlistener (ca, "position", @update????);
+        else
+          ## Restore certain listeners
+          addlistener (hlegend, "location", @updatelegend);
+          addlistener (hlegend, "orientation", @updatelegend);
+          addlistener (hlegend, "string", @updatelegend);
+          addlistener (hlegend, "textposition", @updatelegend);
+        endif
+      unwind_protect_cleanup
+        set (fig, "currentaxes", curaxes);
+      end_unwind_protect
+    endif
+  endif
+
+  if (nargout > 0)
+    hleg = hlegend;
+    hleg_obj = hobjects;
+    hplot = hplots;
+    labels = text_strings;
+  endif
+
+endfunction
+
+function updatelegend (h, ~)
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+    unwind_protect
+      hax = getfield (get (h, "userdata"), "handle");
+      [hplots, ~] = __getlegenddata__ (h);
+      position = get (h, "unmodified_axes_position");
+      outerposition = get (h, "unmodified_axes_outerposition");
+      units = get (hax, "units");
+      set (hax, "units", "points");
+      switch (get (hax, "activepositionproperty"))
+        case "position"
+          set (hax, "outerposition", outerposition);
+          set (hax, "position", position);
+        case "outerposition"
+          set (hax, "position", position);
+          set (hax, "outerposition", outerposition);
+      endswitch
+      set (hax, "units", units);
+      h = legend (hax, hplots, get (h, "string"));
+    unwind_protect_cleanup
+      recursive = false;
+    end_unwind_protect
+  endif
+
+endfunction
+
+function updatelegendtext (h, ~)
+  kids = get (h, "children");
+  htext = [];
+  for i = 1:numel (kids)
+    if (strcmp (get (kids(i), "type"), "text"))
+      htext(end+1) = kids(i);
+    endif
+  endfor
+
+  tprops = {"fontangle", "fontname", "fontweight", "color"};
+  lprops = {"fontangle", "fontname", "fontweight", "textcolor"};
+  set (htext, tprops, get (h, lprops));
+
+  ec = get (h, "edgecolor");
+  set (h, "xcolor", ec, "ycolor", ec);
+endfunction
+
+function hideshowlegend (h, ~, ca, pos1, pos2)
+  isvisible = strcmp (get (h, "visible"), "off");
+  if (! isvisible)
+    kids = get (h, "children");
+    if (any (! strcmp (get (kids, "visible"), "off")))
+      isvisible = true;
+    endif
+  endif
+
+  for i = 1 : numel (ca)
+    if (isaxes (ca(i))
+        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
+        && strcmp (get (ca(i), "beingdeleted"), "off"))
+      units = get (ca(i), "units");
+      unwind_protect
+        set (ca(i), "units", "points");
+        if (isvisible)
+          set (ca(i), "position", pos2);
+        else
+          set (ca(i), "position", pos1);
+        endif
+      unwind_protect_cleanup
+        set (ca(i), "units", units);
+      end_unwind_protect
+    endif
+  endfor
+endfunction
+
+function deletelegend1 (h, ~, ca)
+  if (isaxes (ca)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
+      && strcmp (get (ca, "beingdeleted"), "off"))
+    delete (ca);
+  endif
+endfunction
+
+function deletelegend2 (h, ~, ca, pos, outpos, t1, hplots)
+  for i = 1 : numel (ca)
+    if (isaxes (ca(i))
+        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
+        && strcmp (get (ca(i), "beingdeleted"), "off"))
+      if (! isempty (pos) && ! isempty (outpos))
+        units = get (ca(i), "units");
+        unwind_protect
+          set (ca(i), "units", "points");
+          set (ca(i), "position", pos, "deletefcn", "");
+        unwind_protect_cleanup
+          set (ca(i), "units", units);
+        end_unwind_protect
+      endif
+    endif
+  endfor
+  set (t1, "deletefcn", "");
+  delete (t1);
+  for i = 1 : numel (hplots)
+    if (ishandle (hplots(i)) && strcmp (get (hplots(i), "type"), "line"))
+      dellistener (hplots(i), "color");
+      dellistener (hplots(i), "linestyle");
+      dellistener (hplots(i), "marker");
+      dellistener (hplots(i), "markeredgecolor");
+      dellistener (hplots(i), "markerfacecolor");
+      dellistener (hplots(i), "markersize");
+      dellistener (hplots(i), "displayname");
+    endif
+  endfor
+endfunction
+
+function updateline (h, ~, hlegend, linelength, update_name)
+
+  if (update_name)
+    ## When string changes, have to rebuild legend completely
+    [hplots, text_strings] = __getlegenddata__ (hlegend);
+    legend (hplots, text_strings);
+  else
+    kids = get (hlegend, "children");
+    ll = lm = [];
+    for i = 1 : numel (kids)
+      if (get (kids(i), "userdata") == h
+          && strcmp (get (kids(i), "type"), "line"))
+        if (strcmp (get (kids(i), "marker"), "none"))
+          ll = kids(i);
+        else
+          lm = kids(i);
+        endif
+      endif
+    endfor
+
+    [linestyle, marker, displayname] = ...
+      get (h, {"linestyle", "marker", "displayname"}){:};
+
+    if (! isempty (ll))
+      [xpos1, ypos1] = get (ll, {"xdata", "ydata"}){:};
+      xpos2 = sum (xpos1) / 2;
+      ypos2 = ypos1(1);
+      delete (ll);
+      if (! isempty (lm))
+        delete (lm);
+      endif
+    else
+      [xpos2, ypos2] = get (lm, {"xdata", "ydata"}){:};
+      xpos1 = xpos2 + [-0.5, 0.5] * linelength;
+      ypos1 = [ypos2, ypos2];
+      delete (lm);
+    endif
+
+    if (! strcmp (linestyle, "none"))
+      line ("xdata", xpos1, "ydata", ypos1, "color", get (h, "color"),
+            "linestyle", get (h, "linestyle"), "marker", "none",
+            "userdata", h, "parent", hlegend);
+    endif
+    if (! strcmp (marker, "none"))
+      line ("xdata", xpos2, "ydata", ypos2, "color", get (h, "color"),
+            "marker", marker, "markeredgecolor", get (h, "markeredgecolor"),
+            "markerfacecolor", get (h, "markerfacecolor"),
+            "markersize", get (h, "markersize"), "linestyle", "none",
+            "userdata", h, "parent", hlegend);
+    endif
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! plot (rand (2));
+%! title ('legend called with cellstr and string inputs for labels');
+%! h = legend ({'foo'}, 'bar');
+%! legend location northeastoutside
+%! set (h, 'fontsize', 20);
+
+%!demo
+%! clf;
+%! plot (rand (3));
+%! title ('legend() without inputs creates default labels');
+%! h = legend ();
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! plot (x,x,';I am Blue;', x,2*x, x,3*x,';I am Red;');
+%! legend location northeastoutside
+%! ## Placing legend inside should return axes to original size
+%! legend location northeast
+%! title ('Blue and Red keys, with Green missing');
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('incline is blue and decline is green');
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend hide
+%! legend show
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend with keys in horizontal orientation');
+%! legend ({'I am blue', 'I am green'}, ...
+%!         'location', 'east', 'orientation', 'horizontal');
+%! legend boxoff
+%! legend boxon
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend with box off');
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend boxoff
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend with text to the left of key');
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend left
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ({'Use properties to place legend text to the left of key', ...
+%!         'Legend text color is magenta'});
+%! h = legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend ('right');
+%! set (h, 'textposition', 'left');
+%! set (h, 'textcolor', [1 0 1]);
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend is hidden')
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend hide
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! plot (x,x,';I am Blue;', x,2*x,';I am Green;', x,3*x,';I am Red;');
+%! title ({'Labels are embedded in call to plot', ...
+%!         'Legend is hidden and then shown'});
+%! legend boxon
+%! legend hide
+%! legend show
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! plot (x, x, ';\alpha;',  ...
+%!       x, 2*x, ';\beta=2\alpha;',  ...
+%!       x, 3*x, ';\gamma=3\alpha;');
+%! h = legend ();
+%! set (h, 'interpreter', 'tex');
+%! title ('Labels with interpreted Greek text');
+
+%!demo
+%! clf;
+%! plot (rand (2));
+%! title ('Labels with TeX interpreter turned off');
+%! h = legend ('Hello_World', 'foo^bar');
+%! set (h, 'interpreter', 'none');
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10);
+%! title ('a very long label can sometimes cause problems');
+%! legend ('hello very big world', 'location', 'northeastoutside');
+
+%!demo
+%! clf;
+%! labels = {};
+%! colororder = get (gca, 'colororder');
+%! for i = 1:5
+%!   h = plot (1:100, i + rand (100,1)); hold on;
+%!   set (h, 'color', colororder(i,:));
+%!   labels = {labels{:}, ['Signal ', num2str(i)]};
+%! end
+%! hold off;
+%! title ({'Signals with random offset and uniform noise';
+%!         'Legend shown below and outside of plot'});
+%! xlabel ('Sample Nr [k]'); ylabel ('Amplitude [V]');
+%! legend (labels, 'location', 'southoutside');
+
+%!demo
+%! clf;
+%! x = linspace (0, 10);
+%! plot (x, x);
+%! hold on;
+%! stem (x, x.^2, 'g');
+%! title ('First created object gets first label');
+%! legend ('linear');
+%! hold off;
+
+%!demo
+%! clf;
+%! x = linspace (0, 10);
+%! plot (x, x, x, x.^2);
+%! title ('First created object gets first label');
+%! legend ('linear');
+
+%!demo
+%! clf;
+%! x = linspace (0, 10);
+%! plot (x, x, x, x.^2);
+%! title ('Labels are applied in order of object creation');
+%! legend ('linear', 'quadratic');
+
+%!demo
+%! clf;
+%! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382];
+%! bar (rand_2x3_data1);
+%! ylim ([0 1.0]);
+%! title ('legend() works for bar graphs (hggroups)');
+%! legend ({'1st Bar', '2nd Bar', '3rd Bar'});
+
+%!demo
+%! clf;
+%! rand_2x3_data2 = [0.44804, 0.84368, 0.23012; 0.72311, 0.58335, 0.90531];
+%! bar (rand_2x3_data2);
+%! ylim ([0 1.2]);
+%! title ('legend() works for bar graphs (hggroups)');
+%! legend ('1st Bar', '2nd Bar', '3rd Bar');
+%! legend right;
+
+%!demo
+%! clf;
+%! x = 0:0.1:7;
+%! h = plot (x,sin(x), x,cos(x), x,sin(x.^2/10), x,cos(x.^2/10));
+%! title ('Only the sin() objects have keylabels');
+%! legend (h([1, 3]), {'sin (x)', 'sin (x^2/10)'}, 'location', 'southwest');
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! plot (x, sin (x), ';sin (x);');
+%! hold all;
+%! plot (x, cos (x), ';cos (x);');
+%! hold off;
+%! title ('legend constructed from multiple plot calls');
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! plot (x, sin (x), ';sin (x);');
+%! hold all;
+%! plot (x, cos (x), ';cos (x);');
+%! hold off;
+%! title ('Specified label text overrides previous labels');
+%! legend ({'Sine', 'Cosine'}, 'location', 'northeastoutside');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! plot (x, rand (11));
+%! xlabel ('Indices');
+%! ylabel ('Random Values');
+%! title ('Legend ''off'' deletes the legend');
+%! legend (cellstr (num2str ((1:10)')), 'location', 'northeastoutside');
+%! legend off;
+%! axis ([0, 10, 0 1]);
+
+%!demo
+%! clf;
+%! x = (1:5)';
+%! subplot (2,2,1);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'northwestoutside');
+%! subplot (2,2,2);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'northeastoutside');
+%! subplot (2,2,3);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'southwestoutside');
+%! subplot (2,2,4);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'southeastoutside');
+
+%!demo
+%! clf;
+%! plot (rand (2));
+%! title ('legend() will warn if extra labels are specified');
+%! legend ('Hello', 'World', 'interpreter', 'foobar');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y1 = rand (size (x));
+%! y2 = rand (size (x));
+%! [ax, h1, h2] = plotyy (x, y1, x, y2);
+%! title ('plotyy legend test #1: Blue and Green labels');
+%! legend ([h1, h2], {'Blue', 'Green'}, 'location', 'south');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y1 = rand (size (x));
+%! y2 = rand (size (x));
+%! [ax, h1, h2] = plotyy (x, y1, x, y2);
+%! title ('plotyy legend test #2: Blue and Green labels');
+%! legend ({'Blue', 'Green'}, 'location', 'south');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y1 = rand (size (x));
+%! y2 = rand (size (x));
+%! [ax, h1, h2] = plotyy (x, y1, x, y2);
+%! title ('plotyy legend test #3: Blue and Green labels');
+%! legend ('Blue', 'Green', 'location', 'south');
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  xlabel xlabel;
+%!  ylabel ylabel;
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northeastoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  xlabel xlabel;
+%!  ylabel ylabel;
+%!  legend ({'1234567890'}, 'location', 'eastoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  xlabel xlabel;
+%!  ylabel ylabel;
+%!  legend ({'12345678901234567890'}, 'location', 'southeastoutside');
+%!  legend (option);
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northwestoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  legend ({'1234567890'}, 'location', 'westoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
+%!  legend (option);
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northeastoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'1234567890'}, 'location', 'eastoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'12345678901234567890'}, 'location', 'southeastoutside');
+%!  legend (option);
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northwestoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'1234567890'}, 'location', 'westoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
+%!  legend (option);
+
+%!demo % bug 36408;
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  set (gca (), 'xaxislocation', 'top');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northwestoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  set (gca (), 'xaxislocation', 'top');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'1234567890'}, 'location', 'westoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  set (gca (), 'xaxislocation', 'top');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
+%!  legend (option);
+
+%!demo % bug 39697
+%! clf;
+%! plot (1:10);
+%! legend ('Legend Text');
+%! title ({'Multi-line', 'titles', 'are a', 'problem'});
+
+%!demo
+%! clf;
+%! colormap (cool (64));
+%! surf (peaks ());
+%! legend ('peaks()')
+%! title ('legend() works for surface objects too');
+
+%!test
+%! toolkit = graphics_toolkit ("gnuplot");
+%! h = figure ("visible", "off");
+%! unwind_protect
+%!   position = get (h, "position");
+%!   plot (rand (3));
+%!   legend ();
+%!   filename = sprintf ("%s.eps", tmpnam ());
+%!   print (filename);
+%!   unlink (filename);
+%!   assert (get (h, "position"), position);
+%! unwind_protect_cleanup
+%!   close (h);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/module.mk	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,41 @@
+FCN_FILE_DIRS += plot/appearance
+
+plot_appearance_PRIVATE_FCN_FILES = \
+  plot/appearance/private/__axes_limits__.m \
+  plot/appearance/private/__axis_label__.m
+
+plot_appearance_FCN_FILES = \
+  plot/appearance/__clabel__.m \
+  plot/appearance/__getlegenddata__.m \
+  plot/appearance/axis.m \
+  plot/appearance/box.m \
+  plot/appearance/caxis.m \
+  plot/appearance/clabel.m \
+  plot/appearance/daspect.m \
+  plot/appearance/diffuse.m \
+  plot/appearance/grid.m \
+  plot/appearance/gtext.m \
+  plot/appearance/hidden.m \
+  plot/appearance/legend.m \
+  plot/appearance/orient.m \
+  plot/appearance/pbaspect.m \
+  plot/appearance/shading.m \
+  plot/appearance/specular.m \
+  plot/appearance/text.m \
+  plot/appearance/title.m \
+  plot/appearance/view.m \
+  plot/appearance/whitebg.m \
+  plot/appearance/xlabel.m \
+  plot/appearance/xlim.m \
+  plot/appearance/ylabel.m \
+  plot/appearance/ylim.m \
+  plot/appearance/zlabel.m \
+  plot/appearance/zlim.m \
+  $(plot_appearance_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(plot_appearance_FCN_FILES)
+
+PKG_ADD_FILES += plot/appearance/PKG_ADD
+
+DIRSTAMP_FILES += plot/appearance/$(octave_dirstamp)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/orient.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,126 @@
+## Copyright (C) 2001-2012 Paul Kienzle
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} orient (@var{orientation})
+## @deftypefnx {Function File} {} orient (@var{hfig}, @var{orientation})
+## @deftypefnx {Function File} {@var{orientation} =} orient ()
+## @deftypefnx {Function File} {@var{orientation} =} orient (@var{hfig})
+## Query or set the default print orientation.
+##
+## Valid values for @var{orientation} are @qcode{"landscape"},
+## @qcode{"portrait"}, and @qcode{"tall"}.
+##
+## The @qcode{"tall"} option sets the orientation to portrait and fills
+## the page with the plot, while leaving a 0.25 inch border.
+##
+## When called with no arguments, return the default print orientation.
+##
+## If the first argument @var{hfig} is a figure handle, then operate on this
+## figure rather than the current figure returned by @code{gcf}.
+## @seealso{print, saveas}
+## @end deftypefn
+
+## Author: Paul Kienzle
+## Adapted-By: jwe
+
+function retval = orient (varargin)
+
+  nargs = nargin;
+
+  if (nargs > 0 && numel (varargin{1}) == 1 && isfigure (varargin{1}))
+    cf = varargin{1};
+    varargin(1) = [];
+    nargs--;
+  else
+    cf = gcf ();
+  endif
+
+  if (nargs == 0)
+    retval = get (cf, "paperorientation");
+  elseif (nargin == 1)
+    orientation = varargin{1};
+    if (strcmpi (orientation, "landscape") || strcmpi (orientation, "portrait"))
+      if (! strcmpi (get (cf, "paperorientation"), orientation))
+        ## FIXME: with the proper listeners in place there won't be a need to
+        ##        set the papersize and paperpostion here.
+        papersize = get (cf, "papersize");
+        paperposition = get (cf, "paperposition");
+        set (cf, "paperorientation", orientation);
+        set (cf, "papersize", papersize([2, 1]));
+        set (cf, "paperposition", paperposition([2, 1, 4, 3]));
+      endif
+    elseif (strcmpi (varargin{1}, 'tall'))
+      orient ("portrait");
+      papersize = get (cf, "papersize");
+      set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]);
+    else
+      error ("orient: unknown ORIENTATION");
+    endif
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+
+%!shared papersize, paperposition, tallpaperposition, hfig
+%! papersize = [8.5, 11];
+%! paperposition = [0.25, 2.5, 8, 6];
+%! tallpaperposition = [0.25, 0.25, (papersize-0.5)];
+%! hfig = figure ("visible", "off");
+%! set (hfig, "paperorientation", "portrait");
+%! set (hfig, "papersize", papersize);
+%! set (hfig, "paperposition", paperposition);
+
+%!test
+%! orient portrait;
+%! assert (orient, "portrait")   # default
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), paperposition);
+
+%!test
+%! orient landscape;
+%! assert (orient,"landscape")   # change to landscape
+%! assert (get (hfig, "papersize"), papersize([2, 1]));
+%! assert (get (hfig, "paperposition"), paperposition([2, 1, 4, 3]));
+
+%!test
+%! orient portrait   # change back to portrait
+%! assert (orient, "portrait");
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), paperposition);
+
+%!test
+%! orient landscape;
+%! orient tall;
+%! assert (orient, "portrait");
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), tallpaperposition);
+
+%!fail ("orient ('nobody')", "unknown ORIENTATION")
+
+%!test
+%! orient portrait   # errors don't change the state
+%! assert (orient, "portrait");
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), tallpaperposition);
+
+%!test
+%! close (hfig);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/pbaspect.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,122 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( )
+## @deftypefnx {Function File} {} pbaspect (@var{plot_box_aspect_ratio})
+## @deftypefnx {Function File} {} pbaspect (@var{mode})
+## @deftypefnx {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode")
+## @deftypefnx {Function File} {} pbaspect (@var{hax}, @dots{})
+##
+## Query or set the plot box aspect ratio of the current axes.
+##
+## The aspect ratio is a normalized 3-element vector representing the rendered
+## lengths of the x, y, and z axes.
+##
+## @code{pbaspect(@var{mode})}
+##
+## Set the plot box aspect ratio mode of the current axes.  @var{mode} is
+## either @qcode{"auto"} or @qcode{"manual"}.
+##
+## @code{pbaspect ("mode")}
+##
+## Return the plot box aspect ratio mode of the current axes.
+##
+## @code{pbaspect (@var{hax}, @dots{})}
+##
+## Operate on the axes in handle @var{hax} instead of the current axes.
+##
+## @seealso{axis, daspect, xlim, ylim, zlim}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-01-26
+
+function pbratio = pbaspect (varargin)
+
+  ## Grab axes handle if present
+  if (nargin > 0)
+    if (isscalar (varargin{1}) && isaxes (varargin{1}))
+      hax = varargin{1};
+      varargin = varargin(2:end);
+    else
+      hax = gca ();
+    endif
+  else
+    hax = gca ();
+  endif
+
+  nargin = numel (varargin);
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    pbratio = get (hax, "plotboxaspectratio");
+  else
+    arg = varargin{1};
+    if (isreal (arg))
+      if (numel (arg) == 2)
+        set (hax, "plotboxaspectratio", [arg, 1]);
+      elseif (numel (arg) == 3)
+        set (hax, "plotboxaspectratio", arg);
+      else
+        error ("pbaspect: PLOT_BOX_ASPECT_RATIO must be a 2 or 3 element vector");
+      endif
+    elseif (ischar (arg))
+      arg = tolower (arg);
+      switch (arg)
+        case "auto"
+          set (hax, "plotboxaspectratiomode", "auto");
+        case "manual"
+          set (hax, "plotboxaspectratiomode", "manual");
+        case "mode"
+          pbratio = get (hax, "plotboxaspectratiomode");
+        otherwise
+          error ("pbaspect: Invalid mode <%s>", arg);
+      endswitch
+    else
+      print_usage ();
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! pbaspect ([1 1 1]);
+%! title ('plot box is square');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;;
+%! plot (x,cos(x), x,sin(x));
+%! pbaspect ([2 1 1]);
+%! title ('plot box aspect ratio is 2x1');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! daspect ([1 1 1]);
+%! pbaspect ([2 1 1]);
+%! title ('plot box is 2x1, and axes [0 4 -1 1]');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/private/__axis_label__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,43 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __axis_label__ (@var{caller}, @var{h}, @var{txt}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = __axis_label__ (hax, caller, txt, varargin)
+
+  h = get (hax, caller);
+
+  set (h, "fontangle", get (hax, "fontangle"),
+          "fontname", get (hax, "fontname"),
+          "fontunits", get (hax, "fontunits"),   # must precede fontsize
+          "fontsize", get (hax, "fontsize"),
+          "fontweight", get (hax, "fontweight"),
+          "string", txt,
+          varargin{:});
+
+  if (nargout > 0)
+    retval = h;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/private/__axis_limits__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,58 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __axes_limits__ (@var{fcn}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function retval = __axes_limits__ (fcn, varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (fcn, varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  if (nargin == 0)
+    retval = get (hax, fcn);
+  else
+    retval = [];
+    fcnmode = [fcn "mode"];
+    arg = varargin{1};
+    if (ischar (arg))
+      if (strcmpi (arg, "mode"))
+        retval = get (hax, fcnmode);
+      elseif (any (strcmpi (arg, {"auto", "manual"})))
+        set (hax, fcnmode, arg);
+      endif
+    else
+      if (!isnumeric (arg) && any (size (arg(:)) != [2, 1]))
+        error ("%s: LIMITS must be a 2-element vector", fcn);
+      else
+        if (arg(1) >= arg(2))
+          error ("%s: axis limits must be increasing", fcn);
+        else
+          set (hax, fcn, arg(:));
+        endif
+      endif
+    endif
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/shading.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,142 @@
+## Copyright (C) 2006-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} shading (@var{type})
+## @deftypefnx {Function File} {} shading (@var{hax}, @var{type})
+## Set the shading of patch or surface graphic objects.
+##
+## Valid arguments for @var{type} are
+##
+## @table @asis
+## @item @qcode{"flat"}
+## Single colored patches with invisible edges.
+##
+## @item @qcode{"faceted"}
+## Single colored patches with visible edges.
+##
+## @item @qcode{"interp"}
+## Color between patch vertices are interpolated and the patch edges are
+## invisible.
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{fill, mesh, patch, pcolor, surf, surface, hidden}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function shading (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("shading", varargin{:});
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  mode = varargin{1};
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  ## Find all patch and surface objects that are descendants of hax
+  ## and  which are not part of a contour plot hggroup.
+  hlist = [];
+  kids = get (hax, "children");
+  while (! isempty (kids))
+    types = get (kids, "type");
+    hlist = [hlist; kids(strcmp(types, "patch"))];
+    hlist = [hlist; kids(strcmp(types, "surface"))];
+    parents = kids(strcmp (types, "axes"));
+    hglist = kids(strcmp (types, "hggroup"));
+    for i = 1 : numel (hglist)
+      props = get (hglist(i));
+      if (! isfield (props, "levelstep"))
+        parents(end+1) = hglist(i); 
+      endif
+    endfor
+    kids = get (parents, "children");
+  endwhile
+
+  ## FIXME: This is the old, simple code.
+  ##        Unfortunately, it also shades contour plots which is not desirable.
+  ##hp = findobj (hax, "type", "patch");
+  ##hs = findobj (hax, "type", "surface");
+  ##hlist = [hp(:); hs(:)];
+
+  switch (lower (mode))
+    case "flat"
+      set (hlist, "facecolor", "flat");
+      set (hlist, "edgecolor", "none");
+    case "interp"
+      set (hlist, "facecolor", "interp");
+      set (hlist, "edgecolor", "none");
+    case "faceted"
+      set (hlist, "facecolor", "flat");
+      set (hlist, "edgecolor", [0 0 0]);
+    otherwise
+      error ('shading: Invalid MODE "%s"', mode);
+  endswitch
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! shading faceted;
+%! title ('shading ''faceted''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! shading flat;
+%! title ('shading ''flat''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! shading interp;
+%! title ('shading ''interp''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks ());
+%! shading faceted;
+%! title ('shading ''faceted''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks ());
+%! shading flat;
+%! title ('shading ''flat''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks ());
+%! shading interp;
+%! title ('shading ''interp''');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/specular.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,94 @@
+## Copyright (C) 2009-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv})
+## @deftypefnx {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se})
+## Calculate specular reflection strength of a surface defined by the normal
+## vector elements @var{sx}, @var{sy}, @var{sz} using Phong's approximation.
+##
+## The light source location and viewer location vectors can be specified using
+## parameter @var{lv} and @var{vv} respectively.  The location vectors can
+## given as 2-element vectors [azimuth, elevation] in degrees or as 3-element
+## vectors [x, y, z].
+##
+## An optional sixth argument describes the specular exponent (spread) @var{se}.
+## @seealso{diffuse, surfl}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function retval = specular (sx, sy, sz, lv, vv, se)
+
+  if (nargin < 5 || nargin > 6)
+    print_usage ();
+  endif
+
+  ## Checks for specular exponent (se).
+  if (nargin < 6)
+    se = 10;
+  else
+    if (!isnumeric (se) || numel (se) != 1 || se <= 0)
+      error ("specular: exponent must be positive scalar");
+    endif
+  endif
+
+  ## Checks for normal vector.
+  if (!size_equal (sx, sy, sz))
+    error ("specular: SX, SY, and SZ must have same size");
+  endif
+
+  ## Check for light vector (lv) argument.
+  if (length (lv) < 2 || length (lv) > 3)
+    error ("specular: light vector LV must be a 2- or 3-element vector");
+  elseif (length (lv) == 2)
+    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
+  endif
+
+  ## Check for view vector (vv) argument.
+  if (length (vv) < 2 || length (lv) > 3)
+    error ("specular: view vector VV must be a 2- or 3-element vector");
+  elseif (length (vv) == 2)
+    [vv(1), vv(2), vv(3)] = sph2cart (vv(1) * pi / 180, vv(2) * pi / 180, 1.0);
+  endif
+
+  ## Normalize view and light vector.
+  if (sum (abs (lv)) > 0)
+    lv  /= norm (lv);
+  endif
+  if (sum (abs (vv)) > 0)
+    vv  /= norm (vv);
+  endif
+
+  ## Calculate normal vector lengths and dot-products.
+  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
+  l_dot_n = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
+  v_dot_n = (sx * vv(1) + sy * vv(2) + sz * vv(3)) ./ ns;
+
+  ## Calculate specular reflection using Phong's approximation.
+  retval = 2 * l_dot_n .* v_dot_n - dot (lv, vv);
+
+  ## Set zero if light is on the other side.
+  retval(l_dot_n < 0) = 0;
+
+  ## Allow postive values only.
+  retval(retval < 0) = 0;
+  retval = retval .^ se;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/text.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,338 @@
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} text (@var{x}, @var{y}, @var{string})
+## @deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{z}, @var{string})
+## @deftypefnx {Function File} {} text (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} text (@dots{})
+## Create a text object with text @var{string} at position @var{x}, @var{y},
+## (@var{z}) on the current axes.
+##
+## Multiple locations can be specified if @var{x}, @var{y}, (@var{z}) are
+## vectors.  Multiple strings can be specified with a character matrix or
+## a cell array of strings.
+##
+## Optional property/value pairs may be used to control the appearance of the
+## text.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## created text objects.
+## @seealso{gtext, title, xlabel, ylabel, zlabel}
+## @end deftypefn
+
+## Author: jwe
+
+## Note: The following code is rigged for Matlab compatibility and is
+##       full of hidden assumptions.  Be very wary when modifying.
+
+function h = text (varargin)
+
+  nargs = nargin;
+  offset = 0;
+
+  if (nargs > 2 && isnumeric (varargin{1}) && isnumeric (varargin{2}))
+    x = varargin{1};
+    y = varargin{2};
+
+    if (nargin > 3 && isnumeric (varargin{3}))
+      z = varargin{3};
+      offset = 4;
+    else
+      z = zeros (size (x));
+      offset = 3;
+    endif
+
+    string = varargin{offset};
+    varargin(1:offset) = [];
+
+    nx = numel (x);
+    ny = numel (y);
+    nz = numel (z);
+    if (ischar (string))
+
+      do_keyword_repl = true;
+      nt = rows (string);
+      if (nx == 1 && nt == 1)
+        ## Single text object with one line
+        string = {string};
+      elseif (nx == 1 && nt > 1)
+        ## Single text object with multiple lines
+        ## FIXME: "default" or "factory" as first row
+        ##        should be escaped to "\default" or "\factory"
+        ##        Other rows do not require escaping.
+        do_keyword_repl = false;
+        string = {string};
+      elseif (nx > 1 && nt == nx)
+        ## Mutiple text objects with different strings
+        string = cellstr (string);
+      else 
+        ## Mutiple text objects with same string
+        string = repmat ({string}, [nx, 1]);
+        nt = nx;
+      endif
+
+      ## Escape special keywords
+      if (do_keyword_repl)
+        string = regexprep (string, '^(default|factory)$', '\\$1');
+      endif
+
+    elseif (iscell (string))
+
+      nt = numel (string);
+      if (nx == 1)      
+        ## Single text object with one or more lines
+        string = {string};
+        nt = 1;
+      elseif (nx > 1 && nt == nx)
+        ## Mutiple text objects with different strings
+      else
+        ## Mutiple text objects with same string
+        string = repmat ({string}, [nx, 1]);
+        nt = nx;
+      endif
+
+    else
+
+      error ("text: STRING must be a character string or cell array of character strings");
+
+    endif
+  else  # Only PROP/VALUE pairs
+    x = y = z = 0;
+    nx = ny = nz = 1;
+    string = {""};
+    nt = 1;
+  endif
+
+  ## Any remaining inputs must occur as PROPERTY/VALUE pairs
+  if (rem (numel (varargin), 2) != 0)
+    print_usage ();
+  endif
+
+  ## Get axis argument which may be in a 'parent' PROP/VAL pair
+  [hax, varargin] = __plt_get_axis_arg__ ("text", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  ## Position argument may alse be in PROP/VAL pair
+  idx = find (strcmpi (varargin, "position"), 1);
+  if (idx)
+    pos = varargin{idx+1};
+    varargin(idx:idx+1) = [];
+  else
+    pos = [x(:), y(:), z(:)];
+  endif
+
+  if (nx == ny && nx == nz && (nt == nx || nt == 1 || nx == 1))
+    htmp = zeros (nt, 1);
+    if (nx == 1)
+      htmp = __go_text__ (hax, "string", string{1},
+                               ## varargin first, in case "Units" set for pos.
+                               varargin{:},
+                               "position", pos);
+    elseif (nx == nt)
+      for n = 1:nt
+        htmp(n) = __go_text__ (hax, "string", string{n},
+                                    varargin{:},
+                                    "position", pos(n,:));
+      endfor
+      __request_drawnow__ ();
+    else
+      error ("text: dimension mismatch for coordinates and STRING");
+    endif
+  elseif (nt == nx || nt == 1 || nx == 1)
+    error ("text: dimension mismatch for coordinates");
+  else
+    error ("text: dimension mismatch between coordinates and strings");
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ha = {'left', 'center', 'right'};
+%! va = {'bottom', 'middle', 'top'};
+%! x = [0.25 0.5 0.75];
+%! y = x;
+%! for t = 0:30:359;
+%!   for nh = 1:numel (ha)
+%!     for nv = 1:numel (va)
+%!       text (x(nh), y(nv), 'Hello World', ...
+%!             'rotation', t, ...
+%!             'horizontalalignment', ha{nh}, ...
+%!             'verticalalignment', va{nv});
+%!     end
+%!   end
+%! end
+%! set (gca, 'xtick', [0.25, 0.5, 0.75], ...
+%!           'xticklabel', ha, ...
+%!           'ytick', [0.25, 0.5, 0.75], ...
+%!           'yticklabel', va);
+%! axis ([0 1 0 1]);
+%! xlabel ('horizontal alignment');
+%! ylabel ('vertical alignment');
+%! title ('text alignment and rotation (0:30:360 degrees)');
+
+%!demo
+%! clf;
+%! h = mesh (peaks, 'edgecolor', 0.7 * [1 1 1], ...
+%!                  'facecolor', 'none', ...
+%!                  'facealpha', 0);
+%! for t = 0:45:359;
+%!   text (25, 25, 0, 'Vertical Alignment = Bottom', ...
+%!                    'rotation', t, ...
+%!                    'horizontalalignment', 'left', ...
+%!                    'verticalalignment', 'bottom');
+%! end
+%! caxis ([-100 100]);
+%! title ('Vertically Aligned at Bottom');
+
+%!demo
+%! clf;
+%! axis ([0 8 0 8]);
+%! title (['1st title';'2nd title']);
+%! xlabel (['1st xlabel';'2nd xlabel']);
+%! ylabel (['1st ylabel';'2nd ylabel']);
+%! text (4, 4, {'Hello', 'World'}, ...
+%!       'horizontalalignment', 'center', ...
+%!       'verticalalignment', 'middle');
+%! grid on;
+
+%!demo
+%! clf;
+%! h = mesh (peaks (), 'edgecolor', 0.7 * [1 1 1], ...
+%!                     'facecolor', 'none', ...
+%!                     'facealpha', 0);
+%! title (['1st title';'2nd title']);
+%! xlabel (['1st xlabel';'2nd xlabel']);
+%! ylabel (['1st ylabel';'2nd ylabel']);
+%! zlabel (['1st zlabel';'2nd zlabel']);
+%! text (0, 0, 5, {'Hello', 'World'}, ...
+%!       'horizontalalignment', 'center', ...
+%!       'verticalalignment', 'middle');
+%! hold on;
+%! plot3 (0, 0, 5, '+k');
+
+%!demo
+%! clf;
+%! h = text (0.5, 0.3, 'char');
+%! assert ('char', class (get (h, 'string')));
+%! h = text (0.5, 0.4, ['char row 1'; 'char row 2']);
+%! assert ('char', class (get (h, 'string')));
+%! h = text (0.5, 0.6, {'cell2str (1,1)', 'cell2str (1,2)'; 'cell2str (2,1)', 'cell2str (2,2)'});
+%! assert ('cell', class (get (h, 'string')));
+%! h = text (0.5, 0.8, 'foobar');
+%! set (h, 'string', 1:3);
+%! h = text ([0.1, 0.1], [0.3, 0.4], 'one string & two objects');
+%! assert ('char', class (get (h(1), 'string')));
+%! assert ('char', class (get (h(2), 'string')));
+%! h = text ([0.1, 0.1], [0.5, 0.6], {'one cellstr & two objects'});
+%! assert ('cell', class (get (h(1), 'string')));
+%! assert ('cell', class (get (h(2), 'string')));
+%! h = text ([0.1, 0.1], [0.7, 0.8], {'cellstr 1 object 1', 'cellstr 2 object 2'});
+%! assert ('char', class (get (h(1), 'string')));
+%! assert ('char', class (get (h(2), 'string')));
+%! h = text ([0.1, 0.1], [0.1, 0.2], ['1st string & 1st object'; '2nd string & 2nd object']);
+%! assert ('char', class (get (h(1), 'string')));
+%! assert ('char', class (get (h(2), 'string')));
+%! h = text (0.7, 0.6, 'single string');
+%! assert ('char', class (get (h, 'string')));
+%! h = text (0.7, 0.5, {'single cell-string'});
+%! assert ('cell', class (get (h, 'string')));
+%! xlabel (1:2);
+%! ylabel (1:2);
+%! title (1:2);
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ## Single object with one line
+%!   h = text (0.5, 0.3, "single object with one line");
+%!   obs = get (h, "string");
+%!   assert (class (obs), "char");
+%!   assert (obs, "single object with one line");
+%!
+%!   ## Single object with multiple lines
+%!   h = text (0.5, 0.4, ["char row 1"; "char row 2"]);
+%!   obs = get (h, "string");
+%!   assert (class (obs), "char");
+%!   assert (obs, ["char row 1"; "char row 2"]);
+%!
+%!   ## Multiple objects with single line
+%!   h = text ([0.1, 0.1], [0.3, 0.4], "two objects with same string");
+%!   assert (class (get (h(1), "string")), "char");
+%!   assert (class (get (h(2), "string")), "char");
+%!   assert (get (h(1), "string"), "two objects with same string");
+%!   assert (get (h(2), "string"), "two objects with same string");
+%!
+%!   ## Multiple objects with multiple lines
+%!   h = text ([0.1, 0.1], [0.3, 0.4], ["string1"; "string2"]);
+%!   assert (class (get (h(1), "string")), "char");
+%!   assert (class (get (h(2), "string")), "char");
+%!   assert (get (h(1), "string"), "string1");
+%!   assert (get (h(2), "string"), "string2");
+%!
+%!   ### Tests repeated with cell input ###
+%!
+%!   ## Single object with one line
+%!   h = text (0.5, 0.3, {"single object with one line"});
+%!   obs = get (h, "string");
+%!   assert (class (obs), "cell");
+%!   assert (obs, {"single object with one line"});
+%!
+%!   ## Single object with multiple lines
+%!   h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)";
+%!                        "cell2str (2,1)", "cell2str (2,2)"});
+%!   obs = get (h, "string");
+%!   assert (class (obs), "cell");
+%!   assert (obs, {"cell2str (1,1)"; "cell2str (2,1)";
+%!                 "cell2str (1,2)"; "cell2str (2,2)"});
+%!
+%!   ## Multiple objects with single line
+%!   h = text ([0.1, 0.1], [0.5, 0.6], {"two objects with same cellstr"});
+%!   assert (class (get (h(1), "string")), "cell");
+%!   assert (class (get (h(2), "string")), "cell");
+%!   ## FIXME: is return value of cellstr, rather than string, Matlab-verified?
+%!   assert (get (h(1), "string"), {"two objects with same cellstr"});
+%!   assert (get (h(2), "string"), {"two objects with same cellstr"});
+%!
+%!   ## Multiple objects with multiple lines
+%!   h = text ([0.1, 0.1], [0.7, 0.8], {"cellstr1", "cellstr2"});
+%!   ## FIXME: is return value really char in Matlab?
+%!   assert (class (get (h(1), "string")), "char");
+%!   assert (class (get (h(2), "string")), "char");
+%!   assert (get (h(1), "string"), "cellstr1");
+%!   assert (get (h(2), "string"), "cellstr2");
+%!
+%!   ## Test special keyword processing
+%!   h = text (0.5, 0.5, "default");
+%!   assert (get (h, "string"), "default")
+%!   h = text (0.5, 0.5, "factory");
+%!   assert (get (h, "string"), "factory")
+%!
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/title.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,112 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} title (@var{string})
+## @deftypefnx {Function File} {} title (@var{string}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} title (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} title (@dots{})
+## Specify the string used as a title for the current axis.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the appearance of the created title text object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{xlabel, ylabel, zlabel, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = title (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("title", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "title", varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ax = axes ();
+%! h = get (ax, 'title');
+%! title ('Test Title Text');
+
+%!demo
+%! clf;
+%! ax = axes ();
+%! h = get (ax, 'title');
+%! title ({'Multi-line'; 'Title'; 'Text'});
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! h = get (gca, 'title');
+%! title ('Test FontSize Property', 'fontsize', 16);
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ax = axes ();
+%!   h = get (ax, "title");
+%!   title ("Test Title Text");
+%!   assert (get (h, "string"), "Test Title Text");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ax = axes ();
+%!   h = get (ax, "title");
+%!   title ({'Multi-line'; 'Title'; 'Text'});
+%!   assert (get (h, "string"), {'Multi-line'; 'Title'; 'Text'});
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   h = get (gca, "title");
+%!   title ("Test FontSize Property", "fontsize", 16);
+%!   assert (get (h, "string"), "Test FontSize Property");
+%!   assert (get (h, "fontsize"), 16);
+
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/view.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,128 @@
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} view (@var{azimuth}, @var{elevation})
+## @deftypefnx {Function File} {} view ([@var{azimuth} @var{elevation}])
+## @deftypefnx {Function File} {} view ([@var{x} @var{y} @var{z}])
+## @deftypefnx {Function File} {} view (2)
+## @deftypefnx {Function File} {} view (3)
+## @deftypefnx {Function File} {} view (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{azimuth}, @var{elevation}] =} view ()
+## Query or set the viewpoint for the current axes.
+##
+## The parameters @var{azimuth} and @var{elevation} can be given as two
+## arguments or as 2-element vector.  The viewpoint can also be specified with
+## Cartesian coordinates @var{x}, @var{y}, and @var{z}.
+##
+## The call @code{view (2)} sets the viewpoint to @w{@var{azimuth} = 0}
+## and @w{@var{elevation} = 90}, which is the default for 2-D graphs.
+##
+## The call @code{view (3)} sets the viewpoint to @w{@var{azimuth} = -37.5}
+## and @w{@var{elevation} = 30}, which is the default for 3-D graphs.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## If no inputs are given, return the current @var{azimuth} and @var{elevation}.
+## @end deftypefn
+
+## Author: jwe
+
+function [azimuth, elevation] = view (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("view", varargin{:});
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  if (nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    x = get (hax, "view");
+    az = x(1);
+    el = x(2);
+  elseif (length (varargin) == 1)
+    x = varargin{1};
+    if (length (x) == 2)
+      az = x(1);
+      el = x(2);
+    elseif (length (x) == 3)
+      [az, el] = cart2sph (x(1), x(2), x(3));
+      az *= 180/pi;
+      az += 90;
+      el *= 180/pi;
+    elseif (x == 2)
+      az = 0;
+      el = 90;
+    elseif (x == 3)
+      az = -37.5;
+      el = 30;
+    else
+      print_usage ();
+    endif
+  elseif (length (varargin) == 2)
+    az = varargin{1};
+    el = varargin{2};
+  endif
+
+  if (nargin > 0)
+    set (hax, "view", [az, el]);
+  else
+    if (nargout == 1)
+      azimuth = [az, el];
+    elseif (nargout == 2)
+      azimuth = az;
+      elevation = el;
+    endif
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   [az, el] = view;
+%!   assert ([az, el], [-37.5, 30], eps);
+%!   view (2);
+%!   [az, el] = view;
+%!   assert ([az, el], [0, 90], eps);
+%!   view ([1 1 0]);
+%!   [az, el] = view;
+%!   assert ([az, el], [135, 0], eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   line;
+%!   [az, el] = view;
+%!   assert ([az, el], [0, 90], eps);
+%!   view (3);
+%!   [az, el] = view;
+%!   assert ([az, el], [-37.5, 30], eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/whitebg.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,167 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} whitebg ()
+## @deftypefnx {Function File} {} whitebg (@var{color})
+## @deftypefnx {Function File} {} whitebg ("none")
+## @deftypefnx {Function File} {} whitebg (@var{hfig}, @dots{})
+## Invert the colors in the current color scheme.
+##
+## The root properties are also inverted such that all subsequent plot use the
+## new color scheme.
+##
+## If the optional argument @var{color} is present then the background color
+## is set to @var{color} rather than inverted.  @var{color} may be a string
+## representing one of the eight known colors or an RGB triplet.  The special
+## string argument @qcode{"none"} restores the plot to the default colors.
+##
+## If the first argument @var{hfig} is a figure handle, then operate on
+## this figure rather than the current figure returned by @code{gcf}.  The
+## root properties will not be changed.
+## @seealso{reset, get, set}
+## @end deftypefn
+
+function whitebg (varargin)
+  h = 0;
+  color = NaN;
+
+  if (nargin > 0 && nargin < 3)
+    if (ishandle (varargin{1}))
+      h = varargin{1};
+      if (nargin == 2)
+        color = varargin{2};
+      endif
+    elseif (nargin == 1)
+      color = varargin{1};
+    else
+      print_usage ();
+    endif
+  elseif (nargin != 0)
+    print_usage ();
+  endif
+
+  typ = get (h, "type");
+
+  if (strcmp (typ, "root"))
+    isroot = true;
+    fig = gcf ();
+  elseif (strcmp (typ, "figure"))
+    isroot = false;
+    fig = h;
+  else
+    error ("expecting a figure handle");
+  endif
+
+  axes = findall (fig, "type", "axes");
+  if (isnan (color))
+    ## Root figure. Set the default axes and figure properties so that
+    ## subsequent plots have the new color scheme
+    if (isroot)
+      fac = get (0, "factory");
+      fields = fieldnames (fac);
+      fieldindex = intersect (find (!cellfun ("isempty", regexp (fields, 'color'))), union (find (!cellfun ("isempty", regexp (fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp (fields, 'factoryfigure.*')))));
+
+      ## Check whether the factory value has been replaced
+      for nf = 1 : numel (fieldindex);
+        defaultfield = strrep (fields {fieldindex (nf)}, "factory", "default");
+        try
+          defaultvalue = 1 - get (0, defaultfield {n});
+        catch
+          field = fields {fieldindex (nf)};
+          defaultvalue = 1 - subsref (fac, struct ("type", ".", "subs", field));
+        end_try_catch
+        set (0, defaultfield, defaultvalue);
+      endfor
+    endif
+
+    ## Load all objects which qualify for being searched.
+    handles = fig;
+    h = fig;
+    while (numel (handles))
+      children = [];
+      for n = 1 : numel (handles)
+        children = union (children, get (handles(n), "children"));
+      endfor
+      handles = children;
+      h = union (h, children);
+    endwhile
+
+    for nh = 1 : numel (h)
+      p = get (h (nh));
+      fields = fieldnames (p);
+      fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
+      if (numel (fieldindex))
+        for nf = 1 : numel (fieldindex);
+          field = fields {fieldindex (nf)};
+          c = subsref (p, struct ("type", ".", "subs", field));
+          if (! ischar (c) && columns (c) == 3)
+            set (h (nh), field, 1 - c);
+          endif
+        endfor
+      endif
+
+      ## If h(nh) is a figure or axes invert default color properties
+      typ = subsref (p, struct ("type", ".", "subs", "type"));
+      if (strcmp (typ, "axes") || strcmp (typ, "figure"))
+        def = get (h (nh), "default");
+        fields = fieldnames (def);
+        if (! isempty (fields))
+          fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
+          for nf = 1 : numel (fieldindex)
+            defaultfield = fields {fieldindex (nf)};
+            defaultvalue = 1 - subsref (def, struct ("type", ".", "subs", defaultfield));
+            set (h (nh), defaultfield, defaultvalue);
+          endfor
+        endif
+      endif
+    endfor
+  else
+    ## FIXME
+    ## Is this the right thing to do in this case?
+    set (findall (fig, "type", "axes"), "color", color);
+    if (isroot)
+      defs = get (0, "default");
+      if (isfield (defs, "defaultaxescolor")
+          && strcmp (defs.defaultaxescolor, "none"))
+        set (0, "defaultaxescolor", color);
+      endif
+    endif
+  endif
+endfunction
+
+
+%!test
+%! dac = get (0, "defaultaxescolor");
+%! dfc = get (0, "defaultfigurecolor");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   assert (get (hf, "color"), dfc);
+%!   assert (get (gca, "color"), dac);
+%!   whitebg (hf);
+%!   assert (get (hf, "color"), 1 - dfc);
+%!   assert (get (gca, "color"), 1 - dac);
+%!   c = [0.2 0.2 0.2];
+%!   whitebg (hf, c);
+%!   assert (get (hf, "color"), 1 - dfc);
+%!   assert (get (gca, "color"), c);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/xlabel.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,73 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} xlabel (@var{string})
+## @deftypefnx {Function File} {} xlabel (@var{string}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} xlabel (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} xlabel (@dots{})
+## Specify the string used to label the x-axis of the current axis.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the properties of the created text label.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{ylabel, zlabel, datetick, title, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = xlabel (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("xlabel", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "xlabel", varargin{1},
+                         "color", get (hax, "xcolor"), varargin{2:end});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   x = xlabel ("xlabel_string", "color", "r");
+%!   assert (get (gca, "xlabel"), x);
+%!   assert (get (x, "type"), "text");
+%!   assert (get (x, "visible"), "on");
+%!   assert (get (x, "string"), "xlabel_string");
+%!   assert (get (x, "color"), [1 0 0]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/xlim.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,100 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{xlimits} =} xlim ()
+## @deftypefnx {Function File} {@var{xmode} =} xlim ("mode")
+## @deftypefnx {Function File} {} xlim ([@var{x_lo} @var{x_hi}])
+## @deftypefnx {Function File} {} xlim ("auto")
+## @deftypefnx {Function File} {} xlim ("manual")
+## @deftypefnx {Function File} {} xlim (@var{hax}, @dots{})
+## Query or set the limits of the x-axis for the current plot.
+##
+## Called without arguments @code{xlim} returns the x-axis limits of the
+## current plot.  With the input query @qcode{"mode"}, return the current
+## x-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
+##
+## If passed a 2-element vector [@var{x_lo} @var{x_hi}], the limits of the
+## x-axis are set to these values and the mode is set to @qcode{"manual"}.
+##
+## The current plotting mode can be changed by using either @qcode{"auto"}
+## or @qcode{"manual"} as the argument.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{ylim, zlim, axis, set, get, gca}
+## @end deftypefn
+
+function retval = xlim (varargin)
+  ret = __axis_limits__ ("xlim", varargin{:});
+
+  if (! isempty (ret))
+    retval = ret;
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! line ();
+%! xlim ([0.2, 0.8]);
+%! title ('xlim is [0.2, 0.8]');
+%! assert (xlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! line ();
+%! xlim ('auto');
+%! title ('xlim is auto');
+%! assert (xlim ('mode'), 'auto');
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! xlim ([0.2, 0.8]);
+%! title ('xlim is [0.2, 0.8]');
+%! assert (xlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! xlim ('auto');
+%! title ('xlim is auto');
+%! assert (xlim ('mode'), 'auto');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   xlim ([0, 1.1]);
+%!   assert (get (gca, "xlim"), [0, 1.1], eps);
+%!   assert (xlim ("mode"), "manual");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot3 ([0,1.1], [0,1], [0, 1]);
+%!   assert (get (gca, "xlim"), [0, 1.4], eps);
+%!   assert (xlim ("mode"), "auto");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/ylabel.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,75 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ylabel (@var{string})
+## @deftypefnx {Function File} {} ylabel (@var{string}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} ylabel (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ylabel (@dots{})
+## Specify the string used to label the y-axis of the current axis.
+##
+## If @var{hax} is specified then label the axis defined by @var{hax}.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the properties of the created text label.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{xlabel, zlabel, datetick, title, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = ylabel (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ylabel", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "ylabel", varargin{1},
+                         "color", get (hax, "ycolor"), varargin{2:end});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   y = ylabel ("ylabel_string", "color", "r");
+%!   assert (get (gca, "ylabel"), y);
+%!   assert (get (y, "type"), "text");
+%!   assert (get (y, "visible"), "on");
+%!   assert (get (y, "string"), "ylabel_string");
+%!   assert (get (y, "color"), [1 0 0]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/ylim.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,101 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{ylimits} =} ylim ()
+## @deftypefnx {Function File} {@var{xmode} =} ylim ("mode")
+## @deftypefnx {Function File} {} ylim ([@var{y_lo} @var{y_hi}])
+## @deftypefnx {Function File} {} ylim ("auto")
+## @deftypefnx {Function File} {} ylim ("manual")
+## @deftypefnx {Function File} {} ylim (@var{hax}, @dots{})
+## Query or set the limits of the y-axis for the current plot.
+##
+## Called without arguments @code{ylim} returns the y-axis limits of the
+## current plot.  With the input query @qcode{"mode"}, return the current
+## y-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
+##
+## If passed a 2-element vector [@var{y_lo} @var{y_hi}], the limits of the
+## y-axis are set to these values and the mode is set to @qcode{"manual"}.
+##
+## The current plotting mode can be changed by using either @qcode{"auto"}
+## or @qcode{"manual"} as the argument.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{xlim, zlim, axis, set, get, gca}
+## @end deftypefn
+
+function retval = ylim (varargin)
+  ret = __axis_limits__ ("ylim", varargin{:});
+
+  if (! isempty (ret))
+    retval = ret;
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! line ();
+%! ylim ([0.2, 0.8]);
+%! title ('ylim is [0.2, 0.8]');
+%! assert (ylim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! line ();
+%! ylim ('auto');
+%! title ('ylim is auto');
+%! assert (ylim ('mode'), 'auto');
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! ylim ([0.2, 0.8]);
+%! title ('ylim is [0.2, 0.8]');
+%! assert (ylim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! ylim ('auto');
+%! title ('ylim is auto');
+%! assert (ylim ('mode'), 'auto');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   limy = [0, 1.1];
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   ylim (limy);
+%!   assert (get (gca, "ylim"), limy, eps);
+%!   assert (ylim ("mode"), "manual");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1.1], [0, 1]);
+%!   assert (get (gca, "ylim"), [0, 1.4], eps);
+%!   assert (ylim ("mode"), "auto");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/zlabel.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,84 @@
+## Copyright (C) 1995-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} zlabel (@var{string})
+## @deftypefnx {Function File} {} zlabel (@var{string}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} zlabel (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} zlabel (@dots{})
+## Specify the string used to label the z-axis of the current axis.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the properties of the created text label.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{xlabel, ylabel, datetick, title, text}
+## @end deftypefn
+## Author: jwe
+
+function h = zlabel (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("zlabel", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "zlabel", varargin{1},
+                         "color", get (hax, "zcolor"), varargin{2:end});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   z = zlabel ("zlabel_string", "color", "r");
+%!   assert (get (gca, "zlabel"), z);
+%!   assert (get (z, "type"), "text");
+%!   assert (get (z, "visible"), "off");
+%!   assert (get (z, "string"), "zlabel_string");
+%!   assert (get (z, "color"), [1 0 0]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! plot3 (0, 0, 0);
+%! unwind_protect
+%!   z = zlabel ("zlabel_string");
+%!   assert (get (gca, "zlabel"), z);
+%!   assert (get (z, "type"), "text");
+%!   assert (get (z, "string"), "zlabel_string");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/zlim.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,101 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{zlimits} =} zlim ()
+## @deftypefnx {Function File} {@var{xmode} =} zlim ("mode")
+## @deftypefnx {Function File} {} zlim ([@var{z_lo} @var{z_hi}])
+## @deftypefnx {Function File} {} zlim ("auto")
+## @deftypefnx {Function File} {} zlim ("manual")
+## @deftypefnx {Function File} {} zlim (@var{hax}, @dots{})
+## Query or set the limits of the z-axis for the current plot.
+##
+## Called without arguments @code{zlim} returns the z-axis limits of the
+## current plot.  With the input query @qcode{"mode"}, return the current
+## z-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
+##
+## If passed a 2-element vector [@var{z_lo} @var{z_hi}], the limits of the
+## x-axis are set to these values and the mode is set to @qcode{"manual"}.
+##
+## The current plotting mode can be changed by using either @qcode{"auto"}
+## or @qcode{"manual"} as the argument.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{xlim, ylim, axis, set, get, gca}
+## @end deftypefn
+
+function retval = zlim (varargin)
+  ret = __axis_limits__ ("zlim", varargin{:});
+
+  if (! isempty (ret))
+    retval = ret;
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! line ();
+%! zlim ([0.2, 0.8]);
+%! title ('zlim is [0.2, 0.8]');
+%! assert (zlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! line ();
+%! zlim ('auto');
+%! title ('zlim is auto');
+%! assert (zlim ('mode'), 'auto');
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! zlim ([0.2, 0.8]);
+%! title ('zlim is [0.2, 0.8]');
+%! assert (zlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! zlim ('auto');
+%! title ('zlim is auto');
+%! assert (zlim ('mode'), 'auto');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   limz = [0, 1.1];
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   zlim (limz);
+%!   assert (get (gca, "zlim"), limz, eps);
+%!   assert (zlim ("mode"), "manual");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0, 1.1]);
+%!   assert (get (gca, "zlim"), [0, 1.4], eps);
+%!   assert (zlim ("mode"), "auto");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- a/scripts/plot/area.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-## Copyright (C) 2007-2009 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} area (@var{y})
-## @deftypefnx {Function File} {} area (@var{x}, @var{y})
-## @deftypefnx {Function File} {} area (@dots{}, @var{lvl})
-## @deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} area (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} area (@dots{})
-## Area plot of the columns of @var{y}.
-##
-## This plot shows the contributions of each column value to the row sum.  It
-## is functionally similar to @code{plot (@var{x}, cumsum (@var{y}, 2))},
-## except that the area under the curve is shaded.
-##
-## If the @var{x} argument is omitted it defaults to @code{1:rows (@var{y})}.
-## A value @var{lvl} can be defined that determines where the base level of
-## the shading under the curve should be defined.  The default level is 0.
-##
-## Additional property/value pairs are passed directly to the underlying patch
-## object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the hggroup
-## object comprising the area patch objects.  The @qcode{"BaseValue"} property
-## of the hggroup can be used to adjust the level where shading begins.
-##
-## Example: Verify identity sin^2 + cos^2 = 1
-##
-## @example
-## @group
-## t = linspace (0, 2*pi, 100)';
-## y = [sin(t).^2, cos(t).^2)];
-## area (t, y);
-## legend ("sin^2", "cos^2", "location", "NorthEastOutside");
-## @end group
-## @end example
-## @seealso{plot, patch}
-## @end deftypefn
-
-function h = area (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:});
-
-  if (nargin == 0)
-    print_usage ();
-  endif
-
-  x = y = [];
-  bv = 0;
-
-  num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
-  if (isempty (num_numeric))
-    num_numeric = nargin;     
-  endif
-
-  switch (num_numeric)
-    case 1
-      y = varargin{1};
-    case 2
-      if (isscalar (varargin{2})) 
-        y = varargin{1};
-        bv = varargin{2};
-      else
-        x = varargin{1};
-        y = varargin{2};
-      endif
-    case 3
-      x = varargin{1};
-      y = varargin{2};
-      bv = varargin{3};
-    otherwise
-      print_usage ();
-  endswitch
-
-  if (! isreal (x) || ! isreal (y))
-    error ("area: X and Y must be real vectors or matrices");
-  endif
-  if (! isreal (bv) || ! isscalar (bv))
-    error ("area: LVL must be a real scalar");
-  endif
-
-  if (isvector (y))
-    y = y(:);
-  endif
-  if (isempty (x))
-    x = repmat ([1:rows(y)]', 1, columns (y));
-  elseif (isvector (x))
-    x = repmat (x(:), 1, columns (y));
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    htmp = __area__ (hax, x, y, bv, varargin{num_numeric+1:end});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-function retval = __area__ (ax, x, y, bv, varargin)
-
-  y0 = bv * ones (1, rows (y));
-  y0 = zeros (1, rows (y));
-  retval = [];
-  for i = 1: columns (y);
-
-    lc = __next_line_color__ ();
-
-    ## Must occur after __next_line_color__ in order to work correctly.
-    hg = hggroup ();
-    retval = [retval; hg];
-    args = __add_datasource__ ("area", hg, {"x", "y"}, varargin{:});
-
-    x1 = x(:, 1)';
-    y1 = y(:, i)';
-    addproperty ("xdata", hg, "data", x1);
-    addproperty ("ydata", hg, "data", y1);
-
-    addlistener (hg, "xdata", @update_data);
-    addlistener (hg, "ydata", @update_data);
-
-    if (i == 1)
-      h = patch (ax, [x1(1), x1, fliplr(x1)], [bv, y1, bv*ones(1, length(y1))],
-                     lc, "parent", hg);
-    else
-      y1 = y0 + y1;
-      h = patch (ax, [x1(1), x1, fliplr(x1)], [y0(1), y1, fliplr(y0)],
-                     lc, "parent", hg);
-    endif
-
-    y0 = y1;
-
-    addproperty ("basevalue", hg, "data", bv);
-    addlistener (hg, "basevalue", @move_baseline);
-
-    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
-    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
-    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
-    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
-
-    addlistener (hg, "edgecolor", @update_props);
-    addlistener (hg, "facecolor", @update_props);
-    addlistener (hg, "linestyle", @update_props);
-    addlistener (hg, "linewidth", @update_props);
-
-    addproperty ("areagroup", hg, "data");
-    set (retval, "areagroup", retval);
-
-    ## Matlab property, although Octave does not implement it.
-    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-    if (! isempty (args))
-      set (hg, args{:});
-    endif
-  endfor
-
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-  set (kids, "edgecolor", get (h, "edgecolor"),
-             "facecolor", get (h, "facecolor"),
-             "linestyle", get (h, "linestyle"),
-             "linewidth", get (h, "linewidth"));
-endfunction
-
-function move_baseline (h, d)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "areagroup");
-      b0 = get (h, "basevalue");
-
-      for hh = hlist(:)'
-        if (hh != h)
-          b1 = get (hh, "basevalue");
-          if (b1 != b0)
-            set (hh, "basevalue", b0);
-          endif
-        endif
-      endfor
-      update_data (h, d);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_data (h, d)
-  hlist = get (h, "areagroup");
-  bv = get (h, "basevalue");
-  for i = 1 : length (hlist)
-    hh = hlist(i);
-    x1 = get (hh, "xdata")(:);
-    y1 = get (hh, "ydata")(:);
-
-    set (get (hh, "children"), "xdata", [x1(1); x1; flipud(x1)]);
-    if (i == 1)
-      set (get (hh, "children"), "ydata", [bv; y1; bv*ones(length(y1), 1)]);
-    else
-      y1 = y0 + y1;
-      set (get (hh, "children"), "ydata", [y0(1); y1; flipud(y0)]);
-    endif
-
-    y0 = y1;
-  endfor
-endfunction
-
-
-%!demo
-%! ## Verify identity sin^2 + cos^2 = 1
-%! clf;
-%! t = linspace (0, 2*pi, 100)';
-%! y = [sin(t).^2, cos(t).^2];
-%! area (t, y);
-%! axis tight
-%! legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside');  
-%! title ('area() plot');
-
-%!demo
-%! ## Show effects of setting BaseValue
-%! clf;
-%! x = [-2:0.1:2]';
-%! y = x.^2 - 1;
-%! subplot (1, 2, 1)
-%! area (x, y);
-%! title ({'Parabola y = x^2 -1';'BaseValue = 0'});
-%! subplot (1, 2, 2)
-%! h = area (x, y);
-%! set (h, 'basevalue', -1);
-%! title ({'Parabola y = x^2 -1';'BaseValue = -1'});
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! y = rand (size (x));
-%! h = area (x, y);
-%! set (h, 'ydata', sort (get (h, 'ydata')))
-%! title ('area() plot of sorted data');
-
-%% Test input validation
-%!error area ()
-%!error area (1,2,3,4)
-%!error <X and Y must be real vectors or matrices> area ({1})
-%!error <X and Y must be real vectors or matrices> area (1+i)
-%!error <X and Y must be real vectors or matrices> area (1:2, {1, 2})
-%!error <X and Y must be real vectors or matrices> area (1:2, [1 1+i])
-%!error <LVL must be a real scalar> area (1, i)
-%!error <LVL must be a real scalar> area (1, 2, ones (2,2))
-
--- a/scripts/plot/axes.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} axes ()
-## @deftypefnx {Function File} {} axes (@var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} axes (@var{hax})
-## @deftypefnx {Function File} {@var{h} =} axes (@dots{})
-## Create an axes object and return a handle to it, or set the current
-## axes to @var{hax}.
-##
-## Called without any arguments, or with @var{property}/@var{value} pairs,
-## construct a new axes.  For accepted properties and corresponding
-## values, @pxref{XREFset,,set}.
-##
-## Called with a single axes handle argument @var{hax}, the function makes
-## @var{hax} the current axis.  It also restacks the axes in the
-## corresponding figure so that @var{hax} is the first entry in the list
-## of children.  This causes @var{hax} to be displayed on top of any other
-## axes objects (Z-order stacking).
-## 
-## @seealso {gca, set, get}
-## @end deftypefn
-
-## Author: jwe
-
-function h = axes (varargin)
-
-  if (nargin == 0 || nargin > 1)
-    ## Create an axes object.
-    idx = find (strcmpi (varargin(1:2:end), "parent"), 1, "first");
-    if (! isempty (idx) && length (varargin) >= 2*idx)
-      cf = varargin{2*idx};
-      varargin([2*idx-1, 2*idx]) = [];
-    else
-      cf = gcf ();
-    endif
-    htmp = __go_axes__ (cf, varargin{:});
-    if (__is_handle_visible__ (htmp))
-      set (ancestor (cf, "figure"), "currentaxes", htmp);
-    endif
-  else
-    ## ARG is axes handle.
-    htmp = varargin{1};
-    if (isscalar (htmp) && isaxes (htmp))
-      if (__is_handle_visible__ (htmp))
-        parent = ancestor (htmp, "figure");
-        set (0, "currentfigure", parent);
-        set (parent, "currentaxes", htmp);
-
-        ## restack
-        ch = get (parent, "children")(:);
-        idx = (ch == htmp);
-        ch = [ch(idx); ch(!idx)];
-        set (parent, "children", ch);
-      endif
-    else
-      error ("axes: H must be a scalar axes handle");
-    endif
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
--- a/scripts/plot/axis.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,627 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} axis ()
-## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi])
-## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi])
-## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi @var{z}_lo @var{z}_hi])
-## @deftypefnx {Function File} {} axis (@var{option})
-## @deftypefnx {Function File} {} axis (@dots{}, @var{option})
-## @deftypefnx {Function File} {} axis (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{limits} =} axis ()
-## Set axis limits and appearance.
-##
-## The argument @var{limits} should be a 2-, 4-, or 6-element vector.  The
-## first and second elements specify the lower and upper limits for the
-## x-axis.  The third and fourth specify the limits for the y-axis, and the
-## fifth and sixth specify the limits for the z-axis.
-##
-## Without any arguments, @code{axis} turns autoscaling on.
-##
-## With one output argument, @code{@var{limits} = axis} returns the current
-## axis limits.
-##
-## The vector argument specifying limits is optional, and additional
-## string arguments may be used to specify various axis properties.  For
-## example,
-##
-## @example
-## axis ([1, 2, 3, 4], "square");
-## @end example
-##
-## @noindent
-## forces a square aspect ratio, and
-##
-## @example
-## axis ("tic", "labely");
-## @end example
-##
-## @noindent
-## turns tic marks on for all axes and tic mark labels on for the y-axis
-## only.
-##
-## @noindent
-## The following options control the aspect ratio of the axes.
-##
-## @table @asis
-## @item @qcode{"square"}
-## Force a square aspect ratio.
-##
-## @item @qcode{"equal"}
-## Force x distance to equal y-distance.
-##
-## @item @qcode{"normal"}
-## Restore default aspect ratio.
-## @end table
-##
-## @noindent
-## The following options control the way axis limits are interpreted.
-##
-## @table @asis
-## @item @qcode{"auto"}
-## Set the specified axes to have nice limits around the data
-## or all if no axes are specified.
-##
-## @item @qcode{"manual"}
-## Fix the current axes limits.
-##
-## @item @qcode{"tight"}
-## Fix axes to the limits of the data.
-##
-## @item @qcode{"image"}
-## Equivalent to @qcode{"tight"} and @qcode{"equal"}.
-## @end table
-##
-## @noindent
-## The following options affect the appearance of tic marks.
-##
-## @table @asis
-## @item @qcode{"on"}
-## Turn tic marks and labels on for all axes.
-##
-## @item @qcode{"off"}
-## Turn tic marks off for all axes.
-##
-## @item @qcode{"tic[xyz]"}
-## Turn tic marks on for all axes, or turn them on for the
-## specified axes and off for the remainder.
-##
-## @item @qcode{"label[xyz]"}
-## Turn tic labels on for all axes, or turn them on for the
-## specified axes and off for the remainder.
-##
-## @item @qcode{"nolabel"}
-## Turn tic labels off for all axes.
-## @end table
-##
-## Note, if there are no tic marks for an axis, there can be no labels.
-##
-## @noindent
-## The following options affect the direction of increasing values on the axes.
-##
-## @table @asis
-## @item @qcode{"ij"}
-## Reverse y-axis, so lower values are nearer the top.
-##
-## @item @qcode{"xy"}
-## Restore y-axis, so higher values are nearer the top.
-## @end table
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axes rather than the current axes returned by @code{gca}.
-##
-## @seealso{xlim, ylim, zlim, daspect, pbaspect, box, grid}
-## @end deftypefn
-
-## Author: jwe
-
-function limits = axis (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    if (isempty (hax))
-      hax = gca ();
-    endif
-    if (nargin == 0)
-      limits = __axis__ (hax, varargin{:});
-    else
-      __axis__ (hax, varargin{:});
-    endif
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-endfunction
-
-function limits = __axis__ (ca, ax, varargin)
-
-  if (nargin == 1)
-    if (nargout == 0)
-      set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
-    else
-      xlim = get (ca, "xlim");
-      ylim = get (ca, "ylim");
-      view = get (ca, "view");
-      if (view(2) == 90)
-        limits = [xlim, ylim];
-      else
-        zlim = get (ca, "zlim");
-        limits = [xlim, ylim, zlim];
-      endif
-    endif
-
-  elseif (ischar (ax))
-    len = length (ax);
-
-    ## 'matrix mode' to reverse the y-axis
-    if (strcmpi (ax, "ij"))
-      set (ca, "ydir", "reverse");
-    elseif (strcmpi (ax, "xy"))
-      set (ca, "ydir", "normal");
-
-      ## aspect ratio
-    elseif (strcmpi (ax, "image"))
-      __axis__ (ca, "equal");
-      __do_tight_option__ (ca);
-    elseif (strcmpi (ax, "square"))
-      set (ca, "plotboxaspectratio", [1, 1, 1]);
-    elseif (strcmp (ax, "equal"))
-      if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot"))
-        ## FIXME - gnuplot applies the aspect ratio activepostionproperty.
-        set (ca, "activepositionproperty", "position");
-        ## The following line is a trick used to trigger the recalculation of
-        ## aspect related magnitudes even if the aspect ratio is the same
-        ## (useful with the x11 gnuplot terminal after a window resize)
-        set (ca, "dataaspectratiomode", "auto");
-      endif
-      set (ca, "dataaspectratio", [1, 1, 1]);
-    elseif (strcmpi (ax, "normal"))
-      set (ca, "plotboxaspectratio", [1, 1, 1]);
-      set (ca, "plotboxaspectratiomode", "auto");
-
-      ## axis limits
-    elseif (len >= 4 && strcmpi (ax(1:4), "auto"))
-      if (len > 4)
-        if (any (ax == "x"))
-          set (ca, "xlimmode", "auto");
-        endif
-        if (any (ax == "y"))
-          set (ca, "ylimmode", "auto");
-        endif
-        if (any (ax == "z"))
-          set (ca, "zlimmode", "auto");
-        endif
-      else
-        set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
-      endif
-    elseif (strcmpi (ax, "manual"))
-      ## fixes the axis limits, like axis(axis) should;
-      set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual");
-    elseif (strcmpi (ax, "tight"))
-      ## sets the axis limits to the min and max of all data.
-      __do_tight_option__ (ca);
-      ## tic marks
-    elseif (strcmpi (ax, "on") || strcmpi (ax, "tic"))
-      set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto");
-      if (strcmpi (ax, "on"))
-        set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
-           "zticklabelmode", "auto");
-      endif
-      set (ca, "visible", "on");
-    elseif (strcmpi (ax, "off"))
-      set (ca, "xtick", [], "ytick", [], "ztick", []);
-      set (ca, "visible", "off");
-    elseif (len > 3 && strcmpi (ax(1:3), "tic"))
-      if (any (ax == "x"))
-        set (ca, "xtickmode", "auto");
-      else
-        set (ca, "xtick", []);
-      endif
-      if (any (ax == "y"))
-        set (ca, "ytickmode", "auto");
-      else
-        set (ca, "ytick", []);
-      endif
-      if (any (ax == "z"))
-        set (ca, "ztickmode", "auto");
-      else
-        set (ca, "ztick", []);
-      endif
-    elseif (strcmpi (ax, "label"))
-      set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
-           "zticklabelmode", "auto");
-    elseif (strcmpi (ax, "nolabel"))
-      set (ca, "xticklabel", "", "yticklabel", "", "zticklabel", "");
-    elseif (len > 5 && strcmpi (ax(1:5), "label"))
-      if (any (ax == "x"))
-        set (ca, "xticklabelmode", "auto");
-      else
-        set (ca, "xticklabel", "");
-      endif
-      if (any (ax == "y"))
-        set (ca, "yticklabelmode", "auto");
-      else
-        set (ca, "yticklabel", "");
-      endif
-      if (any (ax == "z"))
-        set (ca, "zticklabelmode", "auto");
-      else
-        set (ca, "zticklabel", "");
-      endif
-
-    else
-      warning ("unknown axis option '%s'", ax);
-    endif
-
-  elseif (isvector (ax))
-
-    len = length (ax);
-
-    if (len != 2 && len != 4 && len != 6)
-      error ("axis: expecting vector with 2, 4, or 6 elements");
-    endif
-
-    for i = 1:2:len
-      if (ax(i) >= ax(i+1))
-        error ("axis: limits(%d) must be less than limits(%d)", i, i+1);
-      endif
-    endfor
-
-    if (len > 1)
-      set (ca, "xlim", [ax(1), ax(2)]);
-    endif
-
-    if (len > 3)
-      set (ca, "ylim", [ax(3), ax(4)]);
-    endif
-
-    if (len > 5)
-      set (ca, "zlim", [ax(5), ax(6)]);
-    endif
-
-  else
-    error ("axis: expecting no args, or a vector with 2, 4, or 6 elements");
-  endif
-
-  if (! isempty (varargin))
-    __axis__ (ca, varargin{:});
-  endif
-
-endfunction
-
-function lims = __get_tight_lims__ (ca, ax)
-
-  ## Get the limits for axis ("tight").
-  ## AX should be one of "x", "y", or "z".
-  kids = findobj (ca, "-property", strcat (ax, "data"));
-  ## The data properties for hggroups mirror their children.
-  ## Exclude the redundant hgroup values.
-  hg_kids = findobj (kids, "type", "hggroup");
-  kids = setdiff (kids, hg_kids);
-  if (isempty (kids))
-    ## Return the current limits.
-    lims = get (ca, strcat (ax, "lim"));
-  else
-    data = get (kids, strcat (ax, "data"));
-    scale = get (ca, strcat (ax, "scale"));
-    if (! iscell (data))
-      data = {data};
-    endif
-    if (strcmp (scale, "log"))
-      tmp = data;
-      data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false);
-      n = cellfun ("isempty", data);
-      data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false);
-    endif
-    data = cellfun (@(x) x(isfinite (x)), data, "uniformoutput", false);
-    data = data(! cellfun ("isempty", data));
-    if (! isempty (data))
-      ## Change data from cell array of various sizes to a single column vector
-      data = cat (1, cellindexmat (data, ":"){:});
-      lims = [min(data), max(data)];
-    else
-      lims = [0, 1];
-    endif
-  endif
-
-endfunction
-
-function __do_tight_option__ (ca)
-
-  xlim = __get_tight_lims__ (ca, "x");
-  if (all (xlim == 0))
-    xlim = eps () * [-1 1];
-  elseif (diff (xlim == 0))
-    xlim = xlim .* (1 + eps () * [-1, 1]);
-  endif
-  ylim = __get_tight_lims__ (ca, "y");
-  if (all (ylim == 0))
-    ylim = eps () * [-1 1];
-  elseif (diff (ylim == 0))
-    ylim = ylim .* (1 + eps () * [-1, 1]);
-  endif
-  set (ca, "xlim", xlim, "ylim", ylim)
-  nd = __calc_dimensions__ (ca);
-  is3dview = (get (ca, "view")(2) != 90);
-  if (nd > 2 && is3dview)
-    zlim = __get_tight_lims__ (ca, "z");
-    if (all (zlim == 0))
-      zlim = eps () * [-1 1];
-    elseif (diff (zlim == 0))
-      zlim = zlim .* (1 + eps () * [-1, 1]);
-    endif
-    set (ca, "zlim", zlim);
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (221);
-%!  plot (t, x);
-%!  title ('normal plot');
-%!
-%! subplot (222);
-%!  plot (t, x);
-%!  title ('square plot');
-%!  axis ('square');
-%!
-%! subplot (223);
-%!  plot (t, x);
-%!  title ('equal plot');
-%!  axis ('equal');
-%!
-%! subplot (224);
-%!  plot (t, x);
-%!  title ('normal plot again');
-%!  axis ('normal');
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (121);
-%!  plot (t, x);
-%!  title ('ij plot');
-%!  axis ('ij');
-%!
-%! subplot (122);
-%!  plot (t, x);
-%!  title ('xy plot');
-%!  axis ('xy');
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (331);
-%!  plot (t, x);
-%!  title ('x tics and labels');
-%!  axis ('ticx');
-%!
-%! subplot (332);
-%!  plot (t, x);
-%!  title ('y tics and labels');
-%!  axis ('ticy');
-%!
-%! subplot (333);
-%!  plot (t, x);
-%!  title ('axis off');
-%!  axis ('off');
-%!
-%! subplot (334);
-%!  plot (t, x);
-%!  title ('x and y tics, x labels');
-%!  axis ('labelx','tic');
-%!
-%! subplot (335);
-%!  plot (t, x);
-%!  title ('x and y tics, y labels');
-%!  axis ('labely','tic');
-%!
-%! subplot (336);
-%!  plot (t, x);
-%!  title ('all tics but no labels');
-%!  axis ('nolabel','tic');
-%!
-%! subplot (337);
-%!  plot (t, x);
-%!  title ('x tics, no labels');
-%!  axis ('nolabel','ticx');
-%!
-%! subplot (338);
-%!  plot (t, x);
-%!  title ('y tics, no labels');
-%!  axis ('nolabel','ticy');
-%!
-%! subplot (339);
-%!  plot (t, x);
-%!  title ('all tics and labels');
-%!  axis ('on');
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (321);
-%!  plot (t, x);
-%!  title ('axes at [0 3 0 1]');
-%!  axis ([0,3,0,1]);
-%!
-%! subplot (322);
-%!  plot (t, x);
-%!  title ('auto');
-%!  axis ('auto');
-%!
-%! subplot (323);
-%!  plot (t, x, ';sine [0:2pi];'); hold on;
-%!  plot (-3:3,-3:3, ';line (-3,-3)->(3,3);'); hold off;
-%!  title ('manual');
-%!  axis ('manual');
-%!
-%! subplot (324);
-%!  plot (t, x, ';sine [0:2pi];');
-%!  title ('axes at [0 3 0 1], then autox');
-%!  axis ([0,3,0,1]);
-%!  axis ('autox');
-%!
-%! subplot (325);
-%!  plot (t, x, ';sine [0:2pi];');
-%!  title ('axes at [3 6 0 1], then autoy');
-%!  axis ([3,6,0,1]);
-%!  axis ('autoy');
-%!
-%! subplot (326);
-%!  plot (t, sin(t), t, -2*sin(t/2));
-%!  axis ('tight');
-%!  title ('tight');
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! plot (x, sin(x));
-%! axis image;
-%! title ({'image', 'equivalent to "tight" & "equal"'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x,y,z] = peaks (50);
-%! x1 = max (x(:));
-%! pcolor (x-x1, y-x1/2, z);
-%! hold on;
-%! [x,y,z] = sombrero ();
-%! s = x1 / max (x(:));
-%! pcolor (s*x+x1, s*y+x1/2, 5*z);
-%! axis tight;
-
-%!demo
-%! clf;
-%! x = -10:10;
-%! plot (x,x, x,-x);
-%! set (gca, 'yscale', 'log');
-%! legend ({'x >= 1', 'x <= 1'}, 'location', 'north');
-%! title ('ylim = [1, 10]');
-
-%!demo
-%! clf;
-%! loglog (1:20, '-s');
-%! axis tight;
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1 + abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, 'xaxislocation', 'zero');
-%! set (gca, 'yaxislocation', 'zero');
-%! box off;
-%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = zero'});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, 'xaxislocation', 'zero');
-%! set (gca, 'yaxislocation', 'left');
-%! box off;
-%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = left'});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! title ('no plot box');
-%! set (gca, 'xaxislocation', 'zero');
-%! set (gca, 'yaxislocation', 'right');
-%! box off;
-%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = right'});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, 'xaxislocation', 'bottom');
-%! set (gca, 'yaxislocation', 'zero');
-%! box off;
-%! title ({'no plot box', 'xaxislocation = bottom, yaxislocation = zero'});
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! set (gca, 'xaxislocation', 'top');
-%! set (gca, 'yaxislocation', 'zero');
-%! box off;
-%! title ({'no plot box', 'xaxislocation = top, yaxislocation = zero'});
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot (11:20, [21:24, NaN, -Inf, 27:30]);
-%!   hold all;
-%!   plot (11:20, 25.5 + rand (10));
-%!   axis tight;
-%!   assert (axis (), [11 20 21 30]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   loglog (a, -a);
-%!   axis tight;
-%!   assert (axis (), [1e-5, 10, -10, -1e-5]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-## Test 'axis tight' with differently oriented, differently numbered data vecs
-## Bug #40036.
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   Z = peaks (linspace (-3, 3, 49), linspace (-2, 2, 29));
-%!   surf (Z);
-%!   axis tight;
-%!   assert (axis (), [1 49 1 29 min(Z(:)) max(Z(:))]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/bar.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} bar (@var{y})
-## @deftypefnx {Function File} {} bar (@var{x}, @var{y})
-## @deftypefnx {Function File} {} bar (@dots{}, @var{w})
-## @deftypefnx {Function File} {} bar (@dots{}, @var{style})
-## @deftypefnx {Function File} {} bar (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} bar (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} bar (@dots{}, @var{prop}, @var{val}, @dots{})
-## Produce a bar graph from two vectors of X-Y data.
-##
-## If only one argument is given, @var{y}, it is taken as a vector of Y values
-## and the X coordinates are the range @code{1:numel (@var{y})}.
-##
-## The optional input @var{w} controls the width of the bars.  A value of
-## 1.0 will cause each bar to exactly touch any adjacent bars.
-## The default width is 0.8.
-##
-## If @var{y} is a matrix, then each column of @var{y} is taken to be a
-## separate bar graph plotted on the same graph.  By default the columns
-## are plotted side-by-side.  This behavior can be changed by the @var{style}
-## argument which can take the following values:
-##
-## @table @asis
-## @item @qcode{"grouped"} (default) 
-## Side-by-side bars with a gap between bars and centered over the X-coordinate.
-## 
-## @item  @qcode{"stacked"}
-## Bars are stacked so that each X value has a single bar composed of
-## multiple segments.
-##
-## @item @qcode{"hist"}
-## Side-by-side bars with no gap between bars and centered over the
-## X-coordinate.
-##
-## @item @qcode{"histc"}
-## Side-by-side bars with no gap between bars and left-aligned to the
-## X-coordinate.
-## @end table
-##
-## Optional property/value pairs are passed directly to the underlying patch
-## objects.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of handles to the created
-## "bar series" hggroups with one handle per column of the variable @var{y}.
-## This series makes it possible to change a common element in one bar series
-## object and have the change reflected in the other "bar series".
-## For example,
-##
-## @example
-## @group
-## h = bar (rand (5, 10));
-## set (h(1), "basevalue", 0.5);
-## @end group
-## @end example
-##
-## @noindent
-## changes the position on the base of all of the bar series.
-##
-## The following example modifies the face and edge colors using
-## property/value pairs.
-##
-## @example
-## bar (randn (1, 100), "facecolor", "r", "edgecolor", "b");
-## @end example
-##
-## @noindent
-## The color of the bars is taken from the figure's colormap, such that
-##
-## @example
-## @group
-## bar (rand (10, 3));
-## colormap (summer (64));
-## @end group
-## @end example
-##
-## @noindent
-## will change the colors used for the bars.  The color of bars can also be set
-## manually using the @qcode{"facecolor"} property as shown below.
-##
-## @example
-## @group
-## h = bar (rand (10, 3));
-## set (h(1), "facecolor", "r")
-## set (h(2), "facecolor", "g")
-## set (h(3), "facecolor", "b")
-## @end group
-## @end example
-##
-## @seealso{barh, hist, pie, plot, patch}
-## @end deftypefn
-
-## Author: jwe
-
-function varargout = bar (varargin)
-  varargout = cell (nargout, 1);
-  [varargout{:}] = __bar__ (true, "bar", varargin{:});
-endfunction
-
-
-%!demo
-%! clf;
-%! y = rand (11, 1);
-%! h = bar (y);
-%! set (h, 'ydata', sort (rand (11, 1)));
-%! title ('bar() graph');
-
-%!demo
-%! clf;
-%! h = bar (rand (5, 3));
-%! set (h(1), 'facecolor', 'r');
-%! set (h(2), 'facecolor', 'g');
-%! set (h(3), 'facecolor', 'b');
-%! title ('bar() graph w/multiple bars');
-
-%!demo
-%! clf;
-%! h = bar (rand (5, 3), 'stacked');
-%! title ('bar() graph with stacked style');
-
--- a/scripts/plot/barh.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} barh (@var{y})
-## @deftypefnx {Function File} {} barh (@var{x}, @var{y})
-## @deftypefnx {Function File} {} barh (@dots{}, @var{w})
-## @deftypefnx {Function File} {} barh (@dots{}, @var{style})
-## @deftypefnx {Function File} {} barh (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} barh (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} barh (@dots{}, @var{prop}, @var{val}, @dots{})
-## Produce a horizontal bar graph from two vectors of X-Y data.
-##
-## If only one argument is given, it is taken as a vector of Y values
-## and the X coordinates are the range @code{1:numel (@var{y})}.
-##
-## The optional input @var{w} controls the width of the bars.  A value of
-## 1.0 will cause each bar to exactly touch any adjacent bars.
-## The default width is 0.8.
-##
-## If @var{y} is a matrix, then each column of @var{y} is taken to be a
-## separate bar graph plotted on the same graph.  By default the columns
-## are plotted side-by-side.  This behavior can be changed by the @var{style}
-## argument which can take the following values:
-##
-## @table @asis
-## @item @qcode{"grouped"} (default) 
-## Side-by-side bars with a gap between bars and centered over the Y-coordinate.
-## 
-## @item  @qcode{"stacked"}
-## Bars are stacked so that each Y value has a single bar composed of
-## multiple segments.
-##
-## @item @qcode{"hist"}
-## Side-by-side bars with no gap between bars and centered over the
-## Y-coordinate.
-##
-## @item @qcode{"histc"}
-## Side-by-side bars with no gap between bars and left-aligned to the
-## Y-coordinate.
-## @end table
-##
-## Optional property/value pairs are passed directly to the underlying patch
-## objects.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-## 
-## The optional return value @var{h} is a graphics handle to the created
-## bar series hggroup.  For a description of the use of the
-## bar series, @pxref{XREFbar,,bar}.
-## @seealso{bar, hist, pie, plot, patch}
-## @end deftypefn
-
-## Author: jwe
-
-function varargout = barh (varargin)
-  varargout = cell (nargout, 1);
-  [varargout{:}] = __bar__ (false, "barh", varargin{:});
-endfunction
-
-
-%!demo
-%! clf;
-%! x = rand (10, 1);
-%! barh (x);
-%! title ('barh() graph')
-
-%!demo
-%! clf;
-%! h = barh (rand (5, 3));
-%! set (h(1), 'facecolor', 'r')
-%! set (h(2), 'facecolor', 'g')
-%! set (h(3), 'facecolor', 'b')
-%! title ('barh() graph w/multiple bars')
-
--- a/scripts/plot/box.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-## Copyright (C) 2006-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} box on
-## @deftypefnx {Command} {} box off
-## @deftypefnx {Command} {} box
-## @deftypefnx {Function File} {} box (@var{hax}, @dots{})
-## Control display of the axis border.
-##
-## The argument may be either @qcode{"on"} or @qcode{"off"}.  If it is
-## omitted, the current box state is toggled.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-## @seealso{axis, grid}
-## @end deftypefn
-
-## Author: jwe
-
-function box (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("box", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  if (nargs == 0)
-    box_state = get (hax, "box");
-    if (strcmp (box_state, "on"))
-      box_state = "off";
-    else
-      box_state = "on";
-    endif
-  elseif (nargs == 1)
-    state = varargin{1};
-    if (ischar (state))
-      if (strcmpi (state, "off"))
-        box_state = "off";
-      elseif (strcmpi (state, "on"))
-        box_state = "on";
-      else
-        error ('box: argument must be "on" or "off"');
-      endif
-    else
-      error ('box: argument must be "on" or "off"');
-    endif
-  else
-    print_usage ();
-  endif
-
-  set (hax, "box", box_state);
-
-endfunction
-
--- a/scripts/plot/caxis.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-## Copyright (C)  2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} caxis ([cmin cmax])
-## @deftypefnx {Function File} {} caxis ("auto")
-## @deftypefnx {Function File} {} caxis ("manual")
-## @deftypefnx {Function File} {} caxis (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{limits} =} caxis ()
-## Query or set color axis limits for plots.
-##
-## The limits argument should be a 2-element vector specifying the
-## lower and upper limits to assign to the first and last value in the
-## colormap.  Data values outside this range are clamped to the first and last
-## colormap entries.
-##
-## If the @qcode{"auto"} option is given then automatic colormap limits are
-## applied.  The automatic algorithm sets @var{cmin} to the minimum data value
-## and @var{cmax} to the maximum data value.  If @qcode{"manual"} is specified
-## then the @qcode{"climmode"} property is set to @qcode{"manual"} and the
-## numeric values in the @qcode{"clim"} property are used for limits.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-##
-## Called without arguments the current color axis limits are returned.
-## @seealso{colormap}
-## @end deftypefn
-
-function limits = caxis (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("caxis", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    if (isempty (hax))
-      hax = gca ();
-    endif
-    if (nargin == 0)
-      limits = __caxis__ (hax);
-    else
-      __caxis__ (hax, varargin{:});
-    endif
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-endfunction
-
-function limits = __caxis__ (ca, ax, varargin)
-
-  if (nargin == 1)
-    limits = get (ca, "clim");
-  elseif (ischar (ax))
-    if (strcmpi (ax, "auto"))
-      set (ca, "climmode", "auto");
-    elseif (strcmpi (ax, "manual"))
-      set (ca, "climmode", "manual");
-    endif
-  elseif (isvector (ax))
-    len = length (ax);
-    if (len != 2)
-      error ("caxis: expecting vector with 2 elements");
-    endif
-
-    set (ca, "clim", [ax(1), ax(2)]);
-  else
-    error ("caxis: expecting no args, a string, or a 2 element vector");
-  endif
-
-  ## FIXME: Why should it be possible to call __caxis__ recursively?
-  if (nargin > 2)
-    __caxis__ (ca, varargin{:})';
-  endif
-
-endfunction
-
--- a/scripts/plot/cla.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-## Copyright (C) 2008-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} cla
-## @deftypefnx {Command} {} cla reset
-## @deftypefnx {Function File} {} cla (@var{hax})
-## @deftypefnx {Function File} {} cla (@var{hax}, "reset")
-## Clear the current axes.
-##
-## @code{cla} operates by deleting child graphic objects with visible
-## handles (HandleVisibility = @qcode{"on"}).
-##
-## If the optional argument @qcode{"reset"} is specified, delete all child
-## objects including those with hidden handles and reset all axis properties
-## to their defaults.  However, the following properties are not reset:
-## Position, Units.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-## @seealso{clf, delete, reset}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2008-10-03
-
-function cla (varargin)
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (nargin == 0)
-    hax = gca;
-    do_reset = false;
-  elseif (nargin == 1)
-    if (isscalar (varargin{1}) && isaxes (varargin{1}))
-      hax = varargin{1};
-      do_reset = false;
-    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
-      hax = gca;
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  else
-    if (isscalar (varargin{1}) && isaxes (varargin{1})
-        && ischar (varargin{2}) && strcmpi (varargin{2}, "reset"))
-      hax = varargin{1};
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  endif
-
-  if (! do_reset)
-    delete (get (hax, "children"));
-  else
-    __go_axes_init__ (hax, "replace");
-    __request_drawnow__ ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot (1:10);
-%!   assert (! isempty (get (gca, "children")));
-%!   cla ();
-%!   assert (isempty (get (gca, "children")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   hax = gca;
-%!   plot (hax, 1:10);
-%!   set (hax, "interpreter", "tex");
-%!   cla (hax);
-%!   kids = get (hax, "children");
-%!   assert (numel (kids), 0);
-%!   assert (get (hax, "interpreter"), "tex");
-%!   plot (hax, 1:10);
-%!   cla (hax, "reset");
-%!   kids = get (hax, "children");
-%!   assert (numel (kids), 0);
-%!   assert (get (hax, "interpreter"), "none");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/clabel.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} clabel (@var{c}, @var{h})
-## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, @var{v})
-## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, "manual")
-## @deftypefnx {Function File} {} clabel (@var{c})
-## @deftypefnx {Function File} {} clabel (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} clabel (@dots{})
-## Add labels to the contours of a contour plot.
-##
-## The contour levels are specified by the contour matrix @var{c} which is
-## returned by @code{contour}, @code{contourc}, @code{contourf}, and
-## @code{contour3}.  Contour labels are rotated to match the local line 
-## orientation and centered on the line.  The position of labels along the
-## contour line is chosen randomly.
-##
-## If the argument @var{h} is a handle to a contour group object, then label
-## this plot rather than the one in the current axes returned by @code{gca}.
-##
-## By default, all contours are labeled.  However, the contours to label can be
-## specified by the vector @var{v}.  If the @qcode{"manual"} argument is
-## given then the contours to label can be selected with the mouse.
-##
-## Additional property/value pairs that are valid properties of text objects
-## can be given and are passed to the underlying text objects.  Moreover,
-## the contour group property @qcode{"LabelSpacing"} is available which
-## determines the spacing between labels on a contour to be specified.  The
-## default is 144 points, or 2 inches.
-##
-## The optional return value @var{h} is a vector of graphics handles to
-## the text objects representing each label.
-## The @qcode{"userdata"} property of the text objects contains the numerical
-## value of the contour label.
-##
-## An example of the use of @code{clabel} is
-##
-## @example
-## @group
-## [c, h] = contour (peaks (), -4 : 6);
-## clabel (c, h, -4:2:6, "fontsize", 12);
-## @end group
-## @end example
-##
-## @seealso{contour, contourf, contour3, meshc, surfc, text}
-## @end deftypefn
-
-function h = clabel (c, varargin)
-
-  have_hg = false;
-  have_labelspacing = false;
-  label_spacing = 144;  # 2 inches in points
-
-  if (nargin < 1)
-    print_usage ();
-  elseif (nargin == 1)
-    hparent = gca ();
-  else
-    arg = varargin{1};
-    if (isscalar (arg) && ishandle (arg)
-        && strcmp (get (arg, "type"), "hggroup"))
-      try
-        get (arg, "contourmatrix");
-      catch
-        error ("clabel: H must be a handle to a contour group");
-      end_try_catch
-      have_hg = true;
-      hg = arg;
-      varargin(1) = [];
-    else
-      hparent = gca ();
-    endif
-  endif
-
-  if (length (varargin) > 0 && isnumeric (varargin{1}))
-    v = varargin{1}(:);
-    varargin(1) = [];
-  else
-    v = [];
-  endif
-
-  idx = strcmpi (varargin(1:2:end), "manual");
-  if (any (idx))
-    error ('clabel: "manual" contour mode is not supported');
-  endif
-
-  idx = find (strcmpi (varargin(1:2:end), "labelspacing"), 1);
-  if (! isempty (idx))
-    have_labelspacing = true;
-    label_spacing = varargin{2*idx};
-    varargin(2*idx+(-1:0)) = [];
-  endif    
-
-  if (have_hg)
-    if (! isempty (v))
-      if (have_labelspacing)
-        set (hg, "textlistmode", "manual", "textlist", v,
-                 "labelspacing", label_spacing, "showtext", "on");
-      else
-        set (hg, "textlistmode", "manual", "textlist", v, "showtext", "on");
-      endif
-    else
-      if (have_labelspacing)
-        set (hg, "showtext", "on", "labelspacing", label_spacing);
-      else
-        set (hg, "showtext", "on");
-      endif
-    endif
-    htmp = findobj (hg, "type", "text");
-    if (! isempty (varargin))
-      set (htmp, varargin{:});
-    endif
-  else
-    htmp =  __clabel__ (c, v, hparent, label_spacing, [], varargin{:});
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [c, h] = contour (peaks (), -4:6);
-%! clabel (c, h, -4:2:6, 'fontsize', 12);
-%! title ('clabel() labeling every other contour');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [c, h] = contourf (peaks (), -7:6);
-%! clabel (c, h, -6:2:6, 'fontsize', 12);
-%! title ('clabel() labeling every other contour');
-
--- a/scripts/plot/clf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} clf
-## @deftypefnx {Command} {} clf reset
-## @deftypefnx {Function File} {} clf (@var{hfig})
-## @deftypefnx {Function File} {} clf (@var{hfig}, "reset")
-## @deftypefnx {Function File} {@var{h} =} clf (@dots{})
-## Clear the current figure window.
-## 
-## @code{clf} operates by deleting child graphics objects with visible
-## handles (HandleVisibility = @qcode{"on"}).
-##
-## If the optional argument @qcode{"reset"} is specified, delete all child
-## objects including those with hidden handles and reset all figure
-## properties to their defaults.  However, the following properties are not
-## reset: Position, Units, PaperPosition, PaperUnits.
-##
-## If the first argument @var{hfig} is a figure handle, then operate on
-## this figure rather than the current figure returned by @code{gcf}.
-## 
-## The optional return value @var{h} is the graphics handle of the figure
-## window that was cleared.
-## @seealso{cla, close, delete, reset}
-## @end deftypefn
-
-## Author: jwe
-
-function h = clf (varargin)
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (nargin == 0)
-    hfig = gcf;
-    do_reset = false;
-  elseif (nargin == 1)
-    if (isscalar (varargin{1}) && isfigure (varargin{1}))
-      hfig = varargin{1};
-      do_reset = false;
-    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
-      hfig = gcf;
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  else
-    if (isscalar (varargin{1}) && isfigure (varargin{1})
-        && ischar (varargin{2}) && strcmpi (varargin{2}, "reset"))
-      hfig = varargin{1};
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  endif
-
-  if (do_reset)
-    ## Select all the children, including the one with hidden handles.
-    delete (allchild (hfig));
-    reset (hfig);
-  else
-    ## Select only the chilren with visible handles.
-    delete (get (hfig, "children"));
-  endif
-
-  if (nargout > 0)
-    h = hfig;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   assert (! isempty (get (gcf, "children")));
-%!   clf;
-%!   assert (isempty (get (gcf, "children")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   clf;
-%!   assert (isempty (get (gcf, "children")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!xtest
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot (1:10);
-%!   set (hf, "papertype", "tabloid");
-%!   clf (hf);
-%!   assert (isempty (get (gcf, "children")));
-%!   assert (get (hf, "papertype"), "tabloid");
-%!   plot (1:10);
-%!   clf (hf, "reset");
-%!   kids = get (hf, "children");
-%!   assert (isempty (get (gcf, "children")));
-%!   assert (get (hf, "papertype"), "usletter");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/close.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-## Copyright (C) 2002-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} close
-## @deftypefnx {Command} {} close (@var{h})
-## @deftypefnx {Command} {} close all
-## @deftypefnx {Command} {} close all hidden
-## Close figure window(s).
-##
-## When called with no arguments, close the current figure.  This is equivalent
-## to @code{close (gcf)}.  If the input @var{h} is a graphic handle, or vector
-## of graphics handles, then close each figure in @var{h}.
-##
-## If the argument @qcode{"all"} is given then all figures with visible handles
-## (HandleVisibility = @qcode{"on"}) are closed.
-##
-## If the argument @qcode{"all hidden"} is given then all figures, including
-## hidden ones, are closed.
-##
-## Implementation Note: @code{close} operates by calling the function specified
-## by the @qcode{"closerequestfcn"} property for each figure.  By default, the
-## function @code{closereq} is used.  It is possible that the function invoked
-## will delay or abort removing the figure.  To remove a figure without
-## executing any callback functions use @code{delete}.  When writing a callback
-## function to close a window do not use @code{close} to avoid recursion.
-##
-## @seealso{closereq, delete}
-## @end deftypefn
-
-## Author: jwe
-## 2010-05-02   PBig    allow empty argument
-
-function retval = close (arg1, arg2)
-
-  figs = [];
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (nargin == 0)
-    ## Close current figure.
-    ## Can't use gcf because it opens a new plot window if one does not exist.
-    figs = get (0, "currentfigure");
-    if (figs == 0)  # don't close root figure
-      figs = [];
-    endif
-  elseif (nargin == 1)
-    if (ischar (arg1) && strcmpi (arg1, "all"))
-      figs = (get (0, "children"))';
-      figs = figs(isfigure (figs));
-    elseif (isfigure (arg1))
-      figs = arg1;
-    elseif (isempty (arg1))
-      figs = [];
-    else
-      error ('close: first argument must be "all" or a figure handle');
-    endif
-  elseif (   ischar (arg1) && strcmpi (arg1, "all")
-          && ischar (arg2) && strcmpi (arg2, "hidden"))
-    figs = (allchild (0))';
-    figs = figs(isfigure (figs));
-  else
-    error ('close: expecting argument to be "all hidden"');
-  endif
-
-  for h = figs
-    __go_execute_callback__ (h, "closerequestfcn");
-  endfor
-
-  if (nargout > 0)
-    retval = 1;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   close (hf);
-%!   objs = findobj ("type", "figure");
-%!   assert (! any (objs == hf));
-%! unwind_protect_cleanup
-%!   if (isfigure (hf))
-%!     close (hf);
-%!   endif
-%! end_unwind_protect
-
-%!error close (1,2,3)
-%!error <first argument must be "all" or a figure> close ({"all"})
-%!error <first argument must be "all" or a figure> close ("all_and_more")
-%!error <first argument must be "all" or a figure> close (-1)
-%!error <expecting argument to be "all hidden"> close "all" hid"
-
--- a/scripts/plot/closereq.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} closereq ()
-## Close the current figure and delete all graphics objects associated with it.
-##
-## By default, the @qcode{"closerequestfcn"} property of a new plot figure
-## points to this function.
-## @seealso{close, delete}
-## @end deftypefn
-
-## Author: jwe
-
-function closereq ()
-
-  if (nargin != 0)
-    print_usage ();
-  endif
-
-  cf = gcbf ();
-  if (isempty (cf))
-    warning ("closereq: calling closereq from octave prompt is not supported, use 'close' instead");
-    cf = get (0, "currentfigure");
-  endif
-  if (! isempty (cf) && isfigure (cf))
-    delete (cf);
-  endif
-
-endfunction
-
--- a/scripts/plot/colorbar.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,772 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} colorbar
-## @deftypefnx {Function File} {} colorbar (@var{loc})
-## @deftypefnx {Function File} {} colorbar (@var{delete_option})
-## @deftypefnx {Function File} {} colorbar (@var{hcb}, @dots{})
-## @deftypefnx {Function File} {} colorbar (@var{hax}, @dots{})
-## @deftypefnx {Function File} {} colorbar (@dots{}, "peer", @var{hax}, @dots{})
-## @deftypefnx {Function File} {} colorbar (@dots{}, "location", @var{loc}, @dots{})
-## @deftypefnx {Function File} {} colorbar (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} colorbar (@dots{})
-## Add a colorbar to the current axes.
-##
-## A colorbar displays the current colormap along with numerical rulings
-## so that the color scale can be interpreted.
-##
-## The optional input @var{loc} determines the location of the colorbar.
-## Valid values for @var{loc} are
-##
-## @table @asis
-## @item @qcode{"EastOutside"}
-## Place the colorbar outside the plot to the right.  This is the default.
-##
-## @item @qcode{"East"}
-## Place the colorbar inside the plot to the right.
-##
-## @item @qcode{"WestOutside"}
-## Place the colorbar outside the plot to the left.
-##
-## @item @qcode{"West"}
-## Place the colorbar inside the plot to the left.
-##
-## @item @qcode{"NorthOutside"}
-## Place the colorbar above the plot.
-##
-## @item @qcode{"North"}
-## Place the colorbar at the top of the plot.
-##
-## @item @qcode{"SouthOutside"}
-## Place the colorbar under the plot.
-##
-## @item @qcode{"South"}
-## Place the colorbar at the bottom of the plot.
-## @end table
-##
-## To remove a colorbar from a plot use any one of the following keywords for
-## the @var{delete_option}: @qcode{"delete"}, @qcode{"hide"}, @qcode{"off"}.
-## 
-## If the argument @qcode{"peer"} is given, then the following argument is
-## treated as the axes handle in which to add the colorbar.  Alternatively,
-## If the first argument @var{hax} is an axes handle, then the colorbar is
-## added to this axis, rather than the current axes returned by @code{gca}.
-##
-## If the first argument @var{hcb} is a handle to a colorbar object, then
-## operate on this colorbar directly.
-##
-## Additional property/value pairs are passed directly to the underlying axes
-## object.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## colorbar object.
-##
-## Implementation Note: A colorbar is created as an additional axes to the
-## current figure with the @qcode{"tag"} property set to @qcode{"colorbar"}. 
-## The created axes object has the extra property @qcode{"location"} which
-## controls the positioning of the colorbar.
-## @seealso{colormap}
-## @end deftypefn
-
-function h = colorbar (varargin)
-
-  [hcb, varargin, nargin] = __plt_get_axis_arg__ ("colorbar", varargin{:});
-
-  if (hcb && ! strcmp (get (hcb, "tag"), "colorbar"))
-    ax = hcb;
-    hcb = [];
-  else
-    ax = [];
-  endif
-  loc = "";
-  args = {};
-  deleting = false;
-
-  i = 1;
-  while (i <= nargin)
-    arg = varargin{i++};
-    if (ischar (arg))
-      switch (tolower (arg))
-        case "peer"
-          if (i > nargin)
-            error ('colorbar: missing axes handle after "peer"');
-          else
-            ax = varargin{i++};
-            if (! isscalar (ax) && ! isaxes (ax))
-              error ('colorbar: expecting an axes handle following "peer"');
-            endif
-          endif
-        case {"north", "south", "east", "west",
-              "northoutside", "southoutside", "eastoutside", "westoutside"}
-          loc = tolower (arg);
-        case "location"
-          if (i > nargin)
-            error ('colorbar: missing value after "location"');
-          else
-            loc = tolower (varargin{i++});
-          endif
-        case {"delete", "hide", "off", "none"}
-          deleting = true;
-        otherwise
-          args{end+1} = arg;
-      endswitch
-    else
-      args{end+1} = arg;
-    endif
-  endwhile
-
-  ## Handle changes to existing colorbar
-  if (! isempty (hcb))
-    if (deleting)
-      delete (hcb);
-      if (nargout > 0)
-        h = hcb;
-      endif
-      return;
-    else
-      ## FIXME: No listener on location property so have to re-create
-      ##        colorbar whenever an option changes.
-      ##        re-instate this code if listener is developed.
-      # if (! isempty (loc))
-      #   set (hcb, "location", loc);
-      # endif
-      # if (! isempty (args))
-      #   set (hcb, args{:});
-      # endif
-      ax = get (get (hcb, "parent"), "currrentaxes");      
-    endif
-  endif
-    
-  if (isempty (loc))
-    loc = "eastoutside";
-  endif
-  if (isempty (ax))
-    ax = gca ();
-  endif
-
-  showhiddenhandles = get (0, "showhiddenhandles");
-  unwind_protect
-    set (0, "showhiddenhandles", "on");
-    cax = findobj (get (ax, "parent"), "tag", "colorbar", "type", "axes", "axes", ax);
-    if (! isempty (cax))
-      delete (cax);
-    endif
-  unwind_protect_cleanup
-    set (0, "showhiddenhandles", showhiddenhandles);
-  end_unwind_protect
-
-  if (! deleting)
-    ## FIXME: Matlab does not require the "position" property to be active.
-    ##        Is there a way to determine the plotbox position for the
-    ##        gnuplot graphics toolkit with the outerposition is active?
-    set (ax, "activepositionproperty", "position");
-    obj = get (ax);
-    obj.__cbar_hax__ = ax;
-    position = obj.position;
-    ## FIXME: Should this be ancestor to accommodate hggroups?
-    hpar = get (ax, "parent");  
-    clen = rows (get (hpar, "colormap"));
-    cext = get (ax, "clim");
-    cdiff = (cext(2) - cext(1)) / clen / 2;
-    cmin = cext(1) + cdiff;
-    cmax = cext(2) - cdiff;
-
-    [pos, cpos, vertical, mirror] =  ...
-        __position_colorbox__ (loc, obj, ancestor (ax, "figure"));
-    set (ax, "position", pos);
-
-    cax = __go_axes__ (hpar, "tag", "colorbar",
-                             "handlevisibility", "on",
-                             "activepositionproperty", "position",
-                             "position", cpos);
-    addproperty ("location", cax, "radio",
-                 "eastoutside|east|westoutside|west|northoutside|north|southoutside|south",
-                 loc);
-    addproperty ("axes", cax, "handle", ax);
-
-    if (vertical)
-      hi = image (cax, [0,1], [cmin, cmax], [1 : clen]');
-      if (mirror)
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-                  "ylim", cext, "ylimmode", "manual",
-                  "yaxislocation", "right", args{:});
-      else
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-                  "ylim", cext, "ylimmode", "manual",
-                  "yaxislocation", "left", args{:});
-      endif
-    else
-      hi = image (cax, [cmin, cmax], [0,1], [1 : clen]);
-      if (mirror)
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-                  "xlim", cext, "xlimmode", "manual",
-                  "xaxislocation", "top", args{:});
-      else
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-                  "xlim", cext, "xlimmode", "manual",
-                  "xaxislocation", "bottom", args{:});
-      endif
-    endif
-
-    ## Dummy object placed in axis to delete colorbar when axis is deleted.
-    ctext = text (0, 0, "", "tag", "colorbar",
-                  "visible", "off", "handlevisibility", "off",
-                  "xliminclude", "off", "yliminclude", "off",
-                  "zliminclude", "off",
-                  "deletefcn", {@deletecolorbar, cax, obj});
-
-    set (cax, "deletefcn", {@resetaxis, ax, obj});
-
-    addlistener (hpar, "colormap", {@update_colorbar_cmap, hi, vertical, clen});
-    addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical});
-    addlistener (ax, "dataaspectratio", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "dataaspectratiomode", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "plotboxaspectratio", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "plotboxaspectratiomode", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "position", {@update_colorbar_axis, cax, obj});
-
-  endif
-
-  if (nargout > 0)
-    h = cax;
-  endif
-
-endfunction
-
-function deletecolorbar (h, d, hc, orig_props)
-  ## Don't delete the colorbar and reset the axis size if the
-  ## parent figure is being deleted.
-  if (isaxes (hc)
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
-    if (strcmp (get (hc, "beingdeleted"), "off"))
-      delete (hc);
-    endif
-    if (!isempty (ancestor (h, "axes"))
-        && strcmp (get (ancestor (h, "axes"), "beingdeleted"), "off"))
-      ax = ancestor (h, "axes");
-      units = get (ax, "units");
-      set (ax, "units", orig_props.units);
-      set (ancestor (h, "axes"), "position", orig_props.position,
-                            "outerposition", orig_props.outerposition,
-                   "activepositionproperty", orig_props.activepositionproperty);
-      set (ax, "units", units);
-    endif
-  endif
-endfunction
-
-function resetaxis (cax, d, ax, orig_props)
-  if (isaxes (ax))
-    ## FIXME: Probably don't want to delete everyone's listeners on colormap.
-    dellistener (get (ax, "parent"), "colormap");
-    dellistener (ax, "clim");
-    dellistener (ax, "dataaspectratio");
-    dellistener (ax, "dataaspectratiomode");
-    dellistener (ax, "plotboxaspectratio");
-    dellistener (ax, "plotboxaspectratiomode");
-    dellistener (ax, "position");
-
-    units = get (ax, "units");
-    set (ax, "units", orig_props.units);
-    set (ax, "position", orig_props.position,
-             "outerposition", orig_props.outerposition,
-             "activepositionproperty", orig_props.activepositionproperty);
-    set (ax, "units", units);
-  endif
-endfunction
-
-function update_colorbar_clim (hax, d, hi, vert)
-  if (isaxes (hax)
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
-    clen = rows (get (get (hax, "parent"), "colormap"));
-    cext = get (hax, "clim");
-    cdiff = (cext(2) - cext(1)) / clen / 2;
-    cmin = cext(1) + cdiff;
-    cmax = cext(2) - cdiff;
-
-    hiax = get (hi, "parent");
-    if (vert)
-      set (hi, "ydata", [cmin, cmax]);
-      set (hiax, "ylim", cext);
-    else
-      set (hi, "xdata", [cmin, cmax]);
-      set (hiax, "xlim", cext);
-    endif
-
-    ## FIXME: Setting xlim or ylim from within a listener callback
-    ##        causes the axis to change size rather than change limits.
-    ##        Workaround it by jiggling the position property which forces
-    ##        a redraw of the axis object.
-    ##
-    ## Debug Example:
-    ## Uncomment the line below.
-    ##   keyboard;
-    ## Now run the the following code.
-    ##   clf; colorbar (); contour (peaks ())
-    ## Once the keyboard command has been hit in the debugger try
-    ##   set (hiax, "ylim", [0 0.5]) 
-    pos = get (hiax, "position");
-    pos(1) += eps;
-    set (hiax, "position", pos);
-    pos(1) -= eps;
-    set (hiax, "position", pos);
-  endif
-endfunction
-
-function update_colorbar_cmap (hf, d, hi, vert, init_sz)
-  persistent sz = init_sz;
-
-  if (ishandle (hf) && strcmp (get (hf, "type"), "figure")
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
-    clen = rows (get (hf, "colormap"));
-    if (clen != sz)
-      if (vert)
-        set (hi, "cdata", [1:clen]');
-      else
-        set (hi, "cdata", [1:clen]);
-      endif
-      sz = clen;
-      ## Also update limits on axis or there will be white gaps
-      update_colorbar_clim (get (hi, "parent"), d, hi, vert);
-    endif
-  endif
-endfunction
-
-function update_colorbar_axis (h, d, cax, orig_props)
-  if (isaxes (cax)
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
-    loc = get (cax, "location");
-    obj = get (h);
-    obj.__cbar_hax__ = h;
-    obj.position = orig_props.position;
-    obj.outerposition = orig_props.outerposition;
-    [pos, cpos, vertical, mirror] =  ...
-        __position_colorbox__ (loc, obj, ancestor (h, "figure"));
-
-    if (vertical)
-      if (mirror)
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-                  "yaxislocation", "right", "position", cpos);
-      else
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-                  "yaxislocation", "left", "position", cpos);
-      endif
-    else
-      if (mirror)
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-                  "xaxislocation", "top", "position", cpos);
-      else
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-                  "xaxislocation", "bottom", "position", cpos);
-      endif
-    endif
-
-  endif
-endfunction
-
-function [pos, cpos, vertical, mirr] = __position_colorbox__ (cbox, obj, cf)
-
-  ## This will always represent the position prior to adding the colorbar.
-  pos = obj.position;
-  sz = pos(3:4);
-
-  if (strcmp (obj.plotboxaspectratiomode, "manual")
-      || strcmp (obj.dataaspectratiomode, "manual"))
-    if (isempty (strfind (cbox, "outside")))
-      scale = 1.0;
-    else
-      scale = 0.8;
-    endif
-    if (isempty (strfind (cbox, "east")) && isempty (strfind (cbox, "west")))
-      scale = [1, scale];
-    else
-      scale = [scale, 1];
-    endif
-    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot")
-        && strcmp (obj.activepositionproperty, "outerposition"))
-      obj.outerposition = obj.outerposition .* [1, 1, scale];
-      off = 0.5 * (obj.outerposition (3:4) - __actual_axis_position__ (obj)(3:4));
-    else
-      obj.position = obj.position .* [1, 1, scale];
-      off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4));
-    endif
-  else
-    off = 0.0;
-  endif
-
-  switch (cbox)
-    case "northoutside"
-      origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off;
-      sz = sz .* [1.0, 0.06];
-      pos(4) = 0.8 * pos(4);
-      mirr = true;
-      vertical = false;
-    case "north"
-      origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off;
-      sz = sz .* [1.0, 0.06] * 0.9;
-      mirr = false;
-      vertical = false;
-    case "southoutside"
-      origin = pos(1:2) + off;
-      sz = sz .* [1.0, 0.06];
-      pos(2) = pos(2) + pos(4) * 0.2;
-      pos(4) = 0.8 * pos(4);
-      mirr = false;
-      vertical = false;
-    case "south"
-      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
-      sz = sz .* [1.0, 0.06] * 0.9;
-      mirr = true;
-      vertical = false;
-    case "eastoutside"
-      origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off;
-      sz = sz .* [0.06, 1.0];
-      pos(3) = 0.8 * pos(3);
-      mirr = true;
-      vertical = true;
-    case "east"
-      origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off;
-      sz = sz .* [0.06, 1.0] * 0.9;
-      mirr = false;
-      vertical = true;
-    case "westoutside"
-      origin = pos(1:2) + off;
-      sz = sz .* [0.06, 1.0];
-      pos(1) = pos(1) + pos(3) * 0.2;
-      pos(3) = 0.8 * pos(3);
-      mirr = false;
-      vertical = true;
-    case "west"
-      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
-      sz = sz .* [0.06, 1.0] .* 0.9;
-      mirr = true;
-      vertical = true;
-  endswitch
-
-  cpos = [origin, sz];
-
-  if (strcmp (obj.plotboxaspectratiomode, "manual")
-      || strcmp (obj.dataaspectratiomode, "manual"))
-    obj.position = pos;
-    actual_pos = __actual_axis_position__ (obj);
-    if (strfind (cbox, "outside"))
-      scale = 1.0;
-    else
-      scale = 0.9;
-    endif
-    if (sz(1) > sz(2))
-      ## Ensure north or south colorbars are the proper length
-      dx = (1-scale)*actual_pos(3);
-      cpos(1) = actual_pos(1) + dx/2;
-      cpos(3) = actual_pos(3) - dx;
-    else
-      ## Ensure east or west colorbars are the proper height
-      dy = (1-scale)*actual_pos(4);
-      cpos(2) = actual_pos(2) + dy/2;
-      cpos(4) = actual_pos(4) - dy;
-    endif
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ();
-%! title ('colorbar() example');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ('peer', gca, 'northoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! contour (peaks ());
-%! colorbar ('west');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! subplot (2,2,1);
-%!  contour (peaks ());
-%!  colorbar ('east');
-%! subplot (2,2,2);
-%!  contour (peaks ());
-%!  colorbar ('west');
-%! subplot (2,2,3);
-%!  contour (peaks ());
-%!  colorbar ('north');
-%! subplot (2,2,4);
-%!  contour (peaks ());
-%!  colorbar ('south');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,2,1);
-%!  imagesc (x);
-%!  colorbar ();
-%! subplot (2,2,2);
-%!  imagesc (x);
-%!  colorbar ('westoutside');
-%! subplot (2,2,3);
-%!  imagesc (x);
-%!  colorbar ('northoutside');
-%! subplot (2,2,4);
-%!  imagesc (x);
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ();
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('northoutside');
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ();
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('northoutside');
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  colorbar ();
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  colorbar ('northoutside');
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  colorbar ();
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  colorbar ('northoutside');
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  contour (x);
-%!  axis square;
-%!  colorbar ('east');
-%!  xlim ([1, 64]);
-%!  ylim ([1, 64]);
-%! subplot (1,2,2);
-%!  contour (x);
-%!  colorbar ('west');
-%!  xlim ([1, 64]);
-%!  ylim ([1, 64]);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! contour (x);
-%! xlim ([1, 64]);
-%! ylim ([1, 64]);
-%! colorbar ();
-%! colorbar off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! contour (x);
-%! xlim ([1, 64]);
-%! ylim ([1, 64]);
-%! colorbar ();
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! imagesc (1 ./ hilb (99));
-%! h = colorbar ();
-%! set (h, 'yscale', 'log');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! imagesc (log10 (1 ./ hilb (99)));
-%! h = colorbar ();
-%! ytick = get (h, 'ytick');
-%! set (h, 'yticklabel', sprintf ('10^{%g}|', ytick));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
-%! imagesc (1 ./ hilb (n));
-%! axis equal;
-%! colorbar ();
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
-%! imagesc (x, y, 1 ./ hilb (n));
-%! axis equal;
-%! colorbar ();
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
-%! imagesc (y, x, 1 ./ hilb (n));
-%! axis equal;
-%! colorbar ();
-
-## This requires that the axes position be properly determined for 'axis equal'
-%!demo
-%! clf;
-%! colormap ('default');
-%! axes;
-%! colorbar ();
-%! hold on;
-%! contour (peaks ());
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('east');
-%! axis square;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('eastoutside');
-%! axis square;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks (20));
-%! shading interp;
-%! axis ('tight', 'square');
-%! colorbar ();
-#%! axes ('color','none','box','on','activepositionproperty','position');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('east');
-%! axis equal;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('eastoutside');
-%! axis equal;
-
--- a/scripts/plot/colstyle.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-## Copyright (C) 2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{style}, @var{color}, @var{marker}, @var{msg}] =} colstyle (@var{linespec})
-## Parse @var{linespec} and return the line style, color, and markers given.
-## In the case of an error, the string @var{msg} will return the text of the
-## error.
-## @end deftypefn
-
-function [l, c, m, msg] = colstyle (style)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  if (! ischar (style))
-    error ("colstyle: STYLE must be a string");
-  endif
-
-  try
-    opt = __pltopt__ ("colstyle", style);
-    l = opt.linestyle;
-    c = opt.color;
-    m = opt.marker;
-    msg = [];
-    switch (c)
-      case [0 0 0]
-        c = "k";
-      case [1 0 0]
-        c = "r";
-      case [0 1 0]
-        c = "g";
-      case [0 0 1]
-        c = "b";
-      case [1 1 0]
-        c = "y";
-      case [1 0 1]
-        c = "m";
-      case [0 1 1]
-        c = "c";
-      case [0 1 1]
-        c = "w";
-    endswitch
-  catch
-    l = c = m = [];
-    msg = lasterr ();
-  end_try_catch
-
-endfunction
-
-
-%!test
-%! [l, c, m, msg] = colstyle ("r:x");
-%! assert (isempty (msg));
-%! assert (l, ":");
-%! assert (c, "r");
-%! assert (m, "x");
-
-%!test
-%! [l, c, m, msg] = colstyle (".");
-%! assert (isempty (msg));
-%! assert (l, "none");
-%! assert (c, []);
-%! assert (m, ".");
-
-%!test
-%! [l, c, m, msg] = colstyle ("~");
-%! assert (msg, "colstyle: unrecognized format character: '~'");
-
-%% Test input validation
-%!error colstyle ()
-%!error colstyle (1, 2)
-%!error colstyle (1.5)
-
--- a/scripts/plot/comet.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-## Copyright (C) 2008-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} comet (@var{y})
-## @deftypefnx {Function File} {} comet (@var{x}, @var{y})
-## @deftypefnx {Function File} {} comet (@var{x}, @var{y}, @var{p})
-## @deftypefnx {Function File} {} comet (@var{hax}, @dots{})
-## Produce a simple comet style animation along the trajectory provided by
-## the input coordinate vectors (@var{x}, @var{y}).  If @var{x} is not
-## specified it defaults to the indices of @var{y}.
-##
-## The speed of the comet may be controlled by @var{p}, which represents the
-## time each point is displayed before moving to the next one.  The default for
-## @var{p} is 0.1 seconds.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-## @seealso{comet3}
-## @end deftypefn
-
-## Author: Ben Abbott bpabbott@mac.com
-## Created: 2008-09-21
-
-function comet (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet", varargin{:});
-
-  if (nargin == 0)
-    print_usage ();
-  elseif (nargin == 1)
-    y = varargin{1};
-    x = 1:numel (y);
-    p = 0.1;
-  elseif (nargin == 2)
-    x = varargin{1};
-    y = varargin{2};
-    p = 0.1;
-  elseif (nargin == 3)
-    x = varargin{1};
-    y = varargin{2};
-    p = varargin{3};
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    limits = [min(x), max(x), min(y), max(y)];
-    num = numel (y);
-    dn = round (num/10);
-
-    hl = plot (x(1), y(1), "color", "r", "marker", "none",
-               x(1), y(1), "color", "g", "marker", "none",
-               x(1), y(1), "color", "b", "marker", "o");
-    axis (limits);  # set manual limits to speed up plotting
-
-    for n = 2:(num+dn);
-      m = n - dn;
-      m = max ([m, 1]);
-      k = min ([n, num]);
-      set (hl(1), "xdata", x(1:m), "ydata", y(1:m));
-      set (hl(2), "xdata", x(m:k), "ydata", y(m:k));
-      set (hl(3), "xdata", x(k),   "ydata", y(k));
-      drawnow ();
-      pause (p);
-    endfor
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! title ('comet() animation');
-%! hold on;
-%! t = 0:.1:2*pi;
-%! x = cos (2*t) .* (cos (t).^2);
-%! y = sin (2*t) .* (sin (t).^2);
-%! comet (x, y, 0.05);
-%! hold off;
-
--- a/scripts/plot/comet3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott and John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} comet3 (@var{z})
-## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z}, @var{p})
-## @deftypefnx {Function File} {} comet3 (@var{hax}, @dots{})
-## Produce a simple comet style animation along the trajectory provided by
-## the input coordinate vectors (@var{x}, @var{y}, @var{z}).  If only @var{z}
-## is specified then @var{x}, @var{y} default to the indices of @var{z}.
-##
-## The speed of the comet may be controlled by @var{p}, which represents the
-## time each point is displayed before moving to the next one.  The default for
-## @var{p} is 0.1 seconds.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-## @seealso{comet}
-## @end deftypefn
-
-## Author: jwe
-## Created: 2010-12-17
-
-function comet3 (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet3", varargin{:});
-
-  if (nargin == 0 || nargin == 2 || nargin > 4)
-    print_usage ();
-  elseif (nargin == 1)
-    z = varargin{1};
-    x = y = 1:numel (z);
-    p = 0.1;
-  elseif (nargin == 3)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    p = 0.1;
-  elseif (nargin == 4)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    p = varargin{4};
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    limits = [min(x), max(x), min(y), max(y), min(z), max(z)];
-    num = numel (y);
-    dn = round (num/10);
-
-    hl = plot3 (x(1), y(1), z(1), "color", "r", "marker", "none",
-                x(1), y(1), z(1), "color", "g", "marker", "none",
-                x(1), y(1), z(1), "color", "b", "marker", "o");
-    axis (limits);  # set manual limits to speed up plotting
-
-    for n = 2:(num+dn);
-      m = n - dn;
-      m = max ([m, 1]);
-      k = min ([n, num]);
-      set (hl(1), "xdata", x(1:m), "ydata", y(1:m), "zdata", z(1:m));
-      set (hl(2), "xdata", x(m:k), "ydata", y(m:k), "zdata", z(m:k));
-      set (hl(3), "xdata", x(k)  , "ydata", y(k)  , "zdata", z(k));
-      drawnow ();
-      pause (p);
-    endfor
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! title ('comet3() animation');
-%! view (3); hold on;
-%! t = 0:pi/20:5*pi;
-%! comet3 (cos (t), sin (t), t, 0.05);
-%! hold off;
-
--- a/scripts/plot/compass.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} compass (@var{u}, @var{v})
-## @deftypefnx {Function File} {} compass (@var{z})
-## @deftypefnx {Function File} {} compass (@dots{}, @var{style})
-## @deftypefnx {Function File} {} compass (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} compass (@dots{})
-##
-## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
-## from the origin of a polar plot.
-##
-## The arrow representing each vector has one end at the origin and the tip at
-## [@var{u}(i), @var{v}(i)].  If a single complex argument @var{z} is given,
-## then @code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## of the same format as the @code{plot} command.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of graphics handles to the
-## line objects representing the drawn vectors.
-##
-## @example
-## @group
-## a = toeplitz ([1;randn(9,1)], [1,randn(1,9)]);
-## compass (eig (a));
-## @end group
-## @end example
-##
-## @seealso{polar, feather, quiver, rose, plot}
-## @end deftypefn
-
-function h = compass (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("compass", varargin{:});
-
-  if (nargin == 0 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
-    z = varargin{1}(:).';
-    u = real (z);
-    v = imag (z);
-    have_line_spec = (nargin == 2);
-  elseif (nargin >= 2 && isnumeric (varargin{2}))
-    u = varargin{1}(:).';
-    v = varargin{2}(:).';
-    have_line_spec = (nargin == 3);
-  else
-    print_usage ();
-  endif
-
-  arrowsize = 0.20;
-  line_spec = "-b";
-
-  if (have_line_spec)
-    arg = varargin{end};
-    if (ischar (arg) || iscellstr (arg))
-      [~, valid] = __pltopt__ ("compass", arg, false);
-      if (valid)
-        line_spec = arg;
-      else
-        error ("compass: invalid linestyle STYLE");
-      endif
-    else
-      error ("compass: invalid linestyle STYLE");
-    endif
-  endif
-
-  ## Matlab draws compass plots with the arrow head as one continous line,
-  ## and each arrow separately.  This is completely different from quiver
-  ## and quite ugly.
-  n = length (u);
-  xend = u;
-  xtmp = u .* (1 - arrowsize);
-  yend = v;
-  ytmp = v .* (1 - arrowsize);
-  x = [zeros(1, n); xend; xtmp - v * arrowsize / 3; xend; ...
-       xtmp + v * arrowsize / 3];
-  y = [zeros(1, n); yend; ytmp + u * arrowsize / 3; yend; ...
-       ytmp - u * arrowsize / 3];
-  [r, p] = cart2pol (x, y);
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    hlist = polar (r, p, line_spec);
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = hlist;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! randn_9x1_data = [-2.555884; 0.394974; -0.191871; -1.147024; 1.355425; -0.437335; -0.014370; -0.941312; 1.240300];
-%! randn_1x9_data = [1.42934, -1.10821, -1.70404, 0.63357, -0.68337, -1.19771, -0.96502, -1.12810, 0.22457];
-%! a = toeplitz ([1;randn_9x1_data], [1,randn_1x9_data]);
-%! compass (eig (a));
-
-%% Test input validation
-%!error compass ()
-%!error compass (1,2,3,4)
-%!error compass (1, "-r", 2)
-%!error <invalid linestyle STYLE> compass (1, "abc")
-%!error <invalid linestyle STYLE> compass (1, {1})
-
--- a/scripts/plot/contour.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-## Copyright (C) 1993-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} contour (@var{z})
-## @deftypefnx {Function File} {} contour (@var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour (@dots{}, @var{style})
-## @deftypefnx {Function File} {} contour (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{})
-## Create a 2-D contour plot.
-##
-## Plot level curves (contour lines) of the matrix @var{z}, using the
-## contour matrix @var{c} computed by @code{contourc} from the same
-## arguments; see the latter for their interpretation.
-##
-## The appearance of contour lines can be defined with a line style @var{style}
-## in the same manner as @code{plot}.  Only line style and color are used;
-## Any markers defined by @var{style} are ignored.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional output @var{c} are the contour levels in @code{contourc} format.
-##
-## The optional return value @var{h} is a graphics handle to the hggroup
-## comprising the contour lines.
-##
-## Example:
-##
-## @example
-## @group
-## x = 0:2;
-## y = x;
-## z = x' * y;
-## contour (x, y, z, 2:3)
-## @end group
-## @end example
-##
-## @seealso{ezcontour, contourc, contourf, contour3, clabel, meshc, surfc, caxis, colormap, plot}
-##
-## @end deftypefn
-
-## Author: Shai Ayal <shaiay@users.sourceforge.net>
-
-function [c, h] = contour (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    
-    [ctmp, htmp] = __contour__ (hax, "none", varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    c = ctmp;
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks ();
-%! contour (x, y, z);
-%! title ({'contour() plot (isolines of constant Z)'; 'Z = peaks()'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
-%! [X, Y] = pol2cart (theta, r);
-%! Z = sin (2*theta) .* (1-r);
-%! contour (X, Y, abs (Z), 10);
-%! title ({'contour() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! z = peaks ();
-%! contour (z, [0 0]);
-%! title ({'contour() plot with single isoline at Z == 0'; 'Z = peaks()'});
-
-%!test
-%! hf = figure ("visible", "off");
-%! clf (hf);
-%! unwind_protect
-%!   [x, y, z] = peaks ();
-%!   [c, h] = contour (x, y, z);
-%!   levellist = -6:6;
-%!   set (h, "levellist", levellist);
-%!   assert (get (h, "levellist"), levellist)
-%!   assert (get (h, "levellistmode"), "manual")
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! clf (hf);
-%! unwind_protect
-%!   [x, y, z] = peaks ();
-%!   [c, h] = contour (x, y, z);
-%!   levelstep = 3;
-%!   set (h, "levelstep", levelstep);
-%!   assert (get (h, "levelstep"), levelstep)
-%!   assert (get (h, "levelstepmode"), "manual")
-%!   assert (get (h, "levellist"), -6:levelstep:6)
-%!   assert (get (h, "levellistmode"), "auto")
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/contour3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-## Copyright (C) 2007-2012 David BAteman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} contour3 (@var{z})
-## @deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
-## @deftypefnx {Function File} {} contour3 (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
-## Create a 3-D contour plot.
-##
-## @code{contour3} plots level curves (contour lines) of the matrix @var{z}
-## at a Z level corresponding to each contour.  This is in contrast to
-## @code{contour} which plots all of the contour lines at the same Z level
-## and produces a 2-D plot.
-##
-## The level curves are taken from the contour matrix @var{c} computed by
-## @code{contourc} for the same arguments; see the latter for their
-## interpretation.
-##
-## The appearance of contour lines can be defined with a line style @var{style}
-## in the same manner as @code{plot}.  Only line style and color are used;
-## Any markers defined by @var{style} are ignored.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional output @var{c} are the contour levels in @code{contourc} format.
-##
-## The optional return value @var{h} is a graphics handle to the hggroup
-## comprising the contour lines.
-##
-## Example:
-##
-## @example
-## @group
-## contour3 (peaks (19));
-## colormap cool;
-## hold on;
-## surf (peaks (19), "facecolor", "none", "edgecolor", "black");
-## @end group
-## @end example
-##
-## @seealso{contour, contourc, contourf, clabel, meshc, surfc, caxis, colormap, plot}
-## @end deftypefn
-
-function [c, h] = contour3 (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    
-    [ctmp, htmp] = __contour__ (hax, "auto", varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (! ishold ())
-    set (hax, "view", [-37.5, 30], "box", "off",
-              "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  if (nargout > 0)
-    c = ctmp;
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap (cool (64));
-%! surf (peaks (19), 'facecolor', 'none', 'edgecolor', [0.85 0.85 0.85]);
-%! hold on;
-%! contour3 (peaks (19));
-%! hold off;
-%! axis tight;
-%! zlim auto;
-%! view (315, 17);
-%! title ({'contour3 of peaks() function', 'gray surf() shows peaks function'});
-
--- a/scripts/plot/contourc.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-## Copyright (C) 2003-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z})
-## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z}, @var{vn})
-## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z}, @var{vn})
-## Compute contour lines (isolines of constant Z value).
-##
-## The matrix @var{z} contains height values above the rectangular grid
-## determined by @var{x} and @var{y}.  If only a single input @var{z} is
-## provided then @var{x} is taken to be @code{1:rows (@var{z})} and @var{y} is
-## taken to be @code{1:columns (@var{z})}.
-##
-## The optional input @var{vn} is either a scalar denoting the number of
-## contour lines to compute or a vector containing the Z values where lines
-## will be computed.  When @var{vn} is a vector the number of contour lines
-## is @code{numel (@var{vn})}.  However, to compute a single contour line
-## at a given value use @code{@var{vn} = [val, val]}.  If @var{vn} is omitted
-## it defaults to 10.
-##
-## The return value @var{c} is a 2x@var{n} matrix containing the
-## contour lines in the following format
-##
-## @example
-## @group
-## @var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ...
-##      len1, y1, y2, @dots{}, lenn, y1, y2, @dots{}]
-## @end group
-## @end example
-##
-## @noindent
-## in which contour line @var{n} has a level (height) of @var{levn} and
-## length of @var{lenn}.
-##
-## The optional return value @var{lev} is a vector with the Z values of
-## of the contour levels.
-##
-## Example:
-##
-## @example
-## @group
-## x = 0:2;
-## y = x;
-## z = x' * y;
-## contourc (x, y, z, 2:3)
-##    @result{}   2.0000   2.0000   1.0000   3.0000   1.5000   2.0000
-##         2.0000   1.0000   2.0000   2.0000   2.0000   1.5000
-## @end group
-## @end example
-## @seealso{contour, contourf, contour3, clabel}
-## @end deftypefn
-
-## Author: Shai Ayal <shaiay@users.sourceforge.net>
-
-function [c, lev] = contourc (varargin)
-
-  if (nargin < 1 || nargin > 4)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
-    z = varargin{1};
-    x = 1:columns (z);
-    y = 1:rows (z);
-    vn = 10;
-  elseif (nargin == 2)
-    z = varargin{1};
-    x = 1:columns (z);
-    y = 1:rows (z);
-    vn = varargin{2};
-  elseif (nargin == 3)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    vn = 10;
-  elseif (nargin == 4)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    vn = varargin{4};
-  endif
-
-  if (! ismatrix (z) || ! ismatrix (x) || ! ismatrix (y))
-    error ("contourc: X, Y, and Z must be matrices");
-  endif
-
-  if (isscalar (vn))
-    vv = linspace (min (z(:)), max (z(:)), vn+2)(2:end-1);
-  else
-    vv = unique (sort (vn));
-  endif
-
-  if (isvector (x) && isvector (y))
-    cdat = __contourc__ (x(:)', y(:)', z, vv);
-  elseif (! any (bsxfun (@minus, x, x(1,:))(:))
-          && ! any (bsxfun (@minus, y, y(:,1))(:)))
-    ## x,y are uniform grid (such as from meshgrid)
-    cdat = __contourc__ (x(1,:), y(:,1)', z, vv);
-  else
-    ## Data is sampled over non-uniform mesh.
-    ## Algorithm calculates contours for uniform grid
-    ## and then interpolates values back to the non-uniform mesh.
-
-    ## Uniform grid for __contourc__.
-    [nr, nc] = size (z);
-    ii = 1:nc;
-    jj = 1:nr;
-
-    cdat = __contourc__ (ii, jj, z, vv);
-
-    ## Map the contour lines from index space (i,j)
-    ## back to the original grid (x,y)
-    i = 1;
-
-    while (i < columns (cdat))
-      clen = cdat(2, i);
-      idx = i + (1:clen);
-
-      ci = cdat(1, idx);
-      cj = cdat(2, idx);
-
-      ## Due to rounding errors, some elements of ci and cj
-      ## can fall out of the range of ii and jj and
-      ## interp2 would return NA for those values.
-      ## The permitted range is enforced here:
-
-      ci = max (ci, 1); ci = min (ci, nc);
-      cj = max (cj, 1); cj = min (cj, nr);
-
-      cdat(1, idx) = interp2 (ii, jj, x, ci, cj);
-      cdat(2, idx) = interp2 (ii, jj, y, ci, cj);
-
-      i += clen + 1;
-    endwhile
-  endif
-
-  if (nargout > 0)
-    c = cdat;
-    lev = vv;
-  endif
-
-endfunction
-
-
-%!test
-%! x = 0:2;
-%! y = x;
-%! z = x' * y;
-%! c_exp = [2, 1, 1, 2, 2, 3, 1.5, 2; 4, 2, 2, 1, 1, 2, 2, 1.5];
-%! lev_exp = [2 3];
-%! [c_obs, lev_obs] = contourc (x, y, z, 2:3);
-%! assert (c_obs, c_exp, eps);
-%! assert (lev_obs, lev_exp, eps);
-
--- a/scripts/plot/contourf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-## Copyright (C) 2003 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} contourf (@var{z})
-## @deftypefnx {Function File} {} contourf (@var{z}, @var{vn})
-## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z}, @var{vn})
-## @deftypefnx {Function File} {} contourf (@dots{}, @var{style})
-## @deftypefnx {Function File} {} contourf (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contourf (@dots{})
-## Create a 2-D contour plot with filled intervals.
-##
-## Plot level curves (contour lines) of the matrix @var{z} and fill the region
-## between lines with colors from the current colormap.
-##
-## The level curves are taken from the contour matrix @var{c} computed by
-## @code{contourc} for the same arguments; see the latter for their
-## interpretation.
-##
-## The appearance of contour lines can be defined with a line style @var{style}
-## in the same manner as @code{plot}.  Only line style and color are used;
-## Any markers defined by @var{style} are ignored.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional output @var{c} are the contour levels in @code{contourc} format.
-##
-## The optional return value @var{h} is a graphics handle to the hggroup
-## comprising the contour lines.
-##
-## The following example plots filled contours of the @code{peaks} function.
-##
-## @example
-## @group
-## [x, y, z] = peaks (50);
-## contourf (x, y, z, -7:9)
-## @end group
-## @end example
-## @seealso{ezcontourf, contour, contourc, contour3, clabel, meshc, surfc, caxis, colormap, plot}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-## Author: Shai Ayal <shaiay@users.sourceforge.net>
-
-function [c, h] = contourf (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    
-    [ctmp, htmp] = __contour__ (hax, "none", "fill", "on",
-                                     "linecolor", "black", varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    c = ctmp;
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (50);
-%! contourf (x, y, z, -7:9);
-%! title ({'contourf() plot (filled contour lines)'; 'Z = peaks()'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
-%! [X, Y] = pol2cart (theta, r);
-%! Z = sin (2*theta) .* (1-r);
-%! contourf (X, Y, abs (Z), 10);
-%! title ({'contourf() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = linspace (-2, 2);
-%! [x, y] = meshgrid (x);
-%! z = sqrt (x.^2 + y.^2) ./ (x.^2 + y.^2 + 1);
-%! contourf (x, y, z, [0.4, 0.4]);
-%! title ('Hole should be filled with the background color');
-
--- a/scripts/plot/copyobj.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-## Copyright (C) 2012 pdiribarne
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{hnew} =} copyobj (@var{horig})
-## @deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
-## Construct a copy of the graphic object associated with handle @var{horig}
-## and return a handle @var{hnew} to the new object.
-##
-## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
-## specified, the copied object will be created as a child of @var{hparent}.
-## @seealso{struct2hdl, hdl2struct, findobj}
-## @end deftypefn
-
-## Author: pdiribarne <pdiribarne@new-host.home>
-## Created: 2012-04-01
-
-function hnew = copyobj (horig, hparent = 0)
-
-  partypes = {"root", "figure", "axes", "hggroup"};
-  othertypes = {"line", "patch", "surface", "image", "text"};
-  alltypes = [partypes othertypes];
-
-  if (! ishandle (horig) || nargin > 2)
-    print_usage ();
-  elseif (! ishandle (hparent))
-    hparent = figure (fix (hparent));
-  elseif (! any (strcmpi (get (hparent).type, partypes)))
-    print_usage ();
-  endif
-
-  ## current figure and axes
-  cf = gcf ();
-  ca = gca ();
-  
-  ## compatibility of input handles
-  kididx = find (strcmp (alltypes, get (horig).type));
-  paridx = find (strcmp (alltypes, get (hparent).type));
-
-  if (kididx <= paridx)
-    error ("copyobj: %s object can't be children to %s.",
-           alltypes{kididx}, alltypes{paridx});
-  elseif (nargin == 1)
-    str = hdl2struct (horig);
-    hnew = struct2hdl (str);
-  else
-    str = hdl2struct (horig);
-    hnew = struct2hdl (str, hparent);
-  endif
-
-  ## reset current figure (and eventually axes) to original
-  set (0, "currentfigure", cf);
-  if (get (hnew, "parent") == cf)
-    set (cf, "currentaxes", ca)
-  endif
-  
-endfunction
-
-
-%!demo
-%! hdl = figure (1234);
-%! clf;
-%! hold on;
-%! x = 1:10;
-%! y = x.^2;
-%! dy = 2 * (.2 * x);
-%! y2 = (x - 3).^2;
-%! hg = errorbar (x, y, dy,'#~');
-%! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
-%! plot (x, y2, 'ok-');
-%! legend ('errorbar', 'line');
-%! hnew = copyobj (hdl);
-
-%!demo
-%! ## FIXME: This demo fails occasionally for an obscure reason.
-%! ## It appears that there is something wrong with Octave code for patches.
-%! unwind_protect
-%!   hdl = figure (1234);
-%!   clf;
-%!   subplot (2,2,1);
-%!   hold on;
-%!   contourf (rand (10, 10));
-%!   colorbar ();
-%!   subplot (2,2,2);
-%!   quiver (rand (10, 10), rand (10, 10));
-%!   subplot (2,2,3);
-%!   colormap (jet (64));
-%!   hold on;
-%!   sombrero ();
-%!   colorbar ('peer', gca, 'NorthOutside');
-%!   subplot (2,2,4);
-%!   imagesc (rand (30, 30));
-%!   text (15, 15, 'Rotated text', ...
-%!         'HorizontAlalignment', 'Center', 'Rotation', 30);
-%!   hnew = copyobj (hdl);
-%! unwind_protect_cleanup
-%!   close all;
-%! end_unwind_protect
-
-%!testif HAVE_MAGICK
-%! toolkit = graphics_toolkit ();
-%! graphics_toolkit ("gnuplot");
-%! unwind_protect
-%!   h1 = figure ("visible", "off");
-%!   x = 0:0.1:2*pi;
-%!   y1 = sin (x);
-%!   y2 = exp (x - 1);
-%!   ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
-%!   xlabel ("X");
-%!   ylabel (ax(1), "Axis 1");
-%!   ylabel (ax(2), "Axis 2");
-%!   axes (ax(1));
-%!   text (0.5, 0.5, "Left Axis", ...
-%!         "color", [0 0 1], "horizontalalignment", "center");
-%!   axes (ax(2));
-%!   text (4.5, 80, "Right Axis", ...
-%!         "color", [0 0.5 0], "horizontalalignment", "center");
-%!   s1 = hdl2struct (h1);
-%!   h2 = struct2hdl (s1);
-%!   s2 = hdl2struct (h2);
-%!   png1 = strcat (tmpnam (), ".png");
-%!   png2 = strcat (tmpnam (), ".png");
-%!   unwind_protect
-%!     print (h1, png1);
-%!     [img1, map1, alpha1] = imread (png1);
-%!     print (h2, png2);
-%!     [img2, map2, alpha2] = imread (png2);
-%!   unwind_protect_cleanup
-%!     unlink (png1);
-%!     unlink (png2);
-%!   end_unwind_protect
-%!   assert (img1, img2);
-%!   assert (map1, map2);
-%!   assert (alpha1, alpha2);
-%! unwind_protect_cleanup
-%!   close (h1);
-%!   close (h2);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
--- a/scripts/plot/cylinder.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul and Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} cylinder
-## @deftypefnx {Function File} {} cylinder (@var{r})
-## @deftypefnx {Function File} {} cylinder (@var{r}, @var{n})
-## @deftypefnx {Function File} {} cylinder (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} cylinder (@dots{})
-## Plot a 3-D unit cylinder.
-##
-## The optional input @var{r} is a vector specifying the radius along the
-## unit z-axis.  The default is [1 1] indicating radius 1 at @code{Z == 0}
-## and at @code{Z == 1}.
-##
-## The optional input @var{n} determines the number of faces around the
-## the circumference of the cylinder.  The default value is 20.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## If outputs are requested @code{cylinder} returns three matrices in
-## @code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
-## generates a unit cylinder.
-##
-## Example:
-##
-## @example
-## @group
-## [x, y, z] = cylinder (10:-1:0, 50);
-## surf (x, y, z);
-## title ("a cone");
-## @end group
-## @end example
-## @seealso{ellipsoid, rectangle, sphere}
-## @end deftypefn
-
-function [xx, yy, zz] = cylinder (varargin)
-
-  [hax, args, nargs] = __plt_get_axis_arg__ ("cylinder", varargin{:});
-
-  if (nargs == 0)
-    r = [1, 1];
-    n = 20;
-  elseif (nargs == 1)
-    r = args{1};
-    n = 20;
-  elseif (nargs == 2)
-    r = args{1};
-    n = args{2};
-  else
-    print_usage ();
-  endif
-
-  if (length (r) < 2)
-    error ("cylinder: length (R) must be larger than 2");
-  endif
-
-  phi = linspace (0, 2*pi, n+1);
-  idx = 1:length (r);
-  [phi, idx] = meshgrid (phi, idx);
-  z = (idx - 1) / (length (r) - 1);
-  r = r(idx);
-  [x, y] = pol2cart (phi, r);
-
-  if (nargout > 0)
-    xx = x;
-    yy = y;
-    zz = z;
-  else
-    oldfig = [];
-    if (! isempty (hax))
-      oldfig = get (0, "currentfigure");
-    endif
-    unwind_protect
-      hax = newplot (hax);
-      surf (x, y, z);
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = cylinder (10:-1:0, 50);
-%! surf (x, y, z);
-%! title ('cylinder() with linearly shrinking radius produces a cone');
-
--- a/scripts/plot/daspect.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{data_aspect_ratio} =} daspect ()
-## @deftypefnx {Function File} {} daspect (@var{data_aspect_ratio})
-## @deftypefnx {Function File} {} daspect (@var{mode})
-## @deftypefnx {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode")
-## @deftypefnx {Function File} {} daspect (@var{hax}, @dots{})
-## Query or set the data aspect ratio of the current axes.
-##
-## The aspect ratio is a normalized 3-element vector representing the span of
-## the x, y, and z-axis limits.
-## 
-## @code{(daspect (@var{mode}))}
-##
-## Set the data aspect ratio mode of the current axes.  @var{mode} is
-## either @qcode{"auto"} or @qcode{"manual"}.
-## 
-## @code{daspect (@qcode{"mode"})}
-##
-## Return the data aspect ratio mode of the current axes.
-## 
-## @code{daspect (@var{hax}, @dots{})}
-##
-## Operate on the axes in handle @var{hax} instead of the current axes.
-## 
-## @seealso{axis, pbaspect, xlim, ylim, zlim}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-01-26
-
-function daratio = daspect (varargin)
-
-  ## Grab axes handle if present
-  if (nargin > 0)
-    if (isscalar (varargin{1}) && isaxes (varargin{1}))
-      hax = varargin{1};
-      varargin = varargin(2:end);
-    else
-      hax = gca ();
-    endif
-  else
-    hax = gca ();
-  endif
-
-  nargin = numel (varargin);
-  if (nargin > 1)
-    print_usage ();
-  endif
-
-  if (nargin == 0)
-    daratio = get (hax, "dataaspectratio");
-  else
-    arg = varargin{1};
-    if (isreal (arg))
-      if (numel (arg) == 2)
-        set (hax, "dataaspectratio", [arg, 1]);
-      elseif (numel (arg) == 3)
-        set (hax, "dataaspectratio", arg);
-      else
-        error ("daspect: DATA_ASPECT_RATIO must be a 2 or 3 element vector");
-      endif
-    elseif (ischar (arg))
-      arg = tolower (arg);
-      switch (arg)
-        case "auto"
-          set (hax, "dataaspectratiomode", "auto");
-        case "manual"
-          set (hax, "dataaspectratiomode", "manual");
-        case "mode"
-          daratio = get (hax, "dataaspectratiomode");
-        otherwise
-          error ("daspect: Invalid mode <%s>", arg);
-      endswitch
-    else
-      print_usage ();
-    endif
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! axis square;
-%! daspect ([1 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -2, 2]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos (x), x,sin (x));
-%! axis ([0 4 -1 1]);
-%! daspect ([2 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -1, 1]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! daspect ([1 2 1]);
-%! pbaspect ([2 1 1]);
-%! title ('2x1 plot box with axis limits [0, 4, -2, 2]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x, sin(x));
-%! axis square;
-%! set (gca, 'activepositionproperty', 'position');
-%! daspect ([1 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -2, 2]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! axis ([0 4 -1 1]);
-%! set (gca, 'activepositionproperty', 'position');
-%! daspect ([2 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -1, 1]');
-
-## FIXME: need some input validation tests
-
--- a/scripts/plot/diffuse.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-## Copyright (C) 2009-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv})
-## Calculate diffuse reflection strength of a surface defined by the normal
-## vector elements @var{sx}, @var{sy}, @var{sz}.
-##
-## The light source location vector @var{lv} can be given as 2-element vector
-## [azimuth, elevation] in degrees or as 3-element vector [lx, ly, lz].
-## @seealso{specular, surfl}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function retval = diffuse (sx, sy, sz, lv)
-
-  if (nargin != 4)
-    print_usage ();
-  endif
-
-  ## check for normal vector
-  if (!size_equal (sx, sy, sz))
-    error ("diffuse: SX, SY, and SZ must have same size");
-  endif
-
-  ## check for light vector (lv) argument
-  if (length (lv) < 2 || length (lv) > 3)
-    error ("diffuse: light vector LV must be a 2- or 3-element vector");
-  elseif (length (lv) == 2)
-    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
-  endif
-
-  ## Normalize view and light vector.
-  if (sum (abs (lv)) > 0)
-    lv  /= norm (lv);
-  endif
-
-  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
-  retval = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
-  retval(retval < 0) = 0;
-
-endfunction
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/area.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,283 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+## Copyright (C) 2007-2009 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} area (@var{y})
+## @deftypefnx {Function File} {} area (@var{x}, @var{y})
+## @deftypefnx {Function File} {} area (@dots{}, @var{lvl})
+## @deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} area (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} area (@dots{})
+## Area plot of the columns of @var{y}.
+##
+## This plot shows the contributions of each column value to the row sum.  It
+## is functionally similar to @code{plot (@var{x}, cumsum (@var{y}, 2))},
+## except that the area under the curve is shaded.
+##
+## If the @var{x} argument is omitted it defaults to @code{1:rows (@var{y})}.
+## A value @var{lvl} can be defined that determines where the base level of
+## the shading under the curve should be defined.  The default level is 0.
+##
+## Additional property/value pairs are passed directly to the underlying patch
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## object comprising the area patch objects.  The @qcode{"BaseValue"} property
+## of the hggroup can be used to adjust the level where shading begins.
+##
+## Example: Verify identity sin^2 + cos^2 = 1
+##
+## @example
+## @group
+## t = linspace (0, 2*pi, 100)';
+## y = [sin(t).^2, cos(t).^2)];
+## area (t, y);
+## legend ("sin^2", "cos^2", "location", "NorthEastOutside");
+## @end group
+## @end example
+## @seealso{plot, patch}
+## @end deftypefn
+
+function h = area (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:});
+
+  if (nargin == 0)
+    print_usage ();
+  endif
+
+  x = y = [];
+  bv = 0;
+
+  num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
+  if (isempty (num_numeric))
+    num_numeric = nargin;     
+  endif
+
+  switch (num_numeric)
+    case 1
+      y = varargin{1};
+    case 2
+      if (isscalar (varargin{2})) 
+        y = varargin{1};
+        bv = varargin{2};
+      else
+        x = varargin{1};
+        y = varargin{2};
+      endif
+    case 3
+      x = varargin{1};
+      y = varargin{2};
+      bv = varargin{3};
+    otherwise
+      print_usage ();
+  endswitch
+
+  if (! isreal (x) || ! isreal (y))
+    error ("area: X and Y must be real vectors or matrices");
+  endif
+  if (! isreal (bv) || ! isscalar (bv))
+    error ("area: LVL must be a real scalar");
+  endif
+
+  if (isvector (y))
+    y = y(:);
+  endif
+  if (isempty (x))
+    x = repmat ([1:rows(y)]', 1, columns (y));
+  elseif (isvector (x))
+    x = repmat (x(:), 1, columns (y));
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __area__ (hax, x, y, bv, varargin{num_numeric+1:end});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+function retval = __area__ (ax, x, y, bv, varargin)
+
+  y0 = bv * ones (1, rows (y));
+  y0 = zeros (1, rows (y));
+  retval = [];
+  for i = 1: columns (y);
+
+    lc = __next_line_color__ ();
+
+    ## Must occur after __next_line_color__ in order to work correctly.
+    hg = hggroup ();
+    retval = [retval; hg];
+    args = __add_datasource__ ("area", hg, {"x", "y"}, varargin{:});
+
+    x1 = x(:, 1)';
+    y1 = y(:, i)';
+    addproperty ("xdata", hg, "data", x1);
+    addproperty ("ydata", hg, "data", y1);
+
+    addlistener (hg, "xdata", @update_data);
+    addlistener (hg, "ydata", @update_data);
+
+    if (i == 1)
+      h = patch (ax, [x1(1), x1, fliplr(x1)], [bv, y1, bv*ones(1, length(y1))],
+                     lc, "parent", hg);
+    else
+      y1 = y0 + y1;
+      h = patch (ax, [x1(1), x1, fliplr(x1)], [y0(1), y1, fliplr(y0)],
+                     lc, "parent", hg);
+    endif
+
+    y0 = y1;
+
+    addproperty ("basevalue", hg, "data", bv);
+    addlistener (hg, "basevalue", @move_baseline);
+
+    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
+    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
+    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
+    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
+
+    addlistener (hg, "edgecolor", @update_props);
+    addlistener (hg, "facecolor", @update_props);
+    addlistener (hg, "linestyle", @update_props);
+    addlistener (hg, "linewidth", @update_props);
+
+    addproperty ("areagroup", hg, "data");
+    set (retval, "areagroup", retval);
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    if (! isempty (args))
+      set (hg, args{:});
+    endif
+  endfor
+
+endfunction
+
+function update_props (h, d)
+  kids = get (h, "children");
+  set (kids, "edgecolor", get (h, "edgecolor"),
+             "facecolor", get (h, "facecolor"),
+             "linestyle", get (h, "linestyle"),
+             "linewidth", get (h, "linewidth"));
+endfunction
+
+function move_baseline (h, d)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "areagroup");
+      b0 = get (h, "basevalue");
+
+      for hh = hlist(:)'
+        if (hh != h)
+          b1 = get (hh, "basevalue");
+          if (b1 != b0)
+            set (hh, "basevalue", b0);
+          endif
+        endif
+      endfor
+      update_data (h, d);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_data (h, d)
+  hlist = get (h, "areagroup");
+  bv = get (h, "basevalue");
+  for i = 1 : length (hlist)
+    hh = hlist(i);
+    x1 = get (hh, "xdata")(:);
+    y1 = get (hh, "ydata")(:);
+
+    set (get (hh, "children"), "xdata", [x1(1); x1; flipud(x1)]);
+    if (i == 1)
+      set (get (hh, "children"), "ydata", [bv; y1; bv*ones(length(y1), 1)]);
+    else
+      y1 = y0 + y1;
+      set (get (hh, "children"), "ydata", [y0(1); y1; flipud(y0)]);
+    endif
+
+    y0 = y1;
+  endfor
+endfunction
+
+
+%!demo
+%! ## Verify identity sin^2 + cos^2 = 1
+%! clf;
+%! t = linspace (0, 2*pi, 100)';
+%! y = [sin(t).^2, cos(t).^2];
+%! area (t, y);
+%! axis tight
+%! legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside');  
+%! title ('area() plot');
+
+%!demo
+%! ## Show effects of setting BaseValue
+%! clf;
+%! x = [-2:0.1:2]';
+%! y = x.^2 - 1;
+%! subplot (1, 2, 1)
+%! area (x, y);
+%! title ({'Parabola y = x^2 -1';'BaseValue = 0'});
+%! subplot (1, 2, 2)
+%! h = area (x, y);
+%! set (h, 'basevalue', -1);
+%! title ({'Parabola y = x^2 -1';'BaseValue = -1'});
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y = rand (size (x));
+%! h = area (x, y);
+%! set (h, 'ydata', sort (get (h, 'ydata')))
+%! title ('area() plot of sorted data');
+
+%% Test input validation
+%!error area ()
+%!error area (1,2,3,4)
+%!error <X and Y must be real vectors or matrices> area ({1})
+%!error <X and Y must be real vectors or matrices> area (1+i)
+%!error <X and Y must be real vectors or matrices> area (1:2, {1, 2})
+%!error <X and Y must be real vectors or matrices> area (1:2, [1 1+i])
+%!error <LVL must be a real scalar> area (1, i)
+%!error <LVL must be a real scalar> area (1, 2, ones (2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/bar.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,140 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} bar (@var{y})
+## @deftypefnx {Function File} {} bar (@var{x}, @var{y})
+## @deftypefnx {Function File} {} bar (@dots{}, @var{w})
+## @deftypefnx {Function File} {} bar (@dots{}, @var{style})
+## @deftypefnx {Function File} {} bar (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} bar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} bar (@dots{}, @var{prop}, @var{val}, @dots{})
+## Produce a bar graph from two vectors of X-Y data.
+##
+## If only one argument is given, @var{y}, it is taken as a vector of Y values
+## and the X coordinates are the range @code{1:numel (@var{y})}.
+##
+## The optional input @var{w} controls the width of the bars.  A value of
+## 1.0 will cause each bar to exactly touch any adjacent bars.
+## The default width is 0.8.
+##
+## If @var{y} is a matrix, then each column of @var{y} is taken to be a
+## separate bar graph plotted on the same graph.  By default the columns
+## are plotted side-by-side.  This behavior can be changed by the @var{style}
+## argument which can take the following values:
+##
+## @table @asis
+## @item @qcode{"grouped"} (default) 
+## Side-by-side bars with a gap between bars and centered over the X-coordinate.
+## 
+## @item  @qcode{"stacked"}
+## Bars are stacked so that each X value has a single bar composed of
+## multiple segments.
+##
+## @item @qcode{"hist"}
+## Side-by-side bars with no gap between bars and centered over the
+## X-coordinate.
+##
+## @item @qcode{"histc"}
+## Side-by-side bars with no gap between bars and left-aligned to the
+## X-coordinate.
+## @end table
+##
+## Optional property/value pairs are passed directly to the underlying patch
+## objects.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of handles to the created
+## "bar series" hggroups with one handle per column of the variable @var{y}.
+## This series makes it possible to change a common element in one bar series
+## object and have the change reflected in the other "bar series".
+## For example,
+##
+## @example
+## @group
+## h = bar (rand (5, 10));
+## set (h(1), "basevalue", 0.5);
+## @end group
+## @end example
+##
+## @noindent
+## changes the position on the base of all of the bar series.
+##
+## The following example modifies the face and edge colors using
+## property/value pairs.
+##
+## @example
+## bar (randn (1, 100), "facecolor", "r", "edgecolor", "b");
+## @end example
+##
+## @noindent
+## The color of the bars is taken from the figure's colormap, such that
+##
+## @example
+## @group
+## bar (rand (10, 3));
+## colormap (summer (64));
+## @end group
+## @end example
+##
+## @noindent
+## will change the colors used for the bars.  The color of bars can also be set
+## manually using the @qcode{"facecolor"} property as shown below.
+##
+## @example
+## @group
+## h = bar (rand (10, 3));
+## set (h(1), "facecolor", "r")
+## set (h(2), "facecolor", "g")
+## set (h(3), "facecolor", "b")
+## @end group
+## @end example
+##
+## @seealso{barh, hist, pie, plot, patch}
+## @end deftypefn
+
+## Author: jwe
+
+function varargout = bar (varargin)
+  varargout = cell (nargout, 1);
+  [varargout{:}] = __bar__ (true, "bar", varargin{:});
+endfunction
+
+
+%!demo
+%! clf;
+%! y = rand (11, 1);
+%! h = bar (y);
+%! set (h, 'ydata', sort (rand (11, 1)));
+%! title ('bar() graph');
+
+%!demo
+%! clf;
+%! h = bar (rand (5, 3));
+%! set (h(1), 'facecolor', 'r');
+%! set (h(2), 'facecolor', 'g');
+%! set (h(3), 'facecolor', 'b');
+%! title ('bar() graph w/multiple bars');
+
+%!demo
+%! clf;
+%! h = bar (rand (5, 3), 'stacked');
+%! title ('bar() graph with stacked style');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/barh.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,91 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} barh (@var{y})
+## @deftypefnx {Function File} {} barh (@var{x}, @var{y})
+## @deftypefnx {Function File} {} barh (@dots{}, @var{w})
+## @deftypefnx {Function File} {} barh (@dots{}, @var{style})
+## @deftypefnx {Function File} {} barh (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} barh (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} barh (@dots{}, @var{prop}, @var{val}, @dots{})
+## Produce a horizontal bar graph from two vectors of X-Y data.
+##
+## If only one argument is given, it is taken as a vector of Y values
+## and the X coordinates are the range @code{1:numel (@var{y})}.
+##
+## The optional input @var{w} controls the width of the bars.  A value of
+## 1.0 will cause each bar to exactly touch any adjacent bars.
+## The default width is 0.8.
+##
+## If @var{y} is a matrix, then each column of @var{y} is taken to be a
+## separate bar graph plotted on the same graph.  By default the columns
+## are plotted side-by-side.  This behavior can be changed by the @var{style}
+## argument which can take the following values:
+##
+## @table @asis
+## @item @qcode{"grouped"} (default) 
+## Side-by-side bars with a gap between bars and centered over the Y-coordinate.
+## 
+## @item  @qcode{"stacked"}
+## Bars are stacked so that each Y value has a single bar composed of
+## multiple segments.
+##
+## @item @qcode{"hist"}
+## Side-by-side bars with no gap between bars and centered over the
+## Y-coordinate.
+##
+## @item @qcode{"histc"}
+## Side-by-side bars with no gap between bars and left-aligned to the
+## Y-coordinate.
+## @end table
+##
+## Optional property/value pairs are passed directly to the underlying patch
+## objects.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## 
+## The optional return value @var{h} is a graphics handle to the created
+## bar series hggroup.  For a description of the use of the
+## bar series, @pxref{XREFbar,,bar}.
+## @seealso{bar, hist, pie, plot, patch}
+## @end deftypefn
+
+## Author: jwe
+
+function varargout = barh (varargin)
+  varargout = cell (nargout, 1);
+  [varargout{:}] = __bar__ (false, "barh", varargin{:});
+endfunction
+
+
+%!demo
+%! clf;
+%! x = rand (10, 1);
+%! barh (x);
+%! title ('barh() graph')
+
+%!demo
+%! clf;
+%! h = barh (rand (5, 3));
+%! set (h(1), 'facecolor', 'r')
+%! set (h(2), 'facecolor', 'g')
+%! set (h(3), 'facecolor', 'b')
+%! title ('barh() graph w/multiple bars')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/colorbar.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,772 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} colorbar
+## @deftypefnx {Function File} {} colorbar (@var{loc})
+## @deftypefnx {Function File} {} colorbar (@var{delete_option})
+## @deftypefnx {Function File} {} colorbar (@var{hcb}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@dots{}, "peer", @var{hax}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@dots{}, "location", @var{loc}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} colorbar (@dots{})
+## Add a colorbar to the current axes.
+##
+## A colorbar displays the current colormap along with numerical rulings
+## so that the color scale can be interpreted.
+##
+## The optional input @var{loc} determines the location of the colorbar.
+## Valid values for @var{loc} are
+##
+## @table @asis
+## @item @qcode{"EastOutside"}
+## Place the colorbar outside the plot to the right.  This is the default.
+##
+## @item @qcode{"East"}
+## Place the colorbar inside the plot to the right.
+##
+## @item @qcode{"WestOutside"}
+## Place the colorbar outside the plot to the left.
+##
+## @item @qcode{"West"}
+## Place the colorbar inside the plot to the left.
+##
+## @item @qcode{"NorthOutside"}
+## Place the colorbar above the plot.
+##
+## @item @qcode{"North"}
+## Place the colorbar at the top of the plot.
+##
+## @item @qcode{"SouthOutside"}
+## Place the colorbar under the plot.
+##
+## @item @qcode{"South"}
+## Place the colorbar at the bottom of the plot.
+## @end table
+##
+## To remove a colorbar from a plot use any one of the following keywords for
+## the @var{delete_option}: @qcode{"delete"}, @qcode{"hide"}, @qcode{"off"}.
+## 
+## If the argument @qcode{"peer"} is given, then the following argument is
+## treated as the axes handle in which to add the colorbar.  Alternatively,
+## If the first argument @var{hax} is an axes handle, then the colorbar is
+## added to this axis, rather than the current axes returned by @code{gca}.
+##
+## If the first argument @var{hcb} is a handle to a colorbar object, then
+## operate on this colorbar directly.
+##
+## Additional property/value pairs are passed directly to the underlying axes
+## object.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## colorbar object.
+##
+## Implementation Note: A colorbar is created as an additional axes to the
+## current figure with the @qcode{"tag"} property set to @qcode{"colorbar"}. 
+## The created axes object has the extra property @qcode{"location"} which
+## controls the positioning of the colorbar.
+## @seealso{colormap}
+## @end deftypefn
+
+function h = colorbar (varargin)
+
+  [hcb, varargin, nargin] = __plt_get_axis_arg__ ("colorbar", varargin{:});
+
+  if (hcb && ! strcmp (get (hcb, "tag"), "colorbar"))
+    ax = hcb;
+    hcb = [];
+  else
+    ax = [];
+  endif
+  loc = "";
+  args = {};
+  deleting = false;
+
+  i = 1;
+  while (i <= nargin)
+    arg = varargin{i++};
+    if (ischar (arg))
+      switch (tolower (arg))
+        case "peer"
+          if (i > nargin)
+            error ('colorbar: missing axes handle after "peer"');
+          else
+            ax = varargin{i++};
+            if (! isscalar (ax) && ! isaxes (ax))
+              error ('colorbar: expecting an axes handle following "peer"');
+            endif
+          endif
+        case {"north", "south", "east", "west",
+              "northoutside", "southoutside", "eastoutside", "westoutside"}
+          loc = tolower (arg);
+        case "location"
+          if (i > nargin)
+            error ('colorbar: missing value after "location"');
+          else
+            loc = tolower (varargin{i++});
+          endif
+        case {"delete", "hide", "off", "none"}
+          deleting = true;
+        otherwise
+          args{end+1} = arg;
+      endswitch
+    else
+      args{end+1} = arg;
+    endif
+  endwhile
+
+  ## Handle changes to existing colorbar
+  if (! isempty (hcb))
+    if (deleting)
+      delete (hcb);
+      if (nargout > 0)
+        h = hcb;
+      endif
+      return;
+    else
+      ## FIXME: No listener on location property so have to re-create
+      ##        colorbar whenever an option changes.
+      ##        re-instate this code if listener is developed.
+      # if (! isempty (loc))
+      #   set (hcb, "location", loc);
+      # endif
+      # if (! isempty (args))
+      #   set (hcb, args{:});
+      # endif
+      ax = get (get (hcb, "parent"), "currrentaxes");      
+    endif
+  endif
+    
+  if (isempty (loc))
+    loc = "eastoutside";
+  endif
+  if (isempty (ax))
+    ax = gca ();
+  endif
+
+  showhiddenhandles = get (0, "showhiddenhandles");
+  unwind_protect
+    set (0, "showhiddenhandles", "on");
+    cax = findobj (get (ax, "parent"), "tag", "colorbar", "type", "axes", "axes", ax);
+    if (! isempty (cax))
+      delete (cax);
+    endif
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", showhiddenhandles);
+  end_unwind_protect
+
+  if (! deleting)
+    ## FIXME: Matlab does not require the "position" property to be active.
+    ##        Is there a way to determine the plotbox position for the
+    ##        gnuplot graphics toolkit with the outerposition is active?
+    set (ax, "activepositionproperty", "position");
+    obj = get (ax);
+    obj.__cbar_hax__ = ax;
+    position = obj.position;
+    ## FIXME: Should this be ancestor to accommodate hggroups?
+    hpar = get (ax, "parent");  
+    clen = rows (get (hpar, "colormap"));
+    cext = get (ax, "clim");
+    cdiff = (cext(2) - cext(1)) / clen / 2;
+    cmin = cext(1) + cdiff;
+    cmax = cext(2) - cdiff;
+
+    [pos, cpos, vertical, mirror] =  ...
+        __position_colorbox__ (loc, obj, ancestor (ax, "figure"));
+    set (ax, "position", pos);
+
+    cax = __go_axes__ (hpar, "tag", "colorbar",
+                             "handlevisibility", "on",
+                             "activepositionproperty", "position",
+                             "position", cpos);
+    addproperty ("location", cax, "radio",
+                 "eastoutside|east|westoutside|west|northoutside|north|southoutside|south",
+                 loc);
+    addproperty ("axes", cax, "handle", ax);
+
+    if (vertical)
+      hi = image (cax, [0,1], [cmin, cmax], [1 : clen]');
+      if (mirror)
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "ylim", cext, "ylimmode", "manual",
+                  "yaxislocation", "right", args{:});
+      else
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "ylim", cext, "ylimmode", "manual",
+                  "yaxislocation", "left", args{:});
+      endif
+    else
+      hi = image (cax, [cmin, cmax], [0,1], [1 : clen]);
+      if (mirror)
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xlim", cext, "xlimmode", "manual",
+                  "xaxislocation", "top", args{:});
+      else
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xlim", cext, "xlimmode", "manual",
+                  "xaxislocation", "bottom", args{:});
+      endif
+    endif
+
+    ## Dummy object placed in axis to delete colorbar when axis is deleted.
+    ctext = text (0, 0, "", "tag", "colorbar",
+                  "visible", "off", "handlevisibility", "off",
+                  "xliminclude", "off", "yliminclude", "off",
+                  "zliminclude", "off",
+                  "deletefcn", {@deletecolorbar, cax, obj});
+
+    set (cax, "deletefcn", {@resetaxis, ax, obj});
+
+    addlistener (hpar, "colormap", {@update_colorbar_cmap, hi, vertical, clen});
+    addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical});
+    addlistener (ax, "dataaspectratio", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "dataaspectratiomode", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "plotboxaspectratio", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "plotboxaspectratiomode", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "position", {@update_colorbar_axis, cax, obj});
+
+  endif
+
+  if (nargout > 0)
+    h = cax;
+  endif
+
+endfunction
+
+function deletecolorbar (h, d, hc, orig_props)
+  ## Don't delete the colorbar and reset the axis size if the
+  ## parent figure is being deleted.
+  if (isaxes (hc)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
+    if (strcmp (get (hc, "beingdeleted"), "off"))
+      delete (hc);
+    endif
+    if (!isempty (ancestor (h, "axes"))
+        && strcmp (get (ancestor (h, "axes"), "beingdeleted"), "off"))
+      ax = ancestor (h, "axes");
+      units = get (ax, "units");
+      set (ax, "units", orig_props.units);
+      set (ancestor (h, "axes"), "position", orig_props.position,
+                            "outerposition", orig_props.outerposition,
+                   "activepositionproperty", orig_props.activepositionproperty);
+      set (ax, "units", units);
+    endif
+  endif
+endfunction
+
+function resetaxis (cax, d, ax, orig_props)
+  if (isaxes (ax))
+    ## FIXME: Probably don't want to delete everyone's listeners on colormap.
+    dellistener (get (ax, "parent"), "colormap");
+    dellistener (ax, "clim");
+    dellistener (ax, "dataaspectratio");
+    dellistener (ax, "dataaspectratiomode");
+    dellistener (ax, "plotboxaspectratio");
+    dellistener (ax, "plotboxaspectratiomode");
+    dellistener (ax, "position");
+
+    units = get (ax, "units");
+    set (ax, "units", orig_props.units);
+    set (ax, "position", orig_props.position,
+             "outerposition", orig_props.outerposition,
+             "activepositionproperty", orig_props.activepositionproperty);
+    set (ax, "units", units);
+  endif
+endfunction
+
+function update_colorbar_clim (hax, d, hi, vert)
+  if (isaxes (hax)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
+    clen = rows (get (get (hax, "parent"), "colormap"));
+    cext = get (hax, "clim");
+    cdiff = (cext(2) - cext(1)) / clen / 2;
+    cmin = cext(1) + cdiff;
+    cmax = cext(2) - cdiff;
+
+    hiax = get (hi, "parent");
+    if (vert)
+      set (hi, "ydata", [cmin, cmax]);
+      set (hiax, "ylim", cext);
+    else
+      set (hi, "xdata", [cmin, cmax]);
+      set (hiax, "xlim", cext);
+    endif
+
+    ## FIXME: Setting xlim or ylim from within a listener callback
+    ##        causes the axis to change size rather than change limits.
+    ##        Workaround it by jiggling the position property which forces
+    ##        a redraw of the axis object.
+    ##
+    ## Debug Example:
+    ## Uncomment the line below.
+    ##   keyboard;
+    ## Now run the the following code.
+    ##   clf; colorbar (); contour (peaks ())
+    ## Once the keyboard command has been hit in the debugger try
+    ##   set (hiax, "ylim", [0 0.5]) 
+    pos = get (hiax, "position");
+    pos(1) += eps;
+    set (hiax, "position", pos);
+    pos(1) -= eps;
+    set (hiax, "position", pos);
+  endif
+endfunction
+
+function update_colorbar_cmap (hf, d, hi, vert, init_sz)
+  persistent sz = init_sz;
+
+  if (ishandle (hf) && strcmp (get (hf, "type"), "figure")
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
+    clen = rows (get (hf, "colormap"));
+    if (clen != sz)
+      if (vert)
+        set (hi, "cdata", [1:clen]');
+      else
+        set (hi, "cdata", [1:clen]);
+      endif
+      sz = clen;
+      ## Also update limits on axis or there will be white gaps
+      update_colorbar_clim (get (hi, "parent"), d, hi, vert);
+    endif
+  endif
+endfunction
+
+function update_colorbar_axis (h, d, cax, orig_props)
+  if (isaxes (cax)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
+    loc = get (cax, "location");
+    obj = get (h);
+    obj.__cbar_hax__ = h;
+    obj.position = orig_props.position;
+    obj.outerposition = orig_props.outerposition;
+    [pos, cpos, vertical, mirror] =  ...
+        __position_colorbox__ (loc, obj, ancestor (h, "figure"));
+
+    if (vertical)
+      if (mirror)
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "yaxislocation", "right", "position", cpos);
+      else
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "yaxislocation", "left", "position", cpos);
+      endif
+    else
+      if (mirror)
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xaxislocation", "top", "position", cpos);
+      else
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xaxislocation", "bottom", "position", cpos);
+      endif
+    endif
+
+  endif
+endfunction
+
+function [pos, cpos, vertical, mirr] = __position_colorbox__ (cbox, obj, cf)
+
+  ## This will always represent the position prior to adding the colorbar.
+  pos = obj.position;
+  sz = pos(3:4);
+
+  if (strcmp (obj.plotboxaspectratiomode, "manual")
+      || strcmp (obj.dataaspectratiomode, "manual"))
+    if (isempty (strfind (cbox, "outside")))
+      scale = 1.0;
+    else
+      scale = 0.8;
+    endif
+    if (isempty (strfind (cbox, "east")) && isempty (strfind (cbox, "west")))
+      scale = [1, scale];
+    else
+      scale = [scale, 1];
+    endif
+    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot")
+        && strcmp (obj.activepositionproperty, "outerposition"))
+      obj.outerposition = obj.outerposition .* [1, 1, scale];
+      off = 0.5 * (obj.outerposition (3:4) - __actual_axis_position__ (obj)(3:4));
+    else
+      obj.position = obj.position .* [1, 1, scale];
+      off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4));
+    endif
+  else
+    off = 0.0;
+  endif
+
+  switch (cbox)
+    case "northoutside"
+      origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off;
+      sz = sz .* [1.0, 0.06];
+      pos(4) = 0.8 * pos(4);
+      mirr = true;
+      vertical = false;
+    case "north"
+      origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off;
+      sz = sz .* [1.0, 0.06] * 0.9;
+      mirr = false;
+      vertical = false;
+    case "southoutside"
+      origin = pos(1:2) + off;
+      sz = sz .* [1.0, 0.06];
+      pos(2) = pos(2) + pos(4) * 0.2;
+      pos(4) = 0.8 * pos(4);
+      mirr = false;
+      vertical = false;
+    case "south"
+      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
+      sz = sz .* [1.0, 0.06] * 0.9;
+      mirr = true;
+      vertical = false;
+    case "eastoutside"
+      origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off;
+      sz = sz .* [0.06, 1.0];
+      pos(3) = 0.8 * pos(3);
+      mirr = true;
+      vertical = true;
+    case "east"
+      origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off;
+      sz = sz .* [0.06, 1.0] * 0.9;
+      mirr = false;
+      vertical = true;
+    case "westoutside"
+      origin = pos(1:2) + off;
+      sz = sz .* [0.06, 1.0];
+      pos(1) = pos(1) + pos(3) * 0.2;
+      pos(3) = 0.8 * pos(3);
+      mirr = false;
+      vertical = true;
+    case "west"
+      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
+      sz = sz .* [0.06, 1.0] .* 0.9;
+      mirr = true;
+      vertical = true;
+  endswitch
+
+  cpos = [origin, sz];
+
+  if (strcmp (obj.plotboxaspectratiomode, "manual")
+      || strcmp (obj.dataaspectratiomode, "manual"))
+    obj.position = pos;
+    actual_pos = __actual_axis_position__ (obj);
+    if (strfind (cbox, "outside"))
+      scale = 1.0;
+    else
+      scale = 0.9;
+    endif
+    if (sz(1) > sz(2))
+      ## Ensure north or south colorbars are the proper length
+      dx = (1-scale)*actual_pos(3);
+      cpos(1) = actual_pos(1) + dx/2;
+      cpos(3) = actual_pos(3) - dx;
+    else
+      ## Ensure east or west colorbars are the proper height
+      dy = (1-scale)*actual_pos(4);
+      cpos(2) = actual_pos(2) + dy/2;
+      cpos(4) = actual_pos(4) - dy;
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ();
+%! title ('colorbar() example');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ('peer', gca, 'northoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! contour (peaks ());
+%! colorbar ('west');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! subplot (2,2,1);
+%!  contour (peaks ());
+%!  colorbar ('east');
+%! subplot (2,2,2);
+%!  contour (peaks ());
+%!  colorbar ('west');
+%! subplot (2,2,3);
+%!  contour (peaks ());
+%!  colorbar ('north');
+%! subplot (2,2,4);
+%!  contour (peaks ());
+%!  colorbar ('south');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,2,1);
+%!  imagesc (x);
+%!  colorbar ();
+%! subplot (2,2,2);
+%!  imagesc (x);
+%!  colorbar ('westoutside');
+%! subplot (2,2,3);
+%!  imagesc (x);
+%!  colorbar ('northoutside');
+%! subplot (2,2,4);
+%!  imagesc (x);
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ();
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('northoutside');
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ();
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('northoutside');
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  colorbar ();
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  colorbar ('northoutside');
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  colorbar ();
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  colorbar ('northoutside');
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  contour (x);
+%!  axis square;
+%!  colorbar ('east');
+%!  xlim ([1, 64]);
+%!  ylim ([1, 64]);
+%! subplot (1,2,2);
+%!  contour (x);
+%!  colorbar ('west');
+%!  xlim ([1, 64]);
+%!  ylim ([1, 64]);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! contour (x);
+%! xlim ([1, 64]);
+%! ylim ([1, 64]);
+%! colorbar ();
+%! colorbar off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! contour (x);
+%! xlim ([1, 64]);
+%! ylim ([1, 64]);
+%! colorbar ();
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! imagesc (1 ./ hilb (99));
+%! h = colorbar ();
+%! set (h, 'yscale', 'log');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! imagesc (log10 (1 ./ hilb (99)));
+%! h = colorbar ();
+%! ytick = get (h, 'ytick');
+%! set (h, 'yticklabel', sprintf ('10^{%g}|', ytick));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
+%! imagesc (1 ./ hilb (n));
+%! axis equal;
+%! colorbar ();
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
+%! imagesc (x, y, 1 ./ hilb (n));
+%! axis equal;
+%! colorbar ();
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
+%! imagesc (y, x, 1 ./ hilb (n));
+%! axis equal;
+%! colorbar ();
+
+## This requires that the axes position be properly determined for 'axis equal'
+%!demo
+%! clf;
+%! colormap ('default');
+%! axes;
+%! colorbar ();
+%! hold on;
+%! contour (peaks ());
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('east');
+%! axis square;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('eastoutside');
+%! axis square;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks (20));
+%! shading interp;
+%! axis ('tight', 'square');
+%! colorbar ();
+#%! axes ('color','none','box','on','activepositionproperty','position');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('east');
+%! axis equal;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('eastoutside');
+%! axis equal;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/comet.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,104 @@
+## Copyright (C) 2008-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} comet (@var{y})
+## @deftypefnx {Function File} {} comet (@var{x}, @var{y})
+## @deftypefnx {Function File} {} comet (@var{x}, @var{y}, @var{p})
+## @deftypefnx {Function File} {} comet (@var{hax}, @dots{})
+## Produce a simple comet style animation along the trajectory provided by
+## the input coordinate vectors (@var{x}, @var{y}).  If @var{x} is not
+## specified it defaults to the indices of @var{y}.
+##
+## The speed of the comet may be controlled by @var{p}, which represents the
+## time each point is displayed before moving to the next one.  The default for
+## @var{p} is 0.1 seconds.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{comet3}
+## @end deftypefn
+
+## Author: Ben Abbott bpabbott@mac.com
+## Created: 2008-09-21
+
+function comet (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet", varargin{:});
+
+  if (nargin == 0)
+    print_usage ();
+  elseif (nargin == 1)
+    y = varargin{1};
+    x = 1:numel (y);
+    p = 0.1;
+  elseif (nargin == 2)
+    x = varargin{1};
+    y = varargin{2};
+    p = 0.1;
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    p = varargin{3};
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    limits = [min(x), max(x), min(y), max(y)];
+    num = numel (y);
+    dn = round (num/10);
+
+    hl = plot (x(1), y(1), "color", "r", "marker", "none",
+               x(1), y(1), "color", "g", "marker", "none",
+               x(1), y(1), "color", "b", "marker", "o");
+    axis (limits);  # set manual limits to speed up plotting
+
+    for n = 2:(num+dn);
+      m = n - dn;
+      m = max ([m, 1]);
+      k = min ([n, num]);
+      set (hl(1), "xdata", x(1:m), "ydata", y(1:m));
+      set (hl(2), "xdata", x(m:k), "ydata", y(m:k));
+      set (hl(3), "xdata", x(k),   "ydata", y(k));
+      drawnow ();
+      pause (p);
+    endfor
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+
+%!demo
+%! clf;
+%! title ('comet() animation');
+%! hold on;
+%! t = 0:.1:2*pi;
+%! x = cos (2*t) .* (cos (t).^2);
+%! y = sin (2*t) .* (sin (t).^2);
+%! comet (x, y, 0.05);
+%! hold off;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/comet3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,103 @@
+## Copyright (C) 2010-2012 Ben Abbott and John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} comet3 (@var{z})
+## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z}, @var{p})
+## @deftypefnx {Function File} {} comet3 (@var{hax}, @dots{})
+## Produce a simple comet style animation along the trajectory provided by
+## the input coordinate vectors (@var{x}, @var{y}, @var{z}).  If only @var{z}
+## is specified then @var{x}, @var{y} default to the indices of @var{z}.
+##
+## The speed of the comet may be controlled by @var{p}, which represents the
+## time each point is displayed before moving to the next one.  The default for
+## @var{p} is 0.1 seconds.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{comet}
+## @end deftypefn
+
+## Author: jwe
+## Created: 2010-12-17
+
+function comet3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet3", varargin{:});
+
+  if (nargin == 0 || nargin == 2 || nargin > 4)
+    print_usage ();
+  elseif (nargin == 1)
+    z = varargin{1};
+    x = y = 1:numel (z);
+    p = 0.1;
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    p = 0.1;
+  elseif (nargin == 4)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    p = varargin{4};
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    limits = [min(x), max(x), min(y), max(y), min(z), max(z)];
+    num = numel (y);
+    dn = round (num/10);
+
+    hl = plot3 (x(1), y(1), z(1), "color", "r", "marker", "none",
+                x(1), y(1), z(1), "color", "g", "marker", "none",
+                x(1), y(1), z(1), "color", "b", "marker", "o");
+    axis (limits);  # set manual limits to speed up plotting
+
+    for n = 2:(num+dn);
+      m = n - dn;
+      m = max ([m, 1]);
+      k = min ([n, num]);
+      set (hl(1), "xdata", x(1:m), "ydata", y(1:m), "zdata", z(1:m));
+      set (hl(2), "xdata", x(m:k), "ydata", y(m:k), "zdata", z(m:k));
+      set (hl(3), "xdata", x(k)  , "ydata", y(k)  , "zdata", z(k));
+      drawnow ();
+      pause (p);
+    endfor
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+
+%!demo
+%! clf;
+%! title ('comet3() animation');
+%! view (3); hold on;
+%! t = 0:pi/20:5*pi;
+%! comet3 (cos (t), sin (t), t, 0.05);
+%! hold off;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/compass.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,137 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} compass (@var{u}, @var{v})
+## @deftypefnx {Function File} {} compass (@var{z})
+## @deftypefnx {Function File} {} compass (@dots{}, @var{style})
+## @deftypefnx {Function File} {} compass (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} compass (@dots{})
+##
+## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
+## from the origin of a polar plot.
+##
+## The arrow representing each vector has one end at the origin and the tip at
+## [@var{u}(i), @var{v}(i)].  If a single complex argument @var{z} is given,
+## then @code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## line objects representing the drawn vectors.
+##
+## @example
+## @group
+## a = toeplitz ([1;randn(9,1)], [1,randn(1,9)]);
+## compass (eig (a));
+## @end group
+## @end example
+##
+## @seealso{polar, feather, quiver, rose, plot}
+## @end deftypefn
+
+function h = compass (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("compass", varargin{:});
+
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
+    z = varargin{1}(:).';
+    u = real (z);
+    v = imag (z);
+    have_line_spec = (nargin == 2);
+  elseif (nargin >= 2 && isnumeric (varargin{2}))
+    u = varargin{1}(:).';
+    v = varargin{2}(:).';
+    have_line_spec = (nargin == 3);
+  else
+    print_usage ();
+  endif
+
+  arrowsize = 0.20;
+  line_spec = "-b";
+
+  if (have_line_spec)
+    arg = varargin{end};
+    if (ischar (arg) || iscellstr (arg))
+      [~, valid] = __pltopt__ ("compass", arg, false);
+      if (valid)
+        line_spec = arg;
+      else
+        error ("compass: invalid linestyle STYLE");
+      endif
+    else
+      error ("compass: invalid linestyle STYLE");
+    endif
+  endif
+
+  ## Matlab draws compass plots with the arrow head as one continous line,
+  ## and each arrow separately.  This is completely different from quiver
+  ## and quite ugly.
+  n = length (u);
+  xend = u;
+  xtmp = u .* (1 - arrowsize);
+  yend = v;
+  ytmp = v .* (1 - arrowsize);
+  x = [zeros(1, n); xend; xtmp - v * arrowsize / 3; xend; ...
+       xtmp + v * arrowsize / 3];
+  y = [zeros(1, n); yend; ytmp + u * arrowsize / 3; yend; ...
+       ytmp - u * arrowsize / 3];
+  [r, p] = cart2pol (x, y);
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    hlist = polar (r, p, line_spec);
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hlist;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! randn_9x1_data = [-2.555884; 0.394974; -0.191871; -1.147024; 1.355425; -0.437335; -0.014370; -0.941312; 1.240300];
+%! randn_1x9_data = [1.42934, -1.10821, -1.70404, 0.63357, -0.68337, -1.19771, -0.96502, -1.12810, 0.22457];
+%! a = toeplitz ([1;randn_9x1_data], [1,randn_1x9_data]);
+%! compass (eig (a));
+
+%% Test input validation
+%!error compass ()
+%!error compass (1,2,3,4)
+%!error compass (1, "-r", 2)
+%!error <invalid linestyle STYLE> compass (1, "abc")
+%!error <invalid linestyle STYLE> compass (1, {1})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contour.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,140 @@
+## Copyright (C) 1993-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} contour (@var{z})
+## @deftypefnx {Function File} {} contour (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contour (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{})
+## Create a 2-D contour plot.
+##
+## Plot level curves (contour lines) of the matrix @var{z}, using the
+## contour matrix @var{c} computed by @code{contourc} from the same
+## arguments; see the latter for their interpretation.
+##
+## The appearance of contour lines can be defined with a line style @var{style}
+## in the same manner as @code{plot}.  Only line style and color are used;
+## Any markers defined by @var{style} are ignored.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional output @var{c} are the contour levels in @code{contourc} format.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## comprising the contour lines.
+##
+## Example:
+##
+## @example
+## @group
+## x = 0:2;
+## y = x;
+## z = x' * y;
+## contour (x, y, z, 2:3)
+## @end group
+## @end example
+##
+## @seealso{ezcontour, contourc, contourf, contour3, clabel, meshc, surfc, caxis, colormap, plot}
+##
+## @end deftypefn
+
+## Author: Shai Ayal <shaiay@users.sourceforge.net>
+
+function [c, h] = contour (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    [ctmp, htmp] = __contour__ (hax, "none", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    c = ctmp;
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks ();
+%! contour (x, y, z);
+%! title ({'contour() plot (isolines of constant Z)'; 'Z = peaks()'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
+%! [X, Y] = pol2cart (theta, r);
+%! Z = sin (2*theta) .* (1-r);
+%! contour (X, Y, abs (Z), 10);
+%! title ({'contour() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! z = peaks ();
+%! contour (z, [0 0]);
+%! title ({'contour() plot with single isoline at Z == 0'; 'Z = peaks()'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! clf (hf);
+%! unwind_protect
+%!   [x, y, z] = peaks ();
+%!   [c, h] = contour (x, y, z);
+%!   levellist = -6:6;
+%!   set (h, "levellist", levellist);
+%!   assert (get (h, "levellist"), levellist)
+%!   assert (get (h, "levellistmode"), "manual")
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! clf (hf);
+%! unwind_protect
+%!   [x, y, z] = peaks ();
+%!   [c, h] = contour (x, y, z);
+%!   levelstep = 3;
+%!   set (h, "levelstep", levelstep);
+%!   assert (get (h, "levelstep"), levelstep)
+%!   assert (get (h, "levelstepmode"), "manual")
+%!   assert (get (h, "levellist"), -6:levelstep:6)
+%!   assert (get (h, "levellistmode"), "auto")
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contour3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,106 @@
+## Copyright (C) 2007-2012 David BAteman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} contour3 (@var{z})
+## @deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contour3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
+## Create a 3-D contour plot.
+##
+## @code{contour3} plots level curves (contour lines) of the matrix @var{z}
+## at a Z level corresponding to each contour.  This is in contrast to
+## @code{contour} which plots all of the contour lines at the same Z level
+## and produces a 2-D plot.
+##
+## The level curves are taken from the contour matrix @var{c} computed by
+## @code{contourc} for the same arguments; see the latter for their
+## interpretation.
+##
+## The appearance of contour lines can be defined with a line style @var{style}
+## in the same manner as @code{plot}.  Only line style and color are used;
+## Any markers defined by @var{style} are ignored.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional output @var{c} are the contour levels in @code{contourc} format.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## comprising the contour lines.
+##
+## Example:
+##
+## @example
+## @group
+## contour3 (peaks (19));
+## colormap cool;
+## hold on;
+## surf (peaks (19), "facecolor", "none", "edgecolor", "black");
+## @end group
+## @end example
+##
+## @seealso{contour, contourc, contourf, clabel, meshc, surfc, caxis, colormap, plot}
+## @end deftypefn
+
+function [c, h] = contour3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    [ctmp, htmp] = __contour__ (hax, "auto", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (! ishold ())
+    set (hax, "view", [-37.5, 30], "box", "off",
+              "xgrid", "on", "ygrid", "on", "zgrid", "on");
+  endif
+
+  if (nargout > 0)
+    c = ctmp;
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap (cool (64));
+%! surf (peaks (19), 'facecolor', 'none', 'edgecolor', [0.85 0.85 0.85]);
+%! hold on;
+%! contour3 (peaks (19));
+%! hold off;
+%! axis tight;
+%! zlim auto;
+%! view (315, 17);
+%! title ({'contour3 of peaks() function', 'gray surf() shows peaks function'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contourc.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,171 @@
+## Copyright (C) 2003-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z})
+## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z}, @var{vn})
+## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z}, @var{vn})
+## Compute contour lines (isolines of constant Z value).
+##
+## The matrix @var{z} contains height values above the rectangular grid
+## determined by @var{x} and @var{y}.  If only a single input @var{z} is
+## provided then @var{x} is taken to be @code{1:rows (@var{z})} and @var{y} is
+## taken to be @code{1:columns (@var{z})}.
+##
+## The optional input @var{vn} is either a scalar denoting the number of
+## contour lines to compute or a vector containing the Z values where lines
+## will be computed.  When @var{vn} is a vector the number of contour lines
+## is @code{numel (@var{vn})}.  However, to compute a single contour line
+## at a given value use @code{@var{vn} = [val, val]}.  If @var{vn} is omitted
+## it defaults to 10.
+##
+## The return value @var{c} is a 2x@var{n} matrix containing the
+## contour lines in the following format
+##
+## @example
+## @group
+## @var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ...
+##      len1, y1, y2, @dots{}, lenn, y1, y2, @dots{}]
+## @end group
+## @end example
+##
+## @noindent
+## in which contour line @var{n} has a level (height) of @var{levn} and
+## length of @var{lenn}.
+##
+## The optional return value @var{lev} is a vector with the Z values of
+## of the contour levels.
+##
+## Example:
+##
+## @example
+## @group
+## x = 0:2;
+## y = x;
+## z = x' * y;
+## contourc (x, y, z, 2:3)
+##    @result{}   2.0000   2.0000   1.0000   3.0000   1.5000   2.0000
+##         2.0000   1.0000   2.0000   2.0000   2.0000   1.5000
+## @end group
+## @end example
+## @seealso{contour, contourf, contour3, clabel}
+## @end deftypefn
+
+## Author: Shai Ayal <shaiay@users.sourceforge.net>
+
+function [c, lev] = contourc (varargin)
+
+  if (nargin < 1 || nargin > 4)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    z = varargin{1};
+    x = 1:columns (z);
+    y = 1:rows (z);
+    vn = 10;
+  elseif (nargin == 2)
+    z = varargin{1};
+    x = 1:columns (z);
+    y = 1:rows (z);
+    vn = varargin{2};
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    vn = 10;
+  elseif (nargin == 4)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    vn = varargin{4};
+  endif
+
+  if (! ismatrix (z) || ! ismatrix (x) || ! ismatrix (y))
+    error ("contourc: X, Y, and Z must be matrices");
+  endif
+
+  if (isscalar (vn))
+    vv = linspace (min (z(:)), max (z(:)), vn+2)(2:end-1);
+  else
+    vv = unique (sort (vn));
+  endif
+
+  if (isvector (x) && isvector (y))
+    cdat = __contourc__ (x(:)', y(:)', z, vv);
+  elseif (! any (bsxfun (@minus, x, x(1,:))(:))
+          && ! any (bsxfun (@minus, y, y(:,1))(:)))
+    ## x,y are uniform grid (such as from meshgrid)
+    cdat = __contourc__ (x(1,:), y(:,1)', z, vv);
+  else
+    ## Data is sampled over non-uniform mesh.
+    ## Algorithm calculates contours for uniform grid
+    ## and then interpolates values back to the non-uniform mesh.
+
+    ## Uniform grid for __contourc__.
+    [nr, nc] = size (z);
+    ii = 1:nc;
+    jj = 1:nr;
+
+    cdat = __contourc__ (ii, jj, z, vv);
+
+    ## Map the contour lines from index space (i,j)
+    ## back to the original grid (x,y)
+    i = 1;
+
+    while (i < columns (cdat))
+      clen = cdat(2, i);
+      idx = i + (1:clen);
+
+      ci = cdat(1, idx);
+      cj = cdat(2, idx);
+
+      ## Due to rounding errors, some elements of ci and cj
+      ## can fall out of the range of ii and jj and
+      ## interp2 would return NA for those values.
+      ## The permitted range is enforced here:
+
+      ci = max (ci, 1); ci = min (ci, nc);
+      cj = max (cj, 1); cj = min (cj, nr);
+
+      cdat(1, idx) = interp2 (ii, jj, x, ci, cj);
+      cdat(2, idx) = interp2 (ii, jj, y, ci, cj);
+
+      i += clen + 1;
+    endwhile
+  endif
+
+  if (nargout > 0)
+    c = cdat;
+    lev = vv;
+  endif
+
+endfunction
+
+
+%!test
+%! x = 0:2;
+%! y = x;
+%! z = x' * y;
+%! c_exp = [2, 1, 1, 2, 2, 3, 1.5, 2; 4, 2, 2, 1, 1, 2, 2, 1.5];
+%! lev_exp = [2 3];
+%! [c_obs, lev_obs] = contourc (x, y, z, 2:3);
+%! assert (c_obs, c_exp, eps);
+%! assert (lev_obs, lev_exp, eps);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contourf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,114 @@
+## Copyright (C) 2007-2012 Kai Habel
+## Copyright (C) 2003 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} contourf (@var{z})
+## @deftypefnx {Function File} {} contourf (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contourf (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contourf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contourf (@dots{})
+## Create a 2-D contour plot with filled intervals.
+##
+## Plot level curves (contour lines) of the matrix @var{z} and fill the region
+## between lines with colors from the current colormap.
+##
+## The level curves are taken from the contour matrix @var{c} computed by
+## @code{contourc} for the same arguments; see the latter for their
+## interpretation.
+##
+## The appearance of contour lines can be defined with a line style @var{style}
+## in the same manner as @code{plot}.  Only line style and color are used;
+## Any markers defined by @var{style} are ignored.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional output @var{c} are the contour levels in @code{contourc} format.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## comprising the contour lines.
+##
+## The following example plots filled contours of the @code{peaks} function.
+##
+## @example
+## @group
+## [x, y, z] = peaks (50);
+## contourf (x, y, z, -7:9)
+## @end group
+## @end example
+## @seealso{ezcontourf, contour, contourc, contour3, clabel, meshc, surfc, caxis, colormap, plot}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+## Author: Shai Ayal <shaiay@users.sourceforge.net>
+
+function [c, h] = contourf (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    [ctmp, htmp] = __contour__ (hax, "none", "fill", "on",
+                                     "linecolor", "black", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    c = ctmp;
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (50);
+%! contourf (x, y, z, -7:9);
+%! title ({'contourf() plot (filled contour lines)'; 'Z = peaks()'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
+%! [X, Y] = pol2cart (theta, r);
+%! Z = sin (2*theta) .* (1-r);
+%! contourf (X, Y, abs (Z), 10);
+%! title ({'contourf() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = linspace (-2, 2);
+%! [x, y] = meshgrid (x);
+%! z = sqrt (x.^2 + y.^2) ./ (x.^2 + y.^2 + 1);
+%! contourf (x, y, z, [0.4, 0.4]);
+%! title ('Hole should be filled with the background color');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/cylinder.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,109 @@
+## Copyright (C) 2007-2012 Michael Goffioul and Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} cylinder
+## @deftypefnx {Function File} {} cylinder (@var{r})
+## @deftypefnx {Function File} {} cylinder (@var{r}, @var{n})
+## @deftypefnx {Function File} {} cylinder (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} cylinder (@dots{})
+## Plot a 3-D unit cylinder.
+##
+## The optional input @var{r} is a vector specifying the radius along the
+## unit z-axis.  The default is [1 1] indicating radius 1 at @code{Z == 0}
+## and at @code{Z == 1}.
+##
+## The optional input @var{n} determines the number of faces around the
+## the circumference of the cylinder.  The default value is 20.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## If outputs are requested @code{cylinder} returns three matrices in
+## @code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
+## generates a unit cylinder.
+##
+## Example:
+##
+## @example
+## @group
+## [x, y, z] = cylinder (10:-1:0, 50);
+## surf (x, y, z);
+## title ("a cone");
+## @end group
+## @end example
+## @seealso{ellipsoid, rectangle, sphere}
+## @end deftypefn
+
+function [xx, yy, zz] = cylinder (varargin)
+
+  [hax, args, nargs] = __plt_get_axis_arg__ ("cylinder", varargin{:});
+
+  if (nargs == 0)
+    r = [1, 1];
+    n = 20;
+  elseif (nargs == 1)
+    r = args{1};
+    n = 20;
+  elseif (nargs == 2)
+    r = args{1};
+    n = args{2};
+  else
+    print_usage ();
+  endif
+
+  if (length (r) < 2)
+    error ("cylinder: length (R) must be larger than 2");
+  endif
+
+  phi = linspace (0, 2*pi, n+1);
+  idx = 1:length (r);
+  [phi, idx] = meshgrid (phi, idx);
+  z = (idx - 1) / (length (r) - 1);
+  r = r(idx);
+  [x, y] = pol2cart (phi, r);
+
+  if (nargout > 0)
+    xx = x;
+    yy = y;
+    zz = z;
+  else
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      surf (x, y, z);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = cylinder (10:-1:0, 50);
+%! surf (x, y, z);
+%! title ('cylinder() with linearly shrinking radius produces a cone');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ellipsoid.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,99 @@
+## Copyright (C) 2007-2012 Sylvain Pelissier
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ellipsoid (@var{xc}, @var{yc}, @var{zc}, @var{xr}, @var{yr}, @var{zr}, @var{n})
+## @deftypefnx {Function File} {} ellipsoid (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ellipsoid (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} ellipsoid (@dots{})
+## Plot a 3-D ellipsoid.
+##
+## The inputs @var{xc}, @var{yc}, @var{zc} specify the center of the ellipsoid.
+## The inputs @var{xr}, @var{yr}, @var{zr} specify the semi-major axis lengths.
+##
+## The optional input @var{n} determines the number of faces around the
+## the circumference of the cylinder.  The default value is 20.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## If outputs are requested @code{ellipsoid} returns three matrices in
+## @code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
+## generates the ellipsoid.
+## @seealso{cylinder, rectangle, sphere}
+## @end deftypefn
+
+## Author: Sylvain Pelissier <sylvain.pelissier@gmail.com>
+
+function [xx, yy, zz] = ellipsoid (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ellipsoid", varargin{:});
+
+  if (nargin != 6 && nargin != 7)
+    print_usage ();
+  endif
+
+  xc = varargin{1};
+  yc = varargin{2};
+  zc = varargin{3};
+  xr = varargin{4};
+  yr = varargin{5};
+  zr = varargin{6};
+
+  if (nargin == 6)
+    n = 20;
+  else
+    n = varargin{7};
+  endif
+
+  theta = linspace (0, 2 * pi, n + 1);
+  phi = linspace (-pi / 2, pi / 2, n + 1);
+  [theta, phi] = meshgrid (theta, phi);
+
+  x = xr .* cos (phi) .* cos (theta) + xc;
+  y = yr .* cos (phi) .* sin (theta) + yc;
+  z = zr .* sin (phi) + zc;
+
+  if (nargout > 0)
+    xx = x;
+    yy = y;
+    zz = z;
+  else
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+    
+      surf (x, y, z);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ellipsoid (0, 0, 1, 2, 3, 4, 20);
+%! title ('ellipsoid()');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/errorbar.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,220 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} errorbar (@var{args})
+## @deftypefnx {Function File} {} errorbar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} errorbar (@dots{})
+## Create a 2-D with errorbars.
+##
+## Many different combinations of arguments are possible.  The simplest
+## form is
+##
+## @example
+## errorbar (@var{y}, @var{ey})
+## @end example
+##
+## @noindent
+## where the first argument is taken as the set of @var{y} coordinates
+## and the second argument @var{ey} is taken as the errors of the
+## @var{y} values.  @var{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
+##
+## @example
+## errorbar (@var{x}, @var{y}, @dots{}, @var{fmt}, @dots{})
+## @end example
+##
+## @noindent
+## where after @var{x} and @var{y} there can be up to four error
+## parameters such as @var{ey}, @var{ex}, @var{ly}, @var{uy}, etc.,
+## depending on the plot type.  Any number of argument sets may appear,
+## as long as they are separated with a format string @var{fmt}.
+##
+## If @var{y} is a matrix, @var{x} and error parameters must also be matrices
+## having same dimensions.  The columns of @var{y} are plotted versus the
+## corresponding columns of @var{x} and errorbars are drawn from
+## the corresponding columns of error parameters.
+##
+## If @var{fmt} is missing, yerrorbars ("~") plot style is assumed.
+##
+## If the @var{fmt} argument is supplied, it is interpreted as in
+## normal plots.  In addition, @var{fmt} may include an errorbar style
+## which must precede the line and marker format.  The following plot
+## styles are supported by errorbar:
+##
+## @table @samp
+## @item ~
+## Set yerrorbars plot style (default).
+##
+## @item >
+## Set xerrorbars plot style.
+##
+## @item ~>
+## Set xyerrorbars plot style.
+##
+## @item #
+## Set boxes plot style.
+##
+## @item #~
+## Set boxerrorbars plot style.
+##
+## @item #~>
+## Set boxxyerrorbars plot style.
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a handle to the hggroup object
+## representing the data plot and errorbars.
+##
+## Examples:
+##
+## @example
+## errorbar (@var{x}, @var{y}, @var{ex}, ">")
+## @end example
+##
+## @noindent
+## produces an xerrorbar plot of @var{y} versus @var{x} with @var{x}
+## errorbars drawn from @var{x}-@var{ex} to @var{x}+@var{ex}.
+##
+## @example
+## @group
+## errorbar (@var{x}, @var{y1}, @var{ey}, "~",
+##           @var{x}, @var{y2}, @var{ly}, @var{uy})
+## @end group
+## @end example
+##
+## @noindent
+## produces yerrorbar plots with @var{y1} and @var{y2} versus @var{x}.
+## Errorbars for @var{y1} are drawn from @var{y1}-@var{ey} to
+## @var{y1}+@var{ey}, errorbars for @var{y2} from @var{y2}-@var{ly} to
+## @var{y2}+@var{uy}.
+##
+## @example
+## @group
+## errorbar (@var{x}, @var{y}, @var{lx}, @var{ux},
+##           @var{ly}, @var{uy}, "~>")
+## @end group
+## @end example
+##
+## @noindent
+## produces an xyerrorbar plot of @var{y} versus @var{x} in which
+## @var{x} errorbars are drawn from @var{x}-@var{lx} to @var{x}+@var{ux}
+## and @var{y} errorbars from @var{y}-@var{ly} to @var{y}+@var{uy}.
+## @seealso{semilogxerr, semilogyerr, loglogerr, plot}
+## @end deftypefn
+
+## Created: 18.7.2000
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = errorbar (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("errorbar", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = __errcomm__ ("errorbar", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! rand_1x11_data1 = [0.82712, 0.50325, 0.35613, 0.77089, 0.20474, 0.69160, 0.30858, 0.88225, 0.35187, 0.14168, 0.54270];
+%! rand_1x11_data2 = [0.506375, 0.330106, 0.017982, 0.859270, 0.140641, 0.327839, 0.275886, 0.162453, 0.807592, 0.318509, 0.921112];
+%! errorbar (0:10, rand_1x11_data1, 0.25*rand_1x11_data2);
+%! title ('errorbar() with Y errorbars');
+
+%!demo
+%! clf;
+%! rand_1x11_data3 = [0.423650, 0.142331, 0.213195, 0.129301, 0.975891, 0.012872, 0.635327, 0.338829, 0.764997, 0.401798, 0.551850];
+%! rand_1x11_data4 = [0.682566, 0.456342, 0.132390, 0.341292, 0.108633, 0.601553, 0.040455, 0.146665, 0.309187, 0.586291, 0.540149];
+%! errorbar (0:10, rand_1x11_data3, rand_1x11_data4, '>');
+%! title ('errorbar() with X errorbars');
+
+%!demo
+%! clf;
+%! x = 0:0.5:2*pi;
+%! err = x/30;
+%! y1 = sin (x);
+%! y2 = cos (x);
+%! errorbar (x, y1, err, '~', x, y2, err, '>');
+%! legend ("Y errbar", "X errbar");
+%! title ('errorbar() with 2 datasets');
+
+
+%!demo
+%! clf;
+%! x = 0:0.5:2*pi;
+%! err = x/30;
+%! y1 = sin (x);
+%! y2 = cos (x);
+%! errorbar (x, y1, err, err, '#r', x, y2, err, err, '#~');
+%! legend ("X errbox", "Y errbox");
+%! title ('errorbar() with error boxes');
+
+%!demo
+%! clf;
+%! x = 0:0.5:2*pi;
+%! err = x/30;
+%! y1 = sin (x);
+%! y2 = cos (x);
+%! errorbar (x, y1, err, err, err, err, '~>', ...
+%!           x, y2, err, err, err, err, '#~>-*');
+%! legend ("X-Y errbars", "X-Y errboxes");
+%! title ('errorbar() with X-Y errorbars and error boxes');
+
+## Invisible figure used for tests
+%!shared hf, hax
+%! hf = figure ("visible", "off");
+%! hax = axes;
+
+%!error errorbar ()
+%!error errorbar (1)
+%!error <data argument 1 must be numeric> errorbar (hax, {1}, 2)
+%!error <data argument 2 must be numeric> errorbar (hax, 1, {2})
+%!error <size of argument 2 does not match others> errorbar (hax, 1, 1:2)
+%!error <size of argument 3 does not match others> errorbar (hax, 1, 2, 3:4)
+%!error <too many arguments to plot> errorbar (1,2,3,4,5,6,7)
+
+%!error <2 column errorplot is only valid for xerr> errorbar (1,2, "~>")
+%!error <6 columns only valid for xyerr and boxxy> errorbar (1,2,3,4,5,6, "~")
+%!error <error plot requires 2, 3, 4, or 6 arguments> errorbar (1,2,3,4,5)
+
+## Close figure used for testing
+%!test
+%! close (hf);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezcontour.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,75 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezcontour (@var{f})
+## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezcontour (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezcontour (@dots{})
+##
+## Plot the contour lines of a function.
+## 
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezcontour (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{contour, ezcontourf, ezplot, ezmeshc, ezsurfc}
+## @end deftypefn
+
+function h = ezcontour (varargin)
+
+  [htmp, needusage] = __ezplot__ ("contour", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezcontour (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezcontourf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,75 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezcontourf (@var{f})
+## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezcontourf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezcontourf (@dots{})
+##
+## Plot the filled contour lines of a function.
+## 
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezcontourf (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{contourf, ezcontour, ezplot, ezmeshc, ezsurfc}
+## @end deftypefn
+
+function h = ezcontourf (varargin)
+
+  [htmp, needusage] = __ezplot__ ("contourf", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezcontourf (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezmesh.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,104 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezmesh (@var{f})
+## @deftypefnx {Function File} {} ezmesh (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezmesh (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezmesh (@dots{})
+##
+## Plot the mesh defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created 
+## surface object.
+##
+## Example 1: 2-argument function
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezmesh (f, [-3, 3]);
+## @end group
+## @end example
+##
+## Example 2: parametrically defined function
+##
+## @example
+## @group
+## fx = @@(s,t) cos (s) .* cos (t);
+## fy = @@(s,t) sin (s) .* cos (t);
+## fz = @@(s,t) sin (t);
+## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
+## @end group
+## @end example
+##
+## @seealso{mesh, ezmeshc, ezplot, ezsurf, ezsurfc, hidden}
+## @end deftypefn
+
+function h = ezmesh (varargin)
+
+  [htmp, needusage] = __ezplot__ ("mesh", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezmesh (f, [-3, 3]);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! fx = @(s,t) cos (s) .* cos (t);
+%! fy = @(s,t) sin (s) .* cos (t);
+%! fz = @(s,t) sin (t);
+%! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezmeshc.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,86 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezmeshc (@var{f})
+## @deftypefnx {Function File} {} ezmeshc (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezmeshc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezmeshc (@dots{})
+##
+## Plot the mesh and contour lines defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle for the created mesh plot and a second handle for the created contour
+## plot.
+##
+## Example: 2-argument function
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezmeshc (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{meshc, ezmesh, ezplot, ezsurf, ezsurfc, hidden}
+## @end deftypefn
+
+function h = ezmeshc (varargin)
+
+  [htmp, needusage] = __ezplot__ ("meshc", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezmeshc (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezplot.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,108 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezplot (@var{f})
+## @deftypefnx {Function File} {} ezplot (@var{f2v})
+## @deftypefnx {Function File} {} ezplot (@var{fx}, @var{fy})
+## @deftypefnx {Function File} {} ezplot (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezplot (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezplot (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezplot (@dots{})
+##
+## Plot the 2-D curve defined by the function @var{f}.
+##
+## The function @var{f} may be a string, inline function, or function handle
+## and can have either one or two variables.  If @var{f} has one variable, then
+## the function is plotted over the domain @code{-2*pi < @var{x} < 2*pi}
+## with 500 points.
+##
+## If @var{f2v} is a function of two variables then the implicit function
+## @code{@var{f}(@var{x},@var{y}) = 0} is calculated over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## For example:
+##
+## @example
+## ezplot (@@(@var{x}, @var{y}) @var{x}.^2 - @var{y}.^2 - 1)
+## @end example
+##
+## If two functions are passed as inputs then the parametric function
+##
+## @example
+## @group
+## @var{x} = @var{fx} (@var{t})
+## @var{y} = @var{fy} (@var{t})
+## @end group
+## @end example
+##
+## @noindent
+## is plotted over the domain @code{-2*pi <= @var{t} <= 2*pi} with 500 points.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}, or @var{t} for a parametric plot.  If
+## @var{dom} is a four element vector, then the minimum and maximum values are
+## @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in plotting
+## the function.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the created line objects.
+##
+## @seealso{plot, ezplot3, ezpolar, ezcontour, ezcontourf, ezmesh, ezmeshc, ezsurf, ezsurfc}
+## @end deftypefn
+
+function h = ezplot (varargin)
+
+  [htmp, needusage] = __ezplot__ ("plot", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! %% sinc function using function handle
+%! f = @(x) sin (pi*x) ./ (pi*x);
+%! ezplot (f);
+
+%!demo
+%! %% example of a function string and explicit limits
+%! clf;
+%! ezplot ('1/x', [-2 2]);
+
+%!demo
+%! %% parameterized function example over -2*pi <= t <= +2*pi
+%! clf;
+%! ezplot (@cos, @sin);
+
+%!demo
+%! %% implicit function of 2 variables
+%! clf;
+%! ezplot (inline ('x^2 - y^2 - 1'));
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezplot3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,84 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezplot3 (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezplot3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezplot3 (@dots{})
+##
+## Plot a parametrically defined curve in three dimensions.
+##
+## @var{fx}, @var{fy}, and @var{fz} are strings, inline functions,
+## or function handles with one argument defining the function.  By
+## default the plot is over the domain @code{0 <= @var{t} <= 2*pi}
+## with 500 points.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of @var{t}.
+##
+## @var{n} is a scalar defining the number of points to use in plotting the
+## function.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## @example
+## @group
+## fx = @@(t) cos (t);
+## fy = @@(t) sin (t);
+## fz = @@(t) t;
+## ezplot3 (fx, fy, fz, [0, 10*pi], 100);
+## @end group
+## @end example
+##
+## @seealso{plot3, ezplot, ezmesh, ezsurf}
+## @end deftypefn
+
+function h = ezplot3 (varargin)
+
+  [htmp, needusage] = __ezplot__ ("plot3", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! fx = @(t) cos (t);
+%! fy = @(t) sin (t);
+%! fz = @(t) t;
+%! ezplot3 (fx, fy, fz, [0, 10*pi], 100);
+
+%!demo
+%! clf;
+%! fx = @(t) cos (t);
+%! fy = @(t) sin (t);
+%! fz = @(t) t;
+%! ezplot3 (fx, fy, fz, [0, 5*pi], 100, 'animate');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezpolar.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,72 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezpolar (@var{f})
+## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezpolar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{})
+##
+## Plot a 2-D function in polar coordinates.
+## 
+## The function @var{f} is a string, inline function, or function handle with
+## a single argument.  The expected form of the function is
+## @code{@var{rho} = @var{f}(@var{theta})}.
+## By default the plot is over the domain @code{0 <= @var{theta} <= 2*pi}
+## with 500 points.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of @var{theta}.
+##
+## @var{n} is a scalar defining the number of points to use in plotting
+## the function.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## ezpolar (@@(t) sin (5/4 * t), [0, 8*pi]);
+## @end example
+##
+## @seealso{polar, ezplot}
+## @end deftypefn
+
+function h = ezpolar (varargin)
+
+  [htmp, needusage] = __ezplot__ ("polar", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ezpolar (@(t) sin (5/4 * t), [0, 8*pi]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezsurf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,116 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezsurf (@var{f})
+## @deftypefnx {Function File} {} ezsurf (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezsurf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezsurf (@dots{})
+##
+## Plot the surface defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Example 1: 2-argument function
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezsurf (f, [-3, 3]);
+## @end group
+## @end example
+##
+## Example 2: parametrically defined function
+##
+## @example
+## @group
+## fx = @@(s,t) cos (s) .* cos (t);
+## fy = @@(s,t) sin (s) .* cos (t);
+## fz = @@(s,t) sin (t);
+## ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
+## @end group
+## @end example
+##
+## @seealso{surf, ezsurfc, ezplot, ezmesh, ezmeshc, shading}
+## @end deftypefn
+
+function h = ezsurf (varargin)
+
+  [htmp, needusage] = __ezplot__ ("surf", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezsurf (f, [-3, 3]);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! fx = @(s,t) cos (s) .* cos (t);
+%! fy = @(s,t) sin (s) .* cos (t);
+%! fz = @(s,t) sin (t);
+%! ezsurf (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
+%! axis equal;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) x.^2 + y.^2;
+%! subplot (1,2,1);
+%!  ezsurf (f, [-2,2]);
+%!  title ({'x^2 + y^2'; 'plotted over rectangular grid (default)'});
+%! subplot (1,2,2);
+%!  ezsurf (f, [-2,2], 'circ');
+%!  title ({'x^2 + y^2'; 'plotted over circular disk with "circ"'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezsurfc.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,86 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezsurfc (@var{f})
+## @deftypefnx {Function File} {} ezsurfc (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezsurfc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezsurfc (@dots{})
+##
+## Plot the surface and contour lines defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle for the created surface plot and a second handle for the created
+## contour plot.
+##
+## Example:
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezsurfc (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{surfc, ezsurf, ezplot, ezmesh, ezmeshc, shading}
+## @end deftypefn
+
+function h = ezsurfc (varargin)
+
+  [htmp, needusage] = __ezplot__ ("surfc", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezsurfc (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/feather.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,136 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} feather (@var{u}, @var{v})
+## @deftypefnx {Function File} {} feather (@var{z})
+## @deftypefnx {Function File} {} feather (@dots{}, @var{style})
+## @deftypefnx {Function File} {} feather (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} feather (@dots{})
+##
+## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
+## from equidistant points on the x-axis.
+##
+## If a single complex argument @var{z} is given, then
+## @code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## line objects representing the drawn vectors.
+##
+## @example
+## @group
+## phi = [0 : 15 : 360] * pi/180;
+## feather (sin (phi), cos (phi));
+## @end group
+## @end example
+##
+## @seealso{plot, quiver, compass}
+## @end deftypefn
+
+function h = feather (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("feather", varargin{:});
+
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
+    z = varargin{1}(:).';
+    u = real (z);
+    v = imag (z);
+    have_line_spec = (nargin == 2);
+  elseif (nargin >= 2 && isnumeric (varargin{2}))
+    ioff = 3;
+    u = varargin{1}(:).';
+    v = varargin{2}(:).';
+    have_line_spec = (nargin == 3);
+  else
+    print_usage ();
+  endif
+
+  arrowsize = 0.20;
+  line_spec = "-b";
+
+  if (have_line_spec)
+    arg = varargin{end};
+    if (ischar (arg) || iscellstr (arg))
+      [~, valid] = __pltopt__ ("feather", arg, false);
+      if (valid)
+        line_spec = arg;
+      else
+        error ("feather: invalid linestyle STYLE");
+      endif
+    else
+      error ("feather: invalid linestyle STYLE");
+    endif
+  endif
+
+  ## Matlab draws feather plots, with the arrow head as one continous
+  ## line, and each arrow separately. This is completely different from
+  ## quiver and quite ugly.
+  n = length (u);
+  xend = [1 : n] + u;
+  xtmp = [1 : n] + u .* (1 - arrowsize);
+  yend = v;
+  ytmp = v .* (1 - arrowsize);
+  x = [[1 : n]; xend; xtmp - v * arrowsize / 3; xend; ...
+       xtmp + v * arrowsize / 3];
+  y = [zeros(1, n); yend; ytmp + u * arrowsize / 3; yend; ...
+       ytmp - u * arrowsize / 3];
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    hlist = plot (x, y, line_spec, [1, n], [0, 0], line_spec);
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hlist;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! phi = [0 : 15 : 360] * pi/180;
+%! feather (sin (phi), cos (phi));
+%! axis tight;
+%! title ('feather plot');
+
+%% Test input validation
+%!error feather ()
+%!error feather (1,2,3,4)
+%!error feather (1, "-r", 2)
+%!error <invalid linestyle STYLE> feather (1, "abc")
+%!error <invalid linestyle STYLE> feather (1, {1})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/fill.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,165 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} fill (@var{x}, @var{y}, @var{c})
+## @deftypefnx {Function File} {} fill (@var{x1}, @var{y1}, @var{c1}, @var{x2}, @var{y2}, @var{c2})
+## @deftypefnx {Function File} {} fill (@dots{}, @var{prop}, @var{val})
+## @deftypefnx {Function File} {} fill (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} fill (@dots{})
+## Create one or more filled 2-D polygons.
+##
+## The inputs @var{x} and @var{y} are the coordinates of the polygon vertices.
+## If the inputs are matrices then the rows represent different vertices and
+## each column produces a different polygon.  @code{fill} will close any open
+## polygons before plotting. 
+##
+## The input @var{c} determines the color of the polygon.  The simplest form
+## is a single color specification such as a @code{plot} format or an
+## RGB-triple.  In this case the polygon(s) will have one unique color.  If
+## @var{c} is a vector or matrix then the color data is first scaled using
+## @code{caxis} and then indexed into the current colormap.  A row vector will
+## color each polygon (a column from matrices @var{x} and @var{y}) with a
+## single computed color.  A matrix @var{c} of the same size as @var{x} and
+## @var{y} will compute the color of each vertex and then interpolate the face
+## color between the vertices.
+##
+## Multiple property/value pairs for the underlying patch object may be
+## specified, but they must appear in pairs.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the created patch objects.
+##
+## Example: red square
+##
+## @example
+## @group
+## vertices = [0 0
+##             1 0
+##             1 1
+##             0 1];
+## fill (vertices(:,1), vertices(:,2), "r");
+## axis ([-0.5 1.5, -0.5 1.5])
+## axis equal
+## @end group
+## @end example
+##
+## @seealso{patch, caxis, colormap}
+## @end deftypefn
+
+function h = fill (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("fill", varargin{:});
+
+  hlist = [];
+  iargs = __find_patches__ (varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    old_nxtplt = get (hax, "nextplot");
+    set (hax, "nextplot", "add");
+
+    for i = 1 : length (iargs)
+      if (i == length (iargs))
+        args = varargin(iargs(i):end);
+      else
+        args = varargin(iargs(i):iargs(i+1)-1);
+      endif
+      [htmp, fail] = __patch__ (hax, args{:});
+      if (fail)
+        print_usage ();
+      endif
+      hlist(end + 1, 1) = htmp;
+    endfor
+
+    if (strcmp (old_nxtplt, "replace"))
+      set (hax, "nextplot", old_nxtplt);
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hlist;
+  endif
+
+endfunction
+
+function iargs = __find_patches__ (varargin)
+  iargs = [];
+  i = 1;
+  while (i < nargin)
+    iargs(end + 1) = i;
+    if (ischar (varargin{i})
+        && (strcmpi (varargin{i}, "faces")
+            || strcmpi (varargin{i}, "vertices")))
+      i += 4;
+    elseif (isnumeric (varargin{i}))
+      i += 2;
+    endif
+
+    if (i <= nargin)
+      while (true);
+        if (ischar (varargin{i})
+            && (strcmpi (varargin{i}, "faces")
+                || strcmpi (varargin{i}, "vertices")))
+          break;
+        elseif (isnumeric (varargin{i}))
+          ## Assume its the colorspec
+          i++;
+          break;
+        elseif (ischar (varargin{i}))
+          colspec = tolower (varargin{i});
+          collen = length (colspec);
+          if (any (strncmp (colspec, 
+                            {"blue", "black", "k", "red", "green", ...
+                             "yellow", "magenta", "cyan", "white"},
+                            collen)))
+            i++;
+            break;
+          endif
+        else
+          i += 2;
+        endif
+      endwhile
+    endif
+  endwhile
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t1 = (1/16:1/8:1) * 2*pi;
+%! t2 = ((1/16:1/8:1) + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! h = fill (x1,y1,'r', x2,y2,'g');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/fplot.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,219 @@
+## Copyright (C) 2005-2012 Paul Kienzle
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} fplot (@var{fn}, @var{limits})
+## @deftypefnx {Function File} {} fplot (@dots{}, @var{tol})
+## @deftypefnx {Function File} {} fplot (@dots{}, @var{n})
+## @deftypefnx {Function File} {} fplot (@dots{}, @var{fmt})
+## @deftypefnx {Function File} {[@var{x}, @var{y}] =} fplot (@dots{})
+## Plot a function @var{fn} within the range defined by @var{limits}.
+##
+## @var{fn} is a function handle, inline function, or string containing the
+## name of the function to evaluate.
+##
+## The limits of the plot are of the form @w{@code{[@var{xlo}, @var{xhi}]}} or
+## @w{@code{[@var{xlo}, @var{xhi}, @var{ylo}, @var{yhi}]}}.
+##
+## The next three arguments are all optional and any number of them may be
+## given in any order.
+##
+## @var{tol} is the relative tolerance to use for the plot and defaults
+## to 2e-3 (.2%).
+##
+## @var{n} is the minimum number of points to use.  When @var{n} is specified,
+## the maximum stepsize will be @code{@var{xhi} - @var{xlo} / @var{n}}.  More
+## than @var{n} points may still be used in order to meet the relative
+## tolerance requirement.
+##
+## The @var{fmt} argument specifies the linestyle to be used by the plot
+## command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## With no output arguments the results are immediately plotted.  With two
+## output arguments the 2-D plot data is returned.  The data can subsequently
+## be plotted manually with @code{plot (@var{x}, @var{y})}.
+##
+## Example:
+##
+## @example
+## @group
+## fplot (@@cos, [0, 2*pi])
+## fplot ("[cos(x), sin(x)]", [0, 2*pi])
+## @end group
+## @end example
+##
+## Note: @code{fplot} works best with continuous functions.  Functions with
+## discontinuities are unlikely to plot well.  This restriction may be removed
+## in the future.
+## @seealso{ezplot, plot}
+## @end deftypefn
+
+## Author: Paul Kienzle <pkienzle@users.sf.net>
+
+function [X, Y] = fplot (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("fplot", varargin{:});
+
+  if (nargin < 2 || nargin > 5)
+    print_usage ();
+  endif
+
+  fn = varargin{1};
+  limits = varargin{2};
+  varargin = varargin(3:end);
+
+  if (strcmp (typeinfo (fn), "inline function"))
+    fn = vectorize (fn);
+    nam = formula (fn);
+  elseif (isa (fn, "function_handle"))
+    nam = func2str (fn);
+  elseif (all (isalnum (fn)))
+    nam = fn;
+  elseif (ischar (fn))
+    fn = vectorize (inline (fn));
+    nam = formula (fn);
+  else
+    error ("fplot: FN must be a function handle, inline function, or string");
+  endif
+
+  if (iscomplex (limits) || (numel (limits) != 2 && numel (limits) != 4))
+    error ("fplot: LIMITS must be a real vector with 2 or 4 elements");
+  endif
+
+  n = 5;
+  tol = 2e-3;
+  fmt = "";
+  for i = 1:numel (varargin)
+    arg = varargin{i};
+    if (ischar (arg))
+      fmt = arg;
+    elseif (isnumeric (arg) && isscalar (arg) && arg > 0)
+      if (arg == fix (arg))
+        n = arg;
+      else
+        tol = arg;
+      endif
+    else
+      error ("fplot: bad input in position %d", i+2);
+    endif
+  endfor
+
+  if (n != 5) 
+    ## n was specified 
+    x0 = linspace (limits(1), limits(2), n/2 + 1)';
+    y0 = feval (fn, x0);
+    x = linspace (limits(1), limits(2), n)';
+    y = feval (fn, x);
+  else
+    x0 = linspace (limits(1), limits(2), 5)';
+    y0 = feval (fn, x0);
+    n = 8;
+    x = linspace (limits(1), limits(2), n)';
+    y = feval (fn, x);
+  endif
+
+  if (rows (x0) != rows (y0))
+    ## FN is a constant value function
+    y0 = repmat (y0, size (x0));
+    y = repmat (y, size (x));
+  endif
+
+  err0 = Inf;
+
+  ## FIXME: This algorithm should really use adaptive scaling as the 
+  ##        the numerical quadrature algorithms do so that extra points are
+  ##        used where they are needed and not spread evenly over the entire
+  ##        x-range.  Try any function with a discontinuity, such as
+  ##        fplot (@tan, [-2, 2]) or fplot ("1./x", [-3, 2]), to see the
+  ##        problems with the current solution.
+
+  while (n < 2^18)    # Something is wrong if we need more than 250K points
+    yi = interp1 (x0, y0, x, "linear");
+    ## relative error calculation using average of [yi,y] as reference
+    ## since neither estimate is known a priori to be better than the other.
+    err = 0.5 * max (abs ((yi - y) ./ (yi + y))(:));
+    if (err < tol || abs (err - err0) < tol/2)
+      ## Either relative tolerance has been met OR
+      ## algorithm has stopped making any reasonable progress per iteration.
+      break;
+    endif
+    x0 = x;
+    y0 = y;
+    err0 = err;
+    n = 2 * (n - 1) + 1;
+    x = linspace (limits(1), limits(2), n)';
+    y = feval (fn, x);
+  endwhile
+
+  if (nargout == 2)
+    X = x;
+    Y = y;
+  else
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    plot (hax, x, y, fmt);
+    axis (hax, limits);
+    if (isvector (y))
+      legend (hax, nam);
+    else
+      for i = 1:columns (y)
+        nams{i} = sprintf ("%s(:,%i)", nam, i);
+      endfor
+      legend (hax, nams{:});
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! fplot (@cos, [0, 2*pi]);
+%! title ('fplot() single function');
+
+%!demo
+%! clf;
+%! fplot ('[cos(x), sin(x)]', [0, 2*pi]);
+%! title ('fplot() multiple functions');
+
+%!demo
+%! clf;
+%! %% sinc function
+%! fh = @(x) sin (pi*x) ./ (pi*x);
+%! fplot (fh, [-5, 5]);
+%! title ('fplot() sinc function');
+
+%!test
+%! [x, y] = fplot ("[cos(x), sin(x)]", [0, 2*pi]);
+%! assert (columns (y) == 2);
+%! assert (rows (x) == rows (y));
+%! assert (y, [cos(x), sin(x)], -2e-3);
+
+%% Test input validation
+%!error fplot (1)
+%!error fplot (1,2,3,4,5,6)
+%!error <FN must be a function handle> fplot (1, [0 1])
+%!error <LIMITS must be a real vector> fplot (@cos, [i, 2*i])
+%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1])
+%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1 2 3])
+%!error <bad input in position 3> fplot (@cos,[-1,1], {1})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/hist.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,212 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} hist (@var{y})
+## @deftypefnx {Function File} {} hist (@var{y}, @var{x})
+## @deftypefnx {Function File} {} hist (@var{y}, @var{nbins})
+## @deftypefnx {Function File} {} hist (@var{y}, @var{x}, @var{norm})
+## @deftypefnx {Function File} {} hist (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} hist (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{nn}, @var{xx}] =} hist (@dots{})
+## Produce histogram counts or plots.
+##
+## With one vector input argument, @var{y}, plot a histogram of the values
+## with 10 bins.  The range of the histogram bins is determined by the
+## range of the data.  With one matrix input argument, @var{y}, plot a
+## histogram where each bin contains a bar per input column.
+##
+## Given a second vector argument, @var{x}, use that as the centers of
+## the bins, with the width of the bins determined from the adjacent
+## values in the vector.
+##
+## If scalar, the second argument, @var{nbins}, defines the number of bins.
+##
+## If a third argument is provided, the histogram is normalized such that
+## the sum of the bars is equal to @var{norm}.
+##
+## Extreme values are lumped into the first and last bins.
+##
+## The histogram's appearance may be modified by specifying property/value
+## pairs.  For example the face and edge color may be modified.
+##
+## @example
+## @group
+## hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b");
+## @end group
+## @end example
+##
+## @noindent
+## The histogram's colors also depend upon the current colormap.
+##
+## @example
+## @group
+## hist (rand (10, 3));
+## colormap (summer ());
+## @end group
+## @end example
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## With two output arguments, produce the values @var{nn} (numbers of elements)
+## and @var{xx} (bin centers) such that @code{bar (@var{xx}, @var{nn})} will
+## plot the histogram.
+##
+## @seealso{histc, bar, pie, rose}
+## @end deftypefn
+
+## Author: jwe
+
+function [nn, xx] = hist (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("hist", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+  
+  y = varargin{1};
+  varargin = varargin(2:end);
+
+  arg_is_vector = isvector (y);
+
+  if (arg_is_vector)
+    y = y(:);
+  endif
+
+  if (! isreal (y))
+    error ("hist: Y must be real valued");
+  endif
+
+  max_val = max (y(:));
+  min_val = min (y(:));
+
+  iarg = 1;
+  if (nargin == 1 || ischar (varargin{iarg}))
+    n = 10;
+    x = [0.5:n]'/n;
+    x = x * (max_val - min_val) + ones (size (x)) * min_val;
+  else
+    ## nargin is either 2 or 3
+    x = varargin{iarg++};
+    if (isscalar (x))
+      n = x;
+      if (n <= 0)
+        error ("hist: number of bins NBINS must be positive");
+      endif
+      x = [0.5:n]'/n;
+      x = x * (max_val - min_val) + ones (size (x)) * min_val;
+    elseif (isreal (x))
+      if (isvector (x))
+        x = x(:);
+      endif
+      xsort = sort (x);
+      if (any (xsort != x))
+        warning ("hist: bin values not sorted on input");
+        x = xsort;
+      endif
+    else
+      error ("hist: second argument must be a scalar or a vector");
+    endif
+  endif
+
+  ## Avoid issues with integer types for x and y
+  x = double (x);
+  y = double (y);
+
+  cutoff = (x(1:end-1,:) + x(2:end,:)) / 2;
+  n = rows (x);
+  y_nc = columns (y);
+  if (n < 30 && columns (x) == 1)
+    ## The following algorithm works fastest for n less than about 30.
+    chist = zeros (n+1, y_nc);
+    for i = 1:n-1
+      chist(i+1,:) = sum (y <= cutoff(i));
+    endfor
+    chist(n+1,:) = sum (! isnan (y));
+  else
+    ## The following algorithm works fastest for n greater than about 30.
+    ## Put cutoff elements between boundaries, integrate over all
+    ## elements, keep totals at boundaries.
+    [s, idx] = sort ([y; repmat(cutoff, 1, y_nc)]);
+    len = rows (y);
+    chist = cumsum (idx <= len);
+    chist = [(zeros (1, y_nc));
+             (reshape (chist(idx > len), rows (cutoff), y_nc));
+             (chist(end,:) - sum (isnan (y)))];
+  endif
+
+  freq = diff (chist);
+
+  if (nargin > 2 && ! ischar (varargin{iarg}))
+    ## Normalize the histogram.
+    norm = varargin{iarg++};
+    freq *= norm / sum (! isnan (y));
+  endif
+
+  if (nargout > 0)
+    if (arg_is_vector)  
+      ## Matlab compatibility requires a row vector return
+      nn = freq';  
+      xx = x';
+    else
+      nn = freq;
+      xx = x;
+    endif
+  else
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    bar (hax, x, freq, "hist", varargin{iarg:end});
+  endif
+
+endfunction
+
+
+%!test
+%! [nn,xx] = hist ([1:4], 3);
+%! assert (xx, [1.5,2.5,3.5]);
+%! assert (nn, [2,1,1]);
+%!test
+%! [nn,xx] = hist ([1:4]', 3);
+%! assert (xx, [1.5,2.5,3.5]);
+%! assert (nn, [2,1,1]);
+%!test
+%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3]);
+%! assert (xx, [1,2,3]);
+%! assert (nn, [3,2,1]);
+%!test
+%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3], 6);
+%! assert (xx, [1,2,3]);
+%! assert (nn, [3,2,1]);
+%!test
+%! [nn,xx] = hist ([[1:4]', [1:4]'], 3);
+%! assert (xx, [1.5;2.5;3.5]);
+%! assert (nn, [[2,1,1]',[2,1,1]']);
+%!test
+%! for n = [10, 30, 100, 1000]
+%!   assert (sum (hist ([1:n], n)), n);
+%!   assert (sum (hist ([1:n], [2:n-1])), n);
+%!   assert (sum (hist ([1:n], [1:n])), n);
+%!   assert (sum (hist ([1:n], 29)), n);
+%!   assert (sum (hist ([1:n], 30)), n);
+%! endfor
+%!assert (hist (1,1), 1)
+%!assert (size (hist (randn (750,240), 200)), [200,240])
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/isocolors.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,173 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{cd}] =} isocolors (@var{c}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{c}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{r}, @var{g}, @var{b}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{r}, @var{g}, @var{b}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@dots{}, @var{p})
+## @deftypefnx {Function File} {} isocolors (@dots{})
+##
+## If called with one output argument and the first input argument
+## @var{c} is a three-dimensional array that contains color values and
+## the second input argument @var{v} keeps the vertices of a geometry
+## then return a matrix @var{cd} with color data information for the
+## geometry at computed points
+## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
+## @var{cd} can be taken to manually set FaceVertexCData of a patch.
+##
+## If called with further input arguments @var{x}, @var{y} and @var{z}
+## which are three--dimensional arrays of the same size than @var{c}
+## then the color data is taken at those given points.  Instead of the
+## color data @var{c} this function can also be called with RGB values
+## @var{r}, @var{g}, @var{b}.  If input argumnets @var{x}, @var{y},
+## @var{z} are not given then again @command{meshgrid} computed values
+## are taken.
+##
+## Optionally, the patch handle @var{p} can be given as the last input
+## argument to all variations of function calls instead of the vertices
+## data @var{v}.  Finally, if no output argument is given then directly
+## change the colors of a patch that is given by the patch handle
+## @var{p}.
+##
+## For example:
+##
+## @example
+## function [] = isofinish (p)
+##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##             "PlotBoxAspectRatio", [1 1 1]);
+##   set (p, "FaceColor", "interp");
+##   ## set (p, "FaceLighting", "flat");
+##   ## light ("Position", [1 1 5]); ## Available with JHandles
+## endfunction
+##
+## N = 15;    # Increase number of vertices in each direction
+## iso = .4;  # Change isovalue to .1 to display a sphere
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+## figure (); # Open another figure window
+##
+## subplot (2,2,1); view (-38, 20);
+## [f, v] = isosurface (x, y, z, c, iso);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## cdat = rand (size (c));       # Compute random patch color data
+## isocolors (x, y, z, cdat, p); # Directly set colors of patch
+## isofinish (p);                # Call user function isofinish
+##
+## subplot (2,2,2); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## [r, g, b] = meshgrid (lin, 2-lin, 2-lin);
+## cdat = isocolors (x, y, z, c, v); # Compute color data vertices
+## set (p, "FaceVertexCData", cdat); # Set color data manually
+## isofinish (p);
+##
+## subplot (2,2,3); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## cdat = isocolors (r, g, b, c, p); # Compute color data patch
+## set (p, "FaceVertexCData", cdat); # Set color data manually
+## isofinish (p);
+##
+## subplot (2,2,4); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## r = g = b = repmat ([1:N] / N, [N, 1, N]); # Black to white
+## cdat = isocolors (x, y, z, r, g, b, v);
+## set (p, "FaceVertexCData", cdat);
+## isofinish (p);
+## @end example
+##
+## @seealso{isosurface, isonormals}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function varargout = isocolors (varargin)
+  calc_rgb = false;
+  switch (nargin)
+    case 2
+      c = varargin{1};
+      vp = varargin{2};
+      x = 1:size (c, 2);
+      y = 1:size (c, 1);
+      z = 1:size (c, 3);
+    case 4
+      calc_rgb = true;
+      R = varargin{1};
+      G = varargin{2};
+      B = varargin{3};
+      vp = varargin{4};
+      x = 1:size (R, 1);
+      y = 1:size (R, 2);
+      z = 1:size (R, 3);
+    case 5
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+      c = varargin{4};
+      vp = varargin{5};
+    case 7
+      calc_rgb = true;
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+      R = varargin{4};
+      G = varargin{5};
+      B = varargin{6};
+      vp = varargin{7};
+    otherwise
+      print_usage ();
+  endswitch
+  if (ismatrix (vp) && columns (vp) == 3)
+    pa = [];
+    v = vp;
+  elseif ( ishandle (vp) )
+    pa = vp;
+    v = get (pa, "Vertices");
+  else
+    error ("isocolors: last argument is not a vertex list or patch handle");
+  endif
+  if (calc_rgb)
+    new_col = zeros (rows (v), 3);
+    new_col(:,1) = __interp_cube__ (x, y, z, R, v, "values" );
+    new_col(:,2) = __interp_cube__ (x, y, z, G, v, "values" );
+    new_col(:,3) = __interp_cube__ (x, y, z, B, v, "values" );
+  else
+    new_col = __interp_cube__ (x, y, z, c, v, "values" );
+  endif
+  switch (nargout)
+    case 0
+      if (!isempty (pa))
+        set (pa, "FaceVertexCData", new_col);
+      endif
+    case 1
+      varargout = {new_col};
+    otherwise
+      print_usage ();
+  endswitch
+endfunction
+
+
+%!test
+%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
+%! c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
+%! [f, v] = isosurface (x, y, z, c, .4);
+%! cdat = isocolors (x, y, z, c, v);
+%! assert (rows (cdat) == rows (v));
+## Can't create a patch handle for tests without a figure
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/isonormals.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,165 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{n}] =} isonormals (@var{val}, @var{v})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{val}, @var{p})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{p})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@dots{}, "negate")
+## @deftypefnx {Function File} {} isonormals (@dots{}, @var{p})
+##
+## If called with one output argument and the first input argument
+## @var{val} is a three-dimensional array that contains the data for an
+## isosurface geometry and the second input argument @var{v} keeps the
+## vertices of an isosurface then return the normals @var{n} in form of
+## a matrix with the same size than @var{v} at computed points
+## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
+## @var{n} can be taken to manually set @var{VertexNormals} of a patch.
+##
+## If called with further input arguments @var{x}, @var{y} and @var{z}
+## which are three--dimensional arrays with the same size than @var{val}
+## then the volume data is taken at those given points.  Instead of the
+## vertices data @var{v} a patch handle @var{p} can be passed to this
+## function.
+##
+## If given the string input argument @qcode{"negate"} as last input argument
+## then compute the reverse vector normals of an isosurface geometry.
+##
+## If no output argument is given then directly redraw the patch that is
+## given by the patch handle @var{p}.
+##
+## For example:
+## @c Set example in small font to prevent overfull line
+##
+## @smallexample
+## function [] = isofinish (p)
+##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##             "PlotBoxAspectRatio", [1 1 1]);
+##   set (p, "VertexNormals", -get (p,"VertexNormals")); # Revert normals
+##   set (p, "FaceColor", "interp");
+##   ## set (p, "FaceLighting", "phong");
+##   ## light ("Position", [1 1 5]); # Available with JHandles
+## endfunction
+##
+## N = 15;    # Increase number of vertices in each direction
+## iso = .4;  # Change isovalue to .1 to display a sphere
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+## figure (); # Open another figure window
+##
+## subplot (2,2,1); view (-38, 20);
+## [f, v, cdat] = isosurface (x, y, z, c, iso, y);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## isofinish (p); ## Call user function isofinish
+##
+## subplot (2,2,2); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## isonormals (x, y, z, c, p); # Directly modify patch
+## isofinish (p);
+##
+## subplot (2,2,3); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## n = isonormals (x, y, z, c, v); # Compute normals of isosurface
+## set (p, "VertexNormals", n);    # Manually set vertex normals
+## isofinish (p);
+##
+## subplot (2,2,4); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## isonormals (x, y, z, c, v, "negate"); # Use reverse directly
+## isofinish (p);
+## @end smallexample
+##
+## @seealso{isosurface, isocolors}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function varargout = isonormals (varargin)
+  na = nargin;
+  negate = false;
+  if (ischar (varargin{nargin}))
+    na = nargin-1;
+    if (strcmp (lower (varargin{nargin}), "negate"))
+      negate = true;
+    else
+      error ("isonormals: Unknown option '%s'", varargin{nargin});
+    endif
+  endif
+  switch (na)
+    case 2
+      c = varargin{1};
+      vp = varargin{2};
+      x = 1:size (c, 2);
+      y = 1:size (c, 1);
+      z = 1:size (c, 3);
+    case 5
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+      c = varargin{4};
+      vp = varargin{5};
+    otherwise
+      print_usage ();
+  endswitch
+  if (ismatrix (vp) && columns (vp) == 3)
+    pa = [];
+    v = vp;
+  elseif (ishandle (vp))
+    pa = vp;
+    v = get (pa, "Vertices");
+  else
+    error ("isonormals: Last argument is not a vertex list or a patch handle");
+  endif
+  if (negate)
+    normals = -__interp_cube__ (x, y, z, c, v, "normals");
+  else
+    normals = __interp_cube__ (x, y, z, c, v, "normals");
+  endif
+  switch (nargout)
+    case 0
+      if (!isempty (pa))
+        set (pa, "VertexNormals", normals);
+      endif
+    case 1
+      varargout = {normals};
+    otherwise
+      print_usage ();
+  endswitch
+endfunction
+
+
+%!test
+%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
+%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
+%! n = isonormals (x, y, z, c, v);
+%! assert (size (v), size (n));
+%!test
+%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
+%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
+%! np = isonormals (x, y, z, c, v);
+%! nn = isonormals (x, y, z, c, v, "negate");
+%! assert (np, -nn);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/isosurface.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,231 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{fv}] =} isosurface (@var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@dots{}, "noshare", "verbose")
+## @deftypefnx {Function File} {[@var{fvc}] =} isosurface (@dots{}, @var{col})
+## @deftypefnx {Function File} {[@var{f}, @var{v}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{f}, @var{v}, @var{c}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
+## @deftypefnx {Function File} {} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col}, @var{opt})
+##
+## If called with one output argument and the first input argument
+## @var{val} is a three-dimensional array that contains the data of an
+## isosurface geometry and the second input argument @var{iso} keeps the
+## isovalue as a scalar value then return a structure array @var{fv}
+## that contains the fields @var{Faces} and @var{Vertices} at computed
+## points @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output
+## argument @var{fv} can directly be taken as an input argument for the
+## @command{patch} function.
+##
+## If called with further input arguments @var{x}, @var{y} and @var{z}
+## which are three--dimensional arrays with the same size than @var{val}
+## then the volume data is taken at those given points.
+##
+## The string input argument @qcode{"noshare"} is only for compatibility and
+## has no effect.  If given the string input argument
+## @qcode{"verbose"} then print messages to the command line interface about the
+## current progress.
+##
+## If called with the input argument @var{col} which is a
+## three-dimensional array of the same size than @var{val} then take
+## those values for the interpolation of coloring the isosurface
+## geometry.  Add the field @var{FaceVertexCData} to the structure
+## array @var{fv}.
+##
+## If called with two or three output arguments then return the
+## information about the faces @var{f}, vertices @var{v} and color data
+## @var{c} as separate arrays instead of a single structure array.
+##
+## If called with no output argument then directly process the
+## isosurface geometry with the @command{patch} command.
+##
+## For example,
+##
+## @example
+## @group
+## [x, y, z] = meshgrid (1:5, 1:5, 1:5);
+## val = rand (5, 5, 5);
+## isosurface (x, y, z, val, .5);
+## @end group
+## @end example
+##
+## @noindent
+## will directly draw a random isosurface geometry in a graphics window.
+## Another example for an isosurface geometry with different additional
+## coloring
+## @c Set example in small font to prevent overfull line
+##
+## @smallexample
+## N = 15;    # Increase number of vertices in each direction
+## iso = .4;  # Change isovalue to .1 to display a sphere
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+## figure (); # Open another figure window
+##
+## subplot (2,2,1); view (-38, 20);
+## [f, v] = isosurface (x, y, z, c, iso);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceColor", "green", "FaceLighting", "phong");
+## # light ("Position", [1 1 5]); # Available with the JHandles package
+##
+## subplot (2,2,2); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "blue");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceColor", "none", "FaceLighting", "phong");
+## # light ("Position", [1 1 5]);
+##
+## subplot (2,2,3); view (-38, 20);
+## [f, v, c] = isosurface (x, y, z, c, iso, y);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceLighting", "phong");
+## # light ("Position", [1 1 5]);
+##
+## subplot (2,2,4); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
+##            "FaceColor", "interp", "EdgeColor", "blue");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceLighting", "phong");
+## # light ("Position", [1 1 5]);
+## @end smallexample
+##
+## @seealso{isonormals, isocolors}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function varargout = isosurface (varargin)
+
+  if (nargin < 2 || nargin > 8 || nargout > 3)
+    print_usage ();
+  endif
+
+  calc_colors = false;
+  f = v = c = [];
+  verbose = false;
+  noshare = false;
+  if (nargin >= 5)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    val = varargin{4};
+    iso = varargin{5};
+    if (nargin >= 6 && ismatrix (varargin{6}))
+      colors = varargin{6};
+      calc_colors = true;
+    endif
+  else
+    val = varargin{1};
+    [n2, n1, n3] = size (val);
+    [x, y, z] = meshgrid (1:n1, 1:n2, 1:n3);
+    iso = varargin{2};
+    if (nargin >= 3 && ismatrix (varargin{3}))
+        colors = varargin{3};
+        calc_colors = true;
+    endif
+  endif
+  if (calc_colors)
+    if (nargout == 2)
+      warning ("isosurface: colors will be calculated, but no output argument to receive it.");
+    endif
+    [fvc.faces, fvc.vertices, fvc.facevertexcdata] = __marching_cube__ (x, y, z, val, iso, colors);
+  else
+    [fvc.faces, fvc.vertices] = __marching_cube__ (x, y, z, val, iso);
+  endif
+
+  if (isempty (fvc.vertices) || isempty (fvc.faces))
+    warning ("isosurface: triangulation is empty");
+  endif
+
+  switch (nargout)
+    case 0
+      ## plot the calculated surface
+      hax = newplot ();
+      if (calc_colors)
+        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
+                    "FaceVertexCData", fvc.facevertexcdata,
+                    "FaceColor", "flat", "EdgeColor", "none");
+      else
+        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
+                    "FaceColor", "g", "EdgeColor", "k");
+      endif
+      if (! ishold ())
+        set (hax, "view", [-37.5, 30],
+                  "xgrid", "on", "ygrid", "on", "zgrid", "on");
+      endif
+    case 1
+      varargout = {fvc};
+    case 2
+      varargout = {fvc.faces, fvc.vertices};
+    case 3
+      varargout = {fvc.faces, fvc.vertices, fvc.facevertexcdata};
+    otherwise
+      print_usage ();
+  endswitch
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
+%! v = x.^2 + y.^2 + z.^2;
+%! isosurface (x, y, z, v, 1);
+%! title ('isosurface of a sphere');
+
+%!shared x, y, z, val
+%! [x, y, z]  = meshgrid (0:1, 0:1, 0:1); # Points for single
+%! val        = [0, 0; 0, 0];             # cube and a 3-D
+%! val(:,:,2) = [0, 0; 1, 0];             # array of values
+
+%!test
+%! fv = isosurface (x, y, z, val, 0.3);
+%! assert (isfield (fv, "vertices"), true);
+%! assert (isfield (fv, "faces"), true);
+%! assert (size (fv.vertices), [3 3]);
+%! assert (size (fv.faces), [1 3]);
+
+%!test
+%! fvc = isosurface (x, y, z, val, .3, y);
+%! assert (isfield (fvc, "vertices"), true);
+%! assert (isfield (fvc, "faces"), true);
+%! assert (isfield (fvc, "facevertexcdata"), true);
+%! assert (size (fvc.vertices), [3 3]);
+%! assert (size (fvc.faces), [1 3]);
+%! assert (size (fvc.facevertexcdata), [3 1]);
+
+%!test
+%! [f, v] = isosurface (x, y, z, val, .3);
+%! assert (size (f), [1 3]);
+%! assert (size (v), [3 3]);
+
+%!test
+%! [f, v, c] = isosurface (x, y, z, val, .3, y);
+%! assert (size (f), [1 3]);
+%! assert (size (v), [3 3]);
+%! assert (size (c), [3 1]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/line.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,92 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} line ()
+## @deftypefnx {Function File} {} line (@var{x}, @var{y})
+## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} line (@var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} line (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} line (@dots{})
+## Create line object from @var{x} and @var{y} (and possibly @var{z}) and
+## insert in the current axes.
+##
+## Multiple property-value pairs may be specified for the line object, but they
+## must appear in pairs.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle (or vector of handles)
+## to the line objects created.
+##
+## @seealso{image, patch, rectangle, surface, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = line (varargin)
+
+  ## Get axis argument which may be in a 'parent' PROP/VAL pair
+  [hax, varargin] = __plt_get_axis_arg__ ("line", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  htmp = __line__ (hax, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf
+%! x = 0:0.3:10;
+%! y1 = cos (x);
+%! y2 = sin (x);
+%! subplot (3,1,1);
+%!  args = {'color', 'b', 'marker', 's'};
+%!  line ([x(:), x(:)], [y1(:), y2(:)], args{:});
+%!  title ('Test broadcasting for line()');
+%! subplot (3,1,2);
+%!  line (x(:), [y1(:), y2(:)], args{:});
+%! subplot (3,1,3);
+%!  line ([x(:), x(:)+pi/2], y1(:), args{:});
+%!  xlim ([0 10]);
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = line;
+%!   assert (findobj (hf, "type", "line"), h);
+%!   assert (get (h, "xdata"), [0 1], eps);
+%!   assert (get (h, "ydata"), [0 1], eps);
+%!   assert (get (h, "type"), "line");
+%!   assert (get (h, "color"), get (0, "defaultlinecolor"));
+%!   assert (get (h, "linestyle"), get (0, "defaultlinelinestyle"));
+%!   assert (get (h, "linewidth"), get (0, "defaultlinelinewidth"), eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/loglog.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,120 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} loglog (@var{y})
+## @deftypefnx {Function File} {} loglog (@var{x}, @var{y})
+## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{prop}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} loglog (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} loglog (@dots{})
+## Produce a 2-D plot using logarithmic scales for both axes.
+##
+## See the documentation of @code{plot} for a description of the arguments
+## that @code{loglog} will accept.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+## @seealso{plot, semilogx, semilogy}
+## @end deftypefn
+
+## Author: jwe
+
+function h = loglog (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log", "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on", "yminortick", "on");
+    endif
+
+    htmp = __plt__ ("loglog", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t = 1:0.01:10;
+%! x = sort ((t .* (1 + rand (size (t)))) .^ 2);
+%! y = (t .* (1 + rand (size (t)))) .^ 2;
+%! loglog (x, y);
+%! title ({'loglog() plot', 'Both axes are logarithmic'});
+
+%!demo
+%! clf;
+%! a = logspace (-5, 1, 10);
+%! b =-logspace (-5, 1, 10);
+%!
+%! subplot (1,2,1);
+%!  loglog (a, b);
+%!  xlabel ('loglog (a, b)');
+%!
+%! subplot (1,2,2);
+%!  loglog (a, abs (b));
+%!  set (gca, 'ydir', 'reverse');
+%!  xlabel ('loglog (a, abs (b))');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   loglog (a, b);
+%!   assert (get (gca, "yscale"), "log");
+%!   assert (get (gca, "xscale"), "log");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b =-logspace (-5, 1, 10);
+%!   loglog (a, b);
+%!   axis tight;
+%!   assert (all (get (gca, "ytick") < 0));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/loglogerr.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,87 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} loglogerr (@var{args})
+## @deftypefnx {Function File} {} loglogerr (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} loglogerr (@dots{})
+## Produce 2-D plots on a double logarithm axis with errorbars.
+##
+## Many different combinations of arguments are possible.  The most common
+## form is
+##
+## @example
+## loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
+## @end example
+##
+## @noindent
+## which produces a double logarithm plot of @var{y} versus @var{x}
+## with errors in the @var{y}-scale defined by @var{ey} and the plot
+## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
+## formats and additional information.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{errorbar, semilogxerr, semilogyerr}
+## @end deftypefn
+
+## Created: 20.2.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = loglogerr (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log", "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on", "yminortick", "on");
+    endif
+    htmp = __errcomm__ ("loglogerr", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = exp (log (0.01):0.2:log (10));
+%! y = wblpdf (x, 3, 2);
+%! eyu = 2*rand (size (y)) .* y;
+%! eyl = 0.5*rand (size (y)) .* y;
+%! loglogerr (x, y, eyl, eyu, '#~x-');
+%! xlim (x([1, end]));
+%! title ({'loglogerr(): loglog() plot with errorbars', ...
+%!         'Both axes are logarithmic'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/mesh.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,127 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} mesh (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} mesh (@var{z})
+## @deftypefnx {Function File} {} mesh (@dots{}, @var{c})
+## @deftypefnx {Function File} {} mesh (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} mesh (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} mesh (@dots{})
+## Plot a 3-D wireframe mesh.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{ezmesh, meshc, meshz, trimesh, contour, surf, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: jwe
+
+function h = mesh (varargin)
+
+  if (! all (cellfun ("isreal", varargin)))
+    error ("mesh: X, Y, Z, C arguments must be real");
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("mesh", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = surface (varargin{:});
+
+    set (htmp, "facecolor", "w");
+    set (htmp, "edgecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = logspace (0,1,11);
+%! z = x'*x;
+%! mesh (x, x, z);
+%! xlabel 'X-axis';
+%! ylabel 'Y-axis';
+%! zlabel 'Z-axis';
+%! title ('mesh() with color proportional to height');
+
+%!demo
+%! clf;
+%! x = logspace (0,1,11);
+%! z = x'*x;
+%! mesh (x, x, z, z.^2);
+%! xlabel 'X-axis';
+%! ylabel 'Y-axis';
+%! zlabel 'linear scale';
+%! title ('mesh() with color proportional to Z^2');
+
+%!demo
+%! clf;
+%! x = logspace (0,1,11);
+%! z = x'*x;
+%! mesh (x, x, z, z.^2);
+%! set (gca, 'zscale', 'log');
+%! xlabel 'X-axis';
+%! ylabel 'Y-axis';
+%! zlabel 'log scale';
+%! title ({'mesh() with color proportional to Z^2', 'Z-axis is log scale'});
+%! if (strcmp (get (gcf, '__graphics_toolkit__'), 'gnuplot'))
+%!   title ({'Gnuplot: mesh color is wrong', 'This is a Gnuplot bug'});
+%! endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/meshc.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,111 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} meshc (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} meshc (@var{z})
+## @deftypefnx {Function File} {} meshc (@dots{}, @var{c})
+## @deftypefnx {Function File} {} meshc (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} meshc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} meshc (@dots{})
+## Plot a 3-D wireframe mesh with underlying contour lines.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+## 
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle to the created surface object and to the created contour plot.
+##
+## @seealso{ezmeshc, mesh, meshz, contour, surfc, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+function h = meshc (varargin)
+
+  if (! all (cellfun ("isreal", varargin)))
+    error ("meshc: X, Y, Z, C arguments must be real");
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshc", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = surface (varargin{:});
+
+    ## FIXME - gnuplot does not support a filled surface and a
+    ## non-filled contour.  3D filled patches are also not supported.
+    ## Thus, the facecolor will be transparent for the gnuplot backend.
+    set (htmp, "facecolor", "w");
+    set (htmp, "edgecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on",
+                "xlimmode", "manual", "ylimmode", "manual");
+    endif
+
+    drawnow ();
+
+    zmin = get (hax, "zlim")(1);
+    [~, htmp2] = __contour__ (hax, zmin, varargin{:});
+
+    htmp = [htmp; htmp2];
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X, Y] = meshgrid (linspace (-3, 3, 40));
+%! Z = sqrt (abs (X .* Y)) ./ (1 + X.^2 + Y.^2);
+%! meshc (X, Y, Z);
+%! title ('meshc() combines mesh/contour plots');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/meshz.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,162 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} meshz (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} meshz (@var{z})
+## @deftypefnx {Function File} {} meshz (@dots{}, @var{c})
+## @deftypefnx {Function File} {} meshz (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} meshz (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} meshz (@dots{})
+## Plot a 3-D wireframe mesh with a surrounding curtain.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{mesh, meshc, contour, surf, surface, waterfall, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+function h = meshz (varargin)
+
+  if (! all (cellfun ("isreal", varargin)))
+    error ("meshz: X, Y, Z, C arguments must be real");
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshz", varargin{:});
+
+  ## Find where property/value pairs start
+  charidx = find (cellfun ("isclass", varargin, "char"), 1);
+
+  have_c = false;
+  if (isempty (charidx))
+    if (nargin == 2 || nargin == 4) 
+      have_c = true;
+      charidx = nargin;   # bundle C matrix back into varargin 
+    else
+      charidx = nargin + 1;
+    endif
+  endif
+
+  if (charidx == 2)
+    z = varargin{1};
+    [m, n] = size (z);
+    x = 1:n;
+    y = (1:m).';
+  else
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+  endif
+
+  if (isvector (x) && isvector (y))
+    x = [x(1), x(:).', x(end)];
+    y = [y(1); y(:); y(end)];
+  else
+    x = [x(1,1), x(1,:), x(1,end);
+         x(:,1), x, x(:,end);
+         x(end,1), x(end,:), x(end,end)];
+    y = [y(1,1), y(1,:), y(1,end);
+         y(:,1), y, y(:,end);
+         y(end,1), y(end,:), y(end,end)];
+  endif
+
+  zref = min (z(isfinite (z)));
+  z = [zref .* ones(1, columns(z) + 2);
+       zref .* ones(rows(z), 1), z, zref .* ones(rows(z), 1);
+       zref .* ones(1, columns(z) + 2)];
+
+  if (have_c)
+    c = varargin{charidx};
+    cref = min (c(isfinite (c)));
+    c = [cref .* ones(1, columns(c) + 2);
+         cref .* ones(rows(c), 1), c, cref .* ones(rows(c), 1);
+         cref .* ones(1, columns(c) + 2)];
+    varargin(charidx) = c;
+  endif
+    
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = mesh (x, y, z, varargin{charidx:end});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! meshz (Z);
+%! title ('meshz() plot of peaks() function');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! subplot (1,2,1)
+%!  mesh (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('mesh() plot');
+%! subplot (1,2,2)
+%!  meshz (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('meshz() plot');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = peaks ();
+%! [fx, fy] = gradient (Z); 
+%! C = sqrt (fx.^2 + fy.^2);
+%! meshz (X,Y,Z,C);
+%! title ('meshz() plot with color determined by gradient');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/module.mk	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,104 @@
+FCN_FILE_DIRS += plot/draw
+
+plot_draw_PRIVATE_FCN_FILES = \
+  plot/draw/private/__add_datasource__.m \
+  plot/draw/private/__bar__.m \
+  plot/draw/private/__contour__.m \
+  plot/draw/private/__errcomm__.m \
+  plot/draw/private/__errplot__.m \
+  plot/draw/private/__ezplot__.m \
+  plot/draw/private/__interp_cube__.m \
+  plot/draw/private/__line__.m \
+  plot/draw/private/__marching_cube__.m \
+  plot/draw/private/__patch__.m \
+  plot/draw/private/__pie__.m \
+  plot/draw/private/__plt__.m \
+  plot/draw/private/__quiver__.m \
+  plot/draw/private/__scatter__.m \
+  plot/draw/private/__stem__.m
+
+plot_draw_FCN_FILES = \
+  plot/draw/area.m \
+  plot/draw/barh.m \
+  plot/draw/bar.m \
+  plot/draw/colorbar.m \
+  plot/draw/comet3.m \
+  plot/draw/comet.m \
+  plot/draw/compass.m \
+  plot/draw/contour3.m \
+  plot/draw/contourc.m \
+  plot/draw/contourf.m \
+  plot/draw/contour.m \
+  plot/draw/cylinder.m \
+  plot/draw/ellipsoid.m \
+  plot/draw/errorbar.m \
+  plot/draw/ezcontourf.m \
+  plot/draw/ezcontour.m \
+  plot/draw/ezmeshc.m \
+  plot/draw/ezmesh.m \
+  plot/draw/ezplot3.m \
+  plot/draw/ezplot.m \
+  plot/draw/ezpolar.m \
+  plot/draw/ezsurfc.m \
+  plot/draw/ezsurf.m \
+  plot/draw/feather.m \
+  plot/draw/fill.m \
+  plot/draw/fplot.m \
+  plot/draw/hist.m \
+  plot/draw/isocolors.m \
+  plot/draw/isonormals.m \
+  plot/draw/isosurface.m \
+  plot/draw/line.m \
+  plot/draw/loglogerr.m \
+  plot/draw/loglog.m \
+  plot/draw/meshc.m \
+  plot/draw/mesh.m \
+  plot/draw/meshz.m \
+  plot/draw/pareto.m \
+  plot/draw/patch.m \
+  plot/draw/pcolor.m \
+  plot/draw/peaks.m \
+  plot/draw/pie3.m \
+  plot/draw/pie.m \
+  plot/draw/plot3.m \
+  plot/draw/plot.m \
+  plot/draw/plotmatrix.m \
+  plot/draw/plotyy.m \
+  plot/draw/polar.m \
+  plot/draw/quiver3.m \
+  plot/draw/quiver.m \
+  plot/draw/rectangle.m \
+  plot/draw/ribbon.m \
+  plot/draw/rose.m \
+  plot/draw/scatter3.m \
+  plot/draw/scatter.m \
+  plot/draw/semilogxerr.m \
+  plot/draw/semilogx.m \
+  plot/draw/semilogyerr.m \
+  plot/draw/semilogy.m \
+  plot/draw/shrinkfaces.m \
+  plot/draw/slice.m \
+  plot/draw/sombrero.m \
+  plot/draw/sphere.m \
+  plot/draw/stairs.m \
+  plot/draw/stem3.m \
+  plot/draw/stemleaf.m \
+  plot/draw/stem.m \
+  plot/draw/surface.m \
+  plot/draw/surfc.m \
+  plot/draw/surfl.m \
+  plot/draw/surf.m \
+  plot/draw/surfnorm.m \
+  plot/draw/tetramesh.m \
+  plot/draw/trimesh.m \
+  plot/draw/triplot.m \
+  plot/draw/trisurf.m \
+  plot/draw/waterfall.m \
+  $(plot_draw_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(plot_draw_FCN_FILES)
+
+PKG_ADD_FILES += plot/draw/PKG_ADD
+
+DIRSTAMP_FILES += plot/draw/$(octave_dirstamp)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pareto.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,132 @@
+## Copyright (C) 2007-2012 David Bateman
+## Copyright (C) 2003 Alberto Terruzzi
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pareto (@var{y})
+## @deftypefnx {Function File} {} pareto (@var{y}, @var{x})
+## @deftypefnx {Function File} {} pareto (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} pareto (@dots{})
+## Draw a Pareto chart.
+##
+## A Pareto chart is a bar graph that arranges information in such a way
+## that priorities for process improvement can be established; It organizes
+## and displays information to show the relative importance of data.  The chart
+## is similar to the histogram or bar chart, except that the bars are arranged
+## in decreasing magnitude from left to right along the x-axis.
+##
+## The fundamental idea (Pareto principle) behind the use of Pareto
+## diagrams is that the majority of an effect is due to a small subset of the
+## causes.  For quality improvement, the first few contributing causes 
+## (leftmost bars as presented on the diagram) to a problem usually account for
+## the majority of the result.  Thus, targeting these "major causes" for
+## elimination results in the most cost-effective improvement scheme.
+##
+## Typically only the magnitude data @var{y} is present in which case
+## @var{x} is taken to be the range @code{1 : length (@var{y})}.  If @var{x}
+## is given it may be a string array, a cell array of strings, or a numerical
+## vector.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle for the created bar plot and a second handle for the created line
+## plot.
+##
+## An example of the use of @code{pareto} is
+##
+## @example
+## @group
+## Cheese = @{"Cheddar", "Swiss", "Camembert", ...
+##           "Munster", "Stilton", "Blue"@};
+## Sold = [105, 30, 70, 10, 15, 20];
+## pareto (Sold, Cheese);
+## @end group
+## @end example
+## @seealso{bar, barh, hist, pie, plot}
+## @end deftypefn
+
+function h = pareto (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pareto", varargin{:});
+
+  if (nargin != 1 && nargin != 2)
+    print_usage ();
+  endif
+
+  y = varargin{1}(:).';
+  if (nargin == 2)
+    x = varargin{2}(:).';
+    if (! iscell (x))
+      if (ischar (x))
+        x = cellstr (x);
+      else
+        x = cellstr (num2str (x(:)));
+      endif
+    endif
+  else
+    x = cellstr (int2str ([1:numel(y)]'));
+  endif
+
+  [y, idx] = sort (y, "descend");
+  x = x(idx);
+  cdf = cumsum (y);
+  maxcdf = cdf(end);
+  cdf ./= maxcdf;
+  idx95 = find (cdf < 0.95, 1, "last") + 1;
+
+  if (isempty (hax))
+    [ax, hbar, hline] = plotyy (1 : idx95, y(1:idx95),
+                                1 : length (cdf), 100 * cdf,
+                                @bar, @plot);
+  else
+    [ax, hbar, hline] = plotyy (hax, 1 : idx95, y(1:idx95),
+                                     1 : length (cdf), 100 * cdf,
+                                     @bar, @plot);
+  endif
+
+  axis (ax(1), [1 - 0.6, idx95 + 0.6, 0, maxcdf]);
+  axis (ax(2), [1 - 0.6, idx95 + 0.6, 0, 100]);
+  set (ax(2), "ytick", [0, 20, 40, 60, 80, 100],
+              "yticklabel", {"0%", "20%", "40%", "60%", "80%", "100%"});
+  set (ax(1:2), "xtick", 1:idx95, "xticklabel", x(1:idx95));
+
+  if (nargout > 0)
+    h = [hbar; hline];
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! Cheese = {'Cheddar', 'Swiss', 'Camembert', 'Munster', 'Stilton', 'Blue'};
+%! Sold = [105, 30, 70, 10, 15, 20];
+%! pareto (Sold, Cheese);
+
+%!demo
+%! clf;
+%! % Suppose that we want establish which products makes 80% of turnover.
+%! Codes = {'AB4','BD7','CF8','CC5','AD11','BB5','BB3','AD8','DF3','DE7'};
+%! Value = [2.35 7.9 2.45 1.1 0.15 13.45 5.4 2.05 0.85  1.65]';
+%! SoldUnits = [54723 41114 16939 1576091 168000 687197 120222 168195, ...
+%!              1084118 55576]';
+%! pareto (Value.*SoldUnits, Codes);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/patch.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,270 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} patch ()
+## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c})
+## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} patch (@var{fv})
+## @deftypefnx {Function File} {} patch ("Faces", @var{faces}, "Vertices", @var{verts}, @dots{})
+## @deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} patch (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} patch (@dots{})
+## Create patch object in the current axes with vertices at locations
+## (@var{x}, @var{y}) and of color @var{c}.
+##
+## If the vertices are matrices of size @nospell{MxN} then each polygon patch
+## has M vertices and a total of N polygons will be created.  If some polygons
+## do not have M vertices use NaN to represent "no vertex".  If the @var{z}
+## input is present then 3-D patches will be created.
+##
+## The color argument @var{c} can take many forms.  To create polygons
+## which all share a single color use a string value (e.g., @qcode{"r"} for
+## red), a scalar value which is scaled by @code{caxis} and indexed into the
+## current colormap, or a 3-element RGB vector with the precise TrueColor.
+##
+## If @var{c} is a vector of length N then the ith polygon will have a color
+## determined by scaling entry @var{c}(i) according to @code{caxis} and then
+## indexing into the current colormap.  More complicated coloring situations
+## require directly manipulating patch property/value pairs.
+##
+## Instead of specifying polygons by matrices @var{x} and @var{y}, it is
+## possible to present a unique list of vertices and then a list of polygon
+## faces created from those vertices.  In this case the
+## @qcode{"Vertices"} matrix will be an @nospell{Nx2} (2-D patch) or
+## @nospell{Nx3} (3-D path).  The @nospell{MxN} @qcode{"Faces"} matrix
+## describes M polygons having N vertices---each row describes a
+## single polygon and each column entry is an index into the
+## @qcode{"Vertices"} matrix to identify a vertex.  The patch object
+## can be created by directly passing the property/value pairs
+## @qcode{"Vertices"}/@var{verts}, @qcode{"Faces"}/@var{faces} as
+## inputs.
+##
+## A third input form is to create a structure @var{fv} with the fields
+## @qcode{"vertices"}, @qcode{"faces"}, and optionally
+## @qcode{"facevertexcdata"}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+##
+## Implementation Note: Patches are highly configurable objects.  To truly
+## customize them requires setting patch properties directly.  Useful patch
+## properties are: @qcode{"cdata"}, @qcode{"edgecolor"},
+## @qcode{"facecolor"}, @qcode{"faces"}, @qcode{"facevertexcdata"}.
+## @seealso{fill, get, set}
+## @end deftypefn
+
+## Author: jwe
+
+function h = patch (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
+  
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  [htmp, failed] = __patch__ (hax, varargin{:});
+
+  if (failed)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! %% Patches with same number of vertices
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! patch ([x1,x2], [y1,y2], 'r');
+
+%!demo
+%! %% Unclosed patch
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! patch ([[x1;NaN(8,1)],x2], [[y1;NaN(8,1)],y2], 'r');
+
+%!demo
+%! %% Specify vertices and faces separately
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! vert = [x1, y1; x2, y2];
+%! fac = [1:8,NaN(1,8);9:24];
+%! patch ('Faces',fac, 'Vertices',vert, 'FaceColor','r');
+
+%!demo
+%! %% Specify vertices and faces separately
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! vert = [x1, y1; x2, y2];
+%! fac = [1:8,NaN(1,8);9:24];
+%! patch ('Faces',fac, 'Vertices',vert, 'FaceVertexCData',[0, 1, 0; 0, 0, 1]);
+
+%!demo
+%! %% Property change on multiple patches
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1]));
+%! pause (1);
+%! set (h, 'FaceColor', 'r');
+
+%!demo
+%! clf;
+%! vertices = [0, 0, 0;
+%!             1, 0, 0;
+%!             1, 1, 0;
+%!             0, 1, 0;
+%!             0.5, 0.5, 1];
+%! faces = [1, 2, 5;
+%!          2, 3, 5;
+%!          3, 4, 5;
+%!          4, 1, 5];
+%! patch ('Vertices', vertices, 'Faces', faces, ...
+%!        'FaceVertexCData', jet (4), 'FaceColor', 'flat');
+%! view (-37.5, 30);
+
+%!demo
+%! clf;
+%! vertices = [0, 0, 0;
+%!             1, 0, 0;
+%!             1, 1, 0;
+%!             0, 1, 0;
+%!             0.5, 0.5, 1];
+%! faces = [1, 2, 5;
+%!          2, 3, 5;
+%!          3, 4, 5;
+%!          4, 1, 5];
+%! patch  ('Vertices', vertices, 'Faces', faces, ...
+%!        'FaceVertexCData', jet (5), 'FaceColor', 'interp');
+%! view (-37.5, 30);
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [0 1 1 0];
+%! y = [0 0 1 1];
+%! subplot (2,1,1);
+%!  title ('Blue, Light-Green, and Red Horizontal Bars');
+%!  patch (x, y + 0, 1);
+%!  patch (x, y + 1, 2);
+%!  patch (x, y + 2, 3);
+%! subplot (2,1,2);
+%!  title ('Blue, Light-Green, and Red Vertical Bars');
+%!  patch (x + 0, y, 1 * ones (size (x)));
+%!  patch (x + 1, y, 2 * ones (size (x)));
+%!  patch (x + 2, y, 3 * ones (size (x)));
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [0 1 1 0];
+%! y = [0 0 1 1];
+%! subplot (2,1,1);
+%!  title ('Blue horizontal bars: Dark to Light');
+%!  patch (x, y + 0, 1, 'cdatamapping', 'direct');
+%!  patch (x, y + 1, 9, 'cdatamapping', 'direct');
+%!  patch (x, y + 2, 17, 'cdatamapping', 'direct');
+%! subplot (2,1,2);
+%!  title ('Blue vertical bars: Dark to Light');
+%!  patch (x + 0, y, 1 * ones (size (x)), 'cdatamapping', 'direct');
+%!  patch (x + 1, y, 9 * ones (size (x)), 'cdatamapping', 'direct');
+%!  patch (x + 2, y, 17 * ones (size (x)), 'cdatamapping', 'direct');
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [ 0 0; 1 1; 1 0 ];
+%! y = [ 0 0; 0 1; 1 1 ];
+%! p = patch (x, y, 'facecolor', 'b');
+%! set (p, 'cdatamapping', 'direct', 'facecolor', 'flat', 'cdata', [1 32]);
+%! title ('Direct mapping of colors: Light-Green UL and Blue LR triangles');
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [ 0 0; 1 1; 1 0 ];
+%! y = [ 0 0; 0 1; 1 1 ];
+%! p = patch (x, y, [1 32]);
+%! title ('Autoscaling of colors: Red UL and Blue LR triangles');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = patch ();
+%!   assert (findobj (hf, "type", "patch"), h);
+%!   assert (get (h, "xdata"), [0; 1; 0], eps);
+%!   assert (get (h, "ydata"), [1; 1; 0], eps);
+%!   assert (isempty (get (h, "zdata")));
+%!   assert (isempty (get (h, "cdata")));
+%!   assert (get (h, "faces"), [1, 2, 3], eps);
+%!   assert (get (h, "vertices"), [0 1; 1 1; 0 0], eps);
+%!   assert (get (h, "type"), "patch");
+%!   assert (get (h, "facecolor"), [0 0 0]);
+%!   assert (get (h, "linestyle"), get (0, "defaultpatchlinestyle"));
+%!   assert (get (h, "linewidth"), get (0, "defaultpatchlinewidth"), eps);
+%!   assert (get (h, "marker"), get (0, "defaultpatchmarker"));
+%!   assert (get (h, "markersize"), get (0, "defaultpatchmarkersize"));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! c = 0.9;
+%! unwind_protect
+%!   h = patch ([0 1 0], [0 1 1], c);
+%!   assert (get (gca, "clim"), [c - 1, c + 1]);
+%!   h = patch ([0 1 0], [0 1 1], 2 * c);
+%!   assert (get (gca, "clim"), [c, 2 * c]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pcolor.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,119 @@
+## Copyright (C) 2007-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pcolor (@var{x}, @var{y}, @var{c})
+## @deftypefnx {Function File} {} pcolor (@var{c})
+## @deftypefnx {Function File} {} pcolor (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} pcolor (@dots{})
+## Produce a 2-D density plot.
+##
+## A @code{pcolor} plot draws rectangles with colors from the matrix @var{c}
+## over the two-dimensional region represented by the matrices @var{x} and
+## @var{y}.  @var{x} and @var{y} are the coordinates of the mesh's vertices
+## and are typically the output of @code{meshgrid}.  If @var{x} and @var{y} are
+## vectors, then a typical vertex is (@var{x}(j), @var{y}(i), @var{c}(i,j)).
+## Thus, columns of @var{c} correspond to different @var{x} values and rows
+## of @var{c} correspond to different @var{y} values.
+##
+## The values in @var{c} are scaled to span the range of the current
+## colormap.  Limits may be placed on the color axis by the command
+## @code{caxis}, or by setting the @code{clim} property of the parent axis.
+##
+## The face color of each cell of the mesh is determined by interpolating
+## the values of @var{c} for each of the cell's vertices; Contrast this with
+## @code{imagesc} which renders one cell for each element of @var{c}.
+##
+## @code{shading} modifies an attribute determining the manner by which the
+## face color of each cell is interpolated from the values of @var{c},
+## and the visibility of the cells' edges.  By default the attribute is
+## @qcode{"faceted"}, which renders a single color for each cell's face with
+## the edge visible.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{caxis, shading, meshgrid, contour, imagesc}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function h = pcolor (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pcolor", varargin{:});
+
+  if (nargin == 1)
+    c = varargin{1};
+    [nr, nc] = size (c);
+    [x, y] = meshgrid (1:nc, 1:nr);
+    z = zeros (nr, nc);
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    c = varargin{3};
+    z = zeros (size (c));
+  else
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = surface (x, y, z, c);
+
+    set (htmp, "facecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [0, 90], "box", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! pcolor (Z);
+%! title ('pcolor() of peaks with facet shading');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = sombrero ();
+%! [Fx,Fy] = gradient (Z);
+%! pcolor (X,Y,Fx+Fy);
+%! shading interp;
+%! axis tight;
+%! title ('pcolor() of peaks with interp shading');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/peaks.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,95 @@
+## Copyright (C) 2007-2012 Paul Kienzle
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} peaks ()
+## @deftypefnx {Function File} {} peaks (@var{n})
+## @deftypefnx {Function File} {} peaks (@var{x}, @var{y})
+## @deftypefnx {Function File} {@var{z} =} peaks (@dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} peaks (@dots{})
+## Plot a function with lots of local maxima and minima.
+##
+## The function has the form
+##
+## @tex
+## $$f(x,y) = 3 (1 - x) ^ 2 e ^ {\left(-x^2 - (y+1)^2\right)} - 10 \left({x \over 5} - x^3 - y^5)\right) - {1 \over 3} e^{\left(-(x+1)^2 - y^2\right)}$$
+## @end tex
+## @ifnottex
+## @verbatim
+## f(x,y) = 3*(1-x)^2*exp(-x^2 - (y+1)^2) ...
+##          - 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2) ...
+##          - 1/3*exp(-(x+1)^2 - y^2)
+## @end verbatim
+## @end ifnottex
+##
+## Called without a return argument, @code{peaks} plots the surface of the
+## above function using @code{surf}.
+## 
+## If @var{n} is a scalar, @code{peaks} plots the value of the above
+## function on an @var{n}-by-@var{n} mesh over the range [-3,3].  The
+## default value for @var{n} is 49.
+##
+## If @var{n} is a vector, then it represents the grid values over which
+## to calculate the function.  If @var{x} and @var{y} are specified then
+## the function value is calculated over the specified grid of vertices.
+##
+## When called with output arguments, return the data for the function
+## evaluated over the meshgrid.  This can subsequently be plotted with
+## @code{surf (@var{x}, @var{y}, @var{z})}.
+## 
+## @seealso{sombrero, meshgrid, mesh, surf}
+## @end deftypefn
+
+## Expression for the peaks function was taken from the following paper:
+## http://www.control.hut.fi/Kurssit/AS-74.115/Material/GENALGgoga.pdf
+
+function [X_out, Y_out, Z_out] = peaks (x, y)
+
+  if (nargin == 0)
+    x = y = linspace (-3, 3, 49);
+  elseif (nargin == 1)
+    if (length (x) > 1)
+      y = x;
+    else
+      x = y = linspace (-3, 3, x);
+    endif
+  endif
+
+  if (isvector (x) && isvector (y))
+    [X, Y] = meshgrid (x, y);
+  else
+    X = x;
+    Y = y;
+  endif
+
+  Z = 3 * (1 - X) .^ 2 .* exp (- X .^ 2 - (Y + 1) .^ 2) ...
+      - 10 * (X / 5 - X .^ 3 - Y .^ 5) .* exp (- X .^ 2 - Y .^ 2) ...
+      - 1 / 3 * exp (- (X + 1) .^ 2 - Y .^ 2);
+
+  if (nargout == 0)
+    surf (x, y, Z);
+  elseif (nargout == 1)
+    X_out = Z;
+  else
+    X_out = X;
+    Y_out = Y;
+    Z_out = Z;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pie.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,103 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pie (@var{x})
+## @deftypefnx {Function File} {} pie (@dots{}, @var{explode})
+## @deftypefnx {Function File} {} pie (@dots{}, @var{labels})
+## @deftypefnx {Function File} {} pie (@var{hax}, @dots{});
+## @deftypefnx {Function File} {@var{h} =} pie (@dots{});
+## Plot a 2-D pie chart.
+##
+## When called with a single vector argument, produce a pie chart of the
+## elements in @var{x}.  The size of the ith slice is the percentage that the
+## element @var{x}i represents of the total sum of @var{x}:
+## @code{pct = @var{x}(i) / sum (@var{x})}. 
+##
+## The optional input @var{explode} is a vector of the same length as @var{x}
+## that, if non-zero, "explodes" the slice from the pie chart.
+##
+## The optional input @var{labels} is a cell array of strings of the same
+## length as @var{x} specifying the label for each slice.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a list of handles to the patch
+## and text objects generating the plot.
+##
+## Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
+## interpreted as percentages directly and are not normalized by @code{sum (x)}.
+## Furthermore, if the sum is less than 1 then there will be a missing slice
+## in the pie plot to represent the missing, unspecified percentage.
+##
+## @seealso{pie3, bar, hist, rose}
+## @end deftypefn
+
+## Very roughly based on pie.m from octave-forge whose author was
+## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
+
+function h = pie (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pie", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __pie__ ("pie", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! pie ([3, 2, 1], [0, 0, 1]);
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! title ('pie() with exploded wedge');
+
+%!demo
+%! clf;
+%! pie ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie() with labels');
+
+
+%!demo
+%! clf;
+%! pie ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie() with missing slice');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pie3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,103 @@
+## Copyright (C) 2007-2012 David Bateman
+## Copyright (C) 2010 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pie3 (@var{x})
+## @deftypefnx {Function File} {} pie3 (@dots{}, @var{explode})
+## @deftypefnx {Function File} {} pie3 (@dots{}, @var{labels})
+## @deftypefnx {Function File} {} pie3 (@var{hax}, @dots{});
+## @deftypefnx {Function File} {@var{h} =} pie3 (@dots{});
+## Plot a 3-D pie chart.
+##
+## Called with a single vector argument, produces a 3-D pie chart of the
+## elements in @var{x}.  The size of the ith slice is the percentage that the
+## element @var{x}i represents of the total sum of @var{x}:
+## @code{pct = @var{x}(i) / sum (@var{x})}. 
+##
+## The optional input @var{explode} is a vector of the same length as @var{x}
+## that, if non-zero, "explodes" the slice from the pie chart.
+##
+## The optional input @var{labels} is a cell array of strings of the same
+## length as @var{x} specifying the label for each slice.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a list of graphics handles to the
+## patch, surface, and text objects generating the plot.
+##
+## Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
+## interpreted as percentages directly and are not normalized by @code{sum (x)}.
+## Furthermore, if the sum is less than 1 then there will be a missing slice
+## in the pie plot to represent the missing, unspecified percentage.
+##
+## @seealso{pie, bar, hist, rose}
+## @end deftypefn
+
+## Very roughly based on pie.m from octave-forge whose author was
+## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
+
+function h = pie3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pie3", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __pie__ ("pie3", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! pie3 ([5:-1:1], [0, 0, 1, 0, 0]);
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! title ('pie3() with exploded wedge');
+
+%!demo
+%! clf;
+%! pie3 ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie3() with labels');
+
+%!demo
+%! clf;
+%! pie3 ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie3() with missing slice');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plot.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,285 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plot (@var{y})
+## @deftypefnx {Function File} {} plot (@var{x}, @var{y})
+## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} plot (@dots{}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} plot (@var{x1}, @var{y1}, @dots{}, @var{xn}, @var{yn})
+## @deftypefnx {Function File} {} plot (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} plot (@dots{})
+## Produce 2-D plots.
+##
+## Many different combinations of arguments are possible.  The simplest
+## form is
+##
+## @example
+## plot (@var{y})
+## @end example
+##
+## @noindent
+## where the argument is taken as the set of @var{y} coordinates and the
+## @var{x} coordinates are taken to be the range @code{1:numel (@var{y})}.
+##
+## If more than one argument is given, they are interpreted as
+##
+## @example
+## plot (@var{y}, @var{property}, @var{value}, @dots{})
+## @end example
+##
+## @noindent
+## or
+##
+## @example
+## plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @end example
+##
+## @noindent
+## or
+##
+## @example
+## plot (@var{x}, @var{y}, @var{fmt}, @dots{})
+## @end example
+##
+## @noindent
+## and so on.  Any number of argument sets may appear.  The @var{x} and
+## @var{y} values are interpreted as follows:
+##
+## @itemize @bullet
+## @item
+## If a single data argument is supplied, it is taken as the set of @var{y}
+## coordinates and the @var{x} coordinates are taken to be the indices of
+## the elements, starting with 1.
+##
+## @item
+## If @var{x} and @var{y} are scalars, a single point is plotted.
+##
+## @item
+## @code{squeeze()} is applied to arguments with more than two dimensions,
+## but no more than two singleton dimensions.
+## 
+## @item
+## If both arguments are vectors, the elements of @var{y} are plotted versus
+## the elements of @var{x}.
+##
+## @item
+## If @var{x} is a vector and @var{y} is a matrix, then
+## the columns (or rows) of @var{y} are plotted versus @var{x}.
+## (using whichever combination matches, with columns tried first.)
+##
+## @item
+## If the @var{x} is a matrix and @var{y} is a vector,
+## @var{y} is plotted versus the columns (or rows) of @var{x}.
+## (using whichever combination matches, with columns tried first.)
+##
+## @item
+## If both arguments are matrices, the columns of @var{y} are plotted
+## versus the columns of @var{x}.  In this case, both matrices must have
+## the same number of rows and columns and no attempt is made to transpose
+## the arguments to make the number of rows match.
+## @end itemize
+##
+## Multiple property-value pairs may be specified, but they must appear
+## in pairs.  These arguments are applied to the line objects drawn by
+## @code{plot}.  Useful properties to modify are @qcode{"linestyle"},
+## @qcode{"linewidth"}, @qcode{"color"}, @qcode{"marker"},
+## @qcode{"markersize"}, @qcode{"markeredgecolor"}, @qcode{"markerfacecolor"}.
+##
+## The @var{fmt} format argument can also be used to control the plot style.
+## The format is composed of three parts: linestyle, markerstyle, color. 
+## When a markerstyle is specified, but no linestyle, only the markers are
+## plotted.  Similarly, if a linestyle is specified, but no markerstyle, then
+## only lines are drawn.  If both are specified then lines and markers will
+## be plotted.  If no @var{fmt} and no @var{property}/@var{value} pairs are
+## given, then the default plot style is solid lines with no markers and the
+## color determined by the @qcode{"colororder"} property of the current axes.
+##
+## Format arguments:
+##
+## @table @asis
+## @item linestyle
+##
+## @multitable @columnfractions 0.06 0.94
+## @item @samp{-}  @tab Use solid lines (default).
+## @item @samp{--} @tab Use dashed lines.
+## @item @samp{:}  @tab Use dotted lines.
+## @item @samp{-.} @tab Use dash-dotted lines.
+## @end multitable
+##
+## @item markerstyle
+##
+## @multitable @columnfractions 0.06 0.94
+## @item @samp{+} @tab crosshair
+## @item @samp{o} @tab circle
+## @item @samp{*} @tab star
+## @item @samp{.} @tab point
+## @item @samp{x} @tab cross
+## @item @samp{s} @tab square
+## @item @samp{d} @tab diamond
+## @item @samp{^} @tab upward-facing triangle
+## @item @samp{v} @tab downward-facing triangle
+## @item @samp{>} @tab right-facing triangle
+## @item @samp{<} @tab left-facing triangle
+## @item @samp{p} @tab pentagram
+## @item @samp{h} @tab hexagram
+## @end multitable
+##
+## @item color
+##
+## @multitable @columnfractions 0.06 0.94
+## @item @samp{k} @tab blacK
+## @item @samp{r} @tab Red
+## @item @samp{g} @tab Green
+## @item @samp{b} @tab Blue
+## @item @samp{m} @tab Magenta
+## @item @samp{c} @tab Cyan
+## @item @samp{w} @tab White
+## @end multitable
+##
+## @item @qcode{";key;"}
+## Here @qcode{"key"} is the label to use for the plot legend.
+## @end table
+##
+## The @var{fmt} argument may also be used to assign legend keys.
+## To do so, include the desired label between semicolons after the
+## formatting sequence described above, e.g., @qcode{"+b;Key Title;"}.
+## Note that the last semicolon is required and Octave will generate
+## an error if it is left out.
+##
+## Here are some plot examples:
+##
+## @example
+## plot (x, y, "or", x, y2, x, y3, "m", x, y4, "+")
+## @end example
+##
+## This command will plot @code{y} with red circles, @code{y2} with solid
+## lines, @code{y3} with solid magenta lines, and @code{y4} with points
+## displayed as @samp{+}.
+##
+## @example
+## plot (b, "*", "markersize", 10)
+## @end example
+##
+## This command will plot the data in the variable @code{b},
+## with points displayed as @samp{*} and a marker size of 10.
+##
+## @example
+## @group
+## t = 0:0.1:6.3;
+## plot (t, cos(t), "-;cos(t);", t, sin(t), "-b;sin(t);");
+## @end group
+## @end example
+##
+## This will plot the cosine and sine functions and label them accordingly
+## in the legend.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the created line objects.
+##
+## To save a plot, in one of several image formats such as PostScript
+## or PNG, use the @code{print} command.
+##
+## @seealso{axis, box, grid, hold, legend, title, xlabel, ylabel, xlim, ylim, ezplot, errorbar, fplot, line, plot3, polar, loglog, semilogx, semilogy, subplot}
+## @end deftypefn
+
+## Author: jwe
+
+function h = plot (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __plt__ ("plot", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! x = 1:5;  y = 1:5;
+%! plot (x,y,'g');
+%! title ('plot() of green line at 45 degrees');
+
+%!demo
+%! x = 1:5;  y = 1:5;
+%! plot (x,y,'g*');
+%! title ('plot() of green stars along a line at 45 degrees');
+
+%!demo
+%! x1 = 1:5;  y1 = 1:5;
+%! x2 = 5:9; y2 = 5:-1:1;
+%! plot (x1,y1,'bo-', x2,y2,'rs-');
+%! axis ('tight');
+%! title ({'plot() of blue circles ascending and red squares descending';
+%!         'connecting lines drawn'}); 
+
+%!demo
+%! x = 0:10;
+%! plot (x, rand (numel (x), 3))
+%! axis ([0 10 0 1])
+%! title ({'Three random variables', 'x[1x11], y[11x3]'})
+
+%!demo
+%! x = 0:10;
+%! plot (x, rand (3, numel (x)))
+%! axis ([0 10 0 1])
+%! title ({'Three random variables', 'x[1x11], y[3x11]'})
+
+%!demo
+%! x = 0:10;
+%! plot (repmat (x, 2, 1), rand (2, numel (x)), '-s')
+%! axis ([0 10 0 1])
+%! title ({'Vertical lines with random height and lengths', ...
+%!         'x[2x11], y[2,11]'})
+
+%!demo
+%! x = 0:10;
+%! plot (repmat (x(:), 1, 2), rand (numel (x), 2))
+%! axis ([0 10 0 1])
+%! title ({'Two random variables', 'x[11x2], y[11x2]'})
+
+%!demo
+%! x = 0:10;
+%! shape = [1, 1, numel(x), 2];
+%! x = reshape (repmat (x(:), 1, 2), shape);
+%! y = rand (shape);
+%! plot (x, y)
+%! axis ([0 10 0 1])
+%! title ({'Two random variables', 'squeezed from 4-d arrays'})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plot3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,388 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plot3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{prop}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{fmt})
+## @deftypefnx {Function File} {} plot3 (@var{x}, @var{cplx})
+## @deftypefnx {Function File} {} plot3 (@var{cplx})
+## @deftypefnx {Function File} {} plot3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} plot3 (@dots{})
+## Produce 3-D plots.
+##
+## Many different combinations of arguments are possible.  The simplest
+## form is
+##
+## @example
+## plot3 (@var{x}, @var{y}, @var{z})
+## @end example
+##
+## @noindent
+## in which the arguments are taken to be the vertices of the points to
+## be plotted in three dimensions.  If all arguments are vectors of the
+## same length, then a single continuous line is drawn.  If all arguments
+## are matrices, then each column of is treated as a separate line.  No attempt
+## is made to transpose the arguments to make the number of rows match.
+##
+## If only two arguments are given, as
+##
+## @example
+## plot3 (@var{x}, @var{cplx})
+## @end example
+##
+## @noindent
+## the real and imaginary parts of the second argument are used
+## as the @var{y} and @var{z} coordinates, respectively.
+##
+## If only one argument is given, as
+##
+## @example
+## plot3 (@var{cplx})
+## @end example
+##
+## @noindent
+## the real and imaginary parts of the argument are used as the @var{y}
+## and @var{z} values, and they are plotted versus their index.
+##
+## Arguments may also be given in groups of three as
+##
+## @example
+## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{})
+## @end example
+##
+## @noindent
+## in which each set of three arguments is treated as a separate line or
+## set of lines in three dimensions.
+##
+## To plot multiple one- or two-argument groups, separate each group
+## with an empty format string, as
+##
+## @example
+## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{})
+## @end example
+##
+## Multiple property-value pairs may be specified which will affect the line
+## objects drawn by @code{plot3}.  If the @var{fmt} argument is supplied it
+## will format the line objects in the same manner as @code{plot}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## @group
+## z = [0:0.05:5];
+## plot3 (cos (2*pi*z), sin (2*pi*z), z, ";helix;");
+## plot3 (z, exp (2i*pi*z), ";complex sinusoid;");
+## @end group
+## @end example
+## @seealso{ezplot3, plot}
+## @end deftypefn
+
+## Author: Paul Kienzle
+##         (modified from __plt__.m)
+
+function retval = plot3 (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("plot3", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    x_set = 0;
+    y_set = 0;
+    z_set = 0;
+    property_set = 0;
+    fmt_set = 0;
+    properties = {};
+    tlgnd = {};
+    hlgnd = [];
+    idx = 0;
+
+    ## Gather arguments, decode format, and plot lines.
+    arg = 0;
+    while (arg++ < nargs)
+      new = varargin{arg};
+      new_cell = varargin(arg);
+
+      if (property_set)
+        properties = [properties, new_cell];
+        property_set = 0;
+        continue;
+      endif
+
+      if (ischar (new))
+        if (! z_set)
+          if (! y_set)
+            if (! x_set)
+              error ("plot3: needs X, [ Y, [ Z ] ]");
+            else
+              y = real (x);
+              z = imag (x);
+              y_set = 1;
+              z_set = 1;
+              if (rows (x) > 1)
+                x = repmat ((1:rows (x))', 1, columns (x));
+              else
+                x = 1:columns (x);
+              endif
+            endif
+          else
+            z = imag (y);
+            y = real (y);
+            z_set = 1;
+          endif
+        endif
+
+        if (! fmt_set)
+          [options, valid] = __pltopt__ ("plot3", new, false);
+          if (! valid)
+            properties = [properties, new_cell];
+            property_set = 1;
+            continue;
+          else
+            fmt_set = 1;
+            while (arg < nargs && ischar (varargin{arg+1}))
+              if (nargs - arg < 2)
+                error ("plot3: properties must appear followed by a value");
+              endif
+              properties = [properties, varargin(arg+1:arg+2)];
+              arg += 2;
+            endwhile
+          endif
+        else
+          properties = [properties, new_cell];
+          property_set = 1;
+          continue;
+        endif
+
+        if (isvector (x) && isvector (y))
+          if (isvector (z))
+            x = x(:);
+            y = y(:);
+            z = z(:);
+          elseif (length (x) == rows (z) && length (y) == columns (z))
+            [x, y] = meshgrid (x, y);
+          else
+            error ("plot3: [length(X), length(Y)] must match size (Z)");
+          endif
+        endif
+
+        if (! size_equal (x, y, z))
+          error ("plot3: X, Y, and Z must have the same shape");
+        elseif (ndims (x) > 2)
+          error ("plot3: X, Y, and Z must not have more than two dimensions");
+        endif
+
+        for i = 1 : columns (x)
+          linestyle = options.linestyle;
+          marker = options.marker;
+          if (isempty (marker) && isempty (linestyle))
+             [linestyle, marker] = __next_line_style__ ();
+          endif
+          color = options.color;
+          if (isempty (color))
+            color = __next_line_color__ ();
+          endif
+
+          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
+                              "color", color, "linestyle", linestyle,
+                              "marker", marker, properties{:});
+          key = options.key;
+          if (! isempty (key))
+            hlgnd = [hlgnd, htmp(idx)];
+            tlgnd = {tlgnd{:}, key};
+          endif
+        endfor
+
+        x_set = 0;
+        y_set = 0;
+        z_set = 0;
+        fmt_set = 0;
+        properties = {};
+      elseif (! x_set)
+        x = new;
+        x_set = 1;
+      elseif (! y_set)
+        y = new;
+        y_set = 1;
+      elseif (! z_set)
+        z = new;
+        z_set = 1;
+      else
+        if (isvector (x) && isvector (y))
+          if (isvector (z))
+            x = x(:);
+            y = y(:);
+            z = z(:);
+          elseif (length (x) == rows (z) && length (y) == columns (z))
+            [x, y] = meshgrid (x, y);
+          else
+            error ("plot3: [length(X), length(Y)] must match size (Z)");
+          endif
+        endif
+
+        if (! size_equal (x, y, z))
+          error ("plot3: X, Y, and Z must have the same shape");
+        elseif (ndims (x) > 2)
+          error ("plot3: X, Y, and Z must not have more than two dimensions");
+        endif
+
+        options = __default_plot_options__ ();
+        for i = 1 : columns (x)
+          linestyle = options.linestyle;
+          marker = options.marker;
+          if (isempty (marker) && isempty (linestyle))
+            [linestyle, marker] = __next_line_style__ ();
+          endif
+          color = options.color;
+          if (isempty (color))
+            color = __next_line_color__ ();
+          endif
+
+          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
+                              "color", color, "linestyle", linestyle,
+                              "marker", marker, properties{:});
+          key = options.key;
+          if (! isempty (key))
+            hlgnd = [hlgnd, htmp(idx)];
+            tlgnd = {tlgnd{:}, key};
+          endif
+        endfor
+
+        x = new;
+        y_set = 0;
+        z_set = 0;
+        fmt_set = 0;
+        properties = {};
+      endif
+
+    endwhile
+
+    if (property_set)
+      error ("plot3: properties must appear followed by a value");
+    endif
+
+    ## Handle last plot.
+
+    if (x_set)
+      if (y_set)
+        if (! z_set)
+          z = imag (y);
+          y = real (y);
+          z_set = 1;
+        endif
+      else
+        y = real (x);
+        z = imag (x);
+        y_set = 1;
+        z_set = 1;
+        if (rows (x) > 1)
+          x = repmat ((1:rows (x))', 1, columns (x));
+        else
+          x = 1:columns (x);
+        endif
+      endif
+
+      if (isvector (x) && isvector (y))
+        if (isvector (z))
+          x = x(:);
+          y = y(:);
+          z = z(:);
+        elseif (length (x) == rows (z) && length (y) == columns (z))
+          [x, y] = meshgrid (x, y);
+        else
+          error ("plot3: [length(X), length(Y)] must match size (Z)");
+        endif
+      endif
+
+      if (! size_equal (x, y, z))
+        error ("plot3: X, Y, and Z must have the same shape");
+      elseif (ndims (x) > 2)
+        error ("plot3: X, Y, and Z must not have more than two dimensions");
+      endif
+
+      options = __default_plot_options__ ();
+
+      for i = 1 : columns (x)
+        linestyle = options.linestyle;
+        marker = options.marker;
+        if (isempty (marker) && isempty (linestyle))
+          [linestyle, marker] = __next_line_style__ ();
+        endif
+        color = options.color;
+        if (isempty (color))
+          color = __next_line_color__ ();
+        endif
+
+        htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
+                            "color", color, "linestyle", linestyle,
+                            "marker", marker, properties{:});
+        key = options.key;
+        if (! isempty (key))
+          hlgnd = [hlgnd, htmp(idx)];
+          tlgnd = {tlgnd{:}, key};
+        endif
+      endfor
+    endif
+
+    if (! isempty (hlgnd))
+      legend (hax, hlgnd, tlgnd);
+    endif
+
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30]);
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0 && idx > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! z = [0:0.05:5];
+%! plot3 (cos (2*pi*z), sin (2*pi*z), z, ';helix;');
+%! title ('plot3() of a helix');
+
+%!demo
+%! clf;
+%! z = [0:0.05:5];
+%! plot3 (z, exp (2i*pi*z), ';complex sinusoid;');
+%! title ('plot3() with complex input');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plotmatrix.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,198 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plotmatrix (@var{x}, @var{y})
+## @deftypefnx {Function File} {} plotmatrix (@var{x})
+## @deftypefnx {Function File} {} plotmatrix (@dots{}, @var{style})
+## @deftypefnx {Function File} {} plotmatrix (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{h}, @var{ax}, @var{bigax}, @var{p}, @var{pax}] =} plotmatrix (@dots{})
+## Scatter plot of the columns of one matrix against another.
+##
+## Given the arguments @var{x} and @var{y}, that have a matching number of
+## rows, @code{plotmatrix} plots a set of axes corresponding to
+##
+## @example
+## plot (@var{x}(:, i), @var{y}(:, j))
+## @end example
+##
+## Given a single argument @var{x} this is equivalent to
+##
+## @example
+## plotmatrix (@var{x}, @var{x})
+## @end example
+##
+## @noindent
+## except that the diagonal of the set of axes will be replaced with the
+## histogram @code{hist (@var{x}(:, i))}.
+##
+## The marker to use can be changed with the @var{style} argument, that is a
+## string defining a marker in the same manner as the @code{plot} command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} provides handles to the individual
+## graphics objects in the scatter plots, whereas @var{ax} returns the
+## handles to the scatter plot axis objects.  @var{bigax} is a hidden
+## axis object that surrounds the other axes, such that the commands
+## @code{xlabel}, @code{title}, etc., will be associated with this hidden
+## axis.  Finally, @var{p} returns the graphics objects associated with
+## the histogram and @var{pax} the corresponding axes objects.
+##
+## Example:
+##
+## @example
+## plotmatrix (randn (100, 3), "g+")
+## @end example
+##
+## @seealso{scatter, plot}
+## @end deftypefn
+
+function [h, ax, bigax, p, pax] = plotmatrix (varargin)
+
+  [bigax2, varargin, nargin] = __plt_get_axis_arg__ ("plotmatrix", varargin{:});
+
+  if (nargin > 3 || nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (bigax2))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    bigax2 = newplot (bigax2);
+
+    [h2, ax2, p2, pax2] = __plotmatrix__ (bigax2, varargin{:});
+
+    axes (bigax2);
+    ctext = text (0, 0, "", "visible", "off",
+                  "handlevisibility", "off", "xliminclude", "off",
+                  "yliminclude", "off", "zliminclude", "off",
+                  "deletefcn", {@plotmatrixdelete, [ax2; pax2]});
+    set (bigax2, "visible", "off");
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = h2;
+    ax = ax2;
+    bigax = bigax2;
+    p = p2;
+    pax = pax2;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! plotmatrix (randn (100, 3), 'g+');
+
+
+function plotmatrixdelete (h, d, ax)
+  for i = 1 : numel (ax)
+    hc = ax(i);
+    if (isaxes (hc) && strcmpi (get (hc, "beingdeleted"), "off"))
+      parent = get (hc, "parent");
+      ## If the parent is invalid or being deleted, then do nothing
+      if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off"))
+        delete (hc);
+      endif
+    endif
+  endfor
+endfunction
+
+function [h, ax, p, pax] = __plotmatrix__ (bigax, varargin)
+  have_line_spec = false;
+  have_hist = false;
+  parent = get (bigax, "parent");
+  for i = 1 : nargin - 1
+    arg = varargin{i};
+    if (ischar (arg) || iscellstr (arg))
+      [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false);
+      if (valid)
+        have_line_spec = true;
+        linespec = varargin(i);
+        varargin(i) = [];
+        nargin = nargin - 1;
+        break;
+      else
+        print_usage ("plotmatrix");
+      endif
+    endif
+  endfor
+
+  if (nargin == 2)
+    X = varargin{1};
+    Y = X;
+    have_hist = true;
+  elseif (nargin == 3)
+    X = varargin{1};
+    Y = varargin{2};
+  else
+    print_usage ("plotmatrix");
+  endif
+
+  if (rows (X) != rows (Y))
+    error ("plotmatrix: dimension mismatch in the arguments");
+  endif
+
+  [dummy, m] = size (X);
+  [dummy, n] = size (Y);
+
+  h = [];
+  ax = [];
+  p = [];
+  pax = [];
+
+  xsize = 0.9 / m;
+  ysize = 0.9 / n;
+  xoff = 0.05;
+  yoff = 0.05;
+  border = [0.130, 0.110, 0.225, 0.185] .* [xsize, ysize, xsize, ysize];
+  border(3:4) = - border(3:4) - border(1:2);
+
+  for i = 1 : m
+    for j = 1 : n
+      pos = [xsize * (i - 1) + xoff, ysize * (n - j) + yoff, xsize, ysize];
+      tmp = axes ("outerposition", pos, "position", pos + border,
+                  "parent", parent);
+      if (i == j && have_hist)
+        pax = [pax ; tmp];
+        [nn, xx] = hist (X(:, i));
+        tmp = bar (xx, nn, 1.0);
+        p = [p; tmp];
+      else
+        ax = [ax ; tmp];
+        if (have_line_spec)
+          tmp = plot (X (:, i), Y (:, j), linespec);
+        else
+          tmp = plot (X (:, i), Y (:, j), ".");
+        endif
+        h = [h ; tmp];
+      endif
+    endfor
+  endfor
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plotyy.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,364 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2})
+## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun})
+## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun1}, @var{fun2})
+## @deftypefnx {Function File} {} plotyy (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{})
+## Plot two sets of data with independent y-axes.
+##
+## The arguments @var{x1} and @var{y1} define the arguments for the first plot
+## and @var{x1} and @var{y2} for the second.
+##
+## By default the arguments are evaluated with
+## @code{feval (@@plot, @var{x}, @var{y})}.  However the type of plot can be
+## modified with the @var{fun} argument, in which case the plots are
+## generated by @code{feval (@var{fun}, @var{x}, @var{y})}.  @var{fun} can be
+## a function handle, an inline function, or a string of a function name.
+##
+## The function to use for each of the plots can be independently defined
+## with @var{fun1} and @var{fun2}.
+##
+## If the first argument @var{hax} is an axes handle, then it defines
+## the principal axis in which to plot the @var{x1} and @var{y1} data.
+##
+## The return value @var{ax} is a vector with the axis handles of the two
+## y axes.  @var{h1} and @var{h2} are handles to the objects generated by the
+## plot commands.
+##
+## @example
+## @group
+## x = 0:0.1:2*pi;
+## y1 = sin (x);
+## y2 = exp (x - 1);
+## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy);
+## xlabel ("X");
+## ylabel (ax(1), "Axis 1");
+## ylabel (ax(2), "Axis 2");
+## @end group
+## @end example
+## @seealso{plot}
+## @end deftypefn
+
+function [Ax, H1, H2] = plotyy (varargin)
+
+  ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy
+  if (nargin > 1 && length (varargin{1}) == 2 && ishandle (varargin{1}(1))
+      && ishandle (varargin{1}(2))
+      && all (floor (varargin{1}) != varargin{1}))
+    obj1 = get (varargin{1}(1));
+    obj2 = get (varargin{1}(2));
+    if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes"))
+      ax = [obj1, obj2];
+      varargin(1) = [];
+      if (isempty (varargin))
+        varargin = {};
+      endif
+    else
+      error ("plotyy: expecting first argument to be axes handle");
+    endif
+    oldh = gca ();
+  else
+    f = get (0, "currentfigure");
+    if (isempty (f))
+      f = figure ();
+    endif
+    ca = get (f, "currentaxes");
+    if (isempty (ca))
+      ax = [];
+    elseif (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
+      ax = get (ca, "__plotyy_axes__");
+    else
+      ax = ca;
+    endif
+    if (length (ax) > 2)
+      for i = 3 : length (ax)
+        delete (ax (i));
+      endfor
+      ax = ax(1:2);
+    elseif (length (ax) == 1)
+      ax(2) = axes ();
+      set (ax(2), "nextplot", get (ax(1), "nextplot"));
+    elseif (isempty (ax))
+      ax(1) = axes ();
+      ax(2) = axes ();
+      ca = ax(2);
+    endif
+    if (nargin < 2)
+      varargin = {};
+    endif
+    oldh = ca;
+  endif
+
+  if (nargin < 4)
+    print_usage ();
+  endif
+
+  unwind_protect
+    [ax, h1, h2] = __plotyy__ (ax, varargin{:});
+  unwind_protect_cleanup
+    ## Only change back to the old axis if we didn't delete it
+    if (isaxes (oldh))
+      axes (oldh);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    Ax = ax;
+    H1 = h1;
+    H2 = h2;
+  endif
+
+endfunction
+
+function [ax, h1, h2] = __plotyy__ (ax, x1, y1, x2, y2, varargin)
+  if (nargin > 5)
+    fun1 = varargin{1};
+  else
+    fun1 = @plot;
+  endif
+  if (nargin > 6)
+    fun2 = varargin{2};
+  else
+    fun2 = fun1;
+  endif
+
+  xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])];
+
+  if (isaxes (ax(1)))
+    axes (ax(1));
+  else
+    ax(1) = axes ();
+  endif
+  newplot ();
+  h1 = feval (fun1, x1, y1);
+
+  set (ax(1), "ycolor", getcolor (h1(1)));
+  set (ax(1), "xlim", xlim);
+  set (ax(1), "color", "none");
+
+  cf = gcf ();
+  set (cf, "nextplot", "add");
+
+  if (isaxes (ax(2)))
+    axes (ax(2));
+  else
+    ax(2) = axes ();
+    set (ax(2), "nextplot", get (ax(1), "nextplot"));
+  endif
+  newplot ();
+
+  colors = get (ax(1), "colororder");
+  set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]);
+
+  if (strcmp (get (ax(1), "autopos_tag"), "subplot"))
+    set (ax(2), "autopos_tag", "subplot");
+  else
+    set (ax, "activepositionproperty", "position");
+  endif
+
+  ## Kluge, until __plt_get_axis_arg__ and newplot are reworked. 
+  set (ax(2), "nextplot", "replacechildren");
+  h2 = feval (fun2, ax(2), x2, y2);
+  set (ax(2), "yaxislocation", "right");
+  set (ax(2), "ycolor", getcolor (h2(1)));
+
+  if (strcmp (get(ax(1), "activepositionproperty"), "position"))
+    set (ax(2), "position", get (ax(1), "position"));
+  else
+    set (ax(2), "outerposition", get (ax(1), "outerposition"));
+    set (ax(2), "looseinset", get (ax(1), "looseinset"));
+  endif
+
+  set (ax(2), "xlim", xlim);
+  set (ax(2), "color", "none");
+  set (ax(2), "box", "off");
+
+  ## Add invisible text objects that when destroyed,
+  ## also remove the other axis
+  t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy",
+             "handlevisibility", "off", "visible", "off",
+             "xliminclude", "off", "yliminclude", "off");
+  t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy",
+             "handlevisibility", "off", "visible", "off",
+             "xliminclude", "off", "yliminclude", "off");
+
+  set (t1, "deletefcn", {@deleteplotyy, ax(2), t2});
+  set (t2, "deletefcn", {@deleteplotyy, ax(1), t1});
+
+  addlistener (ax(1), "position", {@update_position, ax(2)});
+  addlistener (ax(2), "position", {@update_position, ax(1)});
+  addlistener (ax(1), "outerposition", {@update_position, ax(2)});
+  addlistener (ax(2), "outerposition", {@update_position, ax(1)});
+  addlistener (ax(1), "looseinset", {@update_position, ax(2)});
+  addlistener (ax(2), "looseinset", {@update_position, ax(1)});
+  addlistener (ax(1), "view", {@update_position, ax(2)});
+  addlistener (ax(2), "view", {@update_position, ax(1)});
+  addlistener (ax(1), "plotboxaspectratio", {@update_position, ax(2)});
+  addlistener (ax(2), "plotboxaspectratio", {@update_position, ax(1)});
+  addlistener (ax(1), "plotboxaspectratiomode", {@update_position, ax(2)});
+  addlistener (ax(2), "plotboxaspectratiomode", {@update_position, ax(1)});
+  addlistener (ax(1), "nextplot", {@update_nextplot, ax(2)});
+  addlistener (ax(2), "nextplot", {@update_nextplot, ax(1)});
+
+  ## Store the axes handles for the sister axes.
+  if (ishandle (ax(1)) && ! isprop (ax(1), "__plotyy_axes__"))
+    addproperty ("__plotyy_axes__", ax(1), "data", ax);
+  elseif (ishandle (ax(1)))
+    set (ax(1), "__plotyy_axes__", ax);
+  else
+    error ("plotyy.m: This shouldn't happen. File a bug report.");
+  endif
+  if (ishandle (ax(2)) && ! isprop (ax(2), "__plotyy_axes__"))
+    addproperty ("__plotyy_axes__", ax(2), "data", ax);
+  elseif (ishandle (ax(2)))
+    set (ax(2), "__plotyy_axes__", ax);
+  else
+    error ("plotyy.m: This shouldn't happen. File a bug report.");
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.1:2*pi;
+%! y1 = sin (x);
+%! y2 = exp (x - 1);
+%! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
+%! xlabel ('X');
+%! ylabel (ax(1), 'Axis 1');
+%! ylabel (ax(2), 'Axis 2');
+%! axes (ax(1));
+%! text (0.5, 0.5, 'Left Axis', ...
+%!       'color', [0 0 1], 'horizontalalignment', 'center');
+%! axes (ax(2));
+%! text (4.5, 80, 'Right Axis', ...
+%!       'color', [0 0.5 0], 'horizontalalignment', 'center');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = linspace (-1, 1, 201);
+%! subplot (2,2,1);
+%!  plotyy (x,sin(pi*x), x,10*cos(pi*x));
+%! subplot (2,2,2);
+%!  surf (peaks (25));
+%! subplot (2,2,3);
+%!  contour (peaks (25));
+%! subplot (2,2,4);
+%!  plotyy (x,10*sin(2*pi*x), x,cos(2*pi*x));
+%! axis square;
+
+%!demo
+%! clf;
+%! x = linspace (-1, 1, 201);
+%! hax = plotyy (x, sin (pi*x), x, cos (pi*x));
+%! ylabel (hax(1), 'Blue on the Left');
+%! ylabel (hax(2), 'Green on the Right');
+%! xlabel ('xlabel');
+
+%!demo
+%! clf
+%! hold on
+%! t = (0:0.1:9);
+%! x = sin (t);
+%! y = 5 * cos (t);
+%! [hax, h1, h2] = plotyy (t, x, t, y);
+%! [~, h3, h4] = plotyy (t+1, x, t+1, y);
+%! set ([h3, h4], 'linestyle', '--');
+%! xlabel (hax(1), 'xlabel');
+%! title (hax(2), 'title');
+%! ylabel (hax(1), 'Left axis is Blue');
+%! ylabel (hax(2), 'Right axis is Green');
+
+function deleteplotyy (h, d, ax2, t2)
+  if (isaxes (ax2)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
+      && strcmp (get (ax2, "beingdeleted"), "off"))
+    set (t2, "deletefcn", []);
+    delete (ax2);
+  endif
+endfunction
+
+function update_nextplot (h, d, ax2)
+  persistent recursion = false;
+  prop = "nextplot";
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      set (ax2, prop, get (h, prop));
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_position (h, d, ax2)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      view = get (h, "view");
+      oldview = get (ax2, "view");
+      plotboxaspectratio = get (h, "plotboxaspectratio");
+      oldplotboxaspectratio = get (ax2, "plotboxaspectratio");
+      plotboxaspectratiomode = get (h, "plotboxaspectratiomode");
+      oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode");
+
+      if (strcmp (get(h, "activepositionproperty"), "position"))
+        position = get (h, "position");
+        oldposition = get (ax2, "position");
+        if (! (isequal (position, oldposition) && isequal (view, oldview)))
+          set (ax2, "position", position, "view", view);
+        endif
+      else
+        outerposition = get (h, "outerposition");
+        oldouterposition = get (ax2, "outerposition");
+        if (! (isequal (outerposition, oldouterposition) && isequal (view, oldview)))
+          set (ax2, "outerposition", outerposition, "view", view);
+        endif
+      endif
+
+      if (! (isequal (plotboxaspectratio, oldplotboxaspectratio)
+             && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode)))
+        set (ax2, "plotboxaspectratio", plotboxaspectratio);
+        set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode);
+      endif
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function color = getcolor (ax)
+  obj = get (ax);
+  if (isfield (obj, "color"))
+    color = obj.color;
+  elseif (isfield (obj, "facecolor") && ! ischar (obj.facecolor))
+    color = obj.facecolor;
+  elseif (isfield (obj, "edgecolor") && !  ischar (obj.edgecolor))
+    color = obj.edgecolor;
+  else
+    color = [0, 0, 0];
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/polar.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,217 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} polar (@var{theta}, @var{rho})
+## @deftypefnx {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt})
+## @deftypefnx {Function File} {} polar (@var{cplx})
+## @deftypefnx {Function File} {} polar (@var{cplx}, @var{fmt})
+## @deftypefnx {Function File} {} polar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} polar (@dots{})
+## Create a 2-D plot from polar coordinates @var{theta} and @var{rho}.
+##
+## If a single complex input @var{cplx} is given then the real part is used
+## for @var{theta} and the imaginary part is used for @var{rho}.
+##
+## The optional argument @var{fmt} specifies the line format in the same way
+## as @code{plot}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## @seealso{rose, compass, plot}
+## @end deftypefn
+
+## Author: jwe
+
+function h = polar (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    if (nargs == 3)
+      if (! ischar (varargin{3}))
+        error ("polar: FMT argument must be a string");
+      endif
+      htmp = __plr2__ (hax, varargin{:});
+      maxr = max (varargin{2}(:));
+    elseif (nargs == 2)
+      if (ischar (varargin{2}))
+        htmp = __plr1__ (hax, varargin{:});
+        if (iscomplex (varargin{1}))
+          maxr = max (imag (varargin{1})(:));
+        else
+          maxr = max (varargin{1}(:));
+        endif
+      else
+        fmt = "";
+        htmp = __plr2__ (hax, varargin{:}, fmt);
+        maxr = max (varargin{2}(:));
+      endif
+    elseif (nargs == 1)
+      fmt = "";
+      htmp = __plr1__ (hax, varargin{:}, fmt);
+      if (iscomplex (varargin{1}))
+        maxr = max (imag (varargin{1})(:));
+      else
+        maxr = max (varargin{1}(:));
+      endif
+    else
+      print_usage ();
+    endif
+
+    set (hax, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr],
+              "xaxislocation", "zero", "yaxislocation", "zero",
+              "plotboxaspectratio", [1, 1, 1]);
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+function retval = __plr1__ (h, theta, fmt)
+
+  theta = theta(:);
+  if (iscomplex (theta))
+    rho = imag (theta);
+    theta = real (theta);
+  else
+    rho = theta;
+    theta = (1:rows (rho))';
+  endif
+
+  retval = __plr2__ (h, theta, rho, fmt);
+
+endfunction
+
+function retval = __plr2__ (h, theta, rho, fmt)
+
+  if (ndims (theta) > 2 || ndims (rho) > 2)
+    error ("polar: THETA and RHO must be 2-D objects");
+  endif
+  theta = real (theta);
+  rho = real (rho);
+
+  if (isscalar (theta))
+    if (isscalar (rho))
+      x = rho * cos (theta);
+      y = rho * sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    else
+      error ("polar: Can't plot constant THETA with varying RHO");
+    endif
+  elseif (isvector (theta))
+    if (isvector (rho))
+      if (length (theta) != length (rho))
+        error ("polar: THETA and RHO vector lengths must match");
+      endif
+      rho = rho(:);
+      theta = theta(:);
+      x = rho .* cos (theta);
+      y = rho .* sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    elseif (ismatrix (rho))
+      theta = theta(:);
+      t_nr = rows (theta);
+      [r_nr, r_nc] = size (rho);
+      if (t_nr != r_nr)
+        rho = rho';
+        r_nr = r_nc;
+      endif
+      if (t_nr != r_nr)
+        error ("polar: THETA vector and RHO matrix sizes must match");
+      endif
+      x = diag (cos (theta)) * rho;
+      y = diag (sin (theta)) * rho;
+      retval = __plt__ ("polar", h, x, y, fmt);
+    else
+      error ("polar: invalid data for plotting");
+    endif
+  elseif (ismatrix (theta))
+    if (isvector (rho))
+      rho = rho(:);
+      r_nr = rows (rho);
+      [t_nr, t_nc] = size (theta);
+      if (r_nr != t_nr)
+        theta = theta';
+        t_nr = t_nc;
+      endif
+      if (r_nr != t_nr)
+        error ("polar: THETA matrix and RHO vector sizes must match");
+      endif
+      diag_r = diag (rho);
+      x = diag_r * cos (theta);
+      y = diag_r * sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    elseif (ismatrix (rho))
+      if (! size_equal (rho, theta))
+        error ("polar: THETA and RHO matrix dimensions must match");
+      endif
+      x = rho .* cos (theta);
+      y = rho .* sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    else
+      error ("polar: invalid data for plotting");
+    endif
+  else
+    error ("polar: invalid data for plotting");
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! theta = linspace (0,2*pi,1000);
+%! rho = sin (7*theta);
+%! polar (theta, rho);
+%! title ('polar() plot');
+
+%!demo
+%! clf;
+%! theta = linspace (0,2*pi,1000);
+%! cplx = theta + i*sin (7*theta);
+%! polar (cplx, 'g');
+%! title ('polar() plot of complex data');
+
+%!demo
+%! clf;
+%! theta = linspace (0,8*pi,1000);
+%! rho = sin (5/4*theta);
+%! polar (theta, rho);
+%! title ('polar() plot');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__add_datasource__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,52 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{newargs} =} __add_datasource__ (@var{fcn}, @var{h}, @var{data}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+function newargs = __add_datasource__ (fcn, h, data, varargin)
+
+  if (ischar (data))
+    data = {data};
+  endif
+
+  for i = 1 : numel (data)
+    addproperty (strcat (data{i}, "datasource"), h, "string", "");
+  endfor
+
+  i = 0;
+  newargs = {};
+  while (i < numel (varargin))
+    arg = varargin{++i};
+    if (i != numel (varargin) && ischar (arg)
+        && length (arg) > 9 && strcmpi (arg(end-9:end), "datasource"))
+      arg = tolower (arg);
+      val = varargin{++i};
+      if (ischar (val))
+        set (h, arg, val);
+      else
+        error ("%s: expecting data source to be a string", fcn);
+      endif
+    else
+      newargs{end + 1} = arg;
+    endif
+  endwhile
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__bar__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,479 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __bar__ (@var{vertical}, @var{func}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function varargout = __bar__ (vertical, func, varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (func, varargin{:});
+
+  ## Slightly smaller than 0.8 to avoid clipping issue in gnuplot 4.0
+  width = 0.8 - 10 * eps;
+  group = true;
+  histc = NA;
+  bv = 0;  # BaseValue
+
+  if (nargin > 1 && isnumeric (varargin{2}))
+    x = varargin{1};
+    if (isvector (x))
+      x = x(:);
+    endif
+    y = varargin{2};
+    if (isvector (y))
+      y = y(:);
+    endif
+    if (rows (x) != rows (y))
+      y = varargin{1};
+      if (isvector (y))
+        y = y(:);
+      endif
+      x = [1:rows(y)]';
+      idx = 2;
+    else
+      if (! isvector (x))
+        error ("%s: X must be a vector", func);
+      endif
+      idx = 3;
+    endif
+  else
+    y = varargin{1};
+    if (isvector (y))
+      y = y(:);
+    endif
+    x = [1:rows(y)]';
+    idx = 2;
+  endif
+
+  newargs = {};
+  have_line_spec = false;
+  while (idx <= nargin)
+    if (ischar (varargin{idx}) && strcmpi (varargin{idx}, "grouped"))
+      group = true;
+      idx++;
+    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "stacked"))
+      group = false;
+      idx++;
+    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "histc"))
+      group = true;
+      histc = true; 
+      idx++;
+    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "hist"))
+      group = true;
+      histc = false;
+      idx++;
+    else
+      if ((ischar (varargin{idx}) || iscellstr (varargin{idx}))
+          && ! have_line_spec)
+        [linespec, valid] = __pltopt__ (func, varargin{idx}, false);
+        if (valid)
+          have_line_spec = true;
+          ## FIXME: strange parse error requires semicolon to be spaced
+          ##        away from closing ']' on next line.
+          newargs = [{"facecolor", linespec.color}, newargs] ;
+          idx++;
+          continue;
+        endif
+      endif
+      if (isscalar (varargin{idx}))
+        width = varargin{idx++};
+      elseif (idx == nargin)
+        newargs = [newargs, varargin(idx++)];
+      elseif (ischar (varargin{idx})
+              && strcmpi (varargin{idx}, "basevalue")
+              && isscalar (varargin{idx+1}))
+        bv = varargin{idx+1};
+        idx += 2;
+      else
+        newargs = [newargs, varargin(idx:idx+1)];
+        idx += 2;
+      endif
+    endif
+  endwhile
+
+  ngrp = rows (x);
+  if (ngrp != rows (y))
+    error ("%s: length of X and Y must be equal", func);
+  endif
+  if (any (x(2:end) < x(1:end-1)))
+    error ("%s: X vector values must be in ascending order", func);
+  endif
+
+  nbars = columns (y);
+
+  ## Column width is 1 for 'hist*' styles.  Otherwise, same as group width.
+  if (nbars == 1)
+    cwidth = 1;
+    gwidth = width;
+  elseif (islogical (histc))
+    cwidth = 1;
+    gwidth = width^2;
+  else
+    cwidth = gwidth = width;
+  endif
+
+  ## Complicated algorithm sizes bars with unitless parameter width.
+  ## If width is 1.0, adjacent bars in a group are touching.
+  ## Otherwise, bar size is cwidth and the remaining space is split evenly on
+  ## either side of the bar.  For the default 0.8, spacing is [0.1 0.8 0.1].
+  ## Groups of bars are spaced by gwidth.  If gwidth is 1.0 then adjacent
+  ## groups will just touch.
+  if (numel (x) > 1)
+    cutoff = min (diff (double (x))) / 2;
+  else
+    cutoff = 1;
+  endif
+  if (group)
+    gdelta = cutoff * gwidth / nbars; 
+    cdelta = repmat ((1 - ((1 - cwidth) / 2)) * gdelta, size (x));
+  else
+    cdelta = repmat (cutoff * gwidth, size (x));
+  endif
+  x1 = (x - cdelta)(:)';
+  x2 = (x + cdelta)(:)';
+  xb = repmat ([x1; x1; x2; x2](:), 1, nbars);
+
+  if (group)
+    if (islogical (histc) && histc)
+      offset = 2*cdelta * [0:(nbars-1)] + cdelta(1);  # not centered
+    else
+      offset = 2*cdelta * [-(nbars - 1) / 2 : (nbars - 1) / 2];
+    endif
+
+    xb(1:4:4*ngrp,:) += offset + (1-cwidth) / 2 * (2 * gdelta);
+    xb(2:4:4*ngrp,:) += offset + (1-cwidth) / 2 * (2 * gdelta);
+    xb(3:4:4*ngrp,:) += offset - (1-cwidth) / 2 * (2 * gdelta);
+    xb(4:4:4*ngrp,:) += offset - (1-cwidth) / 2 * (2 * gdelta);
+
+    y0 = zeros (size (y)) + bv;
+    y1 = y;
+  else
+    y1 = cumsum (y,2);
+    y0 = [zeros(ngrp,1)+bv, y1(:,1:end-1)];
+  endif
+
+  yb = zeros (4*ngrp, nbars);
+  yb(1:4:4*ngrp,:) = y0;
+  yb(2:4:4*ngrp,:) = y1;
+  yb(3:4:4*ngrp,:) = y1;
+  yb(4:4:4*ngrp,:) = y0;
+
+  xb = reshape (xb, [4, ngrp, nbars]);
+  yb = reshape (yb, [4, ngrp, nbars]);
+
+  if (nargout < 2)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+
+      htmp = bars (hax, vertical, x, y, xb, yb, gwidth, group,
+                   have_line_spec, bv, newargs{:});
+
+      if (! ishold (hax))
+        if (all (x(:,1) == fix (x(:,1))))
+          if (vertical)
+            set (hax, "xtick", x(:,1));
+          else
+            set (hax, "ytick", x(:,1));
+          endif
+        endif
+        ## Hack prevents color and xlim setting changes when basevalue changes.
+        if (vertical)
+          set (hax, "clim", [0 1], "xlimmode", "manual");
+        else
+          set (hax, "clim", [0 1], "ylimmode", "manual");
+        endif
+      endif
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+    if (nargout == 1)
+      varargout{1} = htmp;
+    endif
+  else
+    if (vertical)
+      varargout{1} = xb;
+      varargout{2} = yb;
+    else
+      varargout{1} = yb;
+      varargout{2} = xb;
+    endif
+  endif
+
+endfunction
+
+function hglist = bars (hax, vertical, x, y, xb, yb, width, group, have_color_spec, base_value, varargin)
+
+  nbars = columns (y);
+  clim = get (hax, "clim");
+  hglist = [];
+
+  for i = 1:nbars
+    hg = hggroup ();
+    hglist = [hglist; hg];
+    args = __add_datasource__ ("bar", hg, {"x", "y"}, varargin{:});
+
+    if (vertical)
+      if (! have_color_spec)
+        if (nbars == 1)
+          lev = clim(1);
+        else
+          lev = (i - 1) * (clim(2) - clim(1)) / (nbars - 1) - clim(1);
+        endif
+        h = patch (hax, xb(:,:,i), yb(:,:,i),
+                        "FaceColor", "flat", "cdata", lev, "parent", hg);
+      else
+        h = patch (hax, xb(:,:,i), yb(:,:,i), "parent", hg);
+      endif
+    else
+      if (! have_color_spec)
+        if (nbars == 1)
+          lev = clim(1);
+        else
+          lev = (i - 1) * (clim(2) - clim(1)) / (nbars - 1) - clim(1);
+        endif
+        h = patch (hax, yb(:,:,i), xb(:,:,i),
+                        "FaceColor", "flat", "cdata", lev, "parent", hg);
+      else
+        h = patch (hax, yb(:,:,i), xb(:,:,i), "parent", hg);
+      endif
+    endif
+
+    if (i == 1)
+      ## Add baseline object the first time through loop
+      x_axis_range = get (hax, "xlim");
+      h_baseline = line (hax, x_axis_range, [base_value, base_value],
+                             "color", [0, 0, 0]);
+      set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
+      set (h_baseline, "parent", get (hg, "parent"));
+    endif
+
+    ## Setup the hggroup and listeners
+    addproperty ("showbaseline", hg, "radio", "{on}|off");
+    addproperty ("basevalue", hg, "data", base_value);
+    addproperty ("baseline", hg, "data", h_baseline);
+
+    addlistener (hg, "showbaseline", {@show_baseline, "showbl"});
+    addlistener (hg, "visible", {@show_baseline, "visib"});
+    addlistener (hg, "basevalue", @move_baseline);
+
+    addproperty ("barwidth", hg, "data", width);
+    if (group)
+      addproperty ("barlayout", hg, "radio", "stacked|{grouped}", "grouped");
+    else
+      addproperty ("barlayout", hg, "radio", "{stacked}|grouped", "stacked");
+    endif
+    if (vertical)
+      addproperty ("horizontal", hg, "radio", "on|{off}", "off");
+    else
+      addproperty ("horizontal", hg, "radio", "{on}|off", "on");
+    endif
+
+    addlistener (hg, "barwidth", @update_group);
+    addlistener (hg, "barlayout", @update_group);
+    addlistener (hg, "horizontal", @update_group);
+
+    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
+    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
+    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
+    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
+
+    addlistener (hg, "edgecolor", @update_props);
+    addlistener (hg, "facecolor", @update_props);
+    addlistener (hg, "linestyle", @update_props);
+    addlistener (hg, "linewidth", @update_props);
+
+    if (isvector (x))
+      addproperty ("xdata", hg, "data", x);
+    else
+      addproperty ("xdata", hg, "data", x(:, i));
+    endif
+    addproperty ("ydata", hg, "data", y(:, i));
+
+    addlistener (hg, "xdata", @update_data);
+    addlistener (hg, "ydata", @update_data);
+
+    addproperty ("bargroup", hg, "data");
+    set (hglist, "bargroup", hglist);
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    if (! isempty (args))
+      set (hg, args{:});
+    endif
+  endfor
+
+  update_xlim (hax, []);
+  ## Add listeners outside of for loop to prevent constant updating during
+  ## creation of plot when patch objects are added.
+  addlistener (hax, "xlim", @update_xlim);
+  addlistener (h_baseline, "ydata", @update_baseline);
+  addlistener (h_baseline, "visible", @update_baseline);
+
+endfunction
+
+function update_xlim (h, ~)
+  kids = get (h, "children");
+  xlim = get (h, "xlim");
+
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
+      if (any (get (obj.baseline, "xdata") != xlim))
+        set (obj.baseline, "xdata", xlim);
+      endif
+    endif
+  endfor
+endfunction
+
+function update_baseline (h, ~)
+  visible = get (h, "visible");
+  ydata = get (h, "ydata")(1);
+
+  ## Search axis for a bargroup that contains this baseline handle
+  kids = get (get (h, "parent"), "children");
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
+        && obj.baseline == h)
+      set (obj.bargroup, "showbaseline", visible, "basevalue", ydata);
+      break;
+    endif
+  endfor
+endfunction
+
+function show_baseline (h, ~, prop = "")
+  persistent recursion = false;
+  
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "bargroup");
+      if (strcmp (prop, "showbl"))
+        showbaseline = get (h, "showbaseline");
+        hlist = hlist(hlist != h);  # remove current handle being updated
+        set (hlist, "showbaseline", showbaseline);
+      elseif (strcmp (prop, "visib"))
+        showbaseline = "on";
+        if (all (strcmp (get (hlist, "visible"), "off")))
+          showbaseline = "off";
+        endif
+      endif
+      set (get (h, "baseline"), "visible", showbaseline);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function move_baseline (h, ~)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    recursion = true;
+    unwind_protect
+      b0 = get (h, "basevalue");
+      bl = get (h, "baseline");
+      set (bl, "ydata", [b0, b0]);
+
+      if (strcmp (get (h, "barlayout"), "grouped"))
+        update_data (h);
+      endif
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_props (h, ~)
+  kids = get (h, "children");
+  set (kids, {"edgecolor", "linewidth", "linestyle", "facecolor"},
+       get (h, {"edgecolor", "linewidth", "linestyle", "facecolor"}));
+endfunction
+
+function update_data (h, ~)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "bargroup");
+      x = get (h, "xdata");
+      if (! isvector (x))
+        x = x(:);
+      endif
+      ydat = get (hlist, "ydata");
+      if (iscell (ydat))
+        y = cell2mat (ydat.');
+      else
+        y = ydat;
+      endif
+
+      [xb, yb] = bar (x, y, get (h, "barwidth"), get (h, "barlayout"),
+                      "basevalue", get (h, "basevalue"));
+
+      vertical = strcmp (get (h, "horizontal"), "off");
+      for i = 1:columns (y)
+        hp = get (hlist(i), "children");
+        if (vertical)
+          set (hp, "xdata", xb(:,:,i), "ydata", yb(:,:,i));
+        else
+          set (hp, "xdata", yb(:,:,i), "ydata", xb(:,:,i));
+        endif
+      endfor
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_group (h, ~)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "bargroup");
+      barwidth = get (h, "barwidth");
+      barlayout = get (h, "barlayout");
+      horizontal = get (h, "horizontal");
+
+      hlist = hlist(hlist != h);  # remove current handle being updated
+      set (hlist, "barwidth", barwidth, "barlayout", barlayout,
+                  "horizontal", horizontal);
+      update_data (h);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__contour__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,558 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{c}, @var{hg}] =} __contour__ (@dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function [c, hg] = __contour__ (varargin)
+  ax = varargin{1};
+  zlevel = varargin{2};
+  filled = "off";
+
+  linespec.color = "auto";
+  linespec.linestyle = "-";
+  for i = 3:2:nargin
+    arg = varargin{i};
+    if (ischar (arg) || iscellstr (arg))
+      [lspec, valid] = __pltopt__ ("__contour__", arg, false);
+      if (valid)
+        have_line_spec = true;
+        varargin(i) = [];
+        linespec = lspec;
+        if (isempty (linespec.color))
+          linespec.color = "auto";
+        endif
+        if (isempty (linespec.linestyle))
+          linespec.linestyle = "-";
+        endif
+        break;
+      endif
+    endif
+  endfor
+
+  opts = {};
+  i = 3;
+  while (i < length (varargin))
+    if (ischar (varargin{i}))
+      if (strcmpi (varargin{i}, "fill"))
+        filled = varargin{i+1};
+        varargin(i:i+1) = [];
+      elseif (strcmpi (varargin{i}, "linecolor"))
+        linespec.color = varargin{i+1};
+        varargin(i:i+1) = [];
+      else
+        opts(end+(1:2)) = varargin(i:i+1);
+        varargin(i:i+1) = [];
+      endif
+    else
+      i++;
+    endif
+  endwhile
+
+  if (length (varargin) < 5)
+    z1 = varargin{3};
+    x1 = 1 : columns (z1);
+    y1 = 1 : rows (z1);
+  else
+    x1 = varargin{3};
+    y1 = varargin{4};
+    z1 = varargin{5};
+  endif
+  if (! ismatrix (z1) || ! ismatrix (x1) || ! ismatrix (y1))
+    error ("__contour__: X, Y, and Z must be matrices");
+  endif
+  if (length (varargin) == 4 || length (varargin) == 6)
+    vn = varargin{end};
+    vnauto = false;
+  else
+    vn = 10;
+    vnauto = true;
+  endif
+
+  if (isscalar (vn))
+    ## FIXME: The levels should be determined similarly to {x,y,z}ticks
+    ##        so that they aren't set at extremely odd values.
+    lvl = linspace (min (z1(!isinf (z1))), max (z1(!isinf (z1))), vn + 2);
+    ## Strip off max outlier, min must stay for contourf hole algorithm.
+    lvl = lvl(1:end-1);
+  else
+    lvl = sort (vn);
+  endif
+
+  if (strcmpi (filled, "on"))
+    if (isvector (x1) || isvector (y1))
+      [x1, y1] = meshgrid (x1, y1);
+    endif
+    [nr, nc] = size (z1);
+    x0 = prepad (x1, nc+1, 2 * x1(1, 1) - x1(1, 2), 2);
+    x0 = postpad (x0, nc+2, 2 * x1(1, nc) - x1(1, nc - 1), 2);
+    x0 = [x0(1, :); x0; x0(1, :)];
+    y0 = prepad (y1, nr+1, 2 * y1(1, 1) - y1(2, 1), 1);
+    y0 = postpad (y0, nr+2, 2 * y1(nr, 1) - y1(nr - 1, 1));
+    y0 = [y0(:, 1), y0, y0(:, 1)];
+    z0 = -Inf (nr+2, nc+2);
+    z0(2:nr+1, 2:nc+1) = z1;
+    [c, lev] = contourc (x0, y0, z0, lvl);
+  else
+    [c, lev] = contourc (x1, y1, z1, lvl);
+  endif
+
+  hg = hggroup ();
+  opts = __add_datasource__ ("__countour__", hg, {"x", "y", "z"}, opts{:});
+
+  addproperty ("xdata", hg, "data", x1);
+  addproperty ("ydata", hg, "data", y1);
+  addproperty ("zdata", hg, "data", z1);
+  addproperty ("contourmatrix", hg, "data", c);
+
+  addlistener (hg, "xdata", @update_data);
+  addlistener (hg, "ydata", @update_data);
+  addlistener (hg, "zdata", @update_data);
+  addlistener (hg, "contourmatrix", @update_data);
+
+  addproperty ("fill", hg, "radio", "on|{off}", filled);
+
+  ## The properties zlevel and zlevelmode don't exist in matlab, but allow the
+  ## use of contourgroups with the contour3, meshc, and surfc functions.
+  if (isnumeric (zlevel))
+    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", "manual");
+    addproperty ("zlevel", hg, "data", zlevel);
+  else
+    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", zlevel);
+    addproperty ("zlevel", hg, "data", 0.);
+  endif
+
+  lvlstep = sum (diff (lvl)) / (length (lvl) - 1);
+
+  addproperty ("levellist", hg, "data", lev);
+  addproperty ("levelstep", hg, "double", lvlstep);
+  if (vnauto)
+    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
+    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
+  elseif (isscalar (vn))
+    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
+    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "manual");
+  else
+    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "manual");
+    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
+  endif
+
+  addproperty ("labelspacing", hg, "double", 144);
+  addproperty ("textlist", hg, "data", lev);
+  addproperty ("textlistmode", hg, "radio", "{auto}|manual", "auto");
+  addproperty ("textstep", hg, "double", lvlstep);
+  addproperty ("textstepmode", hg, "radio", "{auto}|manual", "auto");
+  addproperty ("showtext", hg, "radio", "on|{off}", "off");
+
+  addproperty ("linecolor", hg, "color", linespec.color, "{auto}|none");
+  addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
+  addproperty ("linewidth", hg, "linelinewidth", 0.5);
+
+  ## Matlab property, although Octave does not implement it.
+  addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+  addlistener (hg, "fill", {@update_data, "fill"});
+
+  addlistener (hg, "zlevelmode", @update_zlevel);
+  addlistener (hg, "zlevel", @update_zlevel);
+
+  addlistener (hg, "levellist", {@update_data, "levellist"});
+  addlistener (hg, "levelstep", {@update_data, "levelstep"});
+  addlistener (hg, "levellistmode", @update_data);
+  addlistener (hg, "levelstepmode", @update_data);
+
+  addlistener (hg, "labelspacing", @update_text);
+  addlistener (hg, "textlist", {@update_text, "textlist"});
+  addlistener (hg, "textlistmode", @update_text);
+  addlistener (hg, "textstep", {@update_text, "textstep"});
+  addlistener (hg, "textstepmode", @update_text);
+  addlistener (hg, "showtext", @update_text);
+
+  addlistener (hg, "linecolor", @update_line);
+  addlistener (hg, "linestyle", @update_line);
+  addlistener (hg, "linewidth", @update_line);
+
+  ## Set axis before adding patches so that each new patch does not trigger
+  ## new axis calculation.  No need if mode is already "manual".
+  if (all (strcmp (get (gca (), {"xlimmode", "ylimmode"}), "auto")))
+    axis ([min(x1(:)) max(x1(:)) min(y1(:)) max(y1(:))]);
+  endif
+
+  add_patch_children (hg);
+
+  if (! isempty (opts))
+    set (hg, opts{:});
+  endif
+
+endfunction
+
+function add_patch_children (hg)
+  c = get (hg, "contourmatrix");
+  lev = get (hg, "levellist");
+  fill = get (hg, "fill");
+  zlev = get (hg, "zlevel");
+  zmode = get (hg, "zlevelmode");
+  lc = get (hg, "linecolor");
+  lw = get (hg, "linewidth");
+  ls = get (hg, "linestyle");
+  filled = get (hg, "fill");
+  ca = gca ();
+
+  ## Turn off automatic updating of clim while adding patches
+  climmode = get (ca, "climmode");
+  set (ca, "climmode", "manual"); 
+
+  if (strcmp (lc, "auto"))
+    lc = "flat";
+  endif
+
+  if (strcmp (filled, "on"))
+
+    lvl_eps = get_lvl_eps (lev);
+
+    ## Decode contourc output format.
+    i = 1;
+    ncont = 0;
+    while (i < columns (c))
+      ncont++;
+      cont_lev(ncont) = c(1, i);
+      cont_len(ncont) = c(2, i);
+      cont_idx(ncont) = i+1;
+      ii = i + (1:cont_len(ncont));
+      cont_area(ncont) = polyarea (c(1, ii), c(2, ii));
+      i += cont_len(ncont) + 1;
+    endwhile
+
+    ## Handle for each level the case where we have (a) hole(s) in a patch.
+    ## Those are to be filled with the color of level below or with the
+    ## background colour.
+    for k = 1:numel (lev)
+      lvl_idx = find (abs (cont_lev - lev(k)) < lvl_eps);
+      len = numel (lvl_idx);
+      if (len > 1)
+        mark = false (size (lvl_idx));
+        a = 1;
+        while (a < len)
+          ## take 1st patch
+          pa_idx = lvl_idx(a);
+          ## get pointer to contour start, and contour length
+          curr_ct_idx = cont_idx(pa_idx);
+          curr_ct_len = cont_len(pa_idx);
+          ## get contour
+          curr_ct = c(:, curr_ct_idx:curr_ct_idx+curr_ct_len-1);
+          b_vec = (a+1):len;
+          next_ct_pt_vec = c(:, cont_idx(lvl_idx(b_vec)));
+          in = inpolygon (next_ct_pt_vec(1,:), next_ct_pt_vec(2,:),
+                          curr_ct(1, :), curr_ct(2, :));
+          mark(b_vec(in)) = ! mark(b_vec(in));
+          a++;
+        endwhile
+        if (numel (mark) > 0)
+          ## All marked contours describe a hole in a larger contour of
+          ## the same level and must be filled with colour of level below.
+          ma_idx = lvl_idx(mark);
+          if (k > 1)
+            ## Find color of level below.
+            tmp = find (abs (cont_lev - lev(k - 1)) < lvl_eps);
+            lvl_bel_idx = tmp(1);
+            ## Set color of patches found.
+            cont_lev(ma_idx) = cont_lev(lvl_bel_idx);
+          else
+            ## Set lowest level contour to NaN.
+            cont_lev(ma_idx) = NaN;
+          endif
+        endif
+      endif
+    endfor
+
+    ## The algorithm can create patches with the size of the plotting
+    ## area, we would like to draw only the patch with the highest level.
+    del_idx = [];
+    max_idx = find (cont_area == max (cont_area));
+    if (numel (max_idx) > 1)
+      ## delete double entries
+      del_idx = max_idx(1:end-1);
+      cont_area(del_idx) = cont_lev(del_idx) = [];
+      cont_len(del_idx) = cont_idx(del_idx) = [];
+    endif
+
+    ## Now we have everything together and can start plotting the patches
+    ## beginning with largest area.
+    [~, svec] = sort (cont_area);
+    len = ncont - numel (del_idx);
+    h = [];
+    for n = len:-1:1
+      idx = svec(n);
+      ctmp = c(:, cont_idx(idx):cont_idx(idx) + cont_len(idx) - 1);
+      if (all (ctmp(:,1) == ctmp(:,end)))
+        ## patch() doesn't need/want closed contour.  It will do it itself.
+        ctmp(:,end) = [];
+      endif
+      if (isnan (cont_lev(idx)))
+        fc = get (ca, "color");
+        if (strcmp (fc, "none"))
+          fc = get (ancestor (ca, "figure"), "color");
+        endif
+      else
+        fc = "flat";
+      endif
+      h = [h; __go_patch__(ca, "xdata", ctmp(1, :)(:), "ydata", ctmp(2, :)(:),
+                           "vertices", ctmp.', "faces", 1:(cont_len(idx)-1),
+                           "facevertexcdata", cont_lev(idx), "facecolor", fc,
+                           "cdata", cont_lev(idx), "edgecolor", lc,
+                           "linestyle", ls, "linewidth", lw,
+                           "parent", hg)];
+    endfor
+
+    if (min (lev) == max (lev))
+      set (ca, "clim", [min(lev)-1, max(lev)+1], "layer", "top");
+    else
+      set (ca, "clim", [min(lev), max(lev)], "layer", "top");
+    endif
+  else
+    ## Decode contourc output format.
+    h = [];
+    i = 1;
+    while (i < length (c))
+      clev = c(1,i);
+      clen = c(2,i);
+
+      if (all (c(:,i+1) == c(:,i+clen)))
+        p = c(:, i+1:i+clen-1).';
+      else
+        p = [c(:, i+1:i+clen), NaN(2, 1)].';
+      endif
+
+      switch (zmode)
+        case "none"
+          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
+                               "zdata", [],
+                               "vertices", p, "faces", 1:rows (p),
+                               "facevertexcdata", clev, "facecolor", "none",
+                               "cdata", clev, "edgecolor", lc,
+                               "linestyle", ls, "linewidth", lw,
+                               "parent", hg)];
+        case "auto"
+          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
+                               "zdata", clev * ones (rows (p),1),
+                               "vertices", [p, clev * ones(rows(p),1)],
+                               "faces", 1:rows(p),
+                               "facevertexcdata", clev, "facecolor", "none",
+                               "cdata", clev, "edgecolor", lc,
+                               "linestyle", ls, "linewidth", lw,
+                               "parent", hg)];
+        otherwise
+          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
+                               "zdata", zlev * ones (rows (p), 1),
+                               "vertices", [p, zlev * ones(rows(p),1)],
+                               "faces", 1:rows (p),
+                               "facevertexcdata", clev, "facecolor", "none",
+                               "cdata", clev, "edgecolor", lc,
+                               "linestyle", ls, "linewidth", lw,
+                               "parent", hg)];
+      endswitch
+      i += clen + 1;
+    endwhile
+  endif
+
+  set (ca, "climmode", climmode);
+
+endfunction
+
+function update_zlevel (h, ~)
+  z = get (h, "zlevel");
+  zmode = get (h, "zlevelmode");
+  kids = get (h, "children");
+
+  switch (zmode)
+    case "none"
+      set (kids, "zdata", []);
+    case "auto"
+      for i = 1 : length (kids)
+        set (kids(i), "zdata", get (kids(i), "cdata") .*
+             ones (size (get (kids(i), "xdata"))));
+      endfor
+    otherwise
+      for i = 1 : length (kids)
+        set (kids(i), "zdata", z .* ones (size (get (kids(i), "xdata"))));
+      endfor
+  endswitch
+endfunction
+
+function update_line (h, ~)
+  lc = get (h, "linecolor");
+  if (strcmp (lc, "auto"))
+    lc = "flat";
+  endif
+  set (findobj (h, "type", "patch"), "edgecolor", lc,
+       "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"));
+endfunction
+
+function update_data (h, ~, prop = "")
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+
+    delete (get (h, "children"));
+
+    switch (prop)
+      case "levellist"
+        set (h, "levellistmode", "manual")
+      case "levelstep"
+        set (h, "levelstepmode", "manual")
+      case "fill"
+        ## Switching from filled ('k' linespec) to unfilled, reset linecolor
+        if (strcmp (get (h, "fill"), "off"))
+          set (h, "linecolor", "auto");
+        else
+          set (h, "linecolor", "black");
+        endif
+    endswitch
+
+    if (strcmp (get (h, "levellistmode"), "manual")
+        && ! strcmp (prop, "levelstep"))
+      lvl = get (h, "levellist");
+    elseif (strcmp (get (h, "levelstepmode"), "manual"))
+      z = get (h, "zdata");
+      lvs = get (h, "levelstep");
+      lvl(1) = ceil (min (z(:)) / lvs) * lvs;
+      lvl(2) = floor (max (z(:)) / lvs) * lvs;
+      if (lvl(1) >= lvl(2))
+        lvl = median (z(:));
+      else
+        lvl = lvl(1) : lvs : lvl(2);
+      endif
+      set (h, "levellist", lvl);
+      set (h, "levellistmode", "auto");
+    else
+      z = get (h, "zdata");
+      ## FIXME: The levels should be determined similarly to {x,y,z}ticks
+      ##        so that they aren't set at extremely odd values.
+      lvl = linspace (min (z(!isinf (z))), max (z(!isinf (z))), 10 + 2);
+      ## Strip off max outlier, min must stay for contourf hole algorithm.
+      lvl = lvl(1:end-1);
+    endif
+
+    if (strcmp (get (h, "fill"), "on"))
+      X = get (h, "xdata");
+      Y = get (h, "ydata");
+      Z = get (h, "zdata");
+      if (isvector (X) || isvector (Y))
+        [X, Y] = meshgrid (X, Y);
+      endif
+      [nr, nc] = size (Z);
+      X0 = prepad (X, nc+1, 2 * X(1, 1) - X(1, 2), 2);
+      X0 = postpad (X0, nc+2, 2 * X(1, nc) - X(1, nc - 1), 2);
+      X0 = [X0(1, :); X0; X0(1, :)];
+      Y0 = prepad (Y, nr+1, 2 * Y(1, 1) - Y(2, 1), 1);
+      Y0 = postpad (Y0, nr+2, 2 * Y(nr, 1) - Y(nr - 1, 1));
+      Y0 = [Y0(:, 1), Y0, Y0(:, 1)];
+      Z0 = -Inf (nr+2, nc+2);
+      Z0(2:nr+1, 2:nc+1) = Z;
+      [c, lev] = contourc (X0, Y0, Z0, lvl);
+    else
+      [c, lev] = contourc (get (h, "xdata"), get (h, "ydata"),
+                           get (h, "zdata"), lvl);
+    endif
+    set (h, "contourmatrix", c);
+
+    if (strcmp (get (h, "levellistmode"), "manual"))
+      ## Do nothing
+    elseif (strcmp (get (h, "levelstepmode"), "manual"))
+      set (h, "levellist", lev);
+    else
+      set (h, "levellist", lev);
+      lvlstep = sum (diff (lvl)) / (length (lvl) - 1);
+      set (h, "levelstep", lvlstep);
+    endif
+
+    add_patch_children (h);
+    update_text (h);
+    recursive = false;
+  endif
+
+endfunction
+
+function update_text (h, ~, prop = "")
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+
+    delete (findobj (h, "type", "text"));
+
+    switch (prop)
+      case "textlist"
+        set (h, "textlistmode", "manual")
+      case "textstep"
+        set (h, "textstepmode", "manual")
+    endswitch
+
+    if (strcmp (get (h, "textlistmode"), "manual"))
+      lvl = get (h, "textlist");
+    elseif (strcmp (get (h, "textstepmode"), "manual"))
+      lev = get (h, "levellist");
+
+      lvl_eps = get_lvl_eps (lev);
+
+      stp = get (h, "textstep");
+      t = [0, floor(cumsum(diff (lev)) / (abs(stp) - lvl_eps))];
+      lvl = lev([true, t(1:end-1) != t(2:end)]);
+      set (h, "textlist", lvl);
+    else
+      lvl = get (h, "levellist");
+      set (h, "textlist", lvl, "textstep", get (h, "levelstep"));
+    endif
+
+    if (strcmp (get (h, "showtext"), "on"))
+      switch (get (h, "zlevelmode"))
+        case "manual"
+          __clabel__ (get (h, "contourmatrix"), lvl, h,
+                      get (h, "labelspacing"), get (h, "zlevel"));
+        case "auto"
+          __clabel__ (get (h, "contourmatrix"), lvl, h,
+                      get (h, "labelspacing"), "auto");
+        otherwise
+          __clabel__ (get (h, "contourmatrix"), lvl, h,
+                      get (h, "labelspacing"), []);
+      endswitch
+    endif
+
+    recursive = false;
+  endif
+endfunction
+
+function lvl_eps = get_lvl_eps (lev)
+  ## FIXME: is this the right thing to do for this tolerance?  Should
+  ## it be an absolute or relative tolerance, or switch from one to the
+  ## other depending on the value of lev?
+  if (isscalar (lev))
+    lvl_eps = abs (lev) * sqrt (eps) + sqrt (eps);
+  else
+    tmp = min (abs (diff (lev)));
+    if (tmp < 10*eps)
+      lvl_eps = sqrt (eps);
+    else
+      lvl_eps = tmp / 1000.0;
+    endif
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__errcomm__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,79 @@
+## Copyright (C) 2001-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __errcomm__ (@var{caller}, @var{hax}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Created: 20.02.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function retval = __errcomm__ (caller, hax, varargin)
+
+  if (nargin < 4)
+    print_usage (caller);
+  endif
+
+  retval = [];
+  data = cell (6,1);
+  nargs = numel (varargin);
+  k = 1;
+  while (k <= nargs)
+    arg = varargin{k++};
+    if (! ismatrix (arg))
+      error ("%s: data argument %d must be numeric", caller, k-1);
+    endif
+    if (isvector (arg))
+      arg = arg(:);
+    endif
+    sz = size (arg);
+    ndata = 1;
+    data{ndata} = arg;
+    while (k <= nargs)
+      arg = varargin{k++};
+      if (ischar (arg) || iscellstr (arg))
+        retval(end+1,1) = __errplot__(arg, hax, data{1:ndata});
+        break;
+      endif
+      if (! ismatrix (arg))
+        error ("%s: data argument %d must be numeric", caller, k-1);
+      endif
+      if (isvector (arg))
+        arg = arg(:);
+      endif
+      if (any (size (arg) != sz))
+        error ("%s: size of argument %d does not match others", caller, k-1);
+      endif
+      data{++ndata} = arg;
+      if (ndata > 6)
+        error ("%s: too many arguments to plot", caller);
+      endif
+    endwhile
+  endwhile
+
+  ## No format code found, use yerrorbar
+  if (! (ischar (arg) || iscellstr (arg)))
+    retval = [retval; __errplot__("~", hax, data{1:ndata})];
+  endif
+
+  drawnow ();
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__errplot__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,349 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __errplot__ (@var{fstr}, @var{hax}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Created: 18.7.2000
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = __errplot__ (fstr, hax, varargin)
+
+  fmt = __pltopt__ ("__errplot__", fstr);
+
+  ## Set the plot type based on linestyle.
+  switch (fmt.errorstyle) 
+    case "~"
+      ifmt = "yerr";
+    case ">"
+      ifmt = "xerr";
+    case "~>"
+      ifmt = "xyerr";
+    case "#"
+      ifmt = "box";
+    case "#~"
+      ifmt = "boxy";
+    case "#~>"
+      ifmt = "boxxy";
+    otherwise
+      ifmt = "yerr";
+  endswitch
+
+  h = [];
+  nplots = columns (varargin{1});
+  for i = 1:nplots
+
+    if (isempty (fmt.color))
+      lc = __next_line_color__ ();
+    else
+      lc = fmt.color ();
+    endif
+    if (isempty (fmt.marker) && isempty (fmt.linestyle))
+      [ls, mk] = __next_line_style__ ();
+    else
+      ls = fmt.linestyle;
+      mk = fmt.marker;
+    endif
+
+    ## Must occur after __next_line_color__ in order to work correctly.
+    hg = hggroup ("parent", hax);
+    h = [h; hg];
+    args = __add_datasource__ ("__errplot__", hg,
+                               {"x", "y", "l", "u", "xl", "xu"});
+
+    hl = [(__line__ (hg, "color", lc, "linestyle", ls, "marker", mk)),
+          (__line__ (hg, "color", lc, "linestyle", "-", "marker", "none"))];
+
+    switch (numel (varargin))
+      case 2
+        ydata = varargin{1}(:,i);
+        xdata = 1:numel (ydata);
+        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
+          ldata  = varargin{2}(:,i);
+          udata  = ldata;
+          xldata = [];
+          xudata = [];
+        elseif (strcmp (ifmt, "xerr") || strcmp (ifmt, "box"))
+          xldata = varargin{2}(:,i);
+          xudata = ldata;
+          ldata  = [];
+          udata  = [];
+        else
+          error ("errorbar: 2 column errorplot is only valid for xerr or yerr");
+        endif
+      case 3
+        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          ldata  = varargin{3}(:,i);
+          udata  = ldata;
+          xldata = [];
+          xudata = [];
+        elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
+          ydata  = varargin{1}(:,i);
+          xdata  = 1:numel (ydata);
+          xldata = varargin{2}(:,i);
+          xudata = xldata;
+          ldata  = varargin{3}(:,i);
+          udata  = ldata;
+        else  # xerr or box
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = xldata;
+          ldata  = [];
+          udata  = [];
+        endif
+      case 4
+        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          ldata  = varargin{3}(:,i);
+          udata  = varargin{4}(:,i);
+          xldata = [];
+          xudata = [];
+        elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = xldata;
+          ldata  = varargin{4}(:,i);
+          udata  = ldata;
+        else  # xerr or box
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = varargin{4}(:,i);
+          ldata  = [];
+          udata  = [];
+        endif
+      case 6  # xyerr, boxxy
+        if (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = varargin{4}(:,i);
+          ldata  = varargin{5}(:,i);
+          udata  = varargin{6}(:,i);
+        else
+          error ("errorbar: error plot with 6 columns only valid for xyerr and boxxy");
+        endif
+      otherwise
+        error ("errorbar: error plot requires 2, 3, 4, or 6 arguments");
+    endswitch
+
+    addproperty ("xdata", hg, "data", xdata(:));
+    addproperty ("ydata", hg, "data", ydata(:));
+    addproperty ("ldata", hg, "data", ldata(:));
+    addproperty ("udata", hg, "data", udata(:));
+    addproperty ("xldata", hg, "data", xldata(:));
+    addproperty ("xudata", hg, "data", xudata(:));
+    addproperty ("format", hg, "string", ifmt);
+
+    addproperty ("color", hg, "linecolor", get (hl(1), "color"));
+    addproperty ("linestyle", hg, "linelinestyle", get (hl(1), "linestyle"));
+    addproperty ("linewidth", hg, "linelinewidth", get (hl(1), "linewidth"));
+    addproperty ("marker", hg, "linemarker", get (hl(1), "marker"));
+    addproperty ("markeredgecolor", hg, "linemarkerfacecolor",
+                 get (hl(1), "markeredgecolor"));
+    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
+                 get (hl(1), "markerfacecolor"));
+    addproperty ("markersize", hg, "linemarkersize",
+                 get (hl(1), "markersize"));
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    fcn = {@update_props, hl};
+    addlistener (hg, "color", fcn);
+    addlistener (hg, "linestyle", fcn);
+    addlistener (hg, "linewidth", fcn);
+    addlistener (hg, "marker", fcn);
+    addlistener (hg, "markeredgecolor", fcn);
+    addlistener (hg, "markerfacecolor", fcn);
+    addlistener (hg, "markersize", fcn);
+
+    fcn = {@update_data, hl};
+    addlistener (hg, "xdata", fcn);
+    addlistener (hg, "ydata", fcn);
+    addlistener (hg, "ldata", fcn);
+    addlistener (hg, "udata", fcn);
+    addlistener (hg, "xldata", fcn);
+    addlistener (hg, "xudata", fcn);
+    addlistener (hg, "format", fcn);
+
+    hax = ancestor (hg, "axes");
+    addlistener (hax, "xscale", fcn);
+    addlistener (hax, "yscale", fcn);
+
+    update_data (hg, [], hl);
+
+  endfor
+
+  ## Process legend key
+  if (! isempty (fmt.key))    
+    hlegend = [];
+    fkids = get (gcf (), "children");
+    for i = 1 : numel (fkids)
+      if (   strcmp (get (fkids(i), "type"), "axes")
+          && strcmp (get (fkids(i), "tag"), "legend"))
+        udata = get (fkids(i), "userdata");
+        if (! isempty (intersect (udata.handle, gca ())))
+          hlegend = fkids (i);
+          break;
+        endif
+      endif
+    endfor
+
+    if (isempty (hlegend))
+      hlgnd = [];
+      tlgnd = {};
+    else
+      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
+    endif
+ 
+    hlgnd(end+1) = hg;
+    tlgnd(end+1) = fmt.key;
+
+    legend (gca (), hlgnd, tlgnd);
+  endif
+
+endfunction
+
+function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata,
+                                         xldata, xudata, ifmt,
+                                         xscale, yscale)
+  if (strcmp (xscale, "linear"))
+    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
+    xlo = xdata - dx;
+    xhi = xdata + dx;
+  else
+    n = xdata > 0;
+    if (! any (n))
+      n = xdata < 0;
+    endif
+    logdata = log (abs (xdata(n)));
+    rx = exp (0.01 * (max (logdata) - min (logdata)));
+    xlo = xdata/rx;
+    xhi = xdata*rx;
+  endif
+  if (strcmp (yscale, "linear"))
+    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
+    ylo = ydata - dy;
+    yhi = ydata + dy;
+  else
+    n = ydata > 0;
+    if (! any (n))
+      n = ydata < 0;
+    endif
+    logdata = log (abs (ydata(n)));
+    ry = exp (0.01 * (max (logdata) - min (logdata)));
+    ylo = ydata/ry;
+    yhi = ydata*ry;
+  endif
+  nans = NaN + xdata(:);  # fast way to do NaN (size (xdata(:)))
+  if (strcmp (ifmt, "yerr"))
+    xdata = [xdata, xdata, nans, ...
+             xlo, xhi, nans, ...
+             xlo, xhi, nans];
+    ydata = [ydata-ldata, ydata+udata, nans, ...
+             ydata+udata, ydata+udata, nans, ...
+             ydata-ldata, ydata-ldata, nans];
+  elseif (strcmp (ifmt, "xerr"))
+    xdata = [xdata-xldata, xdata+xudata, nans, ...
+             xdata+xudata, xdata+xudata, nans, ...
+             xdata-xldata, xdata-xldata, nans];
+    ydata = [ydata, ydata, nans, ...
+             ylo, yhi, nans, ...
+             ylo, yhi, nans];
+  elseif (strcmp (ifmt, "boxy"))
+    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
+    xdata = [xlo, xhi, xhi, xlo, xlo, nans];
+    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
+             ydata-ldata, nans];
+  elseif (strcmp (ifmt, "box"))
+    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
+    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
+             xdata-xldata, nans];
+    ydata = [ylo, ylo, yhi, yhi, ylo, nans];
+  elseif (strcmp (ifmt, "boxxy"))
+    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
+             xdata-xldata, nans];
+    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
+             ydata-ldata, nans];
+  elseif (strcmp (ifmt, "xyerr"))
+    [x1, y1] = errorbar_data (xdata, ydata, ldata, udata,
+                              xldata, xudata, "xerr", xscale, yscale);
+    [x2, y2] = errorbar_data (xdata, ydata, ldata, udata,
+                              xldata, xudata, "yerr", xscale, yscale);
+    xdata = [x1; x2];
+    ydata = [y1; y2];
+    return;
+  else
+    error ("errorbar: valid error bar types are xerr, yerr, xyerr, box, boxy, boxxy");
+  endif
+
+  xdata = xdata.'(:);
+  ydata = ydata.'(:);
+
+endfunction
+
+function update_props (hg, ~, hl)
+  set (hl, "color", get (hg, "color"),
+           "linewidth", get (hg, "linewidth"));
+  set (hl(1), "linestyle", get (hg, "linestyle"),
+              "marker", get (hg, "marker"),
+              "markeredgecolor", get (hg, "markeredgecolor"),
+              "markerfacecolor", get (hg, "markerfacecolor"),
+              "markersize", get (hg, "markersize"));
+endfunction
+
+function update_data (hg, ~, hl)
+
+  if (strcmp (get (hg, "type"), "axes"))
+    hax = hg;
+    hg = ancestor (hl(1), "hggroup");
+  else
+    hax = ancestor (hg, "axes");
+  endif
+  xscale = get (hax, "xscale");
+  yscale = get (hax, "yscale");
+
+  xdata  = get (hg, "xdata");
+  ydata  = get (hg, "ydata");
+  ldata  = get (hg, "ldata");
+  udata  = get (hg, "udata");
+  xldata = get (hg, "xldata");
+  xudata = get (hg, "xudata");
+  ifmt = get (hg, "format");
+
+  set (hl(1), "xdata", xdata);
+  set (hl(1), "ydata", ydata);
+
+  [errorbar_xdata, errorbar_ydata] = ...
+          errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, ...
+                         ifmt, xscale, yscale);
+
+  set (hl(2), "xdata", errorbar_xdata);
+  set (hl(2), "ydata", errorbar_ydata);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__ezplot__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,565 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{h}, @var{needusage}] =} __ezplot__ (@var{pltfunc}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Overview: This function is the back-end for the 9 ez* plot functions.
+##           As such, most of the function is actually dedicated to sorting
+##           out the inputs and verifying that the particular ez* function
+##           called was called correctly.  The actual plotting occurs near
+##           the end in an unwind_protect block. 
+
+function [h, needusage] = __ezplot__ (pltfunc, varargin)
+
+  ezfunc = ["ez" pltfunc];
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (ezfunc, varargin{:});
+
+  ## Define outputs early in case of shorting out of function with return;
+  h = [];
+  needusage = false;
+  if (nargin < 1)
+    needusage = true;
+    return;
+  endif
+
+  iscontour = strncmp (pltfunc, "contour", 7);
+
+  ## Defaults for ezplot
+  isplot  = true;
+  isplot3 = false;
+  ispolar = false;
+  nargs = 1;
+  switch (pltfunc)
+    case "plot"
+      ## defaults already set
+
+    case "plot3"
+      isplot  = false;
+      isplot3 = true;
+  
+    case "polar"
+      isplot  = false;
+      ispolar = true;
+    
+    otherwise
+      ## contour, mesh, surf plots
+      isplot  = false;
+      nargs = 2;
+
+  endswitch
+
+  parametric = false;
+  fun = varargin{1};
+  if (ischar (fun))
+    if (exist (fun, "file") || exist (fun, "builtin"))
+      fun = inline ([fun "(t)"]);
+    else
+      fun = vectorize (inline (fun));
+    endif
+    argids = argnames (fun);
+    if (isplot && length (argids) == 2)
+      nargs = 2;
+    elseif (numel (argids) != nargs)
+      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+    endif
+    fstr = formula (fun);
+    if (isplot)
+      xarg = argids{1};
+      if (nargs == 2)
+        yarg = argids{2};
+      else
+        yarg = "";
+      endif
+    elseif (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = argids{1};
+      yarg = argids{2};
+    endif
+  elseif (strcmp (typeinfo (fun), "inline function"))
+    argids = argnames (fun);
+    if (isplot && length (argids) == 2)
+      nargs = 2;
+    elseif (numel (argids) != nargs)
+      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+    endif
+    fun = vectorize (fun);
+    fstr = formula (fun);
+    if (isplot)
+      xarg = argids{1};
+      if (nargs == 2)
+        yarg = argids{2};
+      else
+        yarg = "";
+      endif
+    elseif (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (isplot || ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = argids{1};
+      yarg = argids{2};
+    endif
+  elseif (isa (fun, "function_handle"))
+    fstr = func2str (fun);
+    idx = index (fstr, ')');
+    if (idx != 0)
+      args = regexp (fstr(3:(idx-1)), '\w+', 'match');
+      fstr = fstr(idx+2:end);  # remove '@(x) ' from string name
+    else
+      args = {"x"};
+    endif
+    if (isplot && length (args) == 2)
+      nargs = 2;
+    elseif (numel (args) != nargs)
+      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+    endif
+    if (isplot)
+      xarg = args{1};
+      if (nargs == 2)
+        yarg = args{2};
+      else
+        yarg = "";
+      endif
+    elseif (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = args{1};
+      yarg = args{2};
+    endif
+  else
+    error ("%s: expecting string, inline function, or function handle", ezfunc);
+  endif
+
+  if (nargin > 2 || (nargin == 2 && isplot))
+    funx = fun;
+    fstrx = fstr;
+    funy = varargin{2};
+    if (ischar (funy) && ! strcmp (funy, "circ") && ! strcmp (funy, "animate"))
+      parametric = true;
+      if (exist (funy, "file") || exist (funy, "builtin"))
+        funy = inline ([funy "(t)"]);
+      else
+        funy = vectorize (inline (funy));
+      endif
+      if (numel (argnames (funy)) != nargs)
+        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+      endif
+      fstry = formula (funy);
+    elseif (strcmp (typeinfo (funy), "inline function"))
+      parametric = true;
+      if (numel (argnames (funy)) != nargs)
+        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+      endif
+      funy = vectorize (funy);
+      fstry = formula (funy);
+    elseif (isa (funy, "function_handle"))
+      parametric = true;
+      fstry = func2str (funy);
+      idx = index (fstry, ')');
+      if (idx != 0)
+        args = regexp (fstry(3:(idx-1)), '\w+', 'match');
+        fstry = fstry(idx+2:end);  # remove '@(x) ' from string name
+      else
+        args = {"y"};
+      endif
+      if (numel (args) != nargs)
+        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+      endif
+    endif
+
+    if (! parametric && isplot3)
+      needusage = true;  # Can't call non-parametric ezplot3
+      return;
+    elseif (parametric && isplot)
+      if (nargs == 2)
+        error ("%s: can not define a parametric function in this manner", ezfunc);
+      else
+        xarg = "x";
+        yarg = "y";
+      endif
+    elseif (parametric)
+      funz = varargin{3};
+      if (ischar (funz) && ! strcmp (funz, "circ")
+          && ! strcmp (funz, "animate"))
+        if (exist (funz, "file") || exist (funz, "builtin"))
+          funz = inline ([funz "(t)"]);
+        else
+          funz = vectorize (inline (funz));
+        endif
+        if (numel (argnames (funz)) > nargs)
+          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+        endif
+        fstrz = formula (funz);
+      elseif (strcmp (typeinfo (funz), "inline function"))
+        if (numel (argnames (funz)) != nargs)
+          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+        endif
+        funz = vectorize (funz);
+        fstrz = formula (funz);
+      elseif (isa (funz, "function_handle"))
+        fstrz = func2str (funz);
+        idx = index (fstrz, ')');
+        if (idx != 0)
+          args = regexp (fstrz(3:(idx-1)), '\w+', 'match');
+          fstrz = fstrz(idx+2:end);  # remove '@(x) ' from string name
+        else
+          args = {"z"};
+        endif
+        if (numel (args) != nargs)
+          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+        endif
+      else
+        error ("%s: parametric plots expect 3 functions", ezfunc);
+      endif
+    endif
+  endif
+
+  if ((isplot && nargs != 2) || isplot3 || ispolar)
+    n = 500;   # default for point-style functions like plot
+  else
+    n = 60;    # default for meshgrid style functions like contour, surf
+  endif
+  domain = [];
+  circ = false;
+  animate = false;
+  if (parametric)
+    if (isplot)
+      iarg = 3;
+    else
+      iarg = 4;
+    endif
+  else
+    iarg = 2;
+  endif
+  while (iarg <= nargin)
+    arg = varargin{iarg++};
+    if (ischar (arg) && strcmp (arg, "circ"))
+      circ = true;
+    elseif (ischar (arg) && strcmp (arg, "animate"))
+      animate = true;
+    elseif (isscalar (arg))
+      n = arg;
+    elseif (numel (arg) == 2)
+      domain = [arg(1) arg(2) arg(1) arg(2)];
+    elseif (numel (arg) == 4)
+      domain = arg(:).';
+    else
+      error ("%s: expecting scalar, 2-, or 4-element vector", ezfunc);
+    endif
+  endwhile
+
+  if (circ && (iscontour || isplot3 || isplot))
+    needusage = true;
+    return;
+  elseif (circ && parametric)
+    error ("%s: can not have both circular domain and parametric function",
+           ezfunc);
+  endif
+
+  if (animate && ! isplot3)
+    error ("%s: animate option only valid for ezplot3", ezfunc);
+  endif
+
+  if (parametric)
+    ## Make the label strings pretty by removing extra spaces between base
+    ## and exponent, the '.' in vectorized code, and the '*' for multiply.
+    fstrx = regexprep (regexprep (regexprep (fstrx,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+    fstry = regexprep (regexprep (regexprep (fstry,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+    if (isplot)
+      fstr = ["x = " fstrx ", y = " fstry];
+    else
+      fstrz = regexprep (regexprep (regexprep (fstrz,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+      fstr = ["x = " fstrx ",y = " fstry ", z = " fstrz];
+    endif
+  else
+    fstr = regexprep (regexprep (regexprep (fstr,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+    if (isplot && nargs == 2)
+      fstr = [fstr " = 0"];  # make title string of implicit function
+    endif
+  endif
+
+  if (isempty (domain))
+    auto_domain = true;
+    if (isplot3 || ispolar)
+      domain = [0, 2*pi, 0, 2*pi];
+    else
+      domain = [-2*pi, 2*pi, -2*pi, 2*pi];
+    endif
+  else
+    auto_domain = false;
+  endif
+
+  auto_domain_done = false;
+  do
+    domain_ok = true;
+
+    if ((isplot && nargs == 1) || isplot3 || ispolar)
+      X = linspace (domain(1), domain(2), n);
+    elseif (isplot && numel (domain) == 2)
+      x = linspace (domain(1), domain(2), n);
+      [X, Y] = meshgrid (x, x);
+    elseif (circ)
+      ## To plot on circular domain develop grid in polar coordinates
+      ## and then switch these to Cartesian coordinates.
+      cent = [domain(1) + domain(2), domain(3) + domain(4)] / 2;
+      rmax = sqrt ((domain(2) - cent(1))^2 + (domain(4) - cent(2))^2);
+      r = linspace (0, rmax, n);
+      t = linspace (0, 2*pi, n);
+      [T, R] = meshgrid (t, r);
+      X = R .* cos (T) + cent(1);
+      Y = R .* sin (T) + cent(2);
+      domain = [-rmax+cent(1), +rmax+cent(1), -rmax+cent(2), +rmax+cent(2)];
+    else  # contour, mesh, surf plots
+      x = linspace (domain(1), domain(2), n);
+      y = linspace (domain(3), domain(4), n);
+      [X, Y] = meshgrid (x, y);
+    endif
+
+    if (parametric)
+      if (isplot)
+        XX = feval (funx, X);
+        Z = feval (funy, X);
+        X = XX;
+      elseif (isplot3)
+        Z = feval (funz, X);
+        XX = feval (funx, X);
+        YY = feval (funy, X);
+        X = XX;
+        Y = YY;
+      else
+        Z = feval (funz, X, Y);
+        XX = feval (funx, X, Y);
+        YY = feval (funy, X, Y);
+        X = XX;
+        Y = YY;
+
+        ## Eliminate the singularities
+        X = __eliminate_sing__ (X);
+        Y = __eliminate_sing__ (Y);
+        Z = __eliminate_sing__ (Z);
+      endif
+    else  ## non-parametric plots
+      if (isplot && nargs == 2)
+        Z = feval (fun, X, Y);
+
+        ## Matlab returns line objects for this case and so can't call
+        ## contour directly as it returns patch objects to allow colormaps
+        ## to work with contours.  Therefore recreate the lines from the
+        ## output for contourc, and store in cell arrays.
+        [c, ~] = contourc (X, Y, Z, [0, 0]);
+
+        i = 1;
+        XX = YY = {};
+        while (i < length (c))
+          clev = c(1,i);
+          clen = c(2,i);
+          XX = [XX, {c(1, i+1:i+clen)}];
+          YY = [YY, {c(2, i+1:i+clen)}];
+          i += clen+1;
+        endwhile
+      else
+        if (ispolar)
+          Z = feval (fun, X);
+          ## FIXME: Why aren't singularities eliminated for polar plots?
+        elseif (isplot)
+          Z = feval (fun, X);
+          ## Eliminate the singularities
+          Z = __eliminate_sing__ (Z);
+          domain = find_valid_domain (X, [], Z);
+        elseif (iscontour)
+          Z = feval (fun, X, Y);
+          Z = __eliminate_sing__ (Z);
+        else  #  mesh, surf plots
+          Z = feval (fun, X, Y);
+          Z = __eliminate_sing__ (Z);
+          if (circ)
+            ## Use domain calculated at the start.
+            ## The X, Y grids are non-monotonic after conversion from polar
+            ## coordinates and find_valid_domain fails.
+
+          elseif (auto_domain && ! auto_domain_done)
+            valid_domain = find_valid_domain (X, Y, Z);
+            domain_ok = isequal (domain, valid_domain);
+            domain = valid_domain;
+            auto_domain_done = true;  # ensures only 1 round of do loop done
+          else
+            if (! auto_domain_done)
+              domain = find_valid_domain (X, Y, Z);
+            endif
+          endif
+        endif
+      endif
+    endif
+  until (domain_ok)
+
+  ## Now, actually call the correct plot function with valid data and domain.
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    if (iscontour)
+      [~, h] = feval (pltfunc, hax, X, Y, Z);
+    elseif (isplot && nargs == 2)
+      h = zeros (length (XX), 1);
+      hold_state = get (hax, "nextplot");
+      for i = 1 : length (XX)
+        h(i) = plot(hax, XX{i}, YY{i});
+        if (i == 1)
+          set (hax, "nextplot", "add");
+        endif
+      endfor
+      set (hax, "nextplot", hold_state);
+      axis (hax, domain);
+    elseif (isplot || ispolar)
+      h = feval (pltfunc, hax, X, Z);
+      if (isplot && ! parametric)
+        axis (hax, domain);
+      endif
+    elseif (isplot3)
+      if (animate)
+        ## draw animation, then replace with true plot3
+        comet3 (hax, X, Y, Z, .05);
+      endif
+      h = feval (pltfunc, hax, X, Y, Z);
+      set (hax, "box", "off");
+      grid (hax, "on");
+      zlabel (hax, "z");
+    else  # mesh and surf plots
+      h = feval (pltfunc, hax, X, Y, Z);
+      ## FIXME: surf, mesh should really do a better job of setting zlim
+      if (! parametric)
+        axis (hax, domain);
+      endif
+    endif
+    xlabel (hax, xarg);
+    ylabel (hax, yarg);
+    title (hax, fstr);
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+## Eliminate bad data (complex values, infinities, singularities)
+function x = __eliminate_sing__ (x)
+  if (iscomplex (x))
+    x(imag (x) != 0) = NaN;
+  endif
+  x(isinf (x)) = NaN;
+  ## High rates of curvature are treated as singularities
+  threshold = 0.2 * (max (x(:)) - min (x(:)));
+  x(abs (del2 (x)) > threshold) = NaN;
+endfunction
+
+## Find: 1) range of function where there are not NaN values,
+##       2) function is changing (not just flat surface)
+function domain = find_valid_domain (X, Y, Z);
+
+  if (isvector (Z))
+    ## 2-D data for isplot
+    domain = [X(1) X(end)];
+
+    ## Guess a range which includes the "mass" of the data by using a 
+    ## median-based approach.  The center 3/4 of the data is used to
+    ## determine the range of the data.
+    ## This seems to be vaguely what Matlab does, but can't be sure.
+    XX = sort (Z(isfinite (Z)));
+    if (length (X) > 4)
+      irlo = XX(fix (1/8 * length (XX)));
+      irhi = XX(fix (7/8 * length (XX)));
+      d = irhi - irlo;
+      domain(3) = max (XX(1) - d/8, irlo - d);
+      domain(4) = min (XX(end) + d/8, irhi + d);
+    else
+      domain(3:4) = [XX(1), XX(end)];
+    endif
+
+    #{
+    ## FIXME: Old algorithm for removing singularities
+    ## Deprecated in 3.8.  Can be removed if no problems appear in ezplot.
+    idx = 2 : length (Z);
+    idx = find (((Z(idx) > yrange(2) / 2) & (Z(idx-1) < yrange(1) / 2)) |
+                ((Z(idx) < yrange(1) / 2) & (Z(idx-1) > yrange(2) / 2)));
+    Z(idx) = NaN;
+    #}
+
+  else
+    ## 3-D data such as mesh, surf
+    Zfinite = ! isnan (Z); 
+    Zrows = any (Zfinite, 2); 
+    rmin = find (Zrows, 1, "first"); 
+    rmax = find (Zrows, 1, "last"); 
+    Zcols = any (Zfinite, 1); 
+    cmin = find (Zcols, 1, "first"); 
+    cmax = find (Zcols, 1, "last"); 
+
+    ## Handle nasty case of all NaNs 
+    if (isempty (rmin))
+      rmin = 1, rmax = rows (Z);
+    endif
+    if (isempty (cmin))
+      cmin = 1, cmax = columns (Z);
+    endif
+
+    if (   ! any (isnan (Z([rmin, rmax],:)(:)))
+        && ! any (isnan (Z(:, [cmin, cmax])(:))))
+      ## Exclude surfaces along borders which are flat (gradient =~ 0).
+      ## Technically, this calculation might be better done with actual
+      ## deltaX, deltaY values.  But, data is usually meshgridded
+      ## (constant spacing) so working with deltaROW#, deltaCOL# is fine.
+      [Zx, Zy] = gradient (Z(rmin:rmax, cmin:cmax));
+      Zgrad = sqrt (Zx.^2 + Zy.^2);
+      slope = ((max (Z(:)) - min (Z(:)))
+                / sqrt ((rmax - rmin)^2 + (cmax - cmin)^2));
+      slope /= 125;  # threshold for discarding points.
+      Zrows = any (Zgrad > slope, 2); 
+      rmin += find (Zrows, 1, "first") - 1; 
+      rmax += find (Zrows, 1, "last") - rows (Zrows); 
+      Zcols = any (Zgrad > slope, 1); 
+      cmin += find (Zcols, 1, "first") - 1; 
+      cmax += find (Zcols, 1, "last") - columns (Zcols); 
+    endif
+
+    domain = [X(1,cmin) X(1,cmax) Y(rmin,1) Y(rmax,1)];
+  endif
+  
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__interp_cube__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,185 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+##
+## Author: Martin Helm <martin@mhelm.de>
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{vxyz}, @var{idx}, @var{frac}] =} __interp_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
+## Undocumented internal function.
+## @end deftypefn
+
+function [Vxyz, idx, frac] = __interp_cube__ (x, y, z, val, v, req = "values" )
+  if (ismatrix (x) && ndims (x) == 3 && ismatrix (y) && ndims (y) == 3
+       && ismatrix (z) && ndims (z) == 3 && size_equal (x, y, z, val))
+    x = squeeze (x(1,:,1))(:);
+    y = squeeze (y(:,1,1))(:);
+    z = squeeze (z(1,1,:))(:);
+  elseif (isvector (x) && isvector (y) && isvector (z))
+    x = x(:);
+    y = y(:);
+    z = z(:);
+  else
+    error ("__interp_cube__: X, Y, Z have wrong dimensions");
+  endif
+  if (size (val) != [length(x), length(y), length(z)])
+    error ("__interp_cube__: VAL has wrong dimensions");
+  endif
+  if (columns (v) != 3)
+    error ( "V has to be Nx3 matrix");
+  endif
+  ##if (!ischar (req))
+  ## error ('__interp_cube__: Invalid request parameter use "values", "normals" or "normals8"');
+  ##endif
+  if (isempty (v))
+    Vxyz = idx = frac = [];
+    return;
+  endif
+
+  switch (req)
+    case "normals"
+      [idx, frac] = cube_idx (x, y, z, v);
+
+      dx = x(2:end) - x(1:end-1);
+      dy = y(2:end) - y(1:end-1);
+      dz = z(2:end) - z(1:end-1);
+      dx = 0.5 .* [dx;dx(end)](idx(:,2));
+      dy = 0.5 .* [dy;dy(end)](idx(:,1));
+      dz = 0.5 .* [dz;dz(end)](idx(:,3));
+
+      p000 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) - dz];
+      p100 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) - dz];
+      p010 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) - dz];
+      p001 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) + dz];
+      p011 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) + dz];
+      p101 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) + dz];
+      p110 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) - dz];
+      p111 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) + dz];
+
+      v000 = interp_cube_trilin (x, y, z, val, p000);
+      v100 = interp_cube_trilin (x, y, z, val, p100);
+      v010 = interp_cube_trilin (x, y, z, val, p010);
+      v001 = interp_cube_trilin (x, y, z, val, p001);
+      v011 = interp_cube_trilin (x, y, z, val, p011);
+      v101 = interp_cube_trilin (x, y, z, val, p101);
+      v110 = interp_cube_trilin (x, y, z, val, p110);
+      v111 = interp_cube_trilin (x, y, z, val, p111);
+
+      Dx = -v000 .+ v100 .- v010 .- v001 .- v011 .+ v101 .+ v110 .+ v111;
+      Dy = -v000 .- v100 .+ v010 .- v001 .+ v011 .- v101 .+ v110 .+ v111;
+      Dz = -v000 .- v100 .- v010 .+ v001 .+ v011 .+ v101 .- v110 .+ v111;
+      Vxyz = 0.5 .* [Dx./dx, Dy./dy, Dz./dz];
+    case "normals8"
+      [idx, frac] = cube_idx (x, y, z, v);
+
+      dx = x(2:end) - x(1:end-1);
+      dy = y(2:end) - y(1:end-1);
+      dz = z(2:end) - z(1:end-1);
+      dx = [dx;dx(end)](idx(:,2));
+      dy = [dy;dy(end)](idx(:,1));
+      dz = [dz;dz(end)](idx(:,3));
+      [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v);
+      Vxyz = [Dx./dx, Dy./dy, Dz./dz];
+    case "values"
+      [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v);
+   otherwise
+     error ('__interp_cube__: Invalid request type "%s", use "values", "normals" or "normals8"', req);
+  endswitch
+endfunction
+
+function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v)
+  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
+  sval = size (val);
+  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
+  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
+  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
+  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
+  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
+  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
+  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
+  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
+  Bx = frac(:, 1);
+  By = frac(:, 2);
+  Bz = frac(:, 3);
+  Vxyz = ...
+    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i100 ) .* Bx .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i010 ) .* (1 .- Bx) .* By .* (1 .- Bz) .+ ...
+    val( i001 ) .* (1 .- Bx) .* (1 .- By) .* Bz .+ ...
+    val( i011 ) .* (1 .- Bx) .* By .* Bz .+ ...
+    val( i101 ) .* Bx .* (1 .- By) .* Bz .+ ...
+    val( i110 ) .* Bx .* By .* (1 .- Bz) .+ ...
+    val( i111 ) .* Bx .* By .* Bz;
+endfunction
+
+function [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v)
+  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
+  sval = size (val);
+  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
+  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
+  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
+  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
+  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
+  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
+  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
+  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
+  Bx = frac(:, 1);
+  By = frac(:, 2);
+  Bz = frac(:, 3);
+  Dx = ...
+    val( i000 ) .* -1 .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i100 ) .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i010 ) .* -1 .* By .* (1 .- Bz) .+ ...
+    val( i001 ) .* -1 .* (1 .- By) .* Bz .+ ...
+    val( i011 ) .* -1 .* By .* Bz .+ ...
+    val( i101 ) .* (1 .- By) .* Bz .+ ...
+    val( i110 ) .* By .* (1 .- Bz) .+ ...
+    val( i111 ) .* By .* Bz;
+  Dy = ...
+    val( i000 ) .* (1 .- Bx) .* -1 .* (1 .- Bz) .+ ...
+    val( i100 ) .* Bx .* -1 .* (1 .- Bz) .+ ...
+    val( i010 ) .* (1 .- Bx) .* (1 .- Bz) .+ ...
+    val( i001 ) .* (1 .- Bx) .* -1 .* Bz .+ ...
+    val( i011 ) .* (1 .- Bx) .* Bz .+ ...
+    val( i101 ) .* Bx .* -1 .* Bz .+ ...
+    val( i110 ) .* Bx .* (1 .- Bz) .+ ...
+    val( i111 ) .* Bx .* Bz;
+  Dz = ...
+    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* -1 .+ ...
+    val( i100 ) .* Bx .* (1 .- By) .* -1 .+ ...
+    val( i010 ) .* (1 .- Bx) .* By .* -1 .+ ...
+    val( i001 ) .* (1 .- Bx) .* (1 .- By) .+ ...
+    val( i011 ) .* (1 .- Bx) .* By + ...
+    val( i101 ) .* Bx .* (1 .- By) .+ ...
+    val( i110 ) .* Bx .* By .* -1 .+ ...
+    val( i111 ) .* Bx .* By;
+endfunction
+
+function [idx, frac] = cube_idx (x, y, z, v)
+  idx = zeros (size (v));
+  frac = zeros (size (v));
+  idx(:, 2) = lookup (x(2:end-1), v(:, 1)) + 1;
+  frac(:, 2) = (v(:, 1) - x(idx(:, 2)) )...
+      ./ (x(idx(:, 2)+1) - x(idx(:, 2)));
+  idx(:, 1) = lookup (y(2:end-1), v(:, 2)) + 1;
+  frac(:, 1) = (v(:, 2) - y(idx(:, 1))) ...
+      ./ (y(idx(:, 1)+1) - y(idx(:, 1)));
+  idx(:, 3) = lookup (z(2:end-1), v(:, 3)) + 1;
+  frac(:, 3) = (v(:, 3) - z(idx(:, 3))) ...
+      ./ (z(idx(:, 3)+1) - z(idx(:, 3)));
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__line__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,128 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __line__ (@var{p}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## __line__ (p, x, y, z)
+## Create line object from x, y, and z with parent p.
+## Return handle to line object.
+
+## Author: jwe
+
+function h = __line__ (p, varargin)
+
+  nvargs = numel (varargin);
+
+  if (nvargs > 1 && ! ischar (varargin{1}) && ! ischar (varargin{2}))
+    if (nvargs > 2 && ! ischar (varargin{3}))
+      num_data_args = 3;
+    else
+      num_data_args = 2;
+    endif
+  else
+    num_data_args = 0;
+  endif
+
+  if (num_data_args > 0 && ! size_equal (varargin{1:num_data_args}))
+    n = 1:num_data_args;
+    m = cellfun (@numel, varargin(1:num_data_args));
+    [~, m] = max (m);
+    b = ones (size (varargin{m(1)}));
+    try
+      varargin(n) = cellfun (@(x) bsxfun (@times, b, x), varargin(n), "uniformoutput", false);
+    catch
+      error ("line: number of X, Y, and Z points must be equal");
+    end_try_catch
+  endif
+
+  if (rem (nvargs - num_data_args, 2) != 0)
+    error ("line: invalid number of PROPERTY / VALUE pairs");
+  endif
+
+  other_args = {};
+  if (nvargs > num_data_args)
+    other_args = varargin(num_data_args+1:end);
+  endif
+
+  nlines = 0;
+  nvecpts = 0;
+  ismat = false (1, 3);
+  for i = 1:num_data_args
+    tmp = varargin{i}(:,:);
+    if (isvector (tmp))
+      nlines = max (1, nlines);
+      if (! isscalar (tmp))
+        if (nvecpts == 0)
+          nvecpts = numel (tmp);
+        elseif (nvecpts != numel (tmp))
+          error ("line: data size mismatch");
+        endif
+      endif
+    else
+      ismat(i) = true;
+      nlines = max (columns (tmp), nlines);
+    endif
+    varargin{i} = tmp;
+  endfor
+
+  if (num_data_args == 0)
+    varargin = {[0, 1], [0, 1]};
+    num_data_args = 2;
+    nlines = 1;
+  endif
+
+  handles = zeros (nlines, 1);
+
+  data = cell (1, 3);
+
+  if (num_data_args > 1)
+    data(1:num_data_args) = varargin(1:num_data_args);
+    for i = 1:num_data_args
+      if (islogical (data{i}))
+        data(i) = double (data{i});
+      elseif (iscomplex (data{i}))
+        data(i) = real (data{i});
+      endif
+    endfor
+  endif
+
+  data_args = reshape ({"xdata", "ydata", "zdata"; data{:}}, [1, 6]);
+  mask = reshape ([false(1,3); ismat], [1, 6]);
+
+  for i = 1:nlines
+    tmp = data(ismat);
+    if (! size_equal (tmp)
+        || (nvecpts != 0 && any (nvecpts != cellfun ("size", tmp, 1))))
+      error ("line: data size_mismatch");
+    endif
+    data_args(mask) = cellfun (@(x) x(:,i), data(ismat),
+                               "uniformoutput", false);
+
+    handles(i) = __go_line__ (p, data_args{:}, other_args{:});
+
+  endfor
+
+  if (nargout > 0)
+    h = handles;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__marching_cube__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,531 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
+## Undocumented internal function.
+## @end deftypefn
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
+##
+## Return the triangulation information @var{t} at points @var{p} for
+## the isosurface values resp. the volume data @var{val} and the iso
+## level @var{iso}.  It is considered that the volume data @var{val} is
+## given at the points @var{x}, @var{y} and @var{z} which are of type
+## three--dimensional numeric arrays.  The orientation of the triangles
+## is choosen such that the normals point from the higher values to the
+## lower values.
+##
+## Optionally the color data @var{col} can be passed to this function
+## whereas computed vertices color data @var{c} is returned as third
+## argument.
+##
+## The marching cube algorithm is well known and described, for example, at
+## Wikipedia.  The triangulation lookup table and the edge table used
+## here are based on Cory Gene Bloyd's implementation and can be found
+## beyond other surface and geometry stuff at Paul Bourke's website
+## @uref{http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise}.
+##
+## For example:
+##
+## @example
+## @group
+## N = 20;
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+##
+## c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
+## [t, p] = __marching_cube__ (x, y, z, c, .5);
+##
+## figure ();
+## trimesh (t, p(:,1), p(:,2), p(:,3));
+## @end group
+## @end example
+##
+## Instead of the @command{trimesh} function the @command{patch}
+## function can be used to visualize the geometry.  For example:
+##
+## @example
+## @group
+## figure (); view (-38, 20);
+## pa = patch ("Faces", t, "Vertices", p, "FaceVertexCData", p, ...
+##             "FaceColor", "interp", "EdgeColor", "none");
+##
+## ## Revert normals
+## set (pa, "VertexNormals", -get (pa, "VertexNormals"));
+##
+## ## Set lightning (available with the JHandles package)
+## # set (pa, "FaceLighting", "gouraud");
+## # light ( "Position", [1 1 5]);
+## @end group
+## @end example
+##
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function [T, p, col] = __marching_cube__ (xx, yy, zz, c, iso, colors)
+
+  persistent edge_table=[];
+  persistent tri_table=[];
+
+  calc_cols = false;
+  lindex = 4;
+
+  if (isempty (tri_table) || isempty (edge_table))
+    [edge_table, tri_table] = init_mc ();
+  endif
+
+  if ((nargin != 5 && nargin != 6) || (nargout != 2 && nargout != 3))
+    print_usage ();
+  endif
+
+  if (!ismatrix (xx) || !ismatrix (yy) || !ismatrix (zz) || !ismatrix (c) || ...
+    ndims (xx) != 3 || ndims (yy) != 3 || ndims (zz) != 3 || ndims (c) != 3)
+    error ("__marching_cube__: XX, YY, ZZ, C must be matrices of dim 3");
+  endif
+
+  if (!size_equal (xx, yy, zz, c))
+    error ("__marching_cube__: XX, YY, ZZ, C must be of equal size");
+  endif
+
+  if (any (size (xx) < [2 2 2]))
+    error ("__marching_cube__: grid size must be at least 2x2x2");
+  endif
+
+  if (!isscalar (iso))
+    error ("__marching_cube__: ISO must be scalar value");
+  endif
+
+  if (nargin == 6)
+    if ( !ismatrix (colors) || ndims (colors) != 3 || size (colors) != size (c) )
+      error ( "COLORS must be a matrix of dim 3 and of same size as C" );
+    endif
+    calc_cols = true;
+    lindex = 5;
+  endif
+
+  n = size (c) - 1;
+
+  ## phase I: assign information to each voxel which edges are intersected by
+  ## the isosurface
+  cc = zeros (n(1), n(2), n(3), "uint16");
+  cedge = zeros (size (cc), "uint16");
+
+  vertex_idx = {1:n(1), 1:n(2), 1:n(3); ...
+    2:n(1)+1, 1:n(2), 1:n(3); ...
+    2:n(1)+1, 2:n(2)+1, 1:n(3); ...
+    1:n(1), 2:n(2)+1, 1:n(3); ...
+    1:n(1), 1:n(2), 2:n(3)+1; ...
+    2:n(1)+1, 1:n(2), 2:n(3)+1; ...
+    2:n(1)+1, 2:n(2)+1, 2:n(3)+1; ...
+    1:n(1), 2:n(2)+1, 2:n(3)+1 };
+
+  ## calculate which vertices have values higher than iso
+  for ii=1:8
+    idx = c(vertex_idx{ii, :}) > iso;
+    cc(idx) = bitset (cc(idx), ii);
+  endfor
+
+  cedge = edge_table(cc+1); # assign the info about intersected edges
+  id =  find (cedge); # select only voxels which are intersected
+  if (isempty (id))
+    T = p = col = [];
+    return;
+  endif
+
+  ## phase II: calculate the list of intersection points
+  xyz_off = [1, 1, 1; 2, 1, 1; 2, 2, 1; 1, 2, 1; 1, 1, 2;  2, 1, 2; 2, 2, 2; 1, 2, 2];
+  edges = [1 2; 2 3; 3 4; 4 1; 5 6; 6 7; 7 8; 8 5; 1 5; 2 6; 3 7; 4 8];
+  offset = sub2ind (size (c), xyz_off(:, 1), xyz_off(:, 2), xyz_off(:, 3)) -1;
+  pp = zeros (length (id), lindex, 12);
+  ccedge = [vec(cedge(id)), id];
+  ix_offset=0;
+  for jj=1:12
+    id__ = bitget (ccedge(:, 1), jj);
+    id_ = ccedge(id__, 2);
+    [ix iy iz] = ind2sub (size (cc), id_);
+    id_c = sub2ind (size (c), ix, iy, iz);
+    id1 = id_c + offset(edges(jj, 1));
+    id2 = id_c + offset(edges(jj, 2));
+    if (calc_cols)
+      pp(id__, 1:5, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
+        xx(id2), yy(id2), zz(id2), c(id1), c(id2), colors(id1), colors(id2)), ...
+        (1:rows (id_))' + ix_offset ];
+    else
+      pp(id__, 1:4, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
+        xx(id2), yy(id2), zz(id2), c(id1), c(id2)), ...
+        (1:rows (id_))' + ix_offset ];
+    endif
+    ix_offset += rows (id_);
+  endfor
+
+  ## phase III: calculate the triangulation from the point list
+  T = [];
+  tri = tri_table(cc(id)+1, :);
+  for jj=1:3:15
+    id_ = find (tri(:, jj)>0);
+    p = [id_, lindex*ones(rows (id_), 1),tri(id_, jj:jj+2)];
+    if (!isempty (p))
+      p1 = sub2ind (size (pp), p(:,1), p(:,2), p(:,3));
+      p2 = sub2ind (size (pp), p(:,1), p(:,2), p(:,4));
+      p3 = sub2ind (size (pp), p(:,1), p(:,2), p(:,5));
+      T = [T; pp(p1), pp(p2), pp(p3)];
+    endif
+  endfor
+
+  p = [];
+  col = [];
+  for jj = 1:12
+    idp = pp(:, lindex, jj) > 0;
+    if (any (idp))
+      p(pp(idp, lindex, jj), 1:3) = pp(idp, 1:3, jj);
+      if (calc_cols)
+        col(pp(idp, lindex, jj),1) = pp(idp, 4, jj);
+      endif
+    endif
+  endfor
+endfunction
+
+function p = vertex_interp (isolevel,p1x, p1y, p1z,...
+  p2x, p2y, p2z,valp1,valp2, col1, col2)
+
+  if (nargin == 9)
+    p = zeros (length (p1x), 3);
+  elseif (nargin == 11)
+    p = zeros (length (p1x), 4);
+  else
+    error ("__marching_cube__: wrong number of arguments");
+  endif
+  mu = zeros (length (p1x), 1);
+  id = abs (valp1-valp2) < (10*eps) .* (abs (valp1) .+ abs (valp2));
+  if (any (id))
+    p(id, 1:3) = [ p1x(id), p1y(id), p1z(id) ];
+    if (nargin == 11)
+      p(id, 4) = col1(id);
+    endif
+  endif
+  nid = !id;
+  if (any (nid))
+    mu(nid) = (isolevel - valp1(nid)) ./ (valp2(nid) - valp1(nid));
+    p(nid, 1:3) = [p1x(nid) + mu(nid) .* (p2x(nid) - p1x(nid)), ...
+      p1y(nid) + mu(nid) .* (p2y(nid) - p1y(nid)), ...
+      p1z(nid) + mu(nid) .* (p2z(nid) - p1z(nid))];
+    if (nargin == 11)
+      p(nid, 4) = col1(nid) + mu(nid) .* (col2(nid) - col1(nid));
+    endif
+  endif
+endfunction
+
+function [edge_table, tri_table] = init_mc ()
+  edge_table = [
+  0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, ...
+  0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, ...
+  0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, ...
+  0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, ...
+  0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c, ...
+  0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, ...
+  0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac, ...
+  0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, ...
+  0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c, ...
+  0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, ...
+  0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc, ...
+  0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, ...
+  0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c, ...
+  0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, ...
+  0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc , ...
+  0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, ...
+  0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, ...
+  0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, ...
+  0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, ...
+  0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, ...
+  0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, ...
+  0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, ...
+  0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, ...
+  0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460, ...
+  0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, ...
+  0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0, ...
+  0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, ...
+  0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230, ...
+  0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, ...
+  0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, ...
+  0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, ...
+  0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0   ];
+
+  tri_table =[
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1;
+  3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1;
+  3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1;
+  3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1;
+  9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1;
+  9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
+  2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1;
+  8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1;
+  9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
+  4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1;
+  3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1;
+  1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1;
+  4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1;
+  4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
+  5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1;
+  2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1;
+  9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
+  0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
+  2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1;
+  10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1;
+  5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1;
+  5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1;
+  9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1;
+  0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1;
+  1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1;
+  10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1;
+  8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1;
+  2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1;
+  7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1;
+  2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1;
+  11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1;
+  5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1;
+  11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1;
+  11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
+  1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1;
+  9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1;
+  5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1;
+  2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
+  5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1;
+  6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1;
+  3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1;
+  6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1;
+  5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1;
+  1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
+  10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1;
+  6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1;
+  8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1;
+  7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1;
+  3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
+  5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1;
+  0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1;
+  9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1;
+  8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1;
+  5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1;
+  0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1;
+  6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1;
+  10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1;
+  10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1;
+  8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1;
+  1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1;
+  0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1;
+  10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1;
+  3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1;
+  6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1;
+  9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1;
+  8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1;
+  3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1;
+  6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1;
+  0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1;
+  10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1;
+  10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1;
+  2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1;
+  7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1;
+  7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1;
+  2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1;
+  1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1;
+  11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1;
+  8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1;
+  0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1;
+  7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
+  10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
+  2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
+  6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1;
+  7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1;
+  2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1;
+  1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1;
+  10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1;
+  10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1;
+  0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1;
+  7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1;
+  6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1;
+  8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1;
+  9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1;
+  6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1;
+  4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1;
+  10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1;
+  8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1;
+  0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1;
+  1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1;
+  8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1;
+  10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1;
+  4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1;
+  10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
+  5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
+  11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1;
+  9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
+  6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1;
+  7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1;
+  3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1;
+  7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1;
+  3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1;
+  6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1;
+  9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1;
+  1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1;
+  4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1;
+  7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1;
+  6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1;
+  3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1;
+  0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1;
+  6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1;
+  0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1;
+  11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1;
+  6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1;
+  5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1;
+  9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1;
+  1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1;
+  1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1;
+  10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1;
+  0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1;
+  5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1;
+  10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1;
+  11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1;
+  9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1;
+  7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1;
+  2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1;
+  8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1;
+  9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1;
+  9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1;
+  1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1;
+  9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1;
+  9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1;
+  5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1;
+  0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1;
+  10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1;
+  2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1;
+  0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1;
+  0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1;
+  9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1;
+  5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1;
+  3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1;
+  5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1;
+  8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1;
+  0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1;
+  9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1;
+  1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1;
+  3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1;
+  4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1;
+  9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1;
+  11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1;
+  11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1;
+  2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1;
+  9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1;
+  3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1;
+  1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1;
+  4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1;
+  3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1;
+  0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1;
+  9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1;
+  1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ] + 1;
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__patch__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,370 @@
+## Copyright (C) 2007-2012 John W. Eaton, Shai Ayal, Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{h}, @var{fail}] =} __patch__ (@var{p}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## __patch__ (p, x, y, c)
+## Create patch object from x and y with color c and parent p.
+## Return handle to patch object.
+
+## Author: Kai Habel
+
+function [h, failed] = __patch__ (p, varargin)
+
+  h = NaN;
+  failed = false;
+
+  is_numeric_arg = cellfun (@isnumeric, varargin);
+
+  if (isempty (varargin))
+    args = {"xdata", [0; 1; 0], "ydata", [1; 1; 0], "facecolor", [0, 0, 0]};
+    args = setvertexdata (args);
+  elseif (isstruct (varargin{1}))
+    if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces"))
+      args{1} = "faces";
+      args{2} = getfield (varargin{1}, "faces");
+      args{3} = "vertices";
+      args{4} = getfield (varargin{1}, "vertices");
+      args{5} = "facevertexcdata";
+      if (isfield (varargin{1}, "facevertexcdata"))
+        args{6} = getfield (varargin{1}, "facevertexcdata");
+      else
+        args{6} = [];
+      endif
+      args = [args; varargin(2:end)];
+      args = setdata (args);
+    else
+      failed = true;
+    endif
+  elseif (is_numeric_arg(1))
+    if (nargin < 3 || ! is_numeric_arg(2))
+      failed = true;
+    else
+
+      if (nargin > 4 && all (is_numeric_arg(1:4)))
+        x = varargin{1};
+        y = varargin{2};
+        z = varargin{3};
+        c = varargin{4};
+        iarg = 5;
+      elseif (nargin > 3 && all (is_numeric_arg(1:3)))
+        x = varargin{1};
+        y = varargin{2};
+        iarg = 4;
+        if (rem (nargin - iarg, 2) == 1)
+          c = varargin {iarg};
+          z = varargin{3};
+          iarg = 5;
+        else
+          z = [];
+          c = varargin{3};
+        endif
+      elseif (nargin > 2 && all (is_numeric_arg(1:2)))
+        x = varargin{1};
+        y = varargin{2};
+        z = [];
+        iarg = 3;
+        if (rem (nargin - iarg, 2) == 1)
+          c = varargin {iarg};
+          iarg++; 
+        else
+          c = [];
+        endif
+      endif
+
+      if (isvector (x))
+        x = x(:);
+        y = y(:);
+        z = z(:);
+        if (isnumeric (c))
+          if (isvector (c) && numel (c) == numel (x))
+            c = c(:);
+          elseif (rows (c) != numel (x) && columns (c) == numel (x))
+            c = c.';
+          endif
+        endif
+      endif
+      args{1} = "xdata";
+      args{2} = x;
+      args{3} = "ydata";
+      args{4} = y;
+      args{5} = "zdata";
+      args{6} = z;
+
+      if (isnumeric (c))
+
+        if (ndims (c) == 3 && columns (c) == 1)
+          c = permute (c, [1, 3, 2]);
+        endif
+
+        if (isvector (c) && numel (c) == columns (x))
+          if (isnan (c))
+            args{7} = "facecolor";
+            args{8} = [1, 1, 1];
+            args{9} = "cdata";
+            args{10} = c;
+          elseif (isnumeric (c))
+            args{7} = "facecolor";
+            args{8} = "flat";
+            args{9} = "cdata";
+            args{10} = c;
+          else
+            error ("patch: color value not valid");
+          endif
+        elseif (isvector (c) && numel (c) == 3)
+          args{7} = "facecolor";
+          args{8} = c;
+          args{9} = "cdata";
+          args{10} = [];
+        elseif (ndims (c) == 3 && size (c, 3) == 3)
+          ## CDATA is specified as RGB data
+          if ((rows (c) == 1 && columns (c) == 1) ...
+              || (rows (c) == 1 && columns (c) == columns (x)))
+            ## Single patch color or per-face color
+            args{7} = "facecolor";
+            args{8} = "flat";
+            args{9} = "cdata";
+            args{10} = c;
+          elseif (rows (c) == rows (x) && columns (c) == columns (x))
+            ## Per-vertex color
+            args{7} = "facecolor";
+            args{8} = "interp";
+            args{9} = "cdata";
+            args{10} = c;
+          else
+            error ("patch: color value not valid");
+          endif
+        else
+          ## Color Vectors
+          if (isempty (c))
+            args{7} = "facecolor";
+            args{8} = "interp";
+            args{9} = "cdata";
+            args{10} = [];
+          elseif (isequal (size (c), size (x)) && isequal (size (c), size (y)))
+            args{7} = "facecolor";
+            args{8} = "interp";
+            args{9} = "cdata";
+            args{10} = c;
+          else
+            error ("patch: size of x, y, and c must be equal");
+          endif
+        endif
+      elseif (ischar (c) && rem (nargin - iarg, 2) == 0)
+        ## Assume that any additional argument over an even number is
+        ## color string.
+        args{7} = "facecolor";
+        args{8} =  tolower (c);
+        args{9} = "cdata";
+        args{10} = [];
+      else
+        args{7} = "facecolor";
+        args{8} = [0, 1, 0];
+        args{9} = "cdata";
+        args{10} = [];
+      endif
+
+      args = [args, varargin(iarg:end)];
+      args = setvertexdata (args);
+    endif
+  else
+    args = varargin;
+    if (any (strcmpi (args, "faces") | strcmpi (args, "vertices")))
+      args = setdata (args);
+    else
+      args = setvertexdata (args);
+    endif
+  endif
+
+  if (!failed)
+    h = __go_patch__ (p, args {:});
+
+    ## Setup listener functions
+    addlistener (h, "xdata", @update_data);
+    addlistener (h, "ydata", @update_data);
+    addlistener (h, "zdata", @update_data);
+    addlistener (h, "cdata", @update_data);
+
+    addlistener (h, "faces", @update_fvc);
+    addlistener (h, "vertices", @update_fvc);
+    addlistener (h, "facevertexcdata", @update_fvc);
+  endif
+endfunction
+
+function args = delfields (args, flds)
+  idx = cellfun ("isclass", args, "char");
+  idx(idx) = ismember (args(idx), flds);
+  if (rows (idx) == 1)
+    idx |= [false, idx(1:end-1)];
+  else
+    idx |= [false; idx(1:end-1)];
+  endif
+  args(idx) = [];
+endfunction
+
+function args = setdata (args)
+  args = delfields (args, {"xdata", "ydata", "zdata", "cdata"});
+  ## Remove the readonly fields as well
+  args = delfields (args, {"type", "uicontextmenu"});
+  nargs = length (args);
+  idx = find (strcmpi (args, "faces"), 1, "last") + 1;
+  if (idx > nargs)
+    faces = [];
+  else
+    faces = args {idx};
+  endif
+  idx = find (strcmpi (args, "vertices"), 1, "last") + 1;
+  if (idx > nargs)
+    vert = [];
+  else
+    vert = args {idx};
+  endif
+  idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    fvc = [];
+  else
+    fvc = args {idx};
+  endif
+  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    if (!isempty (fvc))
+      fc = "flat";
+    else
+      fc = [0, 1, 0];
+    endif
+    args = {"facecolor", fc, args{:}};
+  endif
+
+  nc = rows (faces);
+  idx = faces .';
+  t1 = isnan (idx);
+  for i = find (any (t1))
+    first_idx_in_column = find (t1(:,i), 1);
+    idx(first_idx_in_column:end,i) = idx(first_idx_in_column-1,i);
+  endfor
+  x = reshape (vert(:,1)(idx), size (idx));
+  y = reshape (vert(:,2)(idx), size (idx));
+  if (columns (vert) > 2)
+    z = reshape (vert(:,3)(idx), size (idx));
+  else
+    z = [];
+  endif
+
+  if (rows (fvc) == nc || rows (fvc) == 1)
+    c = reshape (fvc, [1, size(fvc)]);
+  else
+    if (columns (fvc) == 3)
+      c = cat (3, reshape (fvc(idx, 1), size (idx)),
+               reshape (fvc(idx, 2), size (idx)),
+               reshape (fvc(idx, 3), size (idx)));
+    elseif (isempty (fvc))
+      c = [];
+    else ## if (columnns (fvc) == 1)
+      c = permute (fvc(faces), [2, 1]);
+    endif
+  endif
+  args = {"xdata", x, "ydata", y, "zdata", z, "cdata", c, args{:}};
+endfunction
+
+function args = setvertexdata (args)
+  args = delfields (args, {"vertices", "faces", "facevertexcdata"});
+  ## Remove the readonly fields as well
+  args = delfields (args, {"type", "uicontextmenu"});
+  nargs = length (args);
+  idx = find (strcmpi (args, "xdata"), 1, "last") + 1;
+  if (idx > nargs)
+    x = [];
+  else
+    x = args {idx};
+  endif
+  idx = find (strcmpi (args, "ydata"), 1, "last") + 1;
+  if (idx > nargs)
+    y = [];
+  else
+    y = args {idx};
+  endif
+  idx = find (strcmpi (args, "zdata"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    z = [];
+  else
+    z = args {idx};
+  endif
+  idx = find (strcmpi (args, "cdata"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    c = [];
+  else
+    c = args {idx};
+  endif
+  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    if (!isempty (c))
+      fc = "flat";
+    else
+      fc = [0, 1, 0];
+    endif
+    args = {"facecolor", fc, args{:}};
+  endif
+
+  [nr, nc] = size (x);
+  if (nr == 1 && nc > 1)
+    nr = nc;
+    nc = 1;
+  endif
+  if (!isempty (z))
+    vert = [x(:), y(:), z(:)];
+  else
+    vert = [x(:), y(:)];
+  endif
+  faces = reshape (1:numel (x), nr, nc);
+  faces = faces';
+
+  if (ndims (c) == 3)
+    fvc = reshape (c, rows (c) * columns (c), size (c, 3));
+  else
+    fvc = c(:);
+  endif
+
+  args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}};
+endfunction
+
+function update_data (h, d)
+  update_handle (h, false);
+endfunction
+
+function update_fvc (h, d)
+  update_handle (h, true);
+endfunction
+
+function update_handle (h, isfv)
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+    f = get (h);
+    if (isfv)
+      set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:});
+    else
+      set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:});
+    endif
+    recursive = false;
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__pie__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,201 @@
+## Copyright (C) 2007-2012 David Bateman
+## Copyright (C) 2010 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{hlist} =} __pie__ (caller, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function hlist = __pie__ (caller, varargin)
+
+  h = varargin{1};
+  x = abs (varargin{2});
+  iarg = 3;
+
+  if (! isvector (x))
+    error ("%s: expecting vector argument", caller);
+  endif
+
+  len = length (x);
+
+  have_explode = false;
+  have_labels = false;
+
+  while (iarg <= nargin - 1)
+    arg = varargin{iarg++};
+    if (iscell (arg))
+      labels = arg;
+      have_labels = true;
+      if (numel (x) != numel (labels))
+        error ("%s: mismatch in number of labels and data", caller);
+      endif
+    elseif (isnumeric (arg) || islogical (arg))
+      explode = arg;
+      have_explode = true;
+      if (! size_equal (x, explode))
+        error ("%s: mismatch in number of elements in explode and data",
+               caller);
+      endif
+    else
+      error ("%s: %s is invalid as an optional argument", caller, class (arg));
+    endif
+  endwhile
+
+  if (! have_explode)
+    explode = zeros (size (x));
+  endif
+
+  normalize = true;
+  if (sum (x(:)) < 1)
+    normalize = false;
+  endif
+
+  if (! have_labels)
+    if (normalize)
+      xp = round (100 * x ./ sum (x));
+    else
+      xp = round (100 * x);
+    endif
+    for i = 1:len
+      labels{i} = sprintf ("%d%%", xp(i));
+    endfor
+  endif
+
+  hlist = [];
+  refinement = 90;
+  phi = 0:refinement:360;
+  if (normalize)
+    xphi = cumsum (x / sum (x) * 360);
+  else
+    xphi = cumsum (x * 360);
+  endif
+
+  for i = 1:len
+    if (i == 1)
+      xn = 0 : 360 / refinement : xphi(i);
+    else
+      xn = xphi(i-1) : 360 / refinement : xphi(i);
+    endif
+
+    if (xn(end) != xphi(i))
+      xn = [xn, xphi(i)];
+    endif
+
+    xn2 = (xn(1) + xn(end)) / 2;
+    if (explode (i))
+      xoff = - 0.1 * sind (xn2);
+      yoff = 0.1 * cosd (xn2);
+    else
+      xoff = 0;
+      yoff = 0;
+    endif
+    xt = - 1.2 * sind (xn2);
+    yt = 1.2 * cosd (xn2);
+
+    if (len == 1)
+      set (h, "clim", [1, 2]);
+    else
+      set (h, "clim", [1, len]);
+    endif
+
+    if (strcmp (caller, "pie3"))
+      ln = length (xn);
+      zlvl = 0.35;
+      sx = repmat (xoff + [0, -sind(xn), 0], [2, 1]);
+      sy = repmat (yoff + [0, cosd(xn), 0], [2, 1]);
+      sz = [zeros(1, ln + 2); zlvl * ones(1, ln + 2)];
+      sc = i * ones (size (sz));
+
+      hlist = [hlist;
+        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i);
+        surface(sx, sy, sz, sc);
+        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zlvl * ones (1, ln + 1), i);
+        text(xt, yt, zlvl, labels{i})];
+
+    elseif (strcmp (caller, "pie"))
+      if (xt > 0)
+        align = "left";
+      else
+        align = "right";
+      endif
+
+      hlist = [hlist; patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], i);
+               text(xt, yt, labels{i}, "horizontalalignment", align)];
+
+    else
+      error ("__pie__: unknown caller '%s'", caller);
+    endif
+  endfor
+
+  addlistener (gca, "view", {@update_text_pos, hlist});
+
+  if (strcmp (caller, "pie3"))
+    axis ([-1.25, 1.25, -1.25, 1.25, -0.05, 0.4], "equal", "off");
+    view (-37.5, 30);
+  elseif (strcmp (caller, "pie"))
+    axis ([-1.5, 1.5, -1.5, 1.5], "square", "off");
+  endif
+endfunction
+
+function update_text_pos (all_handles)
+  ## Text objects in the foreground should be at the base level.
+  ## Text objects in the background should be at the top level.
+  ## Text objects on the right side should be aligned to the right
+  ## and on the left side to the left.
+  tobj = findobj (all_handles, "type", "text");
+
+  ## check if we are called from pie3
+  s = findobj (all_handles, "type", "surface");
+  is_pie3 = false;
+  if (length (s) > 0)
+    is_pie3 = true;
+  endif
+
+  if (length (tobj) > 0)
+    ax = get (tobj(1), "parent");
+    azel = get (ax, "view");
+    pos = get (tobj, "position");
+    if (iscell (pos))
+      pos = cell2mat (pos);
+    endif
+    phi = atand (pos(:,1) ./ pos(:,2));
+    [theta, r] = cart2pol (pos(:,1), pos(:,2));
+    theta *= 180/pi;
+    theta -= azel(1);
+    theta = mod (theta, 360);
+    ud_mask = (theta > 180);
+    lr_mask = (theta > 90) & (theta < 270);
+    for i = 1 : length (tobj)
+      if (is_pie3)
+        if (ud_mask(i))
+          set (tobj(i), "position", [pos(i,1), pos(i,2), -0.05]);
+        else
+          set (tobj(i), "position", [pos(i,1), pos(i,2), 0.40]);
+        endif
+      endif
+
+      if (lr_mask(i))
+        set (tobj(i), "horizontalalignment", "right");
+      else
+        set (tobj(i), "horizontalalignment", "left");
+      endif
+    endfor
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__plt__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,502 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __plt__ (@var{caller}, @var{h}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = __plt__ (caller, h, varargin)
+
+  persistent warned_callers = {};
+  nargs = nargin - 2;
+
+  if (nargs > 0)
+
+    k = 1;
+
+    x_set = false;
+    y_set = false;
+    property_set = false;
+    properties = {};
+
+    hlegend = [];
+    fkids = get (gcf (), "children");
+    for i = 1 : numel (fkids)
+      if (   strcmp (get (fkids(i), "type"), "axes")
+          && strcmp (get (fkids(i), "tag"), "legend"))
+        udata = get (fkids(i), "userdata");
+        if (! isempty (intersect (udata.handle, gca ())))
+          hlegend = fkids(i);
+          break;
+        endif
+      endif
+    endfor
+
+    setlgnd = false;
+    if (isempty (hlegend))
+      hlgnd = [];
+      tlgnd = {};
+    else
+      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
+    endif
+
+    ## Gather arguments, decode format, gather plot strings, and plot lines.
+
+    retval = [];
+
+    while (nargs > 0 || x_set)
+
+      if (nargs == 0)
+        ## Force the last plot when input variables run out.
+        next_cell = {};
+        next_arg = {""};
+      else
+        next_cell = varargin(k);
+        next_arg = varargin{k++};
+      endif
+
+      if (isnumeric (next_arg) && ndims (next_arg) > 2
+          && any (size (next_arg) == 1))
+        next_arg = squeeze (next_arg);
+        if (! any (strcmp (caller, warned_callers)) && ndims (next_arg) < 3)
+          warning (["%s: N-d inputs have been squeezed to less than " ...
+                    "three dimensions"], caller)
+          warned_callers(end+1) = caller;
+        endif
+      endif
+      if (isnumeric (next_arg) && ndims (next_arg) > 2)
+        error ("%s: plot arrays must have less than 2 dimensions", caller)
+      endif
+
+      nargs--;
+
+      if (ischar (next_arg) || iscellstr (next_arg))
+        if (x_set)
+          [options, valid] = __pltopt__ (caller, next_arg, false);
+          if (! valid)
+            if (nargs == 0)
+              error ("%s: properties must appear followed by a value", caller);
+            endif
+            properties = [properties, [next_cell, varargin(k++)]];
+            nargs--;
+            continue;
+          else
+            while (nargs > 0 && ischar (varargin{k}))
+              if (nargs < 2)
+                error ("%s: properties must appear followed by a value",
+                       caller);
+              endif
+              properties = [properties, varargin(k:k+1)];
+              k += 2;
+              nargs -= 2;
+            endwhile
+          endif
+          if (y_set)
+            tmp = __plt2__ (h, x, y, options, properties);
+            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
+            properties = {};
+            retval = [retval; tmp];
+          else
+            tmp = __plt1__ (h, x, options, properties);
+            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
+            properties = {};
+            retval = [retval; tmp];
+          endif
+          x_set = false;
+          y_set = false;
+        else
+          error ("plot: no data to plot");
+        endif
+      elseif (x_set)
+        if (y_set)
+          options = __pltopt__ (caller, {""});
+          tmp = __plt2__ (h, x, y, options, properties);
+          [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
+          retval = [retval; tmp];
+          x = next_arg;
+          y_set = false;
+          properties = {};
+        else
+          y = next_arg;
+          y_set = true;
+        endif
+      else
+        x = next_arg;
+        x_set = true;
+      endif
+
+    endwhile
+
+    if (setlgnd)
+      legend (gca (), hlgnd, tlgnd);
+    endif
+  else
+    error ("__plt__: invalid number of arguments");
+  endif
+
+endfunction
+
+function [hlgnd, tlgnd, setlgnd] = __plt_key__ (h, options, hlgnd, tlgnd, setlgnd)
+  n = numel (h);
+  if (numel (options) == 1)
+    options = repmat (options(:), n, 1);
+  endif
+
+  for i = 1 : n
+    key = options(i).key;
+    if (! isempty (key))
+      hlgnd = [hlgnd(:); h(i)];
+      tlgnd = {tlgnd{:}, key};
+      setlgnd = true;
+    endif
+  endfor
+endfunction
+
+function retval = __plt1__ (h, x1, options, properties = {})
+
+  if (nargin < 3 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (! isstruct (options))
+    error ("__plt1__: options must be a struct array");
+  endif
+
+  [nr, nc] = size (x1);
+  if (nr == 1)
+    x1 = x1.';
+    [nr, nc] = deal (nc, nr);   # Swap rows and columns
+  endif
+  if (iscomplex (x1))
+    x1_i = imag (x1);
+    if (any ((x1_i(:))))
+      x2 = x1_i;
+      x1 = real (x1);
+    else
+      x2 = x1;
+      x1 = (1:nr)';
+    endif
+  else
+    x2 = x1;
+    x1 = (1:nr)';
+  endif
+
+  retval = __plt2__ (h, x1, x2, options, properties);
+
+endfunction
+
+function retval = __plt2__ (h, x1, x2, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (! isstruct (options))
+    error ("__plt2__: options must be a struct array");
+  endif
+
+  if (islogical (x1))
+    x1 = int8 (x1);
+  elseif (iscomplex ((x1)))
+    x1 = real (x1);
+  endif
+
+  if (islogical (x2))
+    x2 = int8 (x2);
+  elseif (iscomplex (x2))
+    x2 = real (x2);
+  endif
+
+  h_set = false;
+  if (isempty (x1) && isempty (x2))
+    retval = zeros (0, 1);
+  elseif (isscalar (x1))
+    if (isscalar (x2))
+      retval = __plt2ss__ (h, x1, x2, options, properties);
+    elseif (isvector (x2))
+      retval = __plt2sv__ (h, x1, x2, options, properties);
+    else
+      error ("__plt2__: invalid data for plotting");
+    endif
+  elseif (isvector (x1))
+    if (isscalar (x2))
+      retval = __plt2vs__ (h, x1, x2, options, properties);
+    elseif (isvector (x2))
+      retval = __plt2vv__ (h, x1, x2, options, properties);
+    elseif (ismatrix (x2))
+      retval = __plt2vm__ (h, x1, x2, options, properties);
+    else
+      error ("__plt2__: invalid data for plotting");
+    endif
+  elseif (ismatrix (x1))
+    if (isvector (x2))
+      retval = __plt2mv__ (h, x1, x2, options, properties);
+    elseif (ismatrix (x2))
+      retval = __plt2mm__ (h, x1, x2, options, properties);
+    else
+      error ("__plt2__: invalid data for plotting");
+    endif
+  else
+    error ("__plt2__: invalid data for plotting");
+  endif
+
+endfunction
+
+function retval = __plt2mm__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  [x_nr, x_nc] = size (x);
+  [y_nr, y_nc] = size (y);
+
+  if (x_nr != y_nr && x_nc != y_nc)
+    error ("__plt2mm__: matrix dimensions must match");
+  endif
+
+  if (numel (options) == 1)
+    options = repmat (options(:), x_nc, 1);
+  endif
+  retval = zeros (x_nc, 1);
+  for i = 1:x_nc
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      [linestyle, marker] = __next_line_style__ ();
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x(:,i), y(:,i), "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2mv__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  y = y(:);
+  [y_nr, y_nc] = size (y);
+  [x_nr, x_nc] = size (x);
+
+  if (x_nr == y_nr)
+    ## Correctly oriented.  Do nothing.
+  elseif (x_nc == y_nr)
+    x = x.';
+    [x_nr, x_nc] = deal (x_nc, x_nr);
+  else
+    error ("__plt2mv__: matrix dimensions must match");
+  endif
+
+  if (numel (options) == 1)
+    options = repmat (options(:), x_nc, 1);
+  endif
+  retval = zeros (x_nc, 1);
+  for i = 1:x_nc
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      [linestyle, marker] = __next_line_style__ ();
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x(:,i), y, "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2ss__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (numel (options) > 1)
+    options = options(1);
+  endif
+
+  linestyle = options.linestyle;
+  marker = options.marker;
+  if (isempty (marker) && isempty (linestyle))
+    ## If unspecified, marker for a single point is always "."
+    linestyle = "-";
+    marker = ".";
+  endif
+  color = options.color;
+  if (isempty (color))
+    color = __next_line_color__ ();
+  endif
+
+  retval = line (x, y, "color", color,
+                 "linestyle", linestyle,
+                 "marker", marker, properties{:});
+
+endfunction
+
+function retval = __plt2sv__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  len = numel (y);
+  if (numel (options) == 1)
+    options = repmat (options(:), len, 1);
+  endif
+  retval = zeros (len, 1);
+  for i = 1:len
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      ## If unspecified, marker for a point is always "."
+      linestyle = "-";
+      marker = ".";
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x, y(i), "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2vm__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  x = x(:);
+  [x_nr, x_nc] = size (x);
+  [y_nr, y_nc] = size (y);
+
+  if (x_nr == y_nr)
+    ## Correctly oriented.  Do nothing.
+  elseif (x_nr == y_nc)
+    y = y.';
+    [y_nr, y_nc] = deal (y_nc, y_nr);
+  else
+    error ("__plt2vm__: matrix dimensions must match");
+  endif
+
+  if (numel (options) == 1)
+    options = repmat (options(:), y_nc, 1);
+  endif
+  retval = zeros (y_nc, 1);
+  for i = 1:y_nc
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      [linestyle, marker] = __next_line_style__ ();
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x, y(:,i), "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2vs__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  len = numel (x);
+  if (numel (options) == 1)
+    options = repmat (options(:), len, 1);
+  endif
+  retval = zeros (len, 1);
+  for i = 1:len
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      ## If unspecified, marker for a point is always "."
+      linestyle = "-";
+      marker = ".";
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x(i), y, "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2vv__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (numel (options) > 1)
+    options = options(1);
+  endif
+
+  x = x(:);
+  y = y(:);
+
+  if (length (x) != length (y))
+    error ("__plt2vv__: vector lengths must match");
+  endif
+
+  linestyle = options.linestyle;
+  marker = options.marker;
+  if (isempty (marker) && isempty (linestyle))
+    [linestyle, marker] = __next_line_style__ ();
+  endif
+  color = options.color;
+  if (isempty (color))
+    color = __next_line_color__ ();
+  endif
+
+  retval = line (x, y, "color", color,
+                 "linestyle", linestyle,
+                 "marker", marker, properties{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__quiver__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,448 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{hg} =} __quiver__ (@dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function hg = __quiver__ (varargin)
+
+  h = varargin{1};
+  is3d = varargin{2};
+
+  autoscale = 0.9;
+  arrowsize = 0.2;
+
+  firstnonnumeric = Inf;
+  for i = 3:nargin
+    if (! isnumeric (varargin{i}))
+      firstnonnumeric = i;
+      break;
+    endif
+  endfor
+
+  ioff = 3;
+  if (nargin < (6 + is3d) || firstnonnumeric < (6 + is3d))
+    u = varargin{ioff++};
+    v = varargin{ioff++};
+    if (is3d)
+      w = varargin{ioff++};
+      [x, y, z] = meshgrid (1:columns (u), 1:rows (u), 1:max (size (w)));
+    else
+      [x, y] = meshgrid (1:columns (u), 1:rows (u));
+    endif
+    if (nargin >= ioff && isnumeric (varargin{ioff})
+        && isscalar (varargin{ioff}))
+      autoscale = varargin{ioff++};
+    endif
+  else
+    x = varargin{ioff++};
+    y = varargin{ioff++};
+    if (is3d)
+      z = varargin{ioff++};
+    endif
+    u = varargin{ioff++};
+    v = varargin{ioff++};
+    if (is3d)
+      w = varargin{ioff++};
+      if (isvector (x) && isvector (y) && isvector (z)
+          && (! isvector (u) || ! isvector (v) || ! isvector (w)))
+        [x, y, z] = meshgrid (x, y, z);
+      endif
+    else
+      if (isvector (x) && isvector (y) && (! isvector (u) || ! isvector (v)))
+        [x, y] = meshgrid (x, y);
+      endif
+    endif
+    if (nargin >= ioff && isnumeric (varargin{ioff})
+        && isscalar (varargin{ioff}))
+      autoscale = varargin{ioff++};
+    endif
+  endif
+
+  have_filled = false;
+  have_line_spec = false;
+  args = {};
+  while (ioff <= nargin)
+    arg = varargin{ioff++};
+    if (ischar (arg) && strcmpi (arg, "filled"))
+      have_filled = true;
+    elseif ((ischar (arg) || iscellstr (arg))
+            && ! have_line_spec)
+      [linespec, valid] = __pltopt__ ("quiver", arg, false);
+      if (valid)
+        have_line_spec = true;
+        if (strcmp (linespec.linestyle, "none"))
+          linespec.linestyle = "-";
+        endif
+      else
+        args {end + 1} = arg;
+        if (ioff <= nargin)
+          args {end + 1} = varargin{ioff++};
+        endif
+      endif
+    else
+      args {end + 1} = arg;
+      if (ioff <= nargin)
+        args {end + 1} = varargin{ioff++};
+      endif
+    endif
+  endwhile
+
+  if (autoscale && numel (u) > 1)
+    ## Scale the arrows to fit in the grid
+    if (isvector (x))
+      ny = nx = length (x);
+    else
+      [nx, ny] = size (x);
+    endif
+    dx = (max (x(:)) - min (x(:))) ./ nx;
+    dy = (max (y(:)) - min (y(:))) ./ ny;
+    if (is3d)
+      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
+      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
+    else
+      dz = 0;
+      len = max (sqrt (u(:).^2 + v(:).^2));
+    endif
+    if (len > 0)
+      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
+      if (sd != 0)
+        s = sqrt (2) * autoscale * sd;
+      else # special case of identical points with multiple vectors
+        s = autoscale;
+      endif
+      uu = s * u;
+      vv = s * v;
+      if (is3d)
+        ww = s*w;
+      endif
+    endif
+  else
+    uu = u;
+    vv = v;
+    if (is3d)
+      ww = w;
+    endif
+  endif
+
+  hstate = get (h, "nextplot");
+  unwind_protect
+    hg = hggroup ();
+    if (is3d)
+      args = __add_datasource__ ("quiver3", hg,
+                                 {"x", "y", "z", "u", "v", "w"}, args{:});
+    else
+      args = __add_datasource__ ("quiver", hg,
+                                 {"x", "y", "z", "u", "v", "w"}, args{:});
+    endif
+    hold on;
+
+    addproperty ("xdata", hg, "data", x);
+    addproperty ("ydata", hg, "data", y);
+
+    addproperty ("udata", hg, "data", u);
+    addproperty ("vdata", hg, "data", v);
+    if (is3d)
+      addproperty ("zdata", hg, "data", z);
+      addproperty ("wdata", hg, "data", w);
+    else
+      addproperty ("zdata", hg, "data", []);
+      addproperty ("wdata", hg, "data", []);
+    endif
+
+    addlistener (hg, "xdata", @update_data);
+    addlistener (hg, "ydata", @update_data);
+    addlistener (hg, "zdata", @update_data);
+    addlistener (hg, "udata", @update_data);
+    addlistener (hg, "vdata", @update_data);
+    addlistener (hg, "wdata", @update_data);
+
+    x = x(:);
+    y = y(:);
+    xend = x + uu(:);
+    yend = y + vv(:);
+    if (is3d)
+      z = z(:);
+      zend = z + ww(:);
+    endif
+
+    if (have_line_spec)
+      if (is3d)
+        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
+                    [y.'; yend.'; NaN(1, length (y))](:),
+                    [z.'; zend.'; NaN(1, length (z))](:),
+                    "linestyle", linespec.linestyle,
+                    "color", linespec.color, "parent", hg);
+      else
+        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
+                   [y.'; yend.'; NaN(1, length (y))](:),
+                   "linestyle", linespec.linestyle,
+                    "color", linespec.color, "parent", hg);
+      endif
+    else
+      if (is3d)
+        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
+                    [y.'; yend.'; NaN(1, length (y))](:),
+                    [z.'; zend.'; NaN(1, length (z))](:),
+                    "color", "black", "parent", hg);
+      else
+        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
+                   [y.'; yend.'; NaN(1, length (y))](:),
+                   "parent", hg);
+      endif
+    endif
+
+    xtmp = x + uu(:) .* (1 - arrowsize);
+    ytmp = y + vv(:) .* (1 - arrowsize);
+
+    if (is3d)
+      xarrw1 = xtmp + sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
+      xarrw2 = xtmp - sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
+      yarrw1 = ytmp - sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
+      yarrw2 = ytmp + sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
+
+      zarrw1 = zarrw2 = zend - ww(:) * arrowsize;
+    else
+      xarrw1 = xtmp + (y - yend) * arrowsize / 3;
+      xarrw2 = xtmp - (y - yend) * arrowsize / 3;
+      yarrw1 = ytmp - (x - xend) * arrowsize / 3;
+      yarrw2 = ytmp + (x - xend) * arrowsize / 3;
+    endif
+
+    if (have_line_spec)
+      if (isfield (linespec, "marker")
+          && ! strcmp (linespec.marker, "none"))
+        if (is3d)
+          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
+                      "linestyle", "none", "parent", hg);
+        else
+          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                     "linestyle", "none", "parent", hg);
+        endif
+      else
+        if (is3d)
+          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
+                      "linestyle", linespec.linestyle,
+                      "color", linespec.color, "parent", hg);
+        else
+          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                     "linestyle", linespec.linestyle,
+                      "color", linespec.color, "parent", hg);
+        endif
+      endif
+    elseif (is3d)
+      h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                  [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                  [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
+                  "color", "black", "parent", hg);
+    else
+      h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                 [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                 "parent", hg);
+    endif
+
+    if (! have_line_spec
+        || (isfield (linespec, "marker")
+            && strcmp (linespec.marker, "none")))
+      if (is3d)
+        h3 = plot3 (x, y, z, "linestyle", "none", "marker", "none",
+                    "parent", hg);
+      else
+        h3 = plot (x, y, "linestyle", "none", "marker", "none", "parent", hg);
+      endif
+    else
+      if (is3d)
+        h3 = plot3 (x, y, z, "linestyle", "none", "marker", linespec.marker,
+                    "parent", hg);
+      else
+
+        h3 = plot (x, y, "linestyle", "none", "marker", linespec.marker,
+                   "parent", hg);
+      endif
+    endif
+    if (have_filled)
+      ## FIXME: gnuplot doesn't respect the markerfacecolor field
+      set (h3, "markerfacecolor", get (h1, "color"));
+    endif
+
+    ## Set up the hggroup properties and listeners
+    if (autoscale)
+      addproperty ("autoscale", hg, "radio", "{on}|off", "on");
+      addproperty ("autoscalefactor", hg, "data", autoscale);
+    else
+      addproperty ("autoscale", hg, "radio", "{on}|off", "off");
+      addproperty ("autoscalefactor", hg, "data", 1.0);
+    endif
+    addlistener (hg, "autoscale", @update_data);
+    addlistener (hg, "autoscalefactor", @update_data);
+
+    addproperty ("maxheadsize", hg, "data", arrowsize);
+    addlistener (hg, "maxheadsize", @update_data);
+
+    addproperty ("showarrowhead", hg, "radio", "{on}|off", "on");
+    addlistener (hg, "showarrowhead", @update_props);
+
+    addproperty ("color", hg, "linecolor", get (h1, "color"));
+    addproperty ("linewidth", hg, "linelinewidth", get (h1, "linewidth"));
+    addproperty ("linestyle", hg, "linelinestyle", get (h1, "linestyle"));
+    addproperty ("marker", hg, "linemarker", get (h3, "marker"));
+    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
+                 get (h3, "markerfacecolor"));
+    addproperty ("markersize", hg, "linemarkersize", get (h3, "markersize"));
+
+    addlistener (hg, "color", @update_props);
+    addlistener (hg, "linewidth", @update_props);
+    addlistener (hg, "linestyle", @update_props);
+    addlistener (hg, "marker", @update_props);
+    addlistener (hg, "markerfacecolor", @update_props);
+    addlistener (hg, "markersize", @update_props);
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    if (! isempty (args))
+      set (hg, args{:});
+    endif
+  unwind_protect_cleanup
+    set (h, "nextplot", hstate);
+  end_unwind_protect
+
+endfunction
+
+function update_data (h, d)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+  z = get (h, "zdata");
+
+  u = get (h, "udata");
+  v = get (h, "vdata");
+  w = get (h, "wdata");
+
+  s = get (h, "autoscalefactor");
+  arrowsize = get (h, "maxheadsize");
+
+  kids = get (h, "children");
+
+  if (isempty (z) || isempty (w))
+    is3d = false;
+  else
+    is3d = true;
+  endif
+
+  if (strcmpi (get (h, "autoscale"), "on") && s != 0)
+    ## Scale the arrows to fit in the grid
+    if (isvector (x))
+      ny = nx = length (x);
+    else
+      [nx, ny] = size (x);
+    endif
+    dx = (max (x(:)) - min (x(:))) ./ nx;
+    dy = (max (y(:)) - min (y(:))) ./ ny;
+    if (is3d)
+      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
+      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
+    else
+      dz = 0;
+      len = max (sqrt (u(:).^2 + v(:).^2));
+    endif
+    if (len > 0)
+      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
+      if (sd != 0)
+        s *= sqrt (2) * sd;
+      endif
+      u = s * u;
+      v = s * v;
+      if (is3d)
+        w = s*w;
+      endif
+    endif
+  endif
+
+  x = x(:);
+  y = y(:);
+  xend = x + u(:);
+  yend = y + v(:);
+  if (is3d)
+    z = z(:);
+    zend = z + w(:);
+  endif
+
+  set (kids (3), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
+  set (kids (3), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
+  if (is3d)
+    set (kids (3), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
+  endif
+
+  xtmp = x + u(:) .* (1 - arrowsize);
+  ytmp = y + v(:) .* (1 - arrowsize);
+  xarrw1 = xtmp + (y - yend) * arrowsize / 3;
+  xarrw2 = xtmp - (y - yend) * arrowsize / 3;
+  yarrw1 = ytmp - (x - xend) * arrowsize / 3;
+  yarrw2 = ytmp + (x - xend) * arrowsize / 3;
+  if (is3d)
+    zarrw1 = zarrw2 = zend - w(:) * arrowsize;
+  endif
+
+  set (kids (2), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
+  set (kids (2), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
+  if (is3d)
+    set (kids (2), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
+  endif
+
+  set (kids (2), "xdata", [xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:));
+  set (kids (2), "ydata", [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:));
+  if (is3d)
+    set (kids (2), "zdata", [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:));
+  endif
+
+  set (kids (1), "xdata", x);
+  set (kids (1), "ydata", y);
+  if (is3d)
+    set (kids (1), "zdata", z);
+  endif
+
+endfunction
+
+function update_props (h, d)
+  kids = get (h, "children");
+
+  set (kids(3), "color", get (h, "color"),
+       "linewidth", get (h, "linewidth"),
+       "linestyle", get (h, "linestyle"));
+  set (kids(2), "color", get (h, "color"),
+       "linewidth", get (h, "linewidth"),
+       "linestyle", get (h, "linestyle"));
+  if (strcmpi (get (h, "showarrowhead"), "on"))
+    set (kids (2), "visible", "on");
+  else
+    set (kids (2), "visible", "off");
+  endif
+  set (kids(1), "color", get (h, "color"),
+       "marker", get (h, "marker"),
+       "markerfacecolor", get (h, "markerfacecolor"),
+       "markersize", get (h, "markersize"));
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__scatter__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,374 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{hg} =} __scatter__ (@dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function hg = __scatter__ (varargin)
+
+  hax = varargin{1};  # We don't do anything with this.  Could remove it.
+  nd  = varargin{2};
+  fcn = varargin{3};
+  x   = varargin{4}(:);
+  y   = varargin{5}(:);
+
+  if (nd == 2)
+    istart = 6;
+  else
+    z = varargin{6}(:);
+    istart = 7;
+  endif
+
+  if (istart <= nargin)
+    s = varargin{istart}(:);
+    if (isempty (s) || ischar (s))
+      s = 6;
+    endif
+    if (! ischar (varargin{istart}))
+      istart++;
+    endif
+  else
+    s = 6;
+  endif
+
+  ## Remove NaNs
+  idx = isnan (x) | isnan (y) | isnan (s);
+  if (nd == 3)
+    idx |= isnan (z);
+    z(idx) = [];
+  endif
+  x(idx) = [];
+  y(idx) = [];
+  if (nd == 2)
+    z = zeros (length (x), 0);
+  endif
+  if (numel (s) > 1)
+    s(idx) = [];
+  endif
+
+  firstnonnumeric = find (! cellfun ("isnumeric", varargin(istart:nargin)), 1);
+  if (isempty (firstnonnumeric))
+    firstnonnumeric = Inf;
+  else
+    firstnonnumeric += istart - 1;
+  endif
+
+  if (istart <= nargin && firstnonnumeric > istart)
+    c = varargin{istart};
+    if (isvector (c) && columns (c) != 3)
+      c = c(:);
+    endif
+  elseif (firstnonnumeric == istart && ischar (varargin{istart})
+          && ! (   strcmpi (varargin{istart}, "filled")
+                || strcmpi (varargin{istart}, "fill")))
+    c = varargin{istart};
+    firstnonnumeric++;
+  else
+    c = [];
+  endif
+
+  newargs = {};
+  filled = false;
+  have_marker = false;
+  marker = "o";
+  iarg = firstnonnumeric;
+  while (iarg <= nargin)
+    arg = varargin{iarg++};
+    if (ischar (arg) && (strcmpi (arg, "filled") || strcmpi (arg, "fill")))
+      filled = true;
+    elseif ((ischar (arg) || iscellstr (arg)) && ! have_marker)
+      [linespec, valid] = __pltopt__ (fcn, arg, false);
+      if (valid)
+        have_marker = true;
+        marker = linespec.marker;
+        if (strcmp (marker, "none"))
+          marker = "o";
+        elseif (isempty (marker))
+          have_marker = false;
+          [~, marker] = __next_line_style__ ();
+        endif
+      else
+        error ("%s: invalid linespec", fcn);
+      endif
+    else
+      newargs{end+1} = arg;
+      if (iarg <= nargin)
+        newargs{end+1} = varargin{iarg++};
+      endif
+    endif
+  endwhile
+
+  if (isempty (c))
+    c = __next_line_color__ ();
+  endif
+
+  ## Must occur after __next_line_color__ in order to work correctly.
+  hg = hggroup ();
+  newargs = __add_datasource__ (fcn, hg, {"x", "y", "z", "c", "size"},
+                                newargs{:});
+
+  addproperty ("xdata", hg, "data", x);
+  addproperty ("ydata", hg, "data", y);
+  addproperty ("zdata", hg, "data", z);
+  if (ischar (c))
+    ## For single explicit color, cdata is unused
+    addproperty ("cdata", hg, "data", []);
+  else
+    addproperty ("cdata", hg, "data", c);
+  endif
+  addproperty ("sizedata", hg, "data", s);
+  addlistener (hg, "xdata", @update_data);
+  addlistener (hg, "ydata", @update_data);
+  addlistener (hg, "zdata", @update_data);
+  addlistener (hg, "cdata", @update_data);
+  addlistener (hg, "sizedata", @update_data);
+
+  one_explicit_color = ischar (c) || isequal (size (c), [1, 3]);
+
+  if (numel (x) <= 100)
+
+    ## For small number of points, we'll construct an object for each point.
+
+    if (numel (s) == 1)
+      s = repmat (s, numel (x), 1);
+    endif
+
+    if (one_explicit_color)
+      for i = 1 : numel (x)
+        if (filled)
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker,  "markersize", s(i),
+                        "markeredgecolor", c, "markerfacecolor", c,
+                        "linestyle", "none");
+        else
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker,  "markersize", s(i),
+                        "markeredgecolor", c, "markerfacecolor", "none",
+                        "linestyle", "none");
+        endif
+      endfor
+    else
+      if (rows (c) == 1)
+        c = repmat (c, rows (x), 1);
+      endif
+      for i = 1 : numel (x)
+        if (filled)
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker, "markersize", s(i),
+                        "markeredgecolor", "none",
+                        "markerfacecolor", "flat",
+                        "cdata", c(i,:), "facevertexcdata", c(i,:),
+                        "linestyle", "none");
+        else
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker, "markersize", s(i),
+                        "markeredgecolor", "flat",
+                        "markerfacecolor", "none",
+                        "cdata", c(i,:), "facevertexcdata", c(i,:),
+                        "linestyle", "none");
+        endif
+      endfor
+    endif
+
+  else
+
+    ## For larger numbers of points, we split the points by common color.
+
+    vert = [x, y, z];
+    if (one_explicit_color)
+      render_size_color (hg, vert, s, c, marker, filled, true);
+    else
+      if (rows (c) == 1)
+        c = repmat (c, rows (x), 1);
+      endif
+      ## We want to group points by color.  So first get all the unique colors
+      [cc, ~, c_to_cc] = unique (c, "rows");
+
+      for i = 1 : rows (cc)
+        ## Now for each possible unique color, get the logical index of
+        ## points that correspond to that color
+        idx = (i == c_to_cc);
+        if (isscalar (s))
+          render_size_color (hg, vert(idx, :), s, c(idx,:),
+                                 marker, filled, true);
+        else
+          render_size_color (hg, vert(idx, :), s(idx), c(idx,:),
+                                 marker, filled, true);
+        endif
+      endfor
+
+    endif
+  endif
+
+  if (! ischar (c) && rows (c) > 1)
+    ax = get (hg, "parent");
+    clim = get (ax, "clim");
+    if (min (c(:)) < clim(1))
+      clim(1) = min (c(:));
+      set (ax, "clim", clim);
+    endif
+    if (max (c(:)) > clim(2))
+      set (ax, "clim", [clim(1), max(c(:))]);
+    endif
+  endif
+
+  addproperty ("linewidth", hg, "patchlinewidth", 0.5);
+  addproperty ("marker", hg, "patchmarker", marker);
+  if (filled)
+    addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "none");
+    if (one_explicit_color)
+      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", c);
+    else
+      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "flat");
+    endif
+  else
+    addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "none");
+    if (one_explicit_color)
+      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", c);
+    else
+      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "flat");
+    endif
+  endif
+  addlistener (hg, "linewidth", @update_props);
+  addlistener (hg, "marker", @update_props);
+  addlistener (hg, "markerfacecolor", @update_props);
+  addlistener (hg, "markeredgecolor", @update_props);
+
+  ## Matlab property, although Octave does not implement it.
+  addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+  if (! isempty (newargs))
+    set (hg, newargs{:});
+  endif
+
+endfunction
+
+function render_size_color (hg, vert, s, c, marker, filled, isflat)
+  if (isscalar (s))
+    x = vert(:,1);
+    y = vert(:,2);
+    z = vert(:,3:end);
+    toolkit = get (ancestor (hg, "figure"), "__graphics_toolkit__");
+    ## Does gnuplot only support triangles with different vertex colors ?
+    ## TODO: Verify gnuplot can only support one color.  If RGB triplets
+    ##       can be assigned to each vertex, then fix __go_draw_axes__.m
+    gnuplot_hack = (numel (x) > 1 && columns (c) == 3
+                    && strcmp (toolkit, "gnuplot"));
+    if (ischar (c) || ! isflat || gnuplot_hack)
+      if (filled)
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker,
+                          "markeredgecolor", "none",
+                          "markerfacecolor", c(1,:),
+                          "markersize", s, "linestyle", "none");
+      else
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker,
+                          "markeredgecolor", c(1,:),
+                          "markerfacecolor", "none",
+                          "markersize", s, "linestyle", "none");
+      endif
+    else
+      if (filled)
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker, "markersize", s,
+                          "markeredgecolor", "none",
+                          "markerfacecolor", "flat",
+                          "cdata", c, "facevertexcdata", c,
+                          "linestyle", "none");
+      else
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker, "markersize", s,
+                          "markeredgecolor", "flat",
+                          "markerfacecolor", "none",
+                          "cdata", c, "facevertexcdata", c,
+                          "linestyle", "none");
+      endif
+    endif
+  else
+    ## Round size to one decimal place.
+    [ss, ~, s_to_ss] = unique (ceil (s*10) / 10);
+    for i = 1:rows (ss)
+      idx = (i == s_to_ss);
+      render_size_color (hg, vert(idx,:), ss(i), c,
+                             marker, filled, isflat);
+    endfor
+  endif
+endfunction
+
+function update_props (h, d)
+  lw = get (h, "linewidth");
+  m  = get (h, "marker");
+  fc = get (h, "markerfacecolor");
+  ec = get (h, "markeredgecolor");
+  kids = get (h, "children");
+
+  set (kids, "linewidth", lw, "marker", m,
+             "markerfacecolor", fc, "markeredgecolor", ec);
+endfunction
+
+function update_data (h, d)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+  z = get (h, "zdata");
+  c = get (h, "cdata");
+  if (rows (c) == 1)
+    c = repmat (c, numel (x), 1);
+  endif
+  s = get (h, "sizedata");
+  if (numel (s) == 1)
+    s = repmat (s, numel (x), 1);
+  endif
+  hlist = get (h, "children");
+
+  if (isempty (z))
+    for i = 1 : length (hlist)
+      set (hlist(i), "vertices", [x(i), y(i)],
+                     "cdata", reshape (c(i,:),[1, size(c)(2:end)]),
+                     "facevertexcdata", c(i,:),
+                     "markersize", s(i));
+    endfor
+  else
+    for i = 1 : length (hlist)
+      set (hlist(i), "vertices", [x(i), y(i), z(i)],
+                     "cdata", reshape (cd(i,:),[1, size(cd)(2:end)]),
+                     "facevertexcdata", cd(i,:),
+                     "markersize", s(i));
+    endfor
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__stem__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,430 @@
+## Copyright (C) 2006-2012 Michel D. Schmid
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __stem__ (@var{have_z}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
+## Adapted-by: jwe
+
+function h = __stem__ (have_z, varargin)
+
+  if (have_z)
+    caller = "stem3";
+  else
+    caller = "stem";
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (caller, varargin{:});
+
+  [x, y, z, dofill, llc, ls, mmc, ms, varargin] = ...
+                                           check_stem_arg (have_z, varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    hold_state = get (hax, "nextplot");
+    set (hax, "nextplot", "add");
+
+    h = [];
+    nx = rows (x);
+    for i = 1 : columns (x)
+      if (have_z)
+        xt = x(:)';
+        xt = [xt; xt; NaN(1, nx)](:);
+        yt = y(:)';
+        yt = [yt; yt; NaN(1, nx)](:);
+        zt = z(:)';
+        zt = [zeros(1, nx); zt; NaN(1, nx)](:);
+      else
+        xt = x(:, i)';
+        xt = [xt; xt; NaN(1, nx)](:);
+        yt = y(:, i)';
+        yt = [zeros(1, nx); yt; NaN(1, nx)](:);
+      endif
+
+      if (isempty (llc))
+        lc = __next_line_color__ ();
+      else
+        lc = llc;
+      endif
+
+      if (isempty (mmc))
+        mc = lc;
+      else
+        mc = mmc;
+      endif
+
+      if (dofill)
+        fc = mc;
+      else
+        fc = "none";
+      endif
+
+      ## Must occur after __next_line_color__ in order to work correctly.
+      hg = hggroup ();
+      h = [h; hg];
+      args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:});
+
+      if (have_z)
+        __line__ (hax, xt, yt, zt, "color", lc, "linestyle", ls, "parent", hg);
+        __line__ (hax, x, y, z, "color", mc, "linestyle", "none",
+                       "marker", ms, "markerfacecolor", fc, "parent", hg);
+        h_baseline = [];
+      else
+        __line__ (hax, xt, yt, "color", lc, "linestyle", ls, "parent", hg);
+        __line__ (hax, x(:,i), y(:, i), "color", mc, "linestyle", "none",
+                       "marker", ms, "markerfacecolor", fc, "parent", hg);
+        x_axis_range = get (hax, "xlim");
+        h_baseline = line (hax, x_axis_range, [0, 0], "color", [0, 0, 0]);
+        set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
+        addlistener (hax, "xlim", @update_xlim);
+        addproperty ("basevalue", h_baseline, "data", 0);
+        addlistener (h_baseline, "basevalue", {@update_baseline, 0});
+        addlistener (h_baseline, "ydata", {@update_baseline, 1});
+        addlistener (h_baseline, "visible", {@update_baseline, 2});
+      endif
+
+      ## Setup the hggroup and listeners.
+      addproperty ("showbaseline", hg, "radio", "{on}|off");
+      addproperty ("baseline", hg, "data", h_baseline);
+      addproperty ("basevalue", hg, "data", 0);
+
+      if (! have_z)
+        addlistener (hg, "showbaseline", @show_baseline);
+        addlistener (hg, "basevalue", @move_baseline);
+      endif
+
+      addproperty ("color", hg, "linecolor", lc);
+      addproperty ("linestyle", hg, "linelinestyle", ls);
+      addproperty ("linewidth", hg, "linelinewidth", 0.5);
+      addproperty ("marker", hg, "linemarker", ms);
+      addproperty ("markeredgecolor", hg, "linemarkerfacecolor", mc);
+      addproperty ("markerfacecolor", hg, "linemarkerfacecolor", fc);
+      addproperty ("markersize", hg, "linemarkersize", 6);
+
+      addlistener (hg, "color", @update_props);
+      addlistener (hg, "linestyle", @update_props);
+      addlistener (hg, "linewidth", @update_props);
+      addlistener (hg, "marker", @update_props);
+      addlistener (hg, "markeredgecolor", @update_props);
+      addlistener (hg, "markerfacecolor", @update_props);
+      addlistener (hg, "markersize", @update_props);
+
+      addproperty ("xdata", hg, "data", x(:, i));
+      addproperty ("ydata", hg, "data", y(:, i));
+      if (have_z)
+        addproperty ("zdata", hg, "data", z(:, i));
+      else
+        addproperty ("zdata", hg, "data", []);
+      endif
+
+      addlistener (hg, "xdata", @update_data);
+      addlistener (hg, "ydata", @update_data);
+      addlistener (hg, "zdata", @update_data);
+
+      ## Matlab property, although Octave does not implement it.
+      addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+      if (! isempty (args))
+        set (hg, args{:});
+      endif
+      if (i == 1 && ! isempty (h_baseline))
+        set (h_baseline, "parent", get (hg, "parent"));
+      endif
+    endfor
+
+    if (! strcmp (hold_state, "add") && have_z)
+      set (hax, "view", [-37.5 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+    set (hax, "nextplot", hold_state);
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+function [x, y, z, dofill, lc, ls, mc, ms, args] = check_stem_arg (have_z, varargin)
+
+  if (have_z)
+    caller = "stem3";
+  else
+    caller = "stem";
+  endif
+  nargin = nargin - 1;  # account for have_z argument 
+
+  num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
+  if (isempty (num_numeric))
+    num_numeric = nargin;     
+  endif
+
+  if (num_numeric < 1 || num_numeric > 3)
+    print_usage (caller);
+  endif
+
+  x = y = z = [];
+  if (num_numeric == 1)
+    if (have_z)
+      z = varargin{1};
+    else
+      y = varargin{1};
+    endif
+  elseif (num_numeric == 2)
+    if (have_z)
+      error ("stem3: must define X, Y, and Z");
+    else
+      x = varargin{1};
+      y = varargin{2};
+    endif
+  else  # nun_numeric == 3
+    if (have_z)
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+    else
+      error ("stem: can not define Z for 2-D stem plot");
+    endif
+  endif
+
+  ## Validate numeric data
+  if (have_z)
+    if (isempty (x))
+      [nr, nc] = size (z);
+      if (nr >= nc)
+        x = repmat ([1:nc], nr, 1);
+        y = repmat ([1:nr]', 1, nc);
+      else
+        x = repmat ([1:nc], nr, 1);
+        y = repmat ([1:nr]', 1, nc);
+      endif
+    endif
+    if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
+      error ("stem3: X, Y, and Z must be numeric");
+    endif
+  else
+    if (isempty (x))
+      if (isvector (y))
+        x = 1:length (y);
+      elseif (ismatrix (y))
+        x = 1:rows (y);
+      endif
+    endif
+    if (! (ismatrix (x) && ismatrix (y)))
+      error ("stem: X and Y must be numeric");
+    endif
+  endif
+
+  ## Check sizes of x, y and z.
+  if (have_z)
+    if (! size_equal (x, y, z))
+      error ("stem3: inconsistent sizes for X, Y, and Z");
+    endif
+    x = x(:);
+    y = y(:);
+    z = z(:);
+  else
+    if (isvector (x))
+      x = x(:);
+      if (isvector (y))
+        if (length (x) != length (y))
+          error ("stem: inconsistent sizes for X and Y");
+        endif
+        y = y(:);
+      else
+        if (length (x) == rows (y))
+          x = repmat (x(:), 1, columns (y));
+        else
+          error ("stem: inconsistent sizes for X and Y");
+        endif
+      endif
+    elseif (! size_equal (x, y))
+      error ("stem: inconsistent sizes for X and Y");
+    endif
+  endif
+
+  dofill = false;
+  have_line_spec = false;
+  ## set specifiers to default values.
+  [lc, ls, mc, ms] = set_default_values ();
+
+  args = {};
+  ioff = num_numeric + 1;
+  while (ioff <= nargin)
+    arg = varargin{ioff++};
+    if (ischar (arg) && any (strcmpi (arg, {"fill", "filled"})))
+      dofill = true;
+    elseif ((ischar (arg) || iscellstr (arg)) && ! have_line_spec)
+      [linespec, valid] = __pltopt__ (caller, arg, false);
+      if (valid)
+        have_line_spec = true;
+        [lc, ls, mc, ms] = stem_line_spec (linespec);
+      else
+        args{end+1} = arg;
+        if (ioff <= nargin)
+          args{end+1} = varargin{ioff++};
+        else
+          error ('%s: No value specified for property "%s"', caller, arg);
+        endif
+      endif
+    else
+      args{end+1} = arg;
+      if (ioff <= nargin)
+        args{end+1} = varargin{ioff++};
+      else
+        error ('%s: No value specified for property "%s"', caller, arg);
+      endif
+    endif
+  endwhile
+
+endfunction
+
+function [lc, ls, mc, ms] = stem_line_spec (lspec)
+
+  [lc, ls, mc, ms] = set_default_values ();
+
+  if (! isempty (lspec.color))
+    lc = mc = lspec.color;
+  endif
+
+  if (! isempty (lspec.linestyle) && ! strcmp (lspec.linestyle, "none"))
+    ls = lspec.linestyle;
+  endif
+
+  if (! isempty (lspec.marker) && ! strcmp (lspec.marker, "none"))
+    ms = lspec.marker;
+  endif
+
+endfunction
+
+function [lc, ls, mc, ms] = set_default_values ()
+  mc = [];
+  lc = [];
+  ls = "-";
+  ms = "o";
+endfunction
+
+function update_xlim (h, ~)
+  kids = get (h, "children");
+  xlim = get (h, "xlim");
+
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
+      if (any (get (obj.baseline, "xdata") != xlim))
+        set (obj.baseline, "xdata", xlim);
+      endif
+    endif
+  endfor
+endfunction
+
+function update_baseline (h, ~, src)
+  visible = get (h, "visible");
+  if (src == 0)
+    basevalue = get (h, "basevalue");
+  else
+    basevalue = get (h, "ydata")(1);
+  endif
+
+  kids = get (get (h, "parent"), "children");
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
+        && obj.baseline == h)
+      ## Avoid lots of unnecessary listener updates
+      if (! strcmp (get (kids(i), "showbaseline"), visible))
+        set (kids(i), "showbaseline", visible);
+      endif
+      if (get (kids(i), "basevalue") != basevalue)
+        set (kids(i), "basevalue", basevalue);
+      endif
+    endif
+  endfor
+endfunction
+
+function show_baseline (h, ~)
+  set (get (h, "baseline"), "visible", get (h, "showbaseline"));
+endfunction
+
+function move_baseline (h, ~)
+  b0 = get (h, "basevalue");
+  bl = get (h, "baseline");
+
+  set (bl, "ydata", [b0, b0]);
+
+  kids = get (h, "children");
+  yt = get (h, "ydata")(:)';
+  ny = length (yt);
+  yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:);
+  set (kids(2), "ydata", yt);
+endfunction
+
+function update_props (h, ~)
+  kids = get (h, "children");
+  set (kids(2), "color", get (h, "color"),
+                "linestyle", get (h, "linestyle"),
+                "linewidth", get (h, "linewidth"));
+  set (kids(1), "color", get (h, "markeredgecolor"),
+                "marker", get (h, "marker"),
+                "markerfacecolor", get (h, "markerfacecolor"),
+                "markersize", get (h, "markersize"));
+endfunction
+
+function update_data (h, ~)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+  z = get (h, "zdata");
+
+  if (!isempty (z) && size_equal (x, y, z))
+    sz = min ([size(x); size(y); size(z)]);
+    x = x(1:sz(1),1:sz(2));
+    y = y(1:sz(1),1:sz(2));
+    z = z(1:sz(1),1:sz(2));
+  elseif (numel (x) != numel (y));
+    sz = min ([size(x); size(y)]);
+    x = x(1:sz(1),1:sz(2));
+    y = y(1:sz(1),1:sz(2));
+  endif
+  bl = get (h, "basevalue");
+  nx = numel (x);
+  x = x(:)';
+  xt = [x; x; NaN(1, nx)](:);
+  if (! isempty (z))
+    y = y(:)';
+    yt = [y; y; NaN(1, nx)](:);
+    z = z(:)';
+    zt = [bl * ones(1, nx); z; NaN(1, nx)](:);
+  else
+    y = y(:)';
+    yt = [bl * ones(1, nx); y; NaN(1, nx)](:);
+    zt = [];
+  endif
+
+  kids = get (h, "children");
+  set (kids(2), "xdata", xt, "ydata", yt, "zdata", zt);
+  set (kids(1), "xdata", x, "ydata", y, "zdata", z);
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/quiver.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,106 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} quiver (@var{u}, @var{v})
+## @deftypefnx {Function File} {} quiver (@var{x}, @var{y}, @var{u}, @var{v})
+## @deftypefnx {Function File} {} quiver (@dots{}, @var{s})
+## @deftypefnx {Function File} {} quiver (@dots{}, @var{style})
+## @deftypefnx {Function File} {} quiver (@dots{}, "filled")
+## @deftypefnx {Function File} {} quiver (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} quiver (@dots{})
+##
+## Plot the (@var{u}, @var{v}) components of a vector field in
+## an (@var{x}, @var{y}) meshgrid.  If the grid is uniform, you can
+## specify @var{x} and @var{y} as vectors.
+##
+## If @var{x} and @var{y} are undefined they are assumed to be
+## @code{(1:@var{m}, 1:@var{n})} where
+## @code{[@var{m}, @var{n}] = size (@var{u})}.
+##
+## The variable @var{s} is a scalar defining a scaling factor to use for
+## the arrows of the field relative to the mesh spacing.  A value of 0
+## disables all scaling.  The default value is 1.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+## If a marker is specified then markers at the grid points of the vectors are
+## drawn rather than arrows.  If the argument @qcode{"filled"} is given then the
+## markers are filled.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to a quiver object.
+## A quiver object regroups the components of the quiver plot (body, arrow,
+## and marker), and allows them to be changed together.
+##
+## @example
+## @group
+## [x, y] = meshgrid (1:2:20);
+## h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10));
+## set (h, "maxheadsize", 0.33);
+## @end group
+## @end example
+##
+## @seealso{quiver3, compass, feather, plot}
+## @end deftypefn
+
+function retval = quiver (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  else
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+    unwind_protect
+      hax = newplot (hax);
+      htmp = __quiver__ (hax, false, varargin{:});
+    unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+    end_unwind_protect
+  endif
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [x,y] = meshgrid (1:2:20);
+%! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10));
+%! set (h, 'maxheadsize', 0.33);
+
+%!demo
+%! clf;
+%! axis ('equal');
+%! x = linspace (0, 3, 80);
+%! y = sin (2*pi*x);
+%! theta = 2*pi*x + pi/2;
+%! quiver (x, y, sin (theta)/10, cos (theta)/10);
+%! hold on; plot (x,y,'r'); hold off;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/quiver3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,132 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} quiver3 (@var{u}, @var{v}, @var{w})
+## @deftypefnx {Function File} {} quiver3 (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w})
+## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{s})
+## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{style})
+## @deftypefnx {Function File} {} quiver3 (@dots{}, "filled")
+## @deftypefnx {Function File} {} quiver3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} quiver3 (@dots{})
+##
+## Plot the (@var{u}, @var{v}, @var{w}) components of a vector field in
+## an (@var{x}, @var{y}, @var{z}) meshgrid.  If the grid is uniform, you
+## can specify @var{x}, @var{y}, and @var{z} as vectors.
+##
+## If @var{x}, @var{y}, and @var{z} are undefined they are assumed to be
+## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] =
+## size (@var{u})} and @code{@var{p} = max (size (@var{w}))}.
+##
+## The variable @var{s} is a scalar defining a scaling factor to use for
+## the arrows of the field relative to the mesh spacing.  A value of 0
+## disables all scaling.  The default value is 1.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+## If a marker is specified then markers at the grid points of the vectors are
+## drawn rather than arrows.  If the argument @qcode{"filled"} is given then the
+## markers are filled.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to a quiver object.
+## A quiver object regroups the components of the quiver plot (body, arrow,
+## and marker), and allows them to be changed together.
+##
+## @example
+## @group
+## [x, y, z] = peaks (25);
+## surf (x, y, z);
+## hold on;
+## [u, v, w] = surfnorm (x, y, z / 10);
+## h = quiver3 (x, y, z, u, v, w);
+## set (h, "maxheadsize", 0.33);
+## @end group
+## @end example
+##
+## @seealso{quiver, compass, feather, plot}
+## @end deftypefn
+
+function retval = quiver3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  else
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+    unwind_protect
+      hax = newplot (hax);
+      htmp = __quiver__ (hax, true, varargin{:});
+
+      if (! ishold (hax))
+        set (hax, "view", [-37.5, 30]);  # 3D view
+      endif
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x,y] = meshgrid (-1:0.1:1);
+%! z = sin (2*pi * sqrt (x.^2 + y.^2));
+%! theta = 2*pi * sqrt (x.^2 + y.^2) + pi/2;
+%! mesh (x, y, z);
+%! hold on;
+%! quiver3 (x, y, z, sin (theta), cos (theta), ones (size (z)));
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (25);
+%! surf (x, y, z);
+%! hold on;
+%! [u, v, w] = surfnorm (x, y, z / 10);
+%! h = quiver3 (x, y, z, u, v, w);
+%! set (h, 'maxheadsize', 0.33);
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (25);
+%! surf (x, y, z);
+%! hold on;
+%! [u, v, w] = surfnorm (x, y, z / 10);
+%! h = quiver3 (x, y, z, u, v, w);
+%! set (h, 'maxheadsize', 0.33);
+%! hold off;
+%! shading interp;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/rectangle.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,242 @@
+## Copyright (C) 2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} rectangle ()
+## @deftypefnx {Function File} {} rectangle (@dots{}, "Position", @var{pos})
+## @deftypefnx {Function File} {} rectangle (@dots{}, "Curvature", @var{curv})
+## @deftypefnx {Function File} {} rectangle (@dots{}, "EdgeColor", @var{ec})
+## @deftypefnx {Function File} {} rectangle (@dots{}, "FaceColor", @var{fc})
+## @deftypefnx {Function File} {} rectangle (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} rectangle (@dots{})
+##
+## Draw a rectangular patch defined by @var{pos} and @var{curv}.
+## 
+## The variable @code{@var{pos}(1:2)} defines the lower left-hand corner of
+## the patch and @code{@var{pos}(3:4)} defines its width and height.  By
+## default, the value of @var{pos} is @code{[0, 0, 1, 1]}.
+##
+## The variable @var{curv} defines the curvature of the sides of the rectangle
+## and may be a scalar or two-element vector with values between 0 and 1.
+## A value of 0 represents no curvature of the side, whereas a value of 1
+## means that the side is entirely curved into the arc of a circle.
+## If @var{curv} is a two-element vector, then the first element is the
+## curvature along the x-axis of the patch and the second along y-axis.
+##
+## If @var{curv} is a scalar, it represents the curvature of the shorter of the
+## two sides of the rectangle and the curvature of the other side is defined
+## by
+##
+## @example
+## min (pos (1:2)) / max (pos (1:2)) * curv
+## @end example
+##
+## Additional property/value pairs are passed to the underlying patch command. 
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## rectangle object.
+## @end deftypefn
+## @seealso{patch, line, cylinder, ellipsoid, sphere}
+
+function h = rectangle (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("rectangle", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = __rectangle__ (hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+endfunction
+
+function hg = __rectangle__ (hax, varargin)
+
+  iarg = 1;
+  pos = [0, 0, 1, 1];
+  curv2 = [0, 0];
+  ec = [0, 0, 0];
+  fc = "none";
+
+  while (iarg < length (varargin))
+    arg = varargin{iarg};
+    if (ischar (arg))
+      if (strcmpi (arg, "position"))
+        pos = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+        if (!isvector (pos) || numel (pos) != 4)
+          error ("rectangle: position must be a 4 element vector");
+        endif
+      elseif (strcmpi (arg, "curvature"))
+        curv2 = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+        if (!isnumeric (curv2) || (numel (curv2) != 1 && numel (curv2) != 2))
+          error ("rectangle: curvature must be a 2 element vector or a scalar");
+        endif
+        if (any (curv2 < 0) || any (curv2 > 1))
+          error ("rectangle: curvature values must be between 0 and 1");
+        endif
+      elseif (strcmpi (arg, "edgecolor"))
+        ec = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+      elseif (strcmpi (arg, "facecolor"))
+        fc = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+      else
+        iarg ++;
+      endif
+    else
+      iarg ++;
+    endif
+  endwhile
+
+  if (numel (curv2) == 1)
+    [a, ai] = min (pos (3 : 4));
+    [b, bi] = max (pos (3 : 4));
+    if (ai < bi)
+      curv = [curv2, curv2 .* a ./ b];
+    else
+      curv = [curv2 .* a ./ b, curv2];
+    endif
+  else
+    curv = curv2;
+  endif
+
+  if (all (curv) < 0.01)
+    ## Special case : no curvature
+    x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
+    y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
+  else
+    p = pi / 2 * [0 : 15] / 15;
+    c = curv .* pos(3 : 4) / 2;
+    cx = c(1) * sin (p) - c(1);
+    cy = c(2) * cos (p) - c(2);
+    x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
+         pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
+    y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
+         pos(2) + pos(4) + cy, pos(2) + c(2)];
+  endif
+
+  hg = hggroup ();
+
+  h = patch ("xdata", x(:), "ydata", y(:), "facecolor", fc, "edgecolor", ec, ...
+             "parent", hg, varargin{:});
+
+  addproperty ("curvature", hg, "data", curv2);
+  addproperty ("position",  hg, "data", pos);
+  addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
+  addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
+  addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
+  addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
+
+  addlistener (hg, "curvature", @update_data);
+  addlistener (hg, "position",  @update_data);
+  addlistener (hg, "edgecolor", @update_props);
+  addlistener (hg, "linewidth", @update_props);
+  addlistener (hg, "linestyle", @update_props);
+  addlistener (hg, "facecolor", @update_props);
+endfunction
+
+function update_data (h, d)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (!recursion)
+    unwind_protect
+      recursion = true;
+
+      kids = get (h, "children");
+      pos = get (h, "position");
+      curv2 = get (h, "curvature");
+
+      if (numel (curv2) == 1)
+        [a, ai] = min (pos (3 : 4));
+        [b, bi] = max (pos (3 : 4));
+        if (ai < bi)
+          curv = [curv2, curv2 .* a ./ b];
+        else
+          curv = [curv2 .* a ./ b, curv2];
+        endif
+      else
+        curv = curv2;
+      endif
+
+      if (all (curv) < 0.01)
+        ## Special case : no curvature
+        x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
+        y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
+      else
+        p = pi / 2 * [0 : 15] / 15;
+        c = curv .* pos(3 : 4) / 2;
+        cx = c(1) * sin (p) - c(1);
+        cy = c(2) * cos (p) - c(2);
+        x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
+             pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
+        y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
+             pos(2) + pos(4) + cy, pos(2) + c(2)];
+      endif
+
+      set (kids, "xdata", x, "ydata", y);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_props (h, d)
+  kids = get (h, "children");
+  set (kids, "edgecolor", get (h, "edgecolor"),
+             "linewidth", get (h, "linewidth"),
+             "linestyle", get (h, "linestyle"),
+             "facecolor", get (h, "facecolor"));
+endfunction
+
+
+%!demo
+%! clf;
+%! axis equal;
+%! rectangle ('Position', [0.05, 0.05, 0.9, 0.9], 'Curvature', [0.5, 0.5]);
+%! title ('rectangle() with corners curved');
+
+%!demo
+%! clf;
+%! axis equal;
+%! rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
+%! title ('rectangle() with sides as complete arcs');
+
+%!demo
+%! clf;
+%! axis equal;
+%! h = rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
+%! set (h, 'FaceColor', [0, 1, 0]);
+%! title ('rectangle() with FaceColor = green');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ribbon.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,124 @@
+## Copyright (C) 2007-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ribbon (@var{y})
+## @deftypefnx {Function File} {} ribbon (@var{x}, @var{y})
+## @deftypefnx {Function File} {} ribbon (@var{x}, @var{y}, @var{width})
+## @deftypefnx {Function File} {} ribbon (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ribbon (@dots{})
+## Plot a ribbon plot for the columns of @var{y} vs. @var{x}.
+##
+## The optional parameter @var{width} specifies the width of a single ribbon
+## (default is 0.75).  If @var{x} is omitted, a vector containing the
+## row numbers is assumed (@code{1:rows (Y)}).
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the surface objects representing each ribbon.
+## @seealso{surface, waterfall}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel at gmx.de>
+
+function h = ribbon (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ribbon", varargin{:});
+
+  if (nargin < 1 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    y = varargin{1};
+    if (isvector (y))
+      y = y(:);
+    endif
+    [nr, nc] = size (y);
+    x = repmat ((1:nr)', 1, nc);
+    width = 0.75;
+  elseif (nargin == 2)
+    x = varargin{1};
+    y = varargin{2};
+    width = 0.75;
+  else
+    x = varargin{1};
+    y = varargin{2};
+    width = varargin{3};
+  endif
+
+  if (isvector (x) && isvector (y))
+    if (length (x) != length (y))
+      error ("ribbon: vectors X and Y must have the same length");
+    else
+      [x, y] = meshgrid (x, y);
+    endif
+  else
+    if (! size_equal (x, y))
+      error ("ribbon: matrices X and Y must have the same size");
+    endif
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    [nr, nc] = size (y);
+    htmp = zeros (nc, 1);
+
+    for c = nc:-1:1
+      zz = [y(:,c), y(:,c)];
+      yy = x(:,c);
+      xx = [c - width / 2, c + width / 2];
+      [xx, yy] = meshgrid (xx, yy);
+      cc = repmat (c, size (zz));
+      htmp(c) = surface (xx, yy, zz, cc);
+    endfor
+
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30], "box", "off", 
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = sombrero ();
+%! ribbon (y, z);
+%! title ('ribbon() plot of sombrero()');
+
+%!FIXME: Could have some input validation tests here
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/rose.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,121 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} rose (@var{th})
+## @deftypefnx {Function File} {} rose (@var{th}, @var{nbins})
+## @deftypefnx {Function File} {} rose (@var{th}, @var{bins})
+## @deftypefnx {Function File} {} rose (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} rose (@dots{})
+## @deftypefnx {Function File} {[@var{thout} @var{rout}] =} rose (@dots{})
+## Plot an angular histogram.
+##
+## With one vector argument, @var{th}, plot the histogram with 20 angular bins.
+## If @var{th} is a matrix then each column of @var{th} produces a separate
+## histogram.
+##
+## If @var{nbins} is given and is a scalar, then the histogram is produced with
+## @var{nbin} bins.  If @var{bins} is a vector, then the center of each bin is
+## defined by the values of @var{bins} and the number of bins is
+## given by the number of elements in @var{bins}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## line objects representing each histogram.
+##
+## If two output arguments are requested then no plot is made and 
+## the polar vectors necessary to plot the histogram are returned instead.
+##
+## @example
+## @group
+## [th, r] = rose ([2*randn(1e5,1), pi + 2*randn(1e5,1)]);
+## polar (th, r);
+## @end group
+## @end example
+##
+## @seealso{hist, polar}
+## @end deftypefn
+
+function [thout, rout] = rose (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("rose", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  ## Force theta to [0,2*pi] range
+  th = varargin{1};
+  th = atan2 (sin (th), cos (th)) + pi;
+
+  if (nargin > 1)
+    x = varargin{2};
+    if (isscalar (x))
+      x = [0.5/x : 1/x : 1] * 2*pi;
+    else
+      ## Force theta to [0,2*pi] range
+      x = atan2 (sin (x), cos (x)) + pi;
+    endif
+  else
+    x = [1/40 : 1/20 : 1] * 2*pi;
+  endif
+
+  [nn, xx] = hist (th, x);
+  xx = xx(:).';
+  if (isvector (nn))
+    nn = nn(:);
+  endif
+  x1 = xx(1:end-1) + diff (xx, 1) / 2;
+  x1 = [x1 ; x1; x1; x1](:);
+  th = [0; 0; x1; 2*pi ; 2*pi];
+  r = zeros (4 * rows (nn), columns (nn));
+  r(2:4:end, :) = nn;
+  r(3:4:end, :) = nn;
+
+  if (nargout < 2)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      htmp = polar (th, r);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+
+    if (nargout > 0)
+      thout = htmp;
+    endif
+  else
+    thout = th;
+    rout = r;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! rose ([2*randn(1e5, 1), pi + 2*randn(1e5, 1)]);
+%! title ('rose() angular histogram plot');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/scatter.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,217 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} scatter (@var{x}, @var{y})
+## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s})
+## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c})
+## @deftypefnx {Function File} {} scatter (@dots{}, @var{style})
+## @deftypefnx {Function File} {} scatter (@dots{}, "filled")
+## @deftypefnx {Function File} {} scatter (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} scatter (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} scatter (@dots{})
+## Draw a 2-D scatter plot.
+##
+## A marker is plotted at each point defined by the coordinates in the vectors
+## @var{x} and @var{y}.
+##
+## The size of the markers is determined by @var{s}, which can be a scalar
+## or a vector of the same length as @var{x} and @var{y}.  If @var{s}
+## is not given, or is an empty matrix, then a default value of 8 points is
+## used.
+##
+## The color of the markers is determined by @var{c}, which can be a string
+## defining a fixed color; a 3-element vector giving the red, green, and blue
+## components of the color; a vector of the same length as @var{x} that gives
+## a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
+## the RGB color of each marker individually.
+##
+## The marker to use can be changed with the @var{style} argument, that is a
+## string defining a marker in the same manner as the @code{plot} command.
+## If no marker is specified it defaults to @qcode{"o"} or circles.
+## If the argument @qcode{"filled"} is given then the markers are filled.
+##
+## Additional property/value pairs are passed directly to the underlying
+## patch object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+## 
+## Example:
+##
+## @example
+## @group
+## x = randn (100, 1);
+## y = randn (100, 1);
+## scatter (x, y, [], sqrt (x.^2 + y.^2));
+## @end group
+## @end example
+##
+## @seealso{scatter3, patch, plot}
+## @end deftypefn
+
+function retval = scatter (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("scatter", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = __scatter__ (hax, 2, "scatter", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = randn (100, 1);
+%! y = randn (100, 1);
+%! scatter (x, y, 'r');
+%! title ('scatter() plot with red bubbles');
+
+%!demo
+%! clf;
+%! x = randn (100, 1);
+%! y = randn (100, 1);
+%! c = x .* y;
+%! scatter (x, y, 20, c, 'filled');
+%! title ('scatter() with colored filled bubbles');
+
+%!demo
+%! clf;
+%! x = randn (100, 1);
+%! y = randn (100, 1);
+%! scatter (x, y, [], sqrt (x.^2 + y.^2));
+%! title ({'scatter() plot'; ...
+%!         'bubble color determined by distance from origin'});
+
+%!demo
+%! clf;
+%! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949];
+%! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273];
+%! x = rand_10x1_data5;
+%! y = rand_10x1_data6;
+%! s = 10 - 10*log (x.^2 + y.^2);
+%! h = scatter (x, y, [], 'r', 's');
+%! title ({'scatter() plot'; ...
+%!         'marker is square, color is red'});
+
+%!demo
+%! clf;
+%! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726];
+%! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356];
+%! x = rand_10x1_data3;
+%! y = rand_10x1_data4;
+%! s = 10 - 10*log (x.^2 + y.^2);
+%! h = scatter (x, y, [], 'r', 's', 'filled');
+%! title ({'scatter() plot'; ...
+%!         'marker is square, marker is filled, color is red'});
+
+%!demo
+%! clf;
+%! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940];
+%! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143];
+%! x = rand_10x1_data1;
+%! y = rand_10x1_data2;
+%! s = 10 - 10*log (x.^2 + y.^2);
+%! h = scatter (x, y, s, s, 's', 'filled');
+%! title ({'scatter() plot with filled square markers', ...
+%!         'size and color of markers determined by algorithm'});
+
+%!demo
+%! clf;
+%! k = 1;
+%! for m = [1, 3]
+%!   for n = [101, 50, 1]
+%!     x = rand (n, 1);
+%!     y = rand (n, 1);
+%!     if (m > 1)
+%!       str = 'Three Colors';
+%!       idx = ceil (rand (n, 1) * 3);
+%!       colors = eye (3);
+%!       colors = colors(idx, :);
+%!     else
+%!       str = 'Random Colors';
+%!       colors = rand (n, m);
+%!     end
+%!     if (n == 1)
+%!       str = sprintf ('%s: 1 point', str);
+%!     elseif (n < 100)
+%!       str = sprintf ('%s: < 100 points', str);
+%!     else
+%!       str = sprintf ('%s: > 100 points', str);
+%!     end
+%!     subplot (2,3,k);
+%!     k = k + 1;
+%!     scatter (x, y, 15, colors, 'filled');
+%!     axis ([0 1 0 1]);
+%!     title (str);
+%!   end
+%! end
+
+%!demo
+%! clf;
+%! k = 1;
+%! for m = [1, 3]
+%!   for n = [101, 50, 1]
+%!     x = rand (n, 1);
+%!     y = rand (n, 1);
+%!     if (m > 1)
+%!       str = 'Three Colors';
+%!       idx = ceil (rand (n, 1) * 3);
+%!       colors = eye (3);
+%!       colors = colors(idx, :);
+%!     else
+%!       str = 'Random Colors';
+%!       colors = rand (n, m);
+%!     end
+%!     if (n == 1)
+%!       str = sprintf ('%s: 1 point', str);
+%!     elseif (n < 100)
+%!       str = sprintf ('%s: < 100 points', str);
+%!     else
+%!       str = sprintf ('%s: > 100 points', str);
+%!     end
+%!     subplot (2,3,k);
+%!     k = k + 1;
+%!     scatter (x, y, 15, colors);
+%!     axis ([0 1 0 1]);
+%!     title (str);
+%!   end
+%! end
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/scatter3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,129 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} scatter3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s})
+## @deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c})
+## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{style})
+## @deftypefnx {Function File} {} scatter3 (@dots{}, "filled")
+## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{prop}, @var{val})
+## @deftypefnx {Function File} {} scatter3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} scatter3 (@dots{})
+## Draw a 3-D scatter plot.
+##
+## A marker is plotted at each point defined by the coordinates in the vectors
+## @var{x}, @var{y}, and @var{z}.
+##
+## The size of the markers is determined by @var{s}, which can be a scalar
+## or a vector of the same length as @var{x}, @var{y}, and @var{z}.  If @var{s}
+## is not given, or is an empty matrix, then a default value of 8 points is
+## used.
+##
+## The color of the markers is determined by @var{c}, which can be a string
+## defining a fixed color; a 3-element vector giving the red, green, and blue
+## components of the color; a vector of the same length as @var{x} that gives
+## a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
+## the RGB color of each marker individually.
+##
+## The marker to use can be changed with the @var{style} argument, that is a
+## string defining a marker in the same manner as the @code{plot} command.
+## If no marker is specified it defaults to @qcode{"o"} or circles.
+## If the argument @qcode{"filled"} is given then the markers are filled.
+##
+## Additional property/value pairs are passed directly to the underlying
+## patch object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## object representing the points.
+##
+## @example
+## @group
+## [x, y, z] = peaks (20);
+## scatter3 (x(:), y(:), z(:), [], z(:));
+## @end group
+## @end example
+##
+## @seealso{scatter, patch, plot}
+## @end deftypefn
+
+function retval = scatter3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("scatter3", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = __scatter__ (hax, 3, "scatter3", varargin{:});
+
+    if (! ishold (hax))
+      set (hax, "view", [-37.5, 30], "box", "off",
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [x, y, z] = peaks (20);
+%! scatter3 (x(:), y(:), z(:), [], z(:));
+%! title ({'Default scatter3() plot', ...
+%!         'constant size bubbles and color determined by Z'});
+
+%!demo
+%! clf;
+%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
+%! scatter3 (x(:), y(:), z(:), 10, z(:), 's');
+%! title ({'scatter3() plot', ...
+%!         'marker is square, size is 10, color determined by Z'});
+
+%!demo
+%! clf;
+%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
+%! scatter3 (x(:), y(:), z(:), 20*z(:), [], 's');
+%! title ({'scatter3() plot', ...
+%!         'marker is square, size is determined by Z'});
+
+%!demo
+%! clf;
+%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
+%! scatter3 (x(:), y(:), z(:), 20*z(:), z(:), 's');
+%! title ({'scatter3() plot', ...
+%!         'marker is square, size and color determined by Z'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogx.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,133 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogx (@var{y})
+## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y})
+## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} semilogx (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} semilogx (@dots{})
+## Produce a 2-D plot using a logarithmic scale for the x-axis.
+##
+## See the documentation of @code{plot} for a description of the
+## arguments that @code{semilogx} will accept.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+## @seealso{plot, semilogy, loglog}
+## @end deftypefn
+
+## Author: jwe
+
+function h = semilogx (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on");
+    endif
+
+    htmp = __plt__ ("semilogx", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 1:0.01:10;
+%! y = (x .* (1 + rand (size (x)))) .^ 2;
+%! semilogx (y, x);
+%! title ({'semilogx() plot', 'X-axis is logarithmic'});
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (1,2,1);
+%!  semilogx (x, y);
+%!  xlabel ('semilogx (x, y)');
+%!
+%! subplot (1,2,2);
+%!  semilogx (-x, y);
+%!  xlabel ('semilogx (-x, y)');
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (1,2,1);
+%!  semilogx (x, y);
+%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  xlabel ({'semilogx (x, y)', 'xdir = reversed'});
+%!
+%! subplot (1,2,2);
+%!  semilogx (-x, y);
+%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  xlabel ({'semilogx (-x, y)', 'xdir = reversed'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   semilogx (a, b);
+%!   assert (get (gca, "xscale"), "log");
+%!   assert (get (gca, "yscale"), "linear");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a =-logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   semilogx (a, b);
+%!   axis tight;
+%!   assert (all (get (gca, "xtick") < 0));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogxerr.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,89 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogxerr (@var{args})
+## @deftypefnx {Function File} {} semilogxerr (@var{hax}, @var{args})
+## @deftypefnx {Function File} {@var{h} =} semilogxerr (@var{args})
+## Produce 2-D plots using a logarithmic scale for the x-axis and
+## errorbars at each data point.
+##
+## Many different combinations of arguments are possible.  The most common
+## form is
+##
+## @example
+## semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
+## @end example
+##
+## @noindent
+## which produces a semi-logarithmic plot of @var{y} versus @var{x}
+## with errors in the @var{y}-scale defined by @var{ey} and the plot
+## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
+## formats and additional information.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## @seealso{errorbar, semilogyerr, loglogerr}
+## @end deftypefn
+
+## Created: 20.2.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = semilogxerr (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on");
+    endif
+
+    htmp = __errcomm__ ("semilogxerr", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = exp (log (0.01):0.2:log (10));
+%! y = wblpdf (x, 2, 2);
+%! ey = 0.5*rand (size (y)) .* y;
+%! semilogxerr (x, y, ey, '#~x-');
+%! xlim (x([1, end]));
+%! title ({'semilogxerr(): semilogx() plot with errorbars', ...
+%!         'X-axis is logarithmic'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogy.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,133 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogy (@var{y})
+## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y})
+## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} semilogy (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} semilogy (@dots{})
+## Produce a 2-D plot using a logarithmic scale for the y-axis.
+##
+## See the documentation of @code{plot} for a description of the
+## arguments that @code{semilogy} will accept.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+## @seealso{plot, semilogx, loglog}
+## @end deftypefn
+
+## Author: jwe
+
+function h = semilogy (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "yminortick", "on");
+    endif
+
+    htmp = __plt__ ("semilogy", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 1:0.01:10;
+%! y = (x .* (1 + rand (size (x)))) .^ 2;
+%! semilogy (x, y);
+%! title ({'semilogx() plot', 'Y-axis is logarithmic'});
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (2,1,1);
+%!  semilogy (x, y);
+%!  ylabel ('semilogy (x, y)');
+%!
+%! subplot (2,1,2);
+%!  semilogy (x, -y);
+%!  ylabel ('semilogy (x, -y)');
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (2,1,1);
+%!  semilogy (x, y);
+%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  ylabel ({'semilogy (x, y)', 'ydir = reversed'});
+%!
+%! subplot (2,1,2);
+%!  semilogy (x, -y);
+%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  ylabel ({'semilogy (x, -y)', 'ydir = reversed'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   semilogy (a, b);
+%!   assert (get (gca, "yscale"), "log");
+%!   assert (get (gca, "xscale"), "linear");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b =-logspace (-5, 1, 10);
+%!   semilogy (a, b);
+%!   axis tight;
+%!   assert (all (get (gca, "ytick") < 0));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogyerr.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,90 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogyerr (@var{args})
+## @deftypefnx {Function File} {} semilogyerr (@var{hax}, @var{args})
+## @deftypefnx {Function File} {@var{h} =} semilogyerr (@var{args})
+## Produce 2-D plots using a logarithmic scale for the y-axis and
+## errorbars at each data point.
+##
+## Many different combinations of arguments are possible.  The most common
+## form is
+##
+## @example
+## semilogyerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
+## @end example
+##
+## @noindent
+## which produces a semi-logarithmic plot of @var{y} versus @var{x}
+## with errors in the @var{y}-scale defined by @var{ey} and the plot
+## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
+## formats and additional information.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## @seealso{errorbar, semilogxerr, loglogerr}
+## @end deftypefn
+
+## Created: 20.2.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = semilogyerr (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("semilogyerr", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "yminortick", "on");
+    endif
+
+    htmp = __errcomm__ ("semilogyerr", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0.25:0.25:10;
+%! y = wblpdf (x, 4, 2);
+%! eyu = rand (size (y));
+%! eyl = 1.0 - 1./(1+eyu);
+%! semilogyerr (x, y, eyl.*y, eyu.*y, '~-d');
+%! xlim ([0 10]);
+%! title ({'semilogyerr(): semilogy() plot with errorbars', ...
+%!         'Y-axis is logarithmic'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/shrinkfaces.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,218 @@
+## Copyright (C) 2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} shrinkfaces (@var{p}, @var{sf})
+## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{p}, @var{sf})
+## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{fv}, @var{sf})
+## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{f}, @var{v}, @var{sf})
+## @deftypefnx {Function File} {[@var{nf}, @var{nv}] =} shrinkfaces (@dots{})
+##
+## Reduce the faces area for a given patch, structure or explicit faces
+## and points matrices by a scale factor @var{sf}.  The structure
+## @var{fv} must contain the fields @qcode{"faces"} and @qcode{"vertices"}. 
+## If the factor @var{sf} is omitted then a default of 0.3 is used.
+##
+## Given a patch handle as the first input argument and no output
+## parameters, perform the shrinking of the patch faces in place and
+## redraw the patch.
+##
+## If called with one output argument, return a structure with fields
+## @qcode{"faces"}, @qcode{"vertices"}, and @qcode{"facevertexcdata"}
+## containing the data after shrinking which can then directly be used as an
+## input argument for the @code{patch} function.
+##
+## Performing the shrinking on faces which are not convex can lead to
+## undesired results.
+##
+## For example,
+##
+## @example
+## @group
+## [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
+## tri = delaunay (phi(:), r(:));
+## v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
+## clf ()
+## p = patch ("Faces", tri, "Vertices", v, "FaceColor", "none");
+## fv = shrinkfaces (p);
+## patch (fv)
+## axis equal
+## grid on
+## @end group
+## @end example
+##
+## @noindent
+## draws a triangulated 3/4 circle and the corresponding shrunken
+## version.
+## @seealso{patch}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function [nf, nv] = shrinkfaces (varargin)
+
+  if (nargin < 1 || nargin > 3 || nargout > 2)
+    print_usage ();
+  endif
+  
+  sf = 0.3;
+  p = varargin{1};
+  colors = [];
+
+  if (ishandle (p) && nargin < 3)
+    faces = get (p, "Faces");
+    vertices = get (p, "Vertices");
+    colors = get (p, "FaceVertexCData");
+    if (nargin == 2)
+      sf = varargin{2};
+    endif
+  elseif (isstruct (p) && nargin < 3)
+    faces = p.faces;
+    vertices = p.vertices;
+    if (isfield (p, "facevertexcdata"))
+      colors = p.facevertexcdata;
+    endif
+    if (nargin == 2)
+      sf = varargin{2};
+    endif
+  elseif (ismatrix (p) && nargin >= 2 && ismatrix (varargin{2}))
+    faces = p;
+    vertices = varargin{2};
+    if (nargin == 3)
+      sf = varargin{3};
+    endif
+  else
+    print_usage ();
+  endif
+  
+  if (! isscalar (sf) || sf <= 0)
+    error ("shrinkfaces: scale factor must be a positive scalar");
+  endif
+
+  n = columns (vertices);
+  if (n < 2 || n > 3)
+    error ("shrinkfaces: only 2-D and 3-D patches are supported");
+  endif
+
+  m = columns (faces);
+  if (m < 3)
+    error ("shrinkfaces: faces must consist of at least 3 vertices");
+  endif
+
+  v = vertices(faces'(:), :);
+  if (isempty (colors) || rows (colors) == rows (faces))
+    c = colors;
+  elseif (rows (colors) == rows (vertices))
+    c = colors(faces'(:), :);
+  else
+    ## Discard inconsistent color data.
+    c = [];
+  endif
+  sv = rows (v);
+  ## we have to deal with a probably very large number of vertices, so
+  ## use sparse we use as midpoint (1/m, ..., 1/m) in generalized
+  ## barycentric coordinates.
+  midpoints = full (kron ( speye (sv / m), ones (m, m) / m) * sparse (v));
+  v = sqrt (sf) * (v - midpoints) + midpoints;
+  f = reshape (1:sv, m, sv / m)';
+  
+  switch (nargout)
+    case 0
+      if (ishandle (p))
+        ## avoid exceptions
+        set (p, "FaceVertexCData", [], "CData", []);
+        set (p, "Vertices", v, "Faces", f, "FaceVertexCData", c);
+      else
+        nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
+      endif
+    case 1
+      nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
+    case 2
+      nf = f;
+      nv = v;
+  endswitch
+
+endfunction
+
+
+%!demo
+%! clf;
+%! faces = [1 2 3; 1 3 4];
+%! vertices = [0 0; 1 0; 1 1; 0 1];
+%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
+%! fv = shrinkfaces (faces, vertices, 0.25);
+%! patch (fv);
+%! axis equal;
+
+%!demo
+%! clf;
+%! faces = [1 2 3 4; 5 6 7 8];
+%! vertices = [0 0; 1 0; 2 1; 1 1; 2 0; 3 0; 4 1; 3.5 1];
+%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
+%! fv = shrinkfaces (faces, vertices, 0.25);
+%! patch (fv);
+%! axis equal;
+%! grid on;
+
+%!demo
+%! clf;
+%! faces = [1 2 3 4];
+%! vertices = [-1 2; 0 0; 1 2; 0 1];
+%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
+%! fv = shrinkfaces (faces, vertices, 0.25);
+%! patch (fv);
+%! axis equal;
+%! grid on;
+%! title 'faces which are not convex are clearly not allowed'
+
+%!demo
+%! clf;
+%! [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
+%! tri = delaunay (phi(:), r(:));
+%! v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
+%! p = patch ('Faces', tri, 'Vertices', v, 'FaceColor', 'none');
+%! fv = shrinkfaces (p);
+%! patch (fv);
+%! axis equal;
+%! grid on;
+
+%!demo
+%! clf;
+%! N = 10;  % N intervals per axis
+%! [x, y, z] = meshgrid (linspace (-4,4,N+1));
+%! val = x.^3 + y.^3 + z.^3;
+%! fv = isosurface (x, y, z, val, 3, z);
+%!
+%! p = patch ('Faces', fv.faces, 'Vertices', fv.vertices, 'FaceVertexCData', ...
+%!            fv.facevertexcdata, 'FaceColor', 'interp', 'EdgeColor', 'black');
+%! axis equal;
+%! view (115, 30);
+%! drawnow;
+%! shrinkfaces (p, 0.6);
+
+%!shared faces, vertices, nfv, nfv2
+%! faces = [1 2 3];
+%! vertices = [0 0 0; 1 0 0; 1 1 0];
+%! nfv = shrinkfaces (faces, vertices, 0.7);
+%! nfv2 = shrinkfaces (nfv, 1/0.7);
+%!assert (isfield (nfv, "faces"))
+%!assert (isfield (nfv, "vertices"))
+%!assert (size (nfv.faces), [1 3])
+%!assert (size (nfv.vertices), [3 3])
+%!assert (norm (nfv2.vertices - vertices), 0, 2*eps)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/slice.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,217 @@
+## Copyright (C) 2007-2012 Kai Habel, David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{sx}, @var{sy}, @var{sz})
+## @deftypefnx {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi})
+## @deftypefnx {Function File} {} slice (@var{v}, @var{sx}, @var{sy}, @var{sz})
+## @deftypefnx {Function File} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi})
+## @deftypefnx {Function File} {} slice (@dots{}, @var{method})
+## @deftypefnx {Function File} {} slice (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} slice (@dots{})
+## Plot slices of 3-D data/scalar fields.
+##
+## Each element of the 3-dimensional array @var{v} represents a scalar value at
+## a location given by the parameters @var{x}, @var{y}, and @var{z}.  The
+## parameters @var{x}, @var{x}, and @var{z} are either 3-dimensional arrays of
+## the same size as the array @var{v} in the @qcode{"meshgrid"} format or
+## vectors.  The parameters @var{xi}, etc. respect a similar format to
+## @var{x}, etc., and they represent the points at which the array @var{vi}
+## is interpolated using interp3.  The vectors @var{sx}, @var{sy}, and
+## @var{sz} contain points of orthogonal slices of the respective axes.
+##
+## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be
+## @code{x = 1:size (@var{v}, 2)}, @code{y = 1:size (@var{v}, 1)} and
+## @code{z = 1:size (@var{v}, 3)}.
+##
+## @var{method} is one of:
+##
+## @table @asis
+## @item @qcode{"nearest"}
+## Return the nearest neighbor.
+##
+## @item @qcode{"linear"}
+## Linear interpolation from nearest neighbors.
+##
+## @item @qcode{"cubic"}
+## Cubic interpolation from four nearest neighbors (not implemented yet).
+##
+## @item @qcode{"spline"}
+## Cubic spline interpolation---smooth first and second derivatives
+## throughout the curve.
+## @end table
+##
+## The default method is @qcode{"linear"}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Examples:
+##
+## @example
+## @group
+## [x, y, z] = meshgrid (linspace (-8, 8, 32));
+## v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
+## slice (x, y, z, v, [], 0, []);
+##
+## [xi, yi] = meshgrid (linspace (-7, 7));
+## zi = xi + yi;
+## slice (x, y, z, v, xi, yi, zi);
+## @end group
+## @end example
+## @seealso{interp3, surface, pcolor}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function h = slice (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("slice", varargin{:});
+
+  method = "linear";
+
+  if (ischar (varargin{end}))
+    method = varargin{end};
+    nargs -= 1;
+  endif
+
+  if (nargs == 4)
+    v = varargin{1};
+    if (ndims (v) != 3)
+      error ("slice: V must be a 3-dimensional array of values");
+    endif
+    [nx, ny, nz] = size (v);
+    [x, y, z] = meshgrid (1:nx, 1:ny, 1:nz);
+    sx = varargin{2};
+    sy = varargin{3};
+    sz = varargin{4};
+  elseif (nargs == 7)
+    v = varargin{4};
+    if (ndims (v) != 3)
+      error ("slice: V must be a 3-dimensional array of values");
+    endif
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    if (isvector (x) && isvector (y) && isvector (z))
+      [x, y, z] = meshgrid (x, y, z);
+    elseif (ndims (x) == 3 && size_equal (x, y, z))
+      ## Do nothing.
+    else
+      error ("slice: X, Y, Z size mismatch");
+    endif
+    sx = varargin{5};
+    sy = varargin{6};
+    sz = varargin{7};
+  else
+    print_usage ();
+  endif
+
+  if (any ([isvector(sx), isvector(sy), isvector(sz)]))
+    have_sval = true;
+  elseif (ndims (sx) == 2 && size_equal (sx, sy, sz))
+    have_sval = false;
+  else
+    error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)");
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    sidx = 1;
+    minv = min (v(:));
+    maxv = max (v(:));
+    set (hax, "clim", [minv, maxv]);
+
+    if (have_sval)
+      ns = length (sx) + length (sy) + length (sz);
+      hs = zeros (ns,1);
+      [ny, nx, nz] = size (v);
+      if (length (sz) > 0)
+        for i = 1:length (sz)
+          [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)),
+                                   squeeze (y(:,1,1)), sz(i));
+          vz = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
+          htmp(sidx++) = surface (xi, yi, sz(i) * ones (size (yi)), vz);
+        endfor
+      endif
+
+      if (length (sy) > 0)
+        for i = length (sy):-1:1
+          [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)), sy(i), squeeze (z(1,1,:)));
+          vy = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
+          htmp(sidx++) = surface (squeeze (xi),
+                                  squeeze (sy(i) * ones (size (zi))),
+                                  squeeze (zi), vy);
+        endfor
+      endif
+
+      if (length (sx) > 0)
+        for i = length (sx):-1:1
+          [xi, yi, zi] = meshgrid (sx(i), squeeze (y(:,1,1)), squeeze (z(1,1,:)));
+          vx = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
+          htmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))),
+                                  squeeze (yi), squeeze(zi), vx);
+        endfor
+      endif
+    else
+      vi = interp3 (x, y, z, v, sx, sy, sz);
+      htmp = surface (sx, sy, sz, vi);
+    endif
+
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30.0], "box", "off",
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
+%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
+%! slice (x, y, z, v, [], 0, []);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
+%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
+%! [xi, yi] = meshgrid (linspace (-7, 7));
+%! zi = xi + yi;
+%! slice (x, y, z, v, xi, yi, zi);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/sombrero.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,86 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} sombrero ()
+## @deftypefnx {Function File} {} sombrero (@var{n})
+## @deftypefnx {Function File} {@var{z} =} sombrero (@dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sombrero (@dots{})
+## Plot the familiar 3-D sombrero function.
+##
+## The function plotted is
+## @tex
+## $$z = { \rm{sin} (\sqrt {(x^2 + y^2)}) \over \sqrt {(x^2 + y^2)} }$$
+## @end tex
+## @ifnottex
+##
+## @example
+## z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
+## @end example
+##
+## @end ifnottex
+## Called without a return argument, @code{sombrero} plots the surface of the
+## above function over the meshgrid [-8,8] using @code{surf}.
+## 
+## If @var{n} is a scalar the plot is made with @var{n} grid lines.
+## The default value for @var{n} is 41.
+##
+## When called with output arguments, return the data for the function
+## evaluated over the meshgrid.  This can subsequently be plotted with
+## @code{surf (@var{x}, @var{y}, @var{z})}.
+##
+## @seealso{peaks, meshgrid, mesh, surf}
+## @end deftypefn
+
+## Author: jwe
+
+function [x, y, z] = sombrero (n = 41)
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (n <= 1)
+    error ("sombrero: number of grid lines N must be greater than 1");
+  endif
+
+  [xx, yy] = meshgrid (linspace (-8, 8, n));
+  r = sqrt (xx.^2 + yy.^2) + eps;  # eps prevents div/0 errors
+  zz = sin (r) ./ r;
+
+  if (nargout == 0)
+    surf (xx, yy, zz);
+  elseif (nargout == 1)
+    x = zz;
+  else
+    x = xx;
+    y = yy;
+    z = zz;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! title ('sombrero() function');
+
+## Test input validation
+%!error sombrero (1,2,3)
+%!error <N must be greater than 1> sombrero (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/sphere.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,90 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} sphere ()
+## @deftypefnx {Function File} {} sphere (@var{n})
+## @deftypefnx {Function File} {} sphere (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sphere (@dots{})
+## Plot a 3-D unit sphere.
+##
+## The optional input @var{n} determines the number of faces around the
+## the circumference of the sphere.  The default value is 20.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## If outputs are requested @code{sphere} returns three matrices in
+## @code{meshgrid} format such that @code{surf (@var{x}, @var{y}, @var{z})}
+## generates a unit sphere.
+##
+## Example:
+##
+## @example
+## @group
+## [x, y, z] = sphere (40);
+## surf (3*x, 3*y, 3*z);
+## axis equal;
+## title ("sphere of radius 3");
+## @end group
+## @end example
+## @seealso{cylinder, ellipsoid, rectangle}
+## @end deftypefn
+
+function [xx, yy, zz] = sphere (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("sphere", varargin{:});
+
+  if (nargin > 1)
+    print_usage ();
+  elseif (nargin == 1)
+    n = varargin{1};
+  else
+    n = 20;
+  endif
+
+  theta = linspace (0, 2*pi, n+1);
+  phi = linspace (-pi/2, pi/2, n+1);
+  [theta,phi] = meshgrid (theta, phi);
+
+  x = cos (phi) .* cos (theta);
+  y = cos (phi) .* sin (theta);
+  z = sin (phi);
+
+  if (nargout > 0)
+    xx = x;
+    yy = y;
+    zz = z;
+  else
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+    
+      surf (x, y, z);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stairs.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,332 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stairs (@var{y})
+## @deftypefnx {Function File} {} stairs (@var{x}, @var{y})
+## @deftypefnx {Function File} {} stairs (@dots{}, @var{style})
+## @deftypefnx {Function File} {} stairs (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} stairs (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} stairs (@dots{})
+## @deftypefnx {Function File} {[@var{xstep}, @var{ystep}] =} stairs (@dots{})
+## Produce a stairstep plot.
+##
+## The arguments @var{x} and @var{y} may be vectors or matrices.
+## If only one argument is given, it is taken as a vector of Y values
+## and the X coordinates are taken to be the indices of the elements.
+## 
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+##
+## Multiple property/value pairs may be specified, but they must appear in
+## pairs.
+##
+## If the first argument @var{hax} is an axis handle, then plot into this axis,
+## rather than the current axis handle returned by @code{gca}.
+##
+## If one output argument is requested, return a graphics handle to the
+## created plot.  If two output arguments are specified, the data are generated
+## but not plotted.  For example,
+##
+## @example
+## stairs (x, y);
+## @end example
+##
+## @noindent
+## and
+##
+## @example
+## @group
+## [xs, ys] = stairs (x, y);
+## plot (xs, ys);
+## @end group
+## @end example
+##
+## @noindent
+## are equivalent.
+## @seealso{bar, hist, plot, stem}
+## @end deftypefn
+
+## Author: jwe
+
+function [xs, ys] = stairs (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("stairs", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  if (nargout < 2)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      [htmp, xxs, yys] = __stairs__ (true, varargin{:});
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+    if (nargout == 1)
+      xs = htmp;
+    endif
+  else
+    [~, xs, ys] = __stairs__ (false, varargin{:});
+  endif
+
+endfunction
+
+function [h, xs, ys] = __stairs__ (doplot, varargin)
+
+  if (nargin == 2 || ischar (varargin{2}))
+    y = varargin{1};
+    varargin(1) = [];
+    if (! ismatrix (y) || ndims (y) > 2)
+      error ("stairs: Y must be a numeric 2-D vector or matrix");
+    endif
+    if (isvector (y))
+      y = y(:);
+    endif
+    x = 1:rows (y);
+  else
+    x = varargin{1};
+    y = varargin{2};
+    varargin(1:2) = [];
+    if (! ismatrix (x) || ! ismatrix (y) || ndims (x) > 2 || ndims (y) > 2)
+      error ("stairs: X and Y must be numeric 2-D vectors or matrices");
+    endif
+  endif
+
+  vec_x = isvector (x);
+  if (vec_x)
+    x = x(:);
+  endif
+
+  if (isvector (y))
+    y = y(:);
+  elseif (ismatrix (y) && vec_x)
+    x = repmat (x, [1, columns(y)]);
+  endif
+
+  if (! size_equal (x, y))
+    error ("stairs: X and Y sizes must match");
+  endif
+
+  [nr, nc] = size (y);
+
+  len = 2*nr - 1;
+
+  xs = ys = zeros (len, nc);
+
+  xs(1,:) = x(1,:);
+  ys(1,:) = y(1,:);
+
+  xtmp = x(2:nr,:);
+  ridx = 2:2:len-1;
+  xs(ridx,:) = xtmp;
+  ys(ridx,:) = y(1:nr-1,:);
+
+  ridx = 3:2:len;
+  xs(ridx,:) = xtmp;
+  ys(ridx,:) = y(2:nr,:);
+
+  have_line_spec = false;
+  for i = 1:2:numel (varargin)
+    arg = varargin{i};
+    if (ischar (arg) || iscellstr (arg))
+      [linespec, valid] = __pltopt__ ("stairs", arg, false);
+      if (valid)
+        have_line_spec = true;
+        varargin(i) = [];
+        break;
+      endif
+    endif
+  endfor
+
+  if (doplot)
+    h = [];
+    hold_state = get (gca (), "nextplot");
+    unwind_protect
+      for i = 1 : columns (y)
+
+        if (have_line_spec)
+          lc = linespec.color;
+          if (isempty (lc))
+            lc = __next_line_color__ ();
+          endif
+          ls = linespec.linestyle;
+          if (isempty (ls))
+            ls = "-";
+          endif
+          mk = linespec.marker;
+          if (isempty (mk))
+            mk = "none";
+          endif
+        else
+          lc = __next_line_color__ ();
+          ls = "-";
+          mk = "none";
+        endif
+
+        ## Must occur after __next_line_color__ in order to work correctly.
+        hg = hggroup ();
+        h = [h; hg];
+        args = __add_datasource__ ("stairs", hg, {"x", "y"}, varargin{:});
+
+        addproperty ("xdata", hg, "data", x(:,i).');
+        addproperty ("ydata", hg, "data", y(:,i).');
+
+        addlistener (hg, "xdata", @update_data);
+        addlistener (hg, "ydata", @update_data);
+
+        htmp = line (xs(:,i).', ys(:,i).', "color", lc, "linestyle", ls,
+                                           "marker", mk, "parent", hg);
+
+        addproperty ("color", hg, "linecolor", get (htmp, "color"));
+        addproperty ("linestyle", hg, "linelinestyle", get (htmp, "linestyle"));
+        addproperty ("linewidth", hg, "linelinewidth", get (htmp, "linewidth"));
+
+        addproperty ("marker", hg, "linemarker", get (htmp, "marker"));
+        addproperty ("markeredgecolor", hg, "linemarkeredgecolor",
+                     get (htmp, "markeredgecolor"));
+        addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
+                     get (htmp, "markerfacecolor"));
+        addproperty ("markersize", hg, "linemarkersize",
+                     get (htmp, "markersize"));
+
+        addlistener (hg, "color", @update_props);
+        addlistener (hg, "linestyle", @update_props);
+        addlistener (hg, "linewidth", @update_props);
+        addlistener (hg, "marker", @update_props);
+        addlistener (hg, "markeredgecolor", @update_props);
+        addlistener (hg, "markerfacecolor", @update_props);
+        addlistener (hg, "markersize", @update_props);
+
+        ## Matlab property, although Octave does not implement it.
+        addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+        if (! isempty (args))
+          set (hg, args{:});
+        endif
+      endfor
+    unwind_protect_cleanup
+      set (gca (), "nextplot", hold_state);
+    end_unwind_protect
+  else
+    h = 0;
+  endif
+
+endfunction
+
+function update_props (h, ~)
+  set (get (h, "children"),
+       {"color", "linestyle", "linewidth", "marker", ...
+        "markeredgecolor", "markerfacecolor", "markersize"},
+       get (h, {"color", "linestyle", "linewidth", "marker", ...
+                "markeredgecolor", "markerfacecolor", "markersize"}));
+endfunction
+
+function update_data (h, ~)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+
+  sz = min ([size(x); size(y)]);
+  x = x(1:sz(1), 1:sz(2));
+  y = y(1:sz(1), 1:sz(2));
+
+  nr = length (x);
+  len = 2 * nr - 1;
+  xs = ys = zeros (1, len);
+
+  xs(1) = x(1);
+  ys(1) = y(1);
+
+  xtmp = x(2:nr);
+  ridx = 2:2:len-1;
+  xs(ridx) = xtmp;
+  ys(ridx) = y(1:nr-1);
+
+  ridx = 3:2:len;
+  xs(ridx) = xtmp;
+  ys(ridx) = y(2:nr);
+
+  set (get (h, "children"), "xdata", xs, "ydata", ys);
+endfunction
+
+
+%!demo
+%! clf;
+%! rand_1x10_data1 = [0.073, 0.455, 0.837, 0.124, 0.426, 0.781, 0.004, 0.024, 0.519, 0.698];
+%! y = rand_1x10_data1;
+%! stairs (y);
+%! title ('stairs() plot of y-data');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! rand_1x10_data2 = [0.014, 0.460, 0.622, 0.394, 0.531, 0.378, 0.466, 0.788, 0.342, 0.893];
+%! y = rand_1x10_data2;
+%! [xs, ys] = stairs (x, y);
+%! plot (xs, ys);
+%! title ('plot() of stairs() generated data');
+
+%!demo
+%! clf;
+%! stairs (1:9, '-o');
+%! title ('stairs() plot with linespec to modify marker');
+
+%!demo
+%! clf;
+%! stairs (9:-1:1, 'marker', 's', 'markersize', 10, 'markerfacecolor', 'm');
+%! title ('stairs() plot with prop/val pairs to modify appearance');
+
+%!demo
+%! clf;
+%! N = 11;
+%! x = 0:(N-1);
+%! y = rand (1, N);
+%! hs = stairs (x(1), y(1));
+%! axis ([1, N-1 0, 1]);
+%! title ('stairs plot data modified through handle');
+%! for k = 2:N
+%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k));
+%!   drawnow ();
+%!   pause (0.2);
+%! end
+
+## Invisible figure used for tests
+%!shared hf, hax
+%! hf = figure ("visible", "off");
+%! hax = axes;
+
+%!error stairs ()
+%!error <Y must be a numeric 2-D vector> stairs (hax, {1})
+%!error <Y must be a numeric 2-D vector> stairs (ones (2,2,2))
+%!error <X and Y must be numeric 2-D vector> stairs ({1}, 1)
+%!error <X and Y must be numeric 2-D vector> stairs (1, {1})
+%!error <X and Y must be numeric 2-D vector> stairs (ones (2,2,2), 1)
+%!error <X and Y must be numeric 2-D vector> stairs (1, ones (2,2,2))
+%!error <X and Y sizes must match> stairs (1:2, 1:3)
+
+## Close figure used for testing
+%!test
+%! close (hf);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stem.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,215 @@
+## Copyright (C) 2006-2012 Michel D. Schmid
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stem (@var{y})
+## @deftypefnx {Function File} {} stem (@var{x}, @var{y})
+## @deftypefnx {Function File} {} stem (@dots{}, @var{linespec})
+## @deftypefnx {Function File} {} stem (@dots{}, "filled")
+## @deftypefnx {Function File} {} stem (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} stem (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} stem (@dots{})
+## Plot a 2-D stem graph.
+##
+## If only one argument is given, it is taken as the y-values and the
+## x-coordinates are taken from the indices of the elements.
+##
+## If @var{y} is a matrix, then each column of the matrix is plotted as
+## a separate stem graph.  In this case @var{x} can either be a vector,
+## the same length as the number of rows in @var{y}, or it can be a
+## matrix of the same size as @var{y}.
+##
+## The default color is @qcode{"b"} (blue), the default line style is
+## @qcode{"-"}, and the default marker is @qcode{"o"}.  The line style can
+## be altered by the @code{linespec} argument in the same manner as the
+## @code{plot} command.  If the @qcode{"filled"} argument is present the
+## markers at the top of the stems will be filled in.  For example,
+##
+## @example
+## @group
+## x = 1:10;
+## y = 2*x;
+## stem (x, y, "r");
+## @end group
+## @end example
+##
+## @noindent
+## plots 10 stems with heights from 2 to 20 in red;
+##
+## Optional property/value pairs may be specified to control the appearance
+## of the plot.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a handle to a @nospell{"stem series"}
+## hggroup.  The single hggroup handle has all of the graphical elements
+## comprising the plot as its children; This allows the properties of
+## multiple graphics objects to be changed by modifying just a single
+## property of the @nospell{"stem series"} hggroup.
+##
+## For example,
+##
+## @example
+## @group
+## x = [0:10]';
+## y = [sin(x), cos(x)]
+## h = stem (x, y);
+## set (h(2), "color", "g");
+## set (h(1), "basevalue", -1)
+## @end group
+## @end example
+##
+## @noindent
+## changes the color of the second @nospell{"stem series"} and moves the base
+## line of the first.
+##
+## Stem Series Properties
+##
+## @table @asis
+## @item linestyle
+## The linestyle of the stem.  (Default: @qcode{"-"})
+##
+## @item linewidth
+## The width of the stem.  (Default: 0.5)
+##
+## @item color
+## The color of the stem, and if not separately specified, the marker.
+## (Default: @qcode{"b"} [blue])
+##
+## @item marker
+## The marker symbol to use at the top of each stem.  (Default: @qcode{"o"})
+##
+## @item markeredgecolor
+## The edge color of the marker.  (Default: @qcode{"color"} property)
+##
+## @item markerfacecolor
+## The color to use for @nospell{"filling"} the marker.  
+## (Default: @qcode{"none"} [unfilled])
+##
+## @item markersize
+## The size of the marker.  (Default: 6)
+##
+## @item baseline
+## The handle of the line object which implements the baseline.  Use @code{set}
+## with the returned handle to change graphic properties of the baseline.
+##
+## @item basevalue
+## The y-value where the baseline is drawn.  (Default: 0)
+## @end table
+## @seealso{stem3, bar, hist, plot, stairs}
+## @end deftypefn
+
+## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
+## Adapted-by: jwe
+
+function h = stem (varargin)
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  htmp = __stem__ (false, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! y = 1:10;
+%! stem (y);
+%! title ('stem plot of y-values only');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! stem (x, y);
+%! title ('stem plot of x and y-values');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, 'r');
+%! title ('stem plot with modified color');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, '-.k');
+%! title ('stem plot with modified line style and color');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, '-.ks');
+%! title ('stem plot with modified line style, color, and marker');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, 'filled');
+%! title ('stem plot with "filled" markers');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, 'markerfacecolor', [1 0 1]);
+%! title ('stem plot modified with property/value pair');
+
+%!demo
+%! clf;
+%! x = (0 : 10)';
+%! y = [sin(x), cos(x)];
+%! h = stem (x, y);
+%! set (h(2), 'color', 'g');
+%! set (h(1), 'basevalue', -1);
+%! title ('stem plots modified through hggroup handle');
+
+%!demo
+%! clf;
+%! N = 11;
+%! x = 0:(N-1);
+%! y = rand (1, N);
+%! hs = stem (x(1), y(1));
+%! set (gca (), 'xlim', [1, N-1], 'ylim', [0, 1]);
+%! title ('stem plot data modified through hggroup handle');
+%! for k=2:N
+%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k))
+%!   drawnow ();
+%!   pause (0.2);
+%! end
+
+%!error stem ()
+%!error <can not define Z for 2-D stem plot> stem (1,2,3)
+%!error <X and Y must be numeric> stem ({1})
+%!error <X and Y must be numeric> stem (1, {1})
+%!error <inconsistent sizes for X and Y> stem (1:2, 1:3)
+%!error <inconsistent sizes for X and Y> stem (1:2, ones (3,3))
+%!error <inconsistent sizes for X and Y> stem (ones (2,2), ones (3,3))
+%!error <No value specified for property "FOO"> stem (1, "FOO")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stem3.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,92 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stem3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} stem3 (@dots{}, @var{linespec})
+## @deftypefnx {Function File} {} stem3 (@dots{}, "filled")
+## @deftypefnx {Function File} {} stem3 (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} stem3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} stem3 (@dots{})
+## Plot a 3-D stem graph.
+##
+## Stems are drawn from the height @var{z} to the location in the x-y plane
+## determined by @var{x} and @var{y}.  The default color is @qcode{"b"} (blue),
+## the default line style is @qcode{"-"}, and the default marker is @qcode{"o"}.
+##
+## The line style can be altered by the @code{linespec} argument in the same
+## manner as the @code{plot} command.  If the @qcode{"filled"} argument is
+## present the markers at the top of the stems will be filled in.
+##
+## Optional property/value pairs may be specified to control the appearance
+## of the plot.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a handle to the @nospell{"stem series"}
+## hggroup containing the line and marker objects used for the plot.
+## @xref{XREFstem,,stem}, for a description of the @nospell{"stem series"}
+## object.
+##
+## Example:
+##
+## @example
+## @group
+## theta = 0:0.2:6;
+## stem3 (cos (theta), sin (theta), theta);
+## @end group
+## @end example
+##
+## @noindent
+## plots 31 stems with heights from 0 to 6 lying on a circle.
+##
+## Implementation Note: Color definitions with RGB-triples are not valid.
+## @seealso{stem, bar, hist, plot}
+## @end deftypefn
+
+function h = stem3 (varargin)
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  htmp = __stem__ (true, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! theta = 0:0.2:6;
+%! stem3 (cos (theta), sin (theta), theta);
+%! title ('stem3() plot');
+
+%!error stem3 ()
+%!error <must define X, Y, and Z> stem3 (1,2)
+%!error <X, Y, and Z must be numeric> stem3 ({1}, 1, 1)
+%!error <X, Y, and Z must be numeric> stem3 (1, {1}, 1)
+%!error <X, Y, and Z must be numeric> stem3 (1, 1, {1})
+%!error <inconsistent sizes for X, Y, and Z> stem3 (ones (2,2), 1, 1);
+%!error <inconsistent sizes for X, Y, and Z> stem3 (1, ones (2,2), 1);
+%!error <inconsistent sizes for X, Y, and Z> stem3 (1, 1, ones (2,2));
+%!error <No value specified for property "FOO"> stem3 (1, "FOO")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stemleaf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,596 @@
+## Copyright (C) 2013 Michael D. Godfrey
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public
+## License as published by the Free Software Foundation;
+## either version 3 of the License, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied
+## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+## PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public
+## License along with Octave; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stemleaf (@var{x}, @var{caption})
+## @deftypefnx {Function File} {} stemleaf (@var{x}, @var{caption}, @var{stem_sz})
+## @deftypefnx {Function File} {@var{plotstr} =} stemleaf (@dots{})
+## Compute and display a stem and leaf plot of the vector @var{x}.
+##
+## The input @var{x} should be a vector of integers.  Any non-integer values
+## will be converted to integer by @code{@var{x} = fix (@var{x})}.  By default
+## each element of @var{x} will be plotted with the last digit of the element
+## as a leaf value and the remaining digits as the stem.  For example, 123
+## will be plotted with the stem @samp{12} and the leaf @samp{3}.  The second
+## argument, @var{caption}, should be a character array which provides a
+## description of the data.  It is included as a heading for the output.
+##
+## The optional input @var{stem_sz} sets the width of each stem.
+## The stem width is determined by @code{10^(@var{stem_sz} + 1)}.
+## The default stem width is 10.
+##
+## The output of @code{stemleaf} is composed of two parts: a
+## "Fenced Letter Display," followed by the stem-and-leaf plot itself.
+## The Fenced Letter Display is described in @cite{Exploratory Data Analysis}.
+## Briefly, the entries are as shown:
+##
+## @example
+## @group
+##
+##         Fenced Letter Display
+## #% nx|___________________     nx = numel (x)
+## M% mi|       md         |     mi median index, md median
+## H% hi|hl              hu| hs  hi lower hinge index, hl,hu hinges,
+## 1    |x(1)         x(nx)|     hs h_spreadx(1), x(nx) first 
+##            _______            and last data value.
+##      ______|step |_______     step 1.5*h_spread
+##     f|ifl            ifh|     inner fence, lower and higher
+##      |nfl            nfh|     no.\ of data points within fences
+##     F|ofl            ofh|     outer fence, lower and higher
+##      |nFl            nFh|     no.\ of data points outside outer
+##                               fences
+## @end group
+## @end example
+##
+## The stem-and-leaf plot shows on each line the stem value followed by the
+## string made up of the leaf digits.  If the @var{stem_sz} is not 1 the
+## successive leaf values are separated by ",".
+##
+## With no return argument, the plot is immediately displayed.  If an output
+## argument is provided, the plot is returned as an array of strings. 
+##
+## The leaf digits are not sorted.  If sorted leaf values are desired, use
+## @code{@var{xs} = sort (@var{x})} before calling @code{stemleaf (@var{xs})}.
+##
+## The stem and leaf plot and associated displays are described in: 
+## Ch. 3, @cite{Exploratory Data Analysis} by J. W. Tukey, Addison-Wesley, 1977.
+## @seealso{hist, printd}
+## @end deftypefn
+
+## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
+## Description: Compute stem and leaf plot
+
+function plotstr = stemleaf (x, caption, stem_sz)
+  ## Compute and display a stem and leaf plot of the vector x.  The x
+  ## vector is converted to integer by x = fix(x).  If an output argument
+  ## is provided, the plot is returned as an array of strings.  The
+  ## first element is the heading followed by an element for each stem.
+  ##
+  ## The default stem step is 10.  If stem_sz is provided the stem
+  ## step is set to: 10^(stem_sz+1).  The x vector should be integers.
+  ## It will be treated so that the last digit is the leaf value and the
+  ## other digits are the stems.
+  ##
+  ## When we first implemented stem and leaf plots in the early 1960's
+  ## there was some discussion about sorting vs. leaving the leaf
+  ## entries in the original order in the data.  We decided in favor of
+  ## sorting the leaves for most purposes.  This is the choice
+  ## implemented in the SNAP/IEDA system that was written at that time.
+  ##
+  ## SNAP/IEDA, and particularly its stem and leaf plotting, were further
+  ## developed by Hale Trotter, David Hoagland (at Princeton and MIT),
+  ## and others.
+  ##
+  ## Tukey, in EDA, generally uses unsorted leaves.  In addition, he
+  ## described a wide range of additional display formats.  This
+  ## implementation does not sort the leaves, but if the x vector is
+  ## sorted then the leaves come out sorted.  A simple display format is
+  ## used.
+  ##
+  ## I doubt if providing other options is worthwhile.  The code can
+  ## quite easily be modified to provide specific display results.  Or,
+  ## the returned output string can be edited.  The returned output is an
+  ## array of strings with each row containing a line of the plot
+  ## preceded by the lines of header text as the first row.  This
+  ## facilitates annotation.
+  ##
+  ## Note that the code has some added complexity due to the need to
+  ## distinguish both + and - 0 stems.  The +- stem values are essential
+  ## for all plots which span 0. After dealing with +-0 stems, the added
+  ## complexity of putting +- data values in the correct stem is minor,
+  ## but the sign of 0 leaves must be checked.  And, the cases where the
+  ## stems start or end at +- 0 must also be considered.
+  ##
+  ## The fact that IEEE floating point defines +- 0 helps make this
+  ## easier.
+  ##
+  ## Michael D. Godfrey   January 2013
+
+  ## More could be implemented for better data scaling.  And, of course,
+  ## other options for the kinds of plots described by Tukey could be
+  ## provided.  This may best be left to users.
+
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (! isvector (x))
+    error ("stemleaf: X must be a vector");
+  endif
+
+  if (isinteger (x))
+    ## Avoid use of integers because rounding rules do not use fix():
+    ## Example: floor (int32 (-44)/10) == -4, floor (int32 (-46)/10) = -5 !!!
+    x = single (x);
+  elseif (isfloat (x))
+    xint = fix (x);
+    if (any (x != xint))
+      warning ("stemleaf: X truncated to integer values");
+      x = xint;
+    endif
+  else
+    error ("stemleaf: X must be a numeric vector");
+  endif
+
+  if (! ischar (caption))
+    error ("stemleaf: CAPTION must be a character array");
+  endif
+
+  if (nargin == 2)
+    stem_step = 10;
+  else
+    if (isscalar (stem_sz) && stem_sz >= 0 && isreal (stem_sz))
+      stem_sz = fix (stem_sz);
+      stem_step = 10^(stem_sz+1);
+    else
+      error ("stemleaf: STEM_SZ must be a real integer >= 0");
+    endif
+  endif
+
+  ## Note that IEEE 754 states that -+ 0 should compare equal. This has
+  ## led to C sort (and therefore Octave) treating them as equal.  Thus,
+  ## sort([-1 0 -0 1]) yields [-1 0 -0 1], and sort([-1 -0 0 1])
+  ## yields: [-1 -0 0 1].  This means that stem-and-leaf plotting cannot
+  ## rely on sort to order the data as needed for display.
+  ## This also applies to min()/max() so these routines can't be relied
+  ## upon if the max or min is -+ 0.
+
+  ## Compute hinges and fences based on ref: EDA pgs. 33 and 44.
+  ## Note that these outlier estimates are meant to be "distribution free".
+
+  nx = numel (x);
+  xs = sort (x);                # Note that sort preserves -0
+  mdidx = fix ((nx + 1)/2);     # median index
+  hlidx = fix ((mdidx + 1)/2);  # lower hinge index
+  huidx = fix (nx + 1 - hlidx); # upper hinge index
+  md = xs(mdidx);               # median
+  hl = xs(hlidx);               # lower hinge
+  hu = xs(huidx);               # upper hinge
+  h_spread = hu - hl;           # h_spread: difference between hinges
+  step = 1.5*h_spread;          # step: 1.5 * h_spread
+  i_fence_l = hl - step;        # inner fences: outside hinges + step
+  o_fence_l = hl - 2*step;      # outer fences: outside hinges + 2*step
+  i_fence_h = hu + step;
+  o_fence_h = hu + 2*step;
+  n_out_l   = sum (x<i_fence_l) - sum (x<o_fence_l);
+  n_out_h   = sum (x>i_fence_h) - sum (x>o_fence_h);
+  n_far_l   = sum (x<o_fence_l);
+  n_far_h   = sum (x>o_fence_h);
+
+  ## display table similar to that on pg. 33
+  plot_out = sprintf ("       Data: %s", caption);
+  plot_out = [plot_out; sprintf(" ")];
+  plot_out = [plot_out; sprintf("         Fenced Letter Display")];
+  plot_out = [plot_out; sprintf(" ")];
+  plot_out = [plot_out; sprintf("     #%3d|___________________", nx)];
+  plot_out = [plot_out; sprintf("     M%3d|       %5d      |", mdidx, md)];
+  plot_out = [plot_out; sprintf("     H%3d|%5d        %5d|   %d", hlidx, hl, hu, h_spread)];
+  plot_out = [plot_out; sprintf("     1   |%5d        %5d|", xs(1), xs(nx))];
+  plot_out = [plot_out; sprintf("               _______")];   
+  plot_out = [plot_out; sprintf("         ______|%5d|_______",step)];
+  plot_out = [plot_out; sprintf("        f|%5d        %5d|", i_fence_l, i_fence_h)];
+  plot_out = [plot_out; sprintf("         |%5d        %5d|  out", n_out_l, n_out_h)];
+  plot_out = [plot_out; sprintf("        F|%5d        %5g|", o_fence_l, o_fence_h)];
+  plot_out = [plot_out; sprintf("         |%5d        %5d|  far",n_far_l,n_far_h)];
+  plot_out = [plot_out; " "];
+
+  ## Determine stem values
+  min_x = min (x);
+  max_x = max (x);
+  if (min_x > 0)      # all stems > 0
+    stems = [fix(min(x)/stem_step) : (fix(max(x)/stem_step)+1)];
+  elseif (max_x < 0)  # all stems < 0
+    stems = [(fix(min_x/stem_step)-1) : fix(max_x/stem_step)];
+  elseif (min_x < 0 && max_x > 0)  # range crosses 0
+    stems = [(fix(min_x/stem_step)-1) : -0, 0 : fix(max_x/stem_step)+1 ];
+  else   # one endpoint is a zero which may be +0 or -0
+    if (min_x == 0)
+      if (any (x == 0 & signbit (x)))
+        min_x = -0;
+      else
+        min_x = +0;
+      endif
+    endif
+    if (max_x == 0)
+      if (any (x == 0 & ! signbit (x)))
+        max_x = +0;
+      else
+        max_x = -0;
+      endif
+    endif
+    stems = [];
+    if (signbit (min_x))
+      stems = [(fix(min_x/stem_step)-1) : -0];
+    endif
+    if (! signbit (max_x))
+      stems = [stems, 0 : fix(max_x/stem_step)+1 ];
+    endif
+  endif
+
+  ## Vectorized version provided by Rik Wehbring (rik@octave.org)
+  ## Determine leaves for each stem:
+  new_line  = 1;
+  for kx = 2: numel (stems)
+
+    stem_sign = signbit (stems(kx));
+    if (stems(kx) <= 0)
+      idx = ((x <= stems(kx)*stem_step) & (x > (stems(kx-1)*stem_step))
+              & (signbit (x) == stem_sign));
+      xlf = abs (x(idx) - stems(kx)*stem_step);
+    else
+      idx = ((x < stems(kx)*stem_step) & (x >= (stems(kx-1)*stem_step))
+              & (signbit (x) == stem_sign));
+      xlf = abs (x(idx) - stems(kx-1)*stem_step);
+    endif
+    ## Convert leaves to a string
+    if (stem_step == 10)
+      lf_str = sprintf ("%d", xlf);
+    else
+      lf_str = "";
+      if (! isempty (xlf))
+        lf_str = sprintf ("%d", xlf(1));
+        if (numel (xlf) > 1)
+          lf_str = [lf_str sprintf(",%d", xlf(2:end))];
+        endif
+      endif
+    endif
+
+    ## Set correct -0
+    if (stems(kx) == 0 && signbit (stems(kx)))
+      line = sprintf ("  -0 | %s",  lf_str);  # -0 stem.
+    elseif (stems(kx) < 0)
+      line = sprintf ("%4d | %s", stems(kx), lf_str);
+    elseif (stems(kx) > 0)
+      line = sprintf ("%4d | %s", stems(kx-1), lf_str);
+    else
+      line = "";
+    endif
+
+    if (! isempty (lf_str) || stems(kx) == 0 || stems(kx-1) == 0)
+      plot_out = [plot_out; line];
+      new_line = 1;
+    else
+      if (new_line == 1) 
+        plot_out = [plot_out; "     :"];  # just print one : if no leaves
+        new_line = 0;
+      endif
+    endif
+
+  endfor    # kx = 2: numel (stems)
+
+  if (nargout == 0)
+    disp (plot_out);
+  else
+    plotstr = plot_out;
+  endif
+
+endfunction
+
+
+%!demo
+%! %% Unsorted plot:
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
+%! stemleaf (x, 'Unsorted plot');
+
+%!demo
+%! %% Sorted leaves:
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
+%! y = sort (x);
+%! stemleaf (y, 'Sorted leaves');
+
+%!demo
+%! %% Sorted leaves (large dataset):
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48     ...
+%!      127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119   ...
+%!      58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 ...
+%!      121 58 114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7   ...
+%!      68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40    ...
+%!      119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114   ...
+%!      34 133 45 120 30 127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20  ...
+%!      0];
+%! y = sort (x);
+%! stemleaf (y, 'Sorted leaves (large dataset)');
+
+%!demo
+%! %% Gaussian leaves:
+%! x = fix (30 * randn (300,1));
+%! stemleaf (x, 'Gaussian leaves');
+
+%!test
+%! ## test minus to plus
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48 127   ...
+%!      36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109  ...
+%!      23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58   ...
+%!      114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7 68 40 31   ...
+%!      115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57 ...
+%!      122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30  ...
+%!      127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20 0];
+%! x = sort (x);
+%! rexp = char (
+%! "       Data: test minus to plus"    ,
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     #138|___________________"      ,     
+%! "     M 69|          52      |"      ,     
+%! "     H 35|   30          116|   86" ,
+%! "     1   |  -28          146|"      ,
+%! "               _______"             ,
+%! "         ______|  129|_______"      ,
+%! "        f|  -99          245|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F| -228          374|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "  -2 | 82"                          ,
+%! "  -1 | 3"                           ,
+%! "  -0 | 2"                           ,
+%! "   0 | 00177"                       ,
+%! "   1 | 00112288"                    ,
+%! "   2 | 001133577777899"             ,
+%! "   3 | 000111123456777889"          ,
+%! "   4 | 00122233344456788"           ,
+%! "   5 | 223788"                      ,
+%! "   6 | 138"                         ,
+%! "   7 | 11"                          ,
+%! "     : "                            ,
+%! "   9 | 69"                          ,
+%! "  10 | 04555567999"                 ,
+%! "  11 | 0133344455566667777899"      ,
+%! "  12 | 0011223444555677788"         ,
+%! "  13 | 1239"                        ,
+%! "  14 | 16"                          );
+%! r = stemleaf (x, "test minus to plus", 0);
+%! assert (r, rexp);
+
+%!test
+%! ## positive values above 0
+%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
+%! rexp = char (
+%! "       Data: positive values above 0",
+%! " "                                   ,
+%! "         Fenced Letter Display"      ,
+%! " "                                   ,
+%! "     # 14|___________________"       ,     
+%! "     M  7|          22      |"       ,     
+%! "     H  4|   12           42|   30"  ,
+%! "     1   |    5           52|"       ,
+%! "               _______"              ,
+%! "         ______|   45|_______"       ,
+%! "        f|  -33           87|"       ,     
+%! "         |    0            0|  out"  ,
+%! "        F|  -78          132|"       ,
+%! "         |    0            0|  far"  ,
+%! " "                                   ,
+%! "   0 | 5"                            ,
+%! "   1 | 22118"                        ,
+%! "   2 | 28"                           ,
+%! "   3 | 98"                           ,
+%! "   4 | 244"                          ,
+%! "   5 | 2"                            );
+%! r = stemleaf (x, "positive values above 0");
+%! assert (r, rexp);
+
+%!test
+%! ## negative values below 0
+%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
+%! x = -x;
+%! rexp = char (
+%! "       Data: negative values below 0",
+%! " "                                   ,
+%! "         Fenced Letter Display"      ,
+%! " "                                   ,
+%! "     # 14|___________________"       ,     
+%! "     M  7|         -28      |"       ,     
+%! "     H  4|  -42          -12|   30"  ,
+%! "     1   |  -52           -5|"       ,
+%! "               _______"              ,
+%! "         ______|   45|_______"       ,
+%! "        f|  -87           33|"       ,     
+%! "         |    0            0|  out"  ,
+%! "        F| -132           78|"       ,
+%! "         |    0            0|  far"  ,
+%! " "                                   ,
+%! "  -5 | 2"                            ,
+%! "  -4 | 244"                          ,
+%! "  -3 | 98"                           ,
+%! "  -2 | 28"                           ,
+%! "  -1 | 22118"                        ,
+%! "  -0 | 5"                            );
+%! r = stemleaf (x, "negative values below 0");
+%! assert (r, rexp);
+
+%!test
+%! ## positive values from 0
+%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
+%! rexp = char (
+%! "       Data: positive values from 0",
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     # 15|___________________"      ,     
+%! "     M  8|          22      |"      ,     
+%! "     H  4|   11           42|   31" ,
+%! "     1   |    0           52|"      ,
+%! "               _______"             ,
+%! "         ______|   46|_______"      ,
+%! "        f|  -35           88|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F|  -82          135|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "   0 | 20"                          ,
+%! "   1 | 22118"                       ,
+%! "   2 | 28"                          ,
+%! "   3 | 98"                          ,
+%! "   4 | 244"                         ,
+%! "   5 | 2"                           );
+%! r = stemleaf (x, "positive values from 0");
+%! assert (r, rexp);
+
+%!test
+%! ## negative values from 0
+%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
+%! x = -x;
+%! rexp = char (
+%! "       Data: negative values from 0",
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     # 15|___________________"      ,     
+%! "     M  8|         -22      |"      ,     
+%! "     H  4|  -42          -11|   31" ,
+%! "     1   |  -52            0|"      ,
+%! "               _______"             ,
+%! "         ______|   46|_______"      ,
+%! "        f|  -88           35|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F| -135           82|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "  -5 | 2"                           ,
+%! "  -4 | 244"                         ,
+%! "  -3 | 98"                          ,
+%! "  -2 | 28"                          ,
+%! "  -1 | 22118"                       ,
+%! "  -0 | 20"                          );
+%! r = stemleaf (x, "negative values from 0");
+%! assert (r, rexp);
+
+%!test
+%! ## both +0 and -0 present
+%! x = [-9 -7 -0 0 -0];
+%! rexp = char (
+%! "       Data: both +0 and -0 present",
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     #  5|___________________"      ,     
+%! "     M  3|           0      |"      ,     
+%! "     H  2|   -7            0|   7"  ,
+%! "     1   |   -9            0|"      ,
+%! "               _______"             ,
+%! "         ______|   10|_______"      ,
+%! "        f|  -17           10|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F|  -28           21|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "  -0 | 9700"                        ,
+%! "   0 | 0"                           );
+%! r = stemleaf (x, "both +0 and -0 present");
+%! assert (r, rexp);
+
+%!test
+%! ## both <= 0 and -0 present
+%! x = [-9 -7 0 -0];
+%! rexp = char (
+%! "       Data: both <= 0 and -0 present",
+%! " "                                    ,
+%! "         Fenced Letter Display"       ,
+%! " "                                    ,
+%! "     #  4|___________________"        ,     
+%! "     M  2|          -7      |"        ,     
+%! "     H  1|   -9            0|   9"    ,
+%! "     1   |   -9            0|"        ,
+%! "               _______"               ,
+%! "         ______|   13|_______"        ,
+%! "        f|  -22           13|"        ,     
+%! "         |    0            0|  out"   ,
+%! "        F|  -36           27|"        ,
+%! "         |    0            0|  far"   ,
+%! " "                                    ,
+%! "  -0 | 970"                           ,
+%! "   0 | 0"                             );
+%! r = stemleaf (x, "both <= 0 and -0 present");
+%! assert (r, rexp);
+
+%!test
+%! ##   Example from EDA: Chevrolet Prices pg. 30
+%! x = [150 250 688 695 795 795 895 895 895 ...
+%!      1099 1166 1333 1499 1693 1699 1775 1995];
+%! rexp = char (
+%! "       Data: Chevrolet Prices EDA pg.30",
+%! " "                                      ,
+%! "         Fenced Letter Display"         ,
+%! " "                                      ,
+%! "     # 17|___________________"          ,          
+%! "     M  9|         895      |"          ,
+%! "     H  5|  795         1499|   704"    ,
+%! "     1   |  150         1995|"          ,
+%! "               _______"                 ,
+%! "         ______| 1056|_______"          ,
+%! "        f| -261         2555|"          ,
+%! "         |    0            0|  out"     ,
+%! "        F|-1317         3611|"          ,
+%! "         |    0            0|  far"     ,
+%! " "                                      ,
+%! "   1 | 50"                              ,
+%! "   2 | 50"                              ,
+%! "     :"                                 ,
+%! "   6 | 88,95"                           ,
+%! "   7 | 95,95"                           ,
+%! "   8 | 95,95,95"                        ,
+%! "     :"                                 ,
+%! "  10 | 99"                              ,
+%! "  11 | 66"                              ,
+%! "     :"                                 ,
+%! "  13 | 33"                              ,
+%! "  14 | 99"                              ,
+%! "     :"                                 ,
+%! "  16 | 93,99"                           ,
+%! "  17 | 75"                              ,
+%! "     :"                                 ,
+%! "  19 | 95"                              );
+%! r = stemleaf (x, "Chevrolet Prices EDA pg.30", 1);
+%! assert (r, rexp);
+
+## Test input validation
+%!error stemleaf ()
+%!error stemleaf (1, 2, 3, 4)
+%!error <X must be a vector> stemleaf (ones (2,2), "")
+%!warning <X truncated to integer values> tmp = stemleaf ([0 0.5 1],"");
+%!error <X must be a numeric vector> stemleaf ("Hello World", "data")
+%!error <CAPTION must be a character array> stemleaf (1, 2)
+%!error <STEM_SZ must be a real integer> stemleaf (1, "", ones (2,2))
+%!error <STEM_SZ must be a real integer> stemleaf (1, "", -1)
+%!error <STEM_SZ must be a real integer> stemleaf (1, "", 1+i)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,118 @@
+## Copyright (C) 2007-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surf (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surf (@var{z})
+## @deftypefnx {Function File} {} surf (@dots{}, @var{c})
+## @deftypefnx {Function File} {} surf (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} surf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surf (@dots{})
+## Plot a 3-D surface mesh.
+##
+## The surface mesh is plotted using shaded rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the surface is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the surface can be specified independently of
+## @var{z} by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Note: The exact appearance of the surface can be controlled with the
+## @code{shading} command or by using @code{set} to control surface object
+## properties.
+## @seealso{ezsurf, surfc, surfl, surfnorm, trisurf, contour, mesh, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function retval = surf (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("surf", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = surface (varargin{:});
+
+    if (! ishold (hax))
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! surf (Z);
+%! title ({'surf() plot of peaks() function'; 'color determined by height Z'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = sombrero ();
+%! [Fx,Fy] = gradient (Z);
+%! surf (Z, Fx+Fy);
+%! shading interp;
+%! title ({'surf() plot of peaks() function'; ...
+%!         'facecolor is interpolated, color determined by gradient of Z'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = sombrero ();
+%! [~,Fy] = gradient (Z);
+%! surf (X, Y, Z, Fy);
+%! shading interp;
+%! title ({'surf() plot of peaks() function'; ...
+%!         'facecolor is interpolated, color determined by Y-gradient of Z'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surface.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,211 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surface (@var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} surface (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surface (@var{z}, @var{c})
+## @deftypefnx {Function File} {} surface (@var{z})
+## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} surface (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surface (@dots{})
+## Create a surface graphic object given matrices @var{x} and @var{y} from
+## @code{meshgrid} and a matrix of values @var{z} corresponding to the
+## @var{x} and @var{y} coordinates of the surface.
+##
+## If @var{x} and @var{y} are vectors, then a typical vertex is
+## (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus, columns of @var{z} correspond
+## to different @var{x} values and rows of @var{z} correspond to different
+## @var{y} values.  If only a single input @var{z} is given then @var{x} is
+## taken to be @code{1:rows (@var{z})} and @var{y} is
+## @code{1:columns (@var{z})}.
+##
+## Any property/value input pairs are assigned to the surface object.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+## @seealso{surf, mesh, patch, line}
+## @end deftypefn
+
+## Author: jwe
+
+function h = surface (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("surface", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  [htmp, bad_usage] = __surface__ (hax, varargin{:});
+
+  if (bad_usage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+function [h, bad_usage] = __surface__ (ax, varargin)
+
+  h = 0;
+  bad_usage = false;
+  firststring = nargin;
+  for i = 1 : (nargin - 1)
+    if (ischar (varargin{i}))
+      firststring = i;
+      break;
+    endif
+  endfor
+
+  if (firststring > 5)
+    bad_usage = true;
+    return;
+  elseif (firststring == 5)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    c = varargin{4};
+
+    if (iscomplex (x) || iscomplex (y) || iscomplex (z) || iscomplex (c))
+      error ("mesh: X, Y, Z, C arguments must be real");
+    endif
+
+    [z_nr, z_nc] = size (z);
+    [c_nr, c_nc, c_np] = size (c);
+    if (! (z_nr == c_nr && z_nc == c_nc && (c_np == 1 || c_np == 3)))
+      error ("surface: Z and C must have the same size");
+    endif
+
+    if (isvector (x) && isvector (y) && ismatrix (z))
+      if (rows (z) == length (y) && columns (z) == length (x))
+        x = x(:)';
+        y = y(:);
+      else
+        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
+      endif
+    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
+      if (! size_equal (x, y, z))
+        error ("surface: X, Y, and Z must have the same dimensions");
+      endif
+    else
+      error ("surface: X and Y must be vectors and Z must be a matrix");
+    endif
+  elseif (firststring == 4)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    c = z;
+
+    if (iscomplex (x) || iscomplex (y) || iscomplex (z))
+      error ("mesh: X, Y, Z arguments must be real");
+    endif
+
+    if (isvector (x) && isvector (y) && ismatrix (z))
+      if (rows (z) == length (y) && columns (z) == length (x))
+        x = x(:)';
+        y = y(:);
+      else
+        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
+      endif
+    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
+      if (! size_equal (x, y, z))
+        error ("surface: X, Y, and Z must have the same dimensions");
+      endif
+    else
+      error ("surface: X and Y must be vectors and Z must be a matrix");
+    endif
+  elseif (firststring == 3)
+    z = varargin{1};
+    c = varargin{2};
+
+    if (iscomplex (z) || iscomplex (c))
+      error ("mesh: X, C arguments must be real");
+    endif
+
+    if (ismatrix (z) && !isvector (z) && !isscalar (z))
+      [nr, nc] = size (z);
+      x = 1:nc;
+      y = (1:nr)';
+    else
+      error ("surface: Z argument must be a matrix");
+    endif
+  elseif (firststring == 2)
+    z = varargin{1};
+    c = z;
+
+    if (iscomplex (z))
+      error ("mesh: Z argument must be real");
+    endif
+
+    if (ismatrix (z) && !isvector (z) && !isscalar (z))
+      [nr, nc] = size (z);
+      x = 1:nc;
+      y = (1:nr)';
+    else
+      error ("surface: Z argument must be a matrix");
+    endif
+  elseif (firststring == 1)
+    x = 1:3;
+    y = x';
+    c = z = eye (3);
+  else
+    bad_usage = true;
+    return;
+  endif
+
+  if (firststring < nargin)
+    other_args = varargin(firststring:end);
+  else
+    other_args = {};  # make a default surface object.
+  endif
+  h = __go_surface__ (ax, "xdata", x, "ydata", y, "zdata", z, "cdata", c,
+                      other_args{:});
+
+  if (! ishold ())
+    set (ax, "view", [0, 90], "box", "off");
+  endif
+
+endfunction
+
+
+## Functional tests for surface() are in surf.m, surfc.m, surfl.m, and pcolor.m
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = surface;
+%!   assert (findobj (hf, "type", "surface"), h);
+%!   assert (get (h, "xdata"), 1:3, eps);
+%!   assert (get (h, "ydata"), (1:3)', eps);
+%!   assert (get (h, "zdata"), eye (3));
+%!   assert (get (h, "cdata"), eye (3));
+%!   assert (get (h, "type"), "surface");
+%!   assert (get (h, "linestyle"), get (0, "defaultsurfacelinestyle"));
+%!   assert (get (h, "linewidth"), get (0, "defaultsurfacelinewidth"), eps);
+%!   assert (get (h, "marker"), get (0, "defaultsurfacemarker"));
+%!   assert (get (h, "markersize"), get (0, "defaultsurfacemarkersize"));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surfc.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,142 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surfc (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surfc (@var{z})
+## @deftypefnx {Function File} {} surfc (@dots{}, @var{c})
+## @deftypefnx {Function File} {} surfc (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} surfc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surfc (@dots{})
+## Plot a 3-D surface mesh with underlying contour lines.
+##
+## The surface mesh is plotted using shaded rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the surface is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the surface can be specified independently of
+## @var{z} by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Note: The exact appearance of the surface can be controlled with the
+## @code{shading} command or by using @code{set} to control surface object
+## properties.
+## @seealso{ezsurfc, surf, surfl, surfnorm, trisurf, contour, mesh, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+function h = surfc (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfc", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = surface (varargin{:});
+
+    set (htmp, "facecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on",
+                "xlimmode", "manual", "ylimmode", "manual");
+    endif
+
+    drawnow ();
+
+    ## don't pass string arguments to __contour__()
+    stop_idx = find (cellfun ("isclass", varargin, "char"), 1);
+    if (isempty (stop_idx))
+      stop_idx = nargin;
+    else
+      stop_idx--;
+    endif
+
+    if (stop_idx - 1 == 1 || stop_idx - 1 == 3)
+      ## Don't pass a color matrix c to __contour__
+      stop_idx -= 1;
+    endif
+
+    zmin = get (hax, "zlim")(1);
+    [~, htmp2] = __contour__ (hax, zmin, varargin{1:stop_idx});
+
+    htmp = [htmp; htmp2];
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! surfc (Z);
+%! title ('surfc() combines surf/contour plots');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = sombrero ();
+%! [Fx,Fy] = gradient (Z);
+%! surfc (Z, Fx+Fy);
+%! shading interp;
+%! title ({'surfc() plot of sombrero() function'; ...
+%!         'facecolor is interpolated, color determined by gradient of Z'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = sombrero ();
+%! [~,Fy] = gradient (Z);
+%! surfc (X,Y,Z,Fy);
+%! shading interp;
+%! title ({'surfc() plot of peaks() function'; ...
+%!         'facecolor is interpolated, color determined by Y-gradient of Z'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surfl.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,213 @@
+## Copyright (C) 2009-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surfl (@var{z})
+## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surfl (@dots{}, @var{lsrc})
+## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z}, @var{lsrc}, @var{P})
+## @deftypefnx {Function File} {} surfl (@dots{}, "cdata")
+## @deftypefnx {Function File} {} surfl (@dots{}, "light")
+## @deftypefnx {Function File} {} surfl (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surfl (@dots{})
+##
+## Plot a 3-D surface using shading based on various lighting models.
+##
+## The surface mesh is plotted using shaded rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The default lighting mode @qcode{"cdata"}, changes the cdata property of the
+## surface object to give the impression of a lighted surface.
+## @strong{Warning:} The alternative mode @qcode{"light"} mode which creates a
+## light object to illuminate the surface is not implemented (yet).
+##
+## The light source location can be specified using @var{lsrc}.  It can be given
+## as a 2-element vector [azimuth, elevation] in degrees, or as a 3-element
+## vector [lx, ly, lz].  The default value is rotated 45 degrees
+## counterclockwise to the current view.
+##
+## The material properties of the surface can specified using a 4-element
+## vector @var{P} = [@var{AM} @var{D} @var{SP} @var{exp}] which defaults to
+## @var{p} = [0.55 0.6 0.4 10].
+##
+## @table @asis
+## @item @qcode{"AM"} strength of ambient light
+##
+## @item @qcode{"D"} strength of diffuse reflection
+##
+## @item @qcode{"SP"} strength of specular reflection
+##
+## @item @qcode{"EXP"} specular exponent
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Example:
+##
+## @example
+## @group
+## colormap (bone (64));
+## surfl (peaks);
+## shading interp;
+## @end group
+## @end example
+## @seealso{diffuse, specular, surf, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function h = surfl (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfl", varargin{:});
+
+  if (nargin == 0)
+    print_usage ();
+  endif
+
+  ## Check for lighting type.
+  use_cdata = true;
+  if (ischar (varargin{end}))
+    switch (tolower (varargin{end}))
+      case "light"
+        warning ("surfl: light method not supported (yet), using cdata method instead");
+        ## This can be implemented when light objects are supported.
+        use_cdata = false;
+      case "cdata"
+        use_cdata = true;
+      otherwise
+        error ("surfl: unknown lighting method");
+    endswitch
+    varargin(end) = [];
+  endif
+
+  ## Check for reflection properties argument.
+  ##
+  ## r = [ambient light strength,
+  ##      diffuse reflection strength,
+  ##      specular reflection strength,
+  ##      specular shine]
+  if (isnumeric (varargin{end}) && length (varargin{end}) == 4)
+    r = varargin{end};
+    varargin(end) = [];
+  else
+    ## Default values.
+    r = [0.55, 0.6, 0.4, 10];
+  endif
+
+  ## Check for light vector (lv) argument.
+  have_lv = false;
+  if (isnumeric (varargin{end}))
+    len = numel (varargin{end});
+    lastarg = varargin{end};
+    if (len == 3)
+      lv = lastarg;
+      varargin(end) = [];
+      have_lv = true;
+    elseif (len == 2)
+      [lv(1), lv(2), lv(3)] = sph2cart ((lastarg(1) - 90) * pi/180, 
+                                         lastarg(2) * pi/180,
+                                         1.0);
+      varargin(end) = [];
+      have_lv = true;
+    endif
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = surface (varargin{:});
+    if (! ishold (hax))
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on", "clim", [0 1]);
+    endif
+
+    ## Get view vector (vv).
+    [az, el] = view ();
+    vv = sph2cart ((az - 90) * pi/180.0, el * pi/180.0, 1.0);
+
+    if (! have_lv)
+      ## Calculate light vector (lv) from view vector.
+      phi = pi / 4;  # 45 degrees
+      R = [cos(phi), -sin(phi), 0;
+           sin(phi),  cos(phi), 0;
+           0,         0,        1];
+      lv = (R * vv.').';
+    endif
+
+    vn = get (htmp, "vertexnormals");
+    dar = get (hax, "plotboxaspectratio");
+    vn(:,:,1) *= dar(1);
+    vn(:,:,2) *= dar(2);
+    vn(:,:,3) *= dar(3);
+
+    ## Normalize vn.
+    vn ./= repmat (sqrt (sumsq (vn, 3)), [1, 1, 3]);
+    [nr, nc] = size (get (htmp, "zdata"));
+
+    ## Ambient, diffuse, and specular term.
+    cdata = (  r(1) * ones (nr, nc)
+             + r(2) * diffuse  (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv)
+             + r(3) * specular (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv, vv, r(4)));
+    cdata ./= sum (r(1:3));
+
+    set (htmp, "cdata", cdata);
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [X,Y,Z] = sombrero ();
+%! colormap (copper (64));
+%! surfl (X,Y,Z);
+%! shading interp;
+%! title ('surfl() with defaults');
+
+%!demo
+%! clf;
+%! [X,Y,Z] = sombrero ();
+%! colormap (copper (64));
+%! [az, el] = view ();
+%! surfl (X,Y,Z, [az+225,el], [0.2 0.6 0.4 25]);
+%! shading interp;
+%! title ('surfl() with lighting vector and material properties');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surfnorm.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,166 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surfnorm (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surfnorm (@var{z})
+## @deftypefnx {Function File} {[@var{nx}, @var{ny}, @var{nz}] =} surfnorm (@dots{})
+## @deftypefnx {Function File} {} surfnorm (@var{h}, @dots{})
+## Find the vectors normal to a meshgridded surface.  The meshed gridded
+## surface is defined by @var{x}, @var{y}, and @var{z}.  If @var{x} and
+## @var{y} are not defined, then it is assumed that they are given by
+##
+## @example
+## @group
+## [@var{x}, @var{y}] = meshgrid (1:rows (@var{z}),
+##                    1:columns (@var{z}));
+## @end group
+## @end example
+##
+## If no return arguments are requested, a surface plot with the normal
+## vectors to the surface is plotted.  Otherwise the components of the normal
+## vectors at the mesh gridded points are returned in @var{nx}, @var{ny},
+## and @var{nz}.
+##
+## The normal vectors are calculated by taking the cross product of the
+## diagonals of each of the quadrilaterals in the meshgrid to find the
+## normal vectors of the centers of these quadrilaterals.  The four nearest
+## normal vectors to the meshgrid points are then averaged to obtain the
+## normal to the surface at the meshgridded points.
+##
+## An example of the use of @code{surfnorm} is
+##
+## @example
+## surfnorm (peaks (25));
+## @end example
+## @seealso{surf, quiver3}
+## @end deftypefn
+
+function [Nx, Ny, Nz] = surfnorm (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfnorm", varargin{:});
+
+  if (nargin != 1 && nargin != 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    z = varargin{1};
+    [x, y] = meshgrid (1:rows (z), 1:columns (z));
+    ioff = 2;
+  else
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    ioff = 4;
+  endif
+
+  if (!ismatrix (z) || isvector (z) || isscalar (z))
+    error ("surfnorm: Z argument must be a matrix");
+  endif
+  if (! size_equal (x, y, z))
+    error ("surfnorm: X, Y, and Z must have the same dimensions");
+  endif
+
+  ## Make life easier, and avoid having to do the extrapolation later, do
+  ## a simpler linear extrapolation here. This is approximative, and works
+  ## badly for closed surfaces like spheres.
+  xx = [2 .* x(:,1) - x(:,2), x, 2 .* x(:,end) - x(:,end-1)];
+  xx = [2 .* xx(1,:) - xx(2,:); xx; 2 .* xx(end,:) - xx(end-1,:)];
+  yy = [2 .* y(:,1) - y(:,2), y, 2 .* y(:,end) - y(:,end-1)];
+  yy = [2 .* yy(1,:) - yy(2,:); yy; 2 .* yy(end,:) - yy(end-1,:)];
+  zz = [2 .* z(:,1) - z(:,2), z, 2 .* z(:,end) - z(:,end-1)];
+  zz = [2 .* zz(1,:) - zz(2,:); zz; 2 .* zz(end,:) - zz(end-1,:)];
+
+  u.x = xx(1:end-1,1:end-1) - xx(2:end,2:end);
+  u.y = yy(1:end-1,1:end-1) - yy(2:end,2:end);
+  u.z = zz(1:end-1,1:end-1) - zz(2:end,2:end);
+  v.x = xx(1:end-1,2:end) - xx(2:end,1:end-1);
+  v.y = yy(1:end-1,2:end) - yy(2:end,1:end-1);
+  v.z = zz(1:end-1,2:end) - zz(2:end,1:end-1);
+
+  c = cross ([u.x(:), u.y(:), u.z(:)], [v.x(:), v.y(:), v.z(:)]);
+  w.x = reshape (c(:,1), size (u.x));
+  w.y = reshape (c(:,2), size (u.y));
+  w.z = reshape (c(:,3), size (u.z));
+
+  ## Create normal vectors as mesh vectices from normals at mesh centers
+  nx = (w.x(1:end-1,1:end-1) + w.x(1:end-1,2:end) +
+        w.x(2:end,1:end-1) + w.x(2:end,2:end)) ./ 4;
+  ny = (w.y(1:end-1,1:end-1) + w.y(1:end-1,2:end) +
+        w.y(2:end,1:end-1) + w.y(2:end,2:end)) ./ 4;
+  nz = (w.z(1:end-1,1:end-1) + w.z(1:end-1,2:end) +
+        w.z(2:end,1:end-1) + w.z(2:end,2:end)) ./ 4;
+
+  ## Normalize the normal vectors
+  len = sqrt (nx.^2 + ny.^2 + nz.^2);
+  nx = nx ./ len;
+  ny = ny ./ len;
+  nz = nz ./ len;
+
+  if (nargout == 0)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      
+      surf (x, y, z, varargin{ioff:end});
+      old_hold_state = get (hax, "nextplot");
+      unwind_protect
+        set (hax, "nextplot", "add");
+        plot3 ([x(:)'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:),
+               [y(:)'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:),
+               [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:),
+               varargin{ioff:end});
+      unwind_protect_cleanup
+        set (hax, "nextplot", old_hold_state);
+      end_unwind_protect
+      
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  else
+    Nx = nx;
+    Ny = ny;
+    Nz = nz;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (10);
+%! surfnorm (x, y, z);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! surfnorm (peaks (10));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! surfnorm (peaks (32));
+%! shading interp;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/tetramesh.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,158 @@
+## Copyright (C) 2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} tetramesh (@var{T}, @var{X})
+## @deftypefnx {Function File} {} tetramesh (@var{T}, @var{X}, @var{C})
+## @deftypefnx {Function File} {} tetramesh (@dots{}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} tetramesh (@dots{})
+## Display the tetrahedrons defined in the m-by-4 matrix @var{T} as 3-D patches.
+##
+## @var{T} is typically the output of a Delaunay triangulation
+## of a 3-D set of points.  Every row of @var{T} contains four indices into
+## the n-by-3 matrix @var{X} of the vertices of a tetrahedron.  Every row in
+## @var{X} represents one point in 3-D space. 
+##
+## The vector @var{C} specifies the color of each tetrahedron as an index
+## into the current colormap.  The default value is 1:m where m is the number
+## of tetrahedrons; the indices are scaled to map to the full range of the
+## colormap.  If there are more tetrahedrons than colors in the colormap then
+## the values in @var{C} are cyclically repeated.
+## 
+## Calling @code{tetramesh (@dots{}, "property", "value", @dots{})} passes all
+## property/value pairs directly to the patch function as additional arguments.
+##
+## The optional return value @var{h} is a vector of patch handles where each
+## handle represents one tetrahedron in the order given by @var{T}. 
+## A typical use case for @var{h} is to turn the respective patch
+## @qcode{"visible"} property @qcode{"on"} or @qcode{"off"}.
+##
+## Type @code{demo tetramesh} to see examples on using @code{tetramesh}.
+## @seealso{trimesh, delaunay3, delaunayn, patch}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function h = tetramesh (varargin)
+
+  [reg, prop] = parseparams (varargin);
+
+  if (length (reg) < 2 || length (reg) > 3)
+    print_usage ();
+  endif
+
+  T = reg{1};
+  X = reg{2};
+
+  if (! ismatrix (T) || columns (T) != 4)
+    error ("tetramesh: T must be an n-by-4 matrix");
+  elseif (! ismatrix (X) || columns (X) != 3)
+    error ("tetramesh: X must be an n-by-3 matrix");
+  endif
+
+  size_T = rows (T);
+  cmap = colormap ();
+  
+  if (length (reg) < 3)
+    size_cmap = rows (cmap);
+    C = mod ((1:size_T)' - 1, size_cmap) + 1;
+    if (size_T < size_cmap && size_T > 1) 
+      ## expand to the available range of colors
+      C = floor ((C - 1) * (size_cmap - 1) / (size_T - 1)) + 1;
+    endif
+  else
+    C = reg{3};
+    if (! isvector (C) || size_T != length (C))
+      error ("tetramesh: C must be a vector of the same length as T");
+    endif
+  endif
+
+  hax = newplot ();
+
+  hvec = zeros (size_T, 1);
+  if (strcmp (graphics_toolkit (), "gnuplot"))
+    ## Tiny reduction of the tetrahedron size to help gnuplot by
+    ## avoiding identical faces with different colors
+    for i = 1:size_T
+      [th, p] = __shrink__ ([1 2 3 4], X(T(i, :), :), 1 - 1e-7);
+      hvec(i) = patch ("Faces", th, "Vertices", p, 
+                       "FaceColor", cmap(C(i), :), "FaceAlpha", 0.9,
+                       prop{:});
+    endfor
+  else
+    ## FLTK does not support FaceAlpha.
+    for i = 1:size_T
+      th = [1 2 3; 2 3 4; 3 4 1; 4 1 2];
+      hvec(i) = patch ("Faces", th, "Vertices", X(T(i, :), :), 
+                       "FaceColor", cmap(C(i), :), "FaceAlpha", 1.0,
+                       prop{:});
+    endfor
+  endif
+
+  if (! ishold ())
+    set (hax, "view", [-37.5, 30], "box", "off");
+  endif
+
+  if (nargout > 0)
+    h = hvec;
+  endif
+
+endfunction
+
+## shrink the tetrahedron relative to its center of gravity
+function [tri, p] = __shrink__ (T, X, sf)
+  midpoint = repmat (sum (X(T, :), 1) / 4, 12, 1);
+  p = [X([1 2 3], :); X([2 3 4], :); X([3 4 1], :); X([4 1 2], :)];
+  p = sf * (p - midpoint) + midpoint;
+  tri = reshape (1:12, 3, 4)';
+endfunction
+
+
+%!demo
+%! clf;
+%! d = [-1 1];
+%! [x,y,z] = meshgrid (d, d, d);
+%! x = [x(:); 0];
+%! y = [y(:); 0];
+%! z = [z(:); 0];
+%! tetra = delaunay3 (x, y, z);
+%! X = [x(:) y(:) z(:)];
+%! colormap (jet (64));
+%! h = tetramesh (tetra, X);
+%! set (h(1:2:end), 'Visible', 'off');
+%! axis equal;
+%! view (30, 20);
+%! title ({'tetramesh() plot', ...
+%!         'colormap = jet (64), every other tetrahedron invisible'});
+
+%!demo
+%! clf;
+%! d = [-1 1];
+%! [x,y,z] = meshgrid (d, d, d);
+%! x = [x(:); 0];
+%! y = [y(:); 0];
+%! z = [z(:); 0];
+%! tetra = delaunay3 (x, y, z);
+%! X = [x(:) y(:) z(:)];
+%! colormap (gray (256));
+%! tetramesh (tetra, X, 21:20:241, 'EdgeColor', 'w');
+%! axis equal;
+%! view (30, 20);
+%! title ({'tetramesh() plot', ...
+%!         'colormap = gray (256) with white edges'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/trimesh.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,120 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} trimesh (@var{tri}, @var{x}, @var{y})
+## @deftypefnx {Function File} {} trimesh (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{})
+## Plot a 3-D triangular wireframe mesh.
+## 
+## In contrast to @code{mesh}, which plots a mesh using rectangles,
+## @code{trimesh} plots the mesh using triangles.
+##
+## @var{tri} is typically the output of a Delaunay triangulation over the
+## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
+## and contains three indices into [@var{x}, @var{y}] which are the
+## vertices of the triangles in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If no @var{z} input is given then
+## the triangles are plotted as a 2-D figure.
+## 
+## The color of the trimesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.  If @var{z} has N elements, then
+## @var{c} should be an Nx1 vector for colormap data or an Nx3 matrix for
+## RGB data.
+##
+## Any property/value pairs are passed directly to the underlying patch object.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+## @seealso{mesh, tetramesh, triplot, trisurf, delaunay, patch, hidden}
+## @end deftypefn
+
+function h = trimesh (tri, x, y, z, varargin)
+
+  if (nargin < 3)
+    print_usage ();
+  endif
+
+  if (nargin == 3)
+    htmp = triplot (tri, x, y);
+  elseif (ischar (z))
+    htmp = triplot (tri, x, y, z, varargin{:});
+  else
+    ## Process color argument
+    if (nargin > 4 && isnumeric (varargin{1}))
+      c = varargin{1};
+      varargin(1) = [];
+      if (isvector (c))
+        if (numel (c) != numel (z))
+          error ("trimesh: C must have 'numel (Z)' elements");
+        endif
+        c = c(:);
+      elseif (rows (c) != numel (z) || columns (c) != 3)
+        error ("trimesh: TrueColor C matrix must be 'numel (Z)' rows by 3 columns");
+      endif
+    else
+      c = z(:);
+    endif
+
+    hax = newplot ();
+
+    ## Tag object as "trimesh" so that hidden() can find it.
+    htmp = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
+                  "FaceVertexCdata", c, "EdgeColor", "flat", "FaceColor", "w",
+                  "Tag", "trimesh", varargin{:});
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30], "box", "off",
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! old_state = rand ('state');
+%! restore_state = onCleanup (@() rand ('state', old_state));
+%! rand ('state', 10);
+%! N = 10;
+%! x = 3 - 6 * rand (N, N);
+%! y = 3 - 6 * rand (N, N);
+%! z = peaks (x, y);
+%! tri = delaunay (x(:), y(:));
+%! trimesh (tri, x(:), y(:), z(:));
+
+%% Test input validation
+%!error trimesh ()
+%!error trimesh (1)
+%!error trimesh (1,2)
+%!error <C must have 'numel \(Z\)' elements> trimesh (1,2,3,4,[5 6])
+%!error <C must have 'numel \(Z\)' elements> trimesh (1,2,3,4,[5 6]')
+%!error <TrueColor C matrix must> trimesh ([1;1],[2;2],[3;3],[4;4],zeros(3,3))
+%!error <TrueColor C matrix must> trimesh ([1;1],[2;2],[3;3],[4;4],zeros(2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/triplot.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,66 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} triplot (@var{tri}, @var{x}, @var{y})
+## @deftypefnx {Function File} {} triplot (@var{tri}, @var{x}, @var{y}, @var{linespec})
+## @deftypefnx {Function File} {@var{h} =} triplot (@dots{})
+## Plot a 2-D triangular mesh.
+## 
+## @var{tri} is typically the output of a Delaunay triangulation over the
+## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
+## and contains three indices into [@var{x}, @var{y}] which are the
+## vertices of the triangles in the x-y plane.
+##
+## The linestyle to use for the plot can be defined with the argument
+## @var{linespec} of the same format as the @code{plot} command.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## patch object.
+## @seealso{plot, trimesh, trisurf, delaunay}
+## @end deftypefn
+
+function h = triplot (tri, x, y, varargin)
+
+  if (nargin < 3)
+    print_usage ();
+  endif
+
+  idx = tri(:, [1, 2, 3, 1]).';
+  nt = rows (tri);
+  handle = plot ([x(idx); NaN(1, nt)](:),
+                 [y(idx); NaN(1, nt)](:), varargin{:});
+
+  if (nargout > 0)
+    h = handle;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! old_state = rand ('state');
+%! restore_state = onCleanup (@() rand ('state', old_state));
+%! rand ('state', 2);
+%! N = 20;
+%! x = rand (N, 1);
+%! y = rand (N, 1);
+%! tri = delaunay (x, y);
+%! triplot (tri, x, y);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/trisurf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,174 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} trisurf (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} trisurf (@dots{})
+## Plot a 3-D triangular surface.
+## 
+## In contrast to @code{surf}, which plots a surface mesh using rectangles,
+## @code{trisurf} plots the mesh using triangles.
+##
+## @var{tri} is typically the output of a Delaunay triangulation over the
+## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
+## and contains three indices into [@var{x}, @var{y}] which are the
+## vertices of the triangles in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.
+## 
+## The color of the trimesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.  If @var{z} has N elements, then
+## @var{c} should be an Nx1 vector for colormap data or an Nx3 matrix for
+## RGB data.
+##
+## Any property/value pairs are passed directly to the underlying patch object.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+## @seealso{surf, triplot, trimesh, delaunay, patch, shading}
+## @end deftypefn
+
+function h = trisurf (tri, x, y, z, varargin)
+
+  if (nargin < 4)
+    print_usage ();
+  endif
+
+  if (nargin > 4 && isnumeric (varargin{1}))
+    c = varargin{1};
+    varargin(1) = [];
+    if (isvector (c))
+      if (numel (c) != numel (z))
+        error ("trisurf: C must have 'numel (Z)' elements");
+      endif
+      c = c(:);
+    elseif (rows (c) != numel (z) || columns (c) != 3)
+      error ("trisurf: TrueColor C matrix must be 'numel (Z)' rows by 3 columns");
+    endif
+  else
+    c = z(:);
+  endif
+  ## FIXME: Is all this extra input parsing necessary?
+  ##        Is it for Matlab compatibility?
+  if (! any (strcmpi (varargin, "FaceColor")))
+    nfc = numel (varargin) + 1;
+    varargin(nfc+(0:1)) = {"FaceColor", "flat"};
+  else
+    nfc = find (any (strcmpi (varargin, "FaceColor")), 1);
+  endif
+  if (! any (strcmpi (varargin, "EdgeColor"))
+      && strcmpi (varargin{nfc+1}, "interp"))
+    varargin(end+(1:2)) = {"EdgeColor", "none"};
+  endif
+
+  hax = newplot ();
+
+  htmp = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)],
+                "FaceVertexCData", c, varargin{:});
+
+  if (! ishold ())
+    set (hax, "view", [-37.5, 30], "box", "off",
+              "xgrid", "on", "ygrid", "on", "zgrid", "on");
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! N = 31;
+%! [x, y] = meshgrid (1:N);
+%! tri = delaunay (x(:), y(:));
+%! z = peaks (N);
+%! h = trisurf (tri, x, y, z, 'facecolor', 'interp');
+%! axis tight;
+%! zlim auto;
+%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! N = 31;
+%! [x, y] = meshgrid (1:N);
+%! tri = delaunay (x(:), y(:));
+%! z = peaks (N);
+%! h = trisurf (tri, x, y, z, 'facecolor', 'flat');
+%! axis tight;
+%! zlim auto;
+%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! old_state = rand ('state');
+%! restore_state = onCleanup (@() rand ('state', old_state));
+%! rand ('state', 10);
+%! N = 10;
+%! x = 3 - 6 * rand (N, N);
+%! y = 3 - 6 * rand (N, N);
+%! z = peaks (x, y);
+%! tri = delaunay (x(:), y(:));
+%! trisurf (tri, x(:), y(:), z(:));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = rand (100, 1);
+%! y = rand (100, 1);
+%! z = x.^2 + y.^2;
+%! tri = delaunay (x, y);
+%! trisurf (tri, x, y, z);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = rand (100, 1);
+%! y = rand (100, 1);
+%! z = x.^2 + y.^2;
+%! tri = delaunay (x, y);
+%! trisurf (tri, x, y, z, 'facecolor', 'interp');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = rand (100, 1);
+%! y = rand (100, 1);
+%! z = x.^2 + y.^2;
+%! tri = delaunay (x, y);
+%! trisurf (tri, x, y, z, 'facecolor', 'interp', 'edgecolor', 'k');
+
+%% Test input validation
+%!error trisurf ()
+%!error trisurf (1)
+%!error trisurf (1,2)
+%!error trisurf (1,2,3)
+%!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6])
+%!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6]')
+%!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(3,3))
+%!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/waterfall.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,99 @@
+## Copyright (C) 2013 Mike Miller
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} waterfall (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} waterfall (@var{z})
+## @deftypefnx {Function File} {} waterfall (@dots{}, @var{c})
+## @deftypefnx {Function File} {} waterfall (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} waterfall (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} waterfall (@dots{})
+## Plot a 3-D waterfall plot.
+##
+## A waterfall plot is similar to a @code{meshz} plot except only
+## mesh lines for the rows of @var{z} (x-values) are shown.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{meshz, mesh, meshc, contour, surf, surface, ribbon, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: Mike Miller <mtmiller@ieee.org>
+
+function h = waterfall (varargin)
+
+  htmp = meshz (varargin{:});
+
+  set (htmp, "meshstyle", "row");
+
+  ## The gnuplot toolkit does nothing with the meshstyle property currently.
+  toolkit = get (ancestor (htmp, "figure"), "__graphics_toolkit__");
+  if (strcmp (toolkit, "gnuplot"))
+    warning ("waterfall: may not render correctly using toolkit '%s'", toolkit);
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! waterfall (Z);
+%! title ('waterfall() plot of peaks() function');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! subplot (1,2,1)
+%!  meshz (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('meshz() plot');
+%! subplot (1,2,2)
+%!  waterfall (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('waterfall() plot');
+
--- a/scripts/plot/ellipsoid.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-## Copyright (C) 2007-2012 Sylvain Pelissier
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ellipsoid (@var{xc}, @var{yc}, @var{zc}, @var{xr}, @var{yr}, @var{zr}, @var{n})
-## @deftypefnx {Function File} {} ellipsoid (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ellipsoid (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} ellipsoid (@dots{})
-## Plot a 3-D ellipsoid.
-##
-## The inputs @var{xc}, @var{yc}, @var{zc} specify the center of the ellipsoid.
-## The inputs @var{xr}, @var{yr}, @var{zr} specify the semi-major axis lengths.
-##
-## The optional input @var{n} determines the number of faces around the
-## the circumference of the cylinder.  The default value is 20.
-## 
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## If outputs are requested @code{ellipsoid} returns three matrices in
-## @code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
-## generates the ellipsoid.
-## @seealso{cylinder, rectangle, sphere}
-## @end deftypefn
-
-## Author: Sylvain Pelissier <sylvain.pelissier@gmail.com>
-
-function [xx, yy, zz] = ellipsoid (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ellipsoid", varargin{:});
-
-  if (nargin != 6 && nargin != 7)
-    print_usage ();
-  endif
-
-  xc = varargin{1};
-  yc = varargin{2};
-  zc = varargin{3};
-  xr = varargin{4};
-  yr = varargin{5};
-  zr = varargin{6};
-
-  if (nargin == 6)
-    n = 20;
-  else
-    n = varargin{7};
-  endif
-
-  theta = linspace (0, 2 * pi, n + 1);
-  phi = linspace (-pi / 2, pi / 2, n + 1);
-  [theta, phi] = meshgrid (theta, phi);
-
-  x = xr .* cos (phi) .* cos (theta) + xc;
-  y = yr .* cos (phi) .* sin (theta) + yc;
-  z = zr .* sin (phi) + zc;
-
-  if (nargout > 0)
-    xx = x;
-    yy = y;
-    zz = z;
-  else
-    oldfig = [];
-    if (! isempty (hax))
-      oldfig = get (0, "currentfigure");
-    endif
-    unwind_protect
-      hax = newplot (hax);
-    
-      surf (x, y, z);
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ellipsoid (0, 0, 1, 2, 3, 4, 20);
-%! title ('ellipsoid()');
-
--- a/scripts/plot/errorbar.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} errorbar (@var{args})
-## @deftypefnx {Function File} {} errorbar (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} errorbar (@dots{})
-## Create a 2-D with errorbars.
-##
-## Many different combinations of arguments are possible.  The simplest
-## form is
-##
-## @example
-## errorbar (@var{y}, @var{ey})
-## @end example
-##
-## @noindent
-## where the first argument is taken as the set of @var{y} coordinates
-## and the second argument @var{ey} is taken as the errors of the
-## @var{y} values.  @var{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
-##
-## @example
-## errorbar (@var{x}, @var{y}, @dots{}, @var{fmt}, @dots{})
-## @end example
-##
-## @noindent
-## where after @var{x} and @var{y} there can be up to four error
-## parameters such as @var{ey}, @var{ex}, @var{ly}, @var{uy}, etc.,
-## depending on the plot type.  Any number of argument sets may appear,
-## as long as they are separated with a format string @var{fmt}.
-##
-## If @var{y} is a matrix, @var{x} and error parameters must also be matrices
-## having same dimensions.  The columns of @var{y} are plotted versus the
-## corresponding columns of @var{x} and errorbars are drawn from
-## the corresponding columns of error parameters.
-##
-## If @var{fmt} is missing, yerrorbars ("~") plot style is assumed.
-##
-## If the @var{fmt} argument is supplied, it is interpreted as in
-## normal plots.  In addition, @var{fmt} may include an errorbar style
-## which must precede the line and marker format.  The following plot
-## styles are supported by errorbar:
-##
-## @table @samp
-## @item ~
-## Set yerrorbars plot style (default).
-##
-## @item >
-## Set xerrorbars plot style.
-##
-## @item ~>
-## Set xyerrorbars plot style.
-##
-## @item #
-## Set boxes plot style.
-##
-## @item #~
-## Set boxerrorbars plot style.
-##
-## @item #~>
-## Set boxxyerrorbars plot style.
-## @end table
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a handle to the hggroup object
-## representing the data plot and errorbars.
-##
-## Examples:
-##
-## @example
-## errorbar (@var{x}, @var{y}, @var{ex}, ">")
-## @end example
-##
-## @noindent
-## produces an xerrorbar plot of @var{y} versus @var{x} with @var{x}
-## errorbars drawn from @var{x}-@var{ex} to @var{x}+@var{ex}.
-##
-## @example
-## @group
-## errorbar (@var{x}, @var{y1}, @var{ey}, "~",
-##           @var{x}, @var{y2}, @var{ly}, @var{uy})
-## @end group
-## @end example
-##
-## @noindent
-## produces yerrorbar plots with @var{y1} and @var{y2} versus @var{x}.
-## Errorbars for @var{y1} are drawn from @var{y1}-@var{ey} to
-## @var{y1}+@var{ey}, errorbars for @var{y2} from @var{y2}-@var{ly} to
-## @var{y2}+@var{uy}.
-##
-## @example
-## @group
-## errorbar (@var{x}, @var{y}, @var{lx}, @var{ux},
-##           @var{ly}, @var{uy}, "~>")
-## @end group
-## @end example
-##
-## @noindent
-## produces an xyerrorbar plot of @var{y} versus @var{x} in which
-## @var{x} errorbars are drawn from @var{x}-@var{lx} to @var{x}+@var{ux}
-## and @var{y} errorbars from @var{y}-@var{ly} to @var{y}+@var{uy}.
-## @seealso{semilogxerr, semilogyerr, loglogerr, plot}
-## @end deftypefn
-
-## Created: 18.7.2000
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function h = errorbar (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("errorbar", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    htmp = __errcomm__ ("errorbar", hax, varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! rand_1x11_data1 = [0.82712, 0.50325, 0.35613, 0.77089, 0.20474, 0.69160, 0.30858, 0.88225, 0.35187, 0.14168, 0.54270];
-%! rand_1x11_data2 = [0.506375, 0.330106, 0.017982, 0.859270, 0.140641, 0.327839, 0.275886, 0.162453, 0.807592, 0.318509, 0.921112];
-%! errorbar (0:10, rand_1x11_data1, 0.25*rand_1x11_data2);
-%! title ('errorbar() with Y errorbars');
-
-%!demo
-%! clf;
-%! rand_1x11_data3 = [0.423650, 0.142331, 0.213195, 0.129301, 0.975891, 0.012872, 0.635327, 0.338829, 0.764997, 0.401798, 0.551850];
-%! rand_1x11_data4 = [0.682566, 0.456342, 0.132390, 0.341292, 0.108633, 0.601553, 0.040455, 0.146665, 0.309187, 0.586291, 0.540149];
-%! errorbar (0:10, rand_1x11_data3, rand_1x11_data4, '>');
-%! title ('errorbar() with X errorbars');
-
-%!demo
-%! clf;
-%! x = 0:0.5:2*pi;
-%! err = x/30;
-%! y1 = sin (x);
-%! y2 = cos (x);
-%! errorbar (x, y1, err, '~', x, y2, err, '>');
-%! legend ("Y errbar", "X errbar");
-%! title ('errorbar() with 2 datasets');
-
-
-%!demo
-%! clf;
-%! x = 0:0.5:2*pi;
-%! err = x/30;
-%! y1 = sin (x);
-%! y2 = cos (x);
-%! errorbar (x, y1, err, err, '#r', x, y2, err, err, '#~');
-%! legend ("X errbox", "Y errbox");
-%! title ('errorbar() with error boxes');
-
-%!demo
-%! clf;
-%! x = 0:0.5:2*pi;
-%! err = x/30;
-%! y1 = sin (x);
-%! y2 = cos (x);
-%! errorbar (x, y1, err, err, err, err, '~>', ...
-%!           x, y2, err, err, err, err, '#~>-*');
-%! legend ("X-Y errbars", "X-Y errboxes");
-%! title ('errorbar() with X-Y errorbars and error boxes');
-
-## Invisible figure used for tests
-%!shared hf, hax
-%! hf = figure ("visible", "off");
-%! hax = axes;
-
-%!error errorbar ()
-%!error errorbar (1)
-%!error <data argument 1 must be numeric> errorbar (hax, {1}, 2)
-%!error <data argument 2 must be numeric> errorbar (hax, 1, {2})
-%!error <size of argument 2 does not match others> errorbar (hax, 1, 1:2)
-%!error <size of argument 3 does not match others> errorbar (hax, 1, 2, 3:4)
-%!error <too many arguments to plot> errorbar (1,2,3,4,5,6,7)
-
-%!error <2 column errorplot is only valid for xerr> errorbar (1,2, "~>")
-%!error <6 columns only valid for xyerr and boxxy> errorbar (1,2,3,4,5,6, "~")
-%!error <error plot requires 2, 3, 4, or 6 arguments> errorbar (1,2,3,4,5)
-
-## Close figure used for testing
-%!test
-%! close (hf);
-
--- a/scripts/plot/ezcontour.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezcontour (@var{f})
-## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezcontour (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezcontour (@dots{})
-##
-## Plot the contour lines of a function.
-## 
-## @var{f} is a string, inline function, or function handle with two arguments
-## defining the function.  By default the plot is over the meshed domain
-## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## Example:
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezcontour (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{contour, ezcontourf, ezplot, ezmeshc, ezsurfc}
-## @end deftypefn
-
-function h = ezcontour (varargin)
-
-  [htmp, needusage] = __ezplot__ ("contour", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezcontour (f, [-3, 3]);
-
--- a/scripts/plot/ezcontourf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezcontourf (@var{f})
-## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezcontourf (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezcontourf (@dots{})
-##
-## Plot the filled contour lines of a function.
-## 
-## @var{f} is a string, inline function, or function handle with two arguments
-## defining the function.  By default the plot is over the meshed domain
-## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## Example:
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezcontourf (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{contourf, ezcontour, ezplot, ezmeshc, ezsurfc}
-## @end deftypefn
-
-function h = ezcontourf (varargin)
-
-  [htmp, needusage] = __ezplot__ ("contourf", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezcontourf (f, [-3, 3]);
-
--- a/scripts/plot/ezmesh.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezmesh (@var{f})
-## @deftypefnx {Function File} {} ezmesh (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezmesh (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezmesh (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezmesh (@dots{})
-##
-## Plot the mesh defined by a function.
-##
-## @var{f} is a string, inline function, or function handle with two arguments
-## defining the function.  By default the plot is over the meshed domain
-## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If the argument @qcode{"circ"} is given, then the function is plotted over
-## a disk centered on the middle of the domain @var{dom}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created 
-## surface object.
-##
-## Example 1: 2-argument function
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezmesh (f, [-3, 3]);
-## @end group
-## @end example
-##
-## Example 2: parametrically defined function
-##
-## @example
-## @group
-## fx = @@(s,t) cos (s) .* cos (t);
-## fy = @@(s,t) sin (s) .* cos (t);
-## fz = @@(s,t) sin (t);
-## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
-## @end group
-## @end example
-##
-## @seealso{mesh, ezmeshc, ezplot, ezsurf, ezsurfc, hidden}
-## @end deftypefn
-
-function h = ezmesh (varargin)
-
-  [htmp, needusage] = __ezplot__ ("mesh", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezmesh (f, [-3, 3]);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! fx = @(s,t) cos (s) .* cos (t);
-%! fy = @(s,t) sin (s) .* cos (t);
-%! fz = @(s,t) sin (t);
-%! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
-
--- a/scripts/plot/ezmeshc.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezmeshc (@var{f})
-## @deftypefnx {Function File} {} ezmeshc (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezmeshc (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezmeshc (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezmeshc (@dots{})
-##
-## Plot the mesh and contour lines defined by a function.
-##
-## @var{f} is a string, inline function, or function handle with two arguments
-## defining the function.  By default the plot is over the meshed domain
-## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If the argument @qcode{"circ"} is given, then the function is plotted over
-## a disk centered on the middle of the domain @var{dom}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a 2-element vector with a graphics
-## handle for the created mesh plot and a second handle for the created contour
-## plot.
-##
-## Example: 2-argument function
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezmeshc (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{meshc, ezmesh, ezplot, ezsurf, ezsurfc, hidden}
-## @end deftypefn
-
-function h = ezmeshc (varargin)
-
-  [htmp, needusage] = __ezplot__ ("meshc", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezmeshc (f, [-3, 3]);
-
--- a/scripts/plot/ezplot.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezplot (@var{f})
-## @deftypefnx {Function File} {} ezplot (@var{f2v})
-## @deftypefnx {Function File} {} ezplot (@var{fx}, @var{fy})
-## @deftypefnx {Function File} {} ezplot (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezplot (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezplot (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezplot (@dots{})
-##
-## Plot the 2-D curve defined by the function @var{f}.
-##
-## The function @var{f} may be a string, inline function, or function handle
-## and can have either one or two variables.  If @var{f} has one variable, then
-## the function is plotted over the domain @code{-2*pi < @var{x} < 2*pi}
-## with 500 points.
-##
-## If @var{f2v} is a function of two variables then the implicit function
-## @code{@var{f}(@var{x},@var{y}) = 0} is calculated over the meshed domain
-## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
-##
-## For example:
-##
-## @example
-## ezplot (@@(@var{x}, @var{y}) @var{x}.^2 - @var{y}.^2 - 1)
-## @end example
-##
-## If two functions are passed as inputs then the parametric function
-##
-## @example
-## @group
-## @var{x} = @var{fx} (@var{t})
-## @var{y} = @var{fy} (@var{t})
-## @end group
-## @end example
-##
-## @noindent
-## is plotted over the domain @code{-2*pi <= @var{t} <= 2*pi} with 500 points.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of both @var{x} and @var{y}, or @var{t} for a parametric plot.  If
-## @var{dom} is a four element vector, then the minimum and maximum values are
-## @code{[xmin xmax ymin ymax]}.
-##
-## @var{n} is a scalar defining the number of points to use in plotting
-## the function.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of graphics handles to
-## the created line objects.
-##
-## @seealso{plot, ezplot3, ezpolar, ezcontour, ezcontourf, ezmesh, ezmeshc, ezsurf, ezsurfc}
-## @end deftypefn
-
-function h = ezplot (varargin)
-
-  [htmp, needusage] = __ezplot__ ("plot", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! %% sinc function using function handle
-%! f = @(x) sin (pi*x) ./ (pi*x);
-%! ezplot (f);
-
-%!demo
-%! %% example of a function string and explicit limits
-%! clf;
-%! ezplot ('1/x', [-2 2]);
-
-%!demo
-%! %% parameterized function example over -2*pi <= t <= +2*pi
-%! clf;
-%! ezplot (@cos, @sin);
-
-%!demo
-%! %% implicit function of 2 variables
-%! clf;
-%! ezplot (inline ('x^2 - y^2 - 1'));
-
--- a/scripts/plot/ezplot3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezplot3 (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezplot3 (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezplot3 (@dots{})
-##
-## Plot a parametrically defined curve in three dimensions.
-##
-## @var{fx}, @var{fy}, and @var{fz} are strings, inline functions,
-## or function handles with one argument defining the function.  By
-## default the plot is over the domain @code{0 <= @var{t} <= 2*pi}
-## with 500 points.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of @var{t}.
-##
-## @var{n} is a scalar defining the number of points to use in plotting the
-## function.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @example
-## @group
-## fx = @@(t) cos (t);
-## fy = @@(t) sin (t);
-## fz = @@(t) t;
-## ezplot3 (fx, fy, fz, [0, 10*pi], 100);
-## @end group
-## @end example
-##
-## @seealso{plot3, ezplot, ezmesh, ezsurf}
-## @end deftypefn
-
-function h = ezplot3 (varargin)
-
-  [htmp, needusage] = __ezplot__ ("plot3", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! fx = @(t) cos (t);
-%! fy = @(t) sin (t);
-%! fz = @(t) t;
-%! ezplot3 (fx, fy, fz, [0, 10*pi], 100);
-
-%!demo
-%! clf;
-%! fx = @(t) cos (t);
-%! fy = @(t) sin (t);
-%! fz = @(t) t;
-%! ezplot3 (fx, fy, fz, [0, 5*pi], 100, 'animate');
-
--- a/scripts/plot/ezpolar.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezpolar (@var{f})
-## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezpolar (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{})
-##
-## Plot a 2-D function in polar coordinates.
-## 
-## The function @var{f} is a string, inline function, or function handle with
-## a single argument.  The expected form of the function is
-## @code{@var{rho} = @var{f}(@var{theta})}.
-## By default the plot is over the domain @code{0 <= @var{theta} <= 2*pi}
-## with 500 points.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of @var{theta}.
-##
-## @var{n} is a scalar defining the number of points to use in plotting
-## the function.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## Example:
-##
-## @example
-## ezpolar (@@(t) sin (5/4 * t), [0, 8*pi]);
-## @end example
-##
-## @seealso{polar, ezplot}
-## @end deftypefn
-
-function h = ezpolar (varargin)
-
-  [htmp, needusage] = __ezplot__ ("polar", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ezpolar (@(t) sin (5/4 * t), [0, 8*pi]);
-
--- a/scripts/plot/ezsurf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezsurf (@var{f})
-## @deftypefnx {Function File} {} ezsurf (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezsurf (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezsurf (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezsurf (@dots{})
-##
-## Plot the surface defined by a function.
-##
-## @var{f} is a string, inline function, or function handle with two arguments
-## defining the function.  By default the plot is over the meshed domain
-## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If the argument @qcode{"circ"} is given, then the function is plotted over
-## a disk centered on the middle of the domain @var{dom}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## Example 1: 2-argument function
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezsurf (f, [-3, 3]);
-## @end group
-## @end example
-##
-## Example 2: parametrically defined function
-##
-## @example
-## @group
-## fx = @@(s,t) cos (s) .* cos (t);
-## fy = @@(s,t) sin (s) .* cos (t);
-## fz = @@(s,t) sin (t);
-## ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
-## @end group
-## @end example
-##
-## @seealso{surf, ezsurfc, ezplot, ezmesh, ezmeshc, shading}
-## @end deftypefn
-
-function h = ezsurf (varargin)
-
-  [htmp, needusage] = __ezplot__ ("surf", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezsurf (f, [-3, 3]);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! fx = @(s,t) cos (s) .* cos (t);
-%! fy = @(s,t) sin (s) .* cos (t);
-%! fz = @(s,t) sin (t);
-%! ezsurf (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
-%! axis equal;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) x.^2 + y.^2;
-%! subplot (1,2,1);
-%!  ezsurf (f, [-2,2]);
-%!  title ({'x^2 + y^2'; 'plotted over rectangular grid (default)'});
-%! subplot (1,2,2);
-%!  ezsurf (f, [-2,2], 'circ');
-%!  title ({'x^2 + y^2'; 'plotted over circular disk with "circ"'});
-
--- a/scripts/plot/ezsurfc.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezsurfc (@var{f})
-## @deftypefnx {Function File} {} ezsurfc (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezsurfc (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezsurfc (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezsurfc (@dots{})
-##
-## Plot the surface and contour lines defined by a function.
-##
-## @var{f} is a string, inline function, or function handle with two arguments
-## defining the function.  By default the plot is over the meshed domain
-## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If the argument @qcode{"circ"} is given, then the function is plotted over
-## a disk centered on the middle of the domain @var{dom}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a 2-element vector with a graphics
-## handle for the created surface plot and a second handle for the created
-## contour plot.
-##
-## Example:
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezsurfc (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{surfc, ezsurf, ezplot, ezmesh, ezmeshc, shading}
-## @end deftypefn
-
-function h = ezsurfc (varargin)
-
-  [htmp, needusage] = __ezplot__ ("surfc", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezsurfc (f, [-3, 3]);
-
--- a/scripts/plot/feather.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} feather (@var{u}, @var{v})
-## @deftypefnx {Function File} {} feather (@var{z})
-## @deftypefnx {Function File} {} feather (@dots{}, @var{style})
-## @deftypefnx {Function File} {} feather (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} feather (@dots{})
-##
-## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
-## from equidistant points on the x-axis.
-##
-## If a single complex argument @var{z} is given, then
-## @code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## of the same format as the @code{plot} command.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of graphics handles to the
-## line objects representing the drawn vectors.
-##
-## @example
-## @group
-## phi = [0 : 15 : 360] * pi/180;
-## feather (sin (phi), cos (phi));
-## @end group
-## @end example
-##
-## @seealso{plot, quiver, compass}
-## @end deftypefn
-
-function h = feather (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("feather", varargin{:});
-
-  if (nargin == 0 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
-    z = varargin{1}(:).';
-    u = real (z);
-    v = imag (z);
-    have_line_spec = (nargin == 2);
-  elseif (nargin >= 2 && isnumeric (varargin{2}))
-    ioff = 3;
-    u = varargin{1}(:).';
-    v = varargin{2}(:).';
-    have_line_spec = (nargin == 3);
-  else
-    print_usage ();
-  endif
-
-  arrowsize = 0.20;
-  line_spec = "-b";
-
-  if (have_line_spec)
-    arg = varargin{end};
-    if (ischar (arg) || iscellstr (arg))
-      [~, valid] = __pltopt__ ("feather", arg, false);
-      if (valid)
-        line_spec = arg;
-      else
-        error ("feather: invalid linestyle STYLE");
-      endif
-    else
-      error ("feather: invalid linestyle STYLE");
-    endif
-  endif
-
-  ## Matlab draws feather plots, with the arrow head as one continous
-  ## line, and each arrow separately. This is completely different from
-  ## quiver and quite ugly.
-  n = length (u);
-  xend = [1 : n] + u;
-  xtmp = [1 : n] + u .* (1 - arrowsize);
-  yend = v;
-  ytmp = v .* (1 - arrowsize);
-  x = [[1 : n]; xend; xtmp - v * arrowsize / 3; xend; ...
-       xtmp + v * arrowsize / 3];
-  y = [zeros(1, n); yend; ytmp + u * arrowsize / 3; yend; ...
-       ytmp - u * arrowsize / 3];
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    hlist = plot (x, y, line_spec, [1, n], [0, 0], line_spec);
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = hlist;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! phi = [0 : 15 : 360] * pi/180;
-%! feather (sin (phi), cos (phi));
-%! axis tight;
-%! title ('feather plot');
-
-%% Test input validation
-%!error feather ()
-%!error feather (1,2,3,4)
-%!error feather (1, "-r", 2)
-%!error <invalid linestyle STYLE> feather (1, "abc")
-%!error <invalid linestyle STYLE> feather (1, {1})
-
--- a/scripts/plot/figure.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} figure
-## @deftypefnx {Command} {} figure @var{n}
-## @deftypefnx {Function File} {} figure (@var{n})
-## @deftypefnx {Function File} {} figure (@dots{}, "@var{property}", @var{value}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} figure (@var{dots})
-## Create a new figure window for plotting.
-##
-## If no arguments are specified, a new figure with the next available number
-## is created.
-##
-## If called with an integer @var{n}, and no such numbered figure exists, then
-## a new figure with the specified number is created.  If the figure already
-## exists then it is made visible and becomes the current figure for plotting.
-## 
-## Multiple property-value pairs may be specified for the figure object, but
-## they must appear in pairs.
-##
-## The optional return value @var{h} is a graphics handle to the created figure
-## object.
-## @seealso{axes, gcf, clf, close}
-## @end deftypefn
-
-## Author: jwe, Bill Denney
-
-function h = figure (varargin)
-
-  nargs = nargin;
-
-  if (mod (nargs, 2) == 0)
-    f = NaN;
-    init_new_figure = true;
-  else
-    arg = varargin{1};
-    if (ischar (arg))
-      arg = str2double (arg);
-    endif
-    if (isfigure (arg))
-      f = arg;
-      init_new_figure = false;
-      varargin(1) = [];
-      nargs--;
-    elseif (isnumeric (arg) && isscalar (arg) && arg > 0 && arg == fix (arg))
-      f = arg;
-      init_new_figure = true;
-      varargin(1) = [];
-      nargs--;
-    else
-      error ("figure: N must be figure handle or figure number");
-    endif
-  endif
-
-  if (rem (nargs, 2) == 1)
-    error ("figure: PROPERTY/VALUE arguments must be in pairs");
-  endif
-
-  ## Check to see if we already have a figure on the screen.  If we do,
-  ## then update it if it is different from the figure we are creating
-  ## or switching to.
-  cf = get (0, "currentfigure");   # Can't use gcf () because it calls figure()
-  if (! isempty (cf) && cf != 0)
-    if (init_new_figure || cf != f)
-      drawnow ();
-    endif
-  endif
-
-  if (init_new_figure)
-    if (ismac () && strcmp (graphics_toolkit (), "fltk"))
-      ## FIXME: Hack for fltk-aqua to work around bug #31931
-      f = __go_figure__ (f);
-      drawnow ();
-      if (! isempty (varargin))
-        set (f, varargin{:});
-      endif
-    else
-      f = __go_figure__ (f, varargin{:});
-    endif
-    __add_default_menu__ (f);
-  elseif (nargs > 0)
-    set (f, varargin{:});
-  endif
-
-  set (0, "currentfigure", f);
-  ## When switching to figure N, make figure visible and on top of stack.
-  if (! init_new_figure)
-    set (f, "visible", "on");
-  endif
-
-  if (nargout > 0)
-    h = f;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (hf, gcf);
-%!   assert (isfigure (hf));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!error <N must be figure handle or figure number> figure ({1})
-%!error <N must be figure handle or figure number> figure ([1 2])
-%!error <N must be figure handle or figure number> figure (-1)
-%!error <N must be figure handle or figure number> figure (1.5)
-
--- a/scripts/plot/fill.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} fill (@var{x}, @var{y}, @var{c})
-## @deftypefnx {Function File} {} fill (@var{x1}, @var{y1}, @var{c1}, @var{x2}, @var{y2}, @var{c2})
-## @deftypefnx {Function File} {} fill (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} fill (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} fill (@dots{})
-## Create one or more filled 2-D polygons.
-##
-## The inputs @var{x} and @var{y} are the coordinates of the polygon vertices.
-## If the inputs are matrices then the rows represent different vertices and
-## each column produces a different polygon.  @code{fill} will close any open
-## polygons before plotting. 
-##
-## The input @var{c} determines the color of the polygon.  The simplest form
-## is a single color specification such as a @code{plot} format or an
-## RGB-triple.  In this case the polygon(s) will have one unique color.  If
-## @var{c} is a vector or matrix then the color data is first scaled using
-## @code{caxis} and then indexed into the current colormap.  A row vector will
-## color each polygon (a column from matrices @var{x} and @var{y}) with a
-## single computed color.  A matrix @var{c} of the same size as @var{x} and
-## @var{y} will compute the color of each vertex and then interpolate the face
-## color between the vertices.
-##
-## Multiple property/value pairs for the underlying patch object may be
-## specified, but they must appear in pairs.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of graphics handles to
-## the created patch objects.
-##
-## Example: red square
-##
-## @example
-## @group
-## vertices = [0 0
-##             1 0
-##             1 1
-##             0 1];
-## fill (vertices(:,1), vertices(:,2), "r");
-## axis ([-0.5 1.5, -0.5 1.5])
-## axis equal
-## @end group
-## @end example
-##
-## @seealso{patch, caxis, colormap}
-## @end deftypefn
-
-function h = fill (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("fill", varargin{:});
-
-  hlist = [];
-  iargs = __find_patches__ (varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    old_nxtplt = get (hax, "nextplot");
-    set (hax, "nextplot", "add");
-
-    for i = 1 : length (iargs)
-      if (i == length (iargs))
-        args = varargin(iargs(i):end);
-      else
-        args = varargin(iargs(i):iargs(i+1)-1);
-      endif
-      [htmp, fail] = __patch__ (hax, args{:});
-      if (fail)
-        print_usage ();
-      endif
-      hlist(end + 1, 1) = htmp;
-    endfor
-
-    if (strcmp (old_nxtplt, "replace"))
-      set (hax, "nextplot", old_nxtplt);
-    endif
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = hlist;
-  endif
-
-endfunction
-
-function iargs = __find_patches__ (varargin)
-  iargs = [];
-  i = 1;
-  while (i < nargin)
-    iargs(end + 1) = i;
-    if (ischar (varargin{i})
-        && (strcmpi (varargin{i}, "faces")
-            || strcmpi (varargin{i}, "vertices")))
-      i += 4;
-    elseif (isnumeric (varargin{i}))
-      i += 2;
-    endif
-
-    if (i <= nargin)
-      while (true);
-        if (ischar (varargin{i})
-            && (strcmpi (varargin{i}, "faces")
-                || strcmpi (varargin{i}, "vertices")))
-          break;
-        elseif (isnumeric (varargin{i}))
-          ## Assume its the colorspec
-          i++;
-          break;
-        elseif (ischar (varargin{i}))
-          colspec = tolower (varargin{i});
-          collen = length (colspec);
-          if (any (strncmp (colspec, 
-                            {"blue", "black", "k", "red", "green", ...
-                             "yellow", "magenta", "cyan", "white"},
-                            collen)))
-            i++;
-            break;
-          endif
-        else
-          i += 2;
-        endif
-      endwhile
-    endif
-  endwhile
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t1 = (1/16:1/8:1) * 2*pi;
-%! t2 = ((1/16:1/8:1) + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! h = fill (x1,y1,'r', x2,y2,'g');
-
--- a/scripts/plot/findall.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2008-2012 Bill Denney
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} findall ()
-## @deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
-## @deftypefnx {Function File} {@var{h} =} findall ("-property", @var{prop_name})
-## @deftypefnx {Function File} {@var{h} =} findall ("-regexp", @var{prop_name}, @var{pattern})
-## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "flat", @dots{})
-## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "-depth", @var{d}, @dots{})
-## Find graphics object, including hidden ones, with specified property values.
-##
-## The return value @var{h} is a list of handles to the found graphic objects.
-##
-## @code{findall} performs the same search as @code{findobj}, but it
-## includes hidden objects (HandleVisibility = @qcode{"off"}).  For full
-## documentation, @pxref{XREFfindobj,,findobj}.
-## @seealso{findobj, allchild, get, set}
-## @end deftypefn
-
-## Author: Bill Denney <bill@denney.ws>
-
-function h = findall (varargin)
-
-  unwind_protect
-    shh = get (0, "showhiddenhandles");
-    set (0, "showhiddenhandles", "on");
-    h = findobj (varargin{:});
-  unwind_protect_cleanup
-    set (0, "showhiddenhandles", shh);
-  end_unwind_protect
-
-endfunction
-
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = findall (hf);
-%!   all_handles(1) = {"figure"};
-%!   all_handles(2:14,1) = {"uimenu"};
-%!   assert (get (h, "type"), all_handles);
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
--- a/scripts/plot/findfigs.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-## Copyright (C) 2008 Bill Denney
-## Copyright (C) 2012 Carnë Draug
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} findfigs ()
-## Find all visible figures that are currently off the screen and move them
-## onto the screen.
-## @seealso{allchild, figure, get, set}
-## @end deftypefn
-
-## Author: Bill Denney <bill@denney.ws>
-## Modified by: Carnë Draug <carandraug+dev@gmail.com>
-
-function findfigs ()
-
-  hfigs = allchild (0);
-  units = get (0, "units");
-  unwind_protect
-    set (0, "units", "pixels");
-    screensize = get (0, "screensize");
-  unwind_protect_cleanup
-    set (0, "units", units);
-  end_unwind_protect
-
-  ## give the monitor a margin so that the figure must not just
-  ## marginally be on the monitor.
-  margin = 30;
-  screensize(1:2) += margin;
-  screensize(3:4) -= margin;
-
-  hfigs = hfigs(strcmp (get (hfigs, "visible"), "on"));
-  for hf = hfigs'
-    units = get (hf, "units");
-    unwind_protect
-      set (hf, "units", "pixels");
-      pos = get (hf, "position");
-      ## Test if (in order):
-      ## The left side is outside the right side of the screen
-      ## The bottom is above the top of the screen
-      ## The right side is outside the left of the screen
-      ## the top is below the bottom of the screen
-      if (pos(1) > screensize(3)
-          || pos(2) > screensize(4)
-          || pos(1)+pos(3) < screensize(1)
-          || pos(2)+pos(4) < screensize(2))
-
-        ## the new position will be at the top left of the screen
-        ## (all moved figures will overlap).  The bottom left is chosen
-        ## instead of the top left because that allows for the unknown
-        ## amount of space for the menu bar and the title bar.
-        pos(1) = screensize(1);
-        pos(2) = screensize(2);
-        set (hf, "position", pos);
-      endif
-    unwind_protect_cleanup
-      set (hf, "units", units);
-    end_unwind_protect
-  endfor
-
-endfunction
-
--- a/scripts/plot/findobj.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,420 +0,0 @@
-## Copyright (C) 2007-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} findobj ()
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
-## @deftypefnx {Function File} {@var{h} =} findobj ("-property", @var{prop_name})
-## @deftypefnx {Function File} {@var{h} =} findobj ("-regexp", @var{prop_name}, @var{pattern})
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "flat", @dots{})
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "-depth", @var{d}, @dots{})
-## Find graphics object with specified property values.
-##
-## The simplest form is
-##
-## @example
-## findobj (@var{prop_name}, @var{prop_value})
-## @end example
-##
-## @noindent
-## which returns the handles of all objects which have a property named
-## @var{prop_name} that has the value @var{prop_value}.  If multiple
-## property/value pairs are specified then only objects meeting all of the
-## conditions are returned.
-##
-## The search can be limited to a particular set of objects and their
-## descendants, by passing a handle or set of handles @var{hlist} as the first
-## argument.
-##
-## The depth of the object hierarchy to search can be limited with the
-## @qcode{"-depth"} argument.  An example of searching only three generations
-## of children is:
-##
-## @example
-## findobj (@var{hlist}, "-depth", 3, @var{prop_name}, @var{prop_value})
-## @end example
-##
-## Specifying a depth @var{d} of 0, limits the search to the set of objects
-## passed in @var{hlist}.  A depth @var{d} of 0 is equivalent to the
-## @qcode{"flat"} argument.
-##
-## A specified logical operator may be applied to the pairs of @var{prop_name}
-## and @var{prop_value}.  The supported logical operators are:
-## @qcode{"-and"}, @qcode{"-or"},
-## @qcode{"-xor"}, @qcode{"-not"}.
-##
-## Objects may also be matched by comparing a regular expression to the
-## property values, where property values that match
-## @code{regexp (@var{prop_value}, @var{pattern})} are returned.
-##
-## Finally, objects may be matched by property name only by using the
-## @qcode{"-property"} option.
-##
-## Implementation Note: The search only includes objects with visible
-## handles (HandleVisibility = @qcode{"on"}).  @xref{XREFfindall,,findall}, to
-## search for all objects including hidden ones.
-## @seealso{findall, allchild, get, set}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-
-function h = findobj (varargin)
-
-  depth = NaN;
-  if (nargin == 0)
-    handles = 0;
-    n1 = 0;
-  else
-    if (! isempty (varargin{1}))
-      if (ishandle (varargin{1}(1)))
-        handles = varargin{1};
-        n1 = 2;
-      else
-        handles = 0;
-        n1 = 1;
-      endif
-    else
-      ## Return [](0x1) for compatibility.
-      h = zeros (0, 1);
-      return;
-    endif
-    if (n1 <= nargin)
-      if (ischar (varargin{n1}))
-        if (strcmpi (varargin{n1}, "flat"))
-          depth = 0;
-          n1 = n1 + 1;
-        elseif (strcmpi (varargin{n1}, "-depth"))
-          depth = varargin{n1+1};
-          n1 = n1 + 2;
-        endif
-      else
-        error ("findobj: properties and options must be strings");
-      endif
-    endif
-  endif
-
-  if (n1 <= nargin && nargin > 0)
-    args = varargin(n1 : nargin);
-  else
-    args = {};
-  endif
-
-  regularexpression = [];
-  property          = [];
-  logicaloperator   = {};
-  pname             = {};
-  pvalue            = {};
-  np = 1;
-  na = 1;
-  operatorprecedence = {"-not", "-and", "-or", "-xor"};
-
-  while (na <= numel (args))
-    regularexpression(np) = 0;
-    property(np) = 0;
-    logicaloperator{np} = "and";
-    if (ischar (args{na}))
-      if (strcmpi (args{na}, "-regexp"))
-        if (na + 2 <= numel (args))
-          regularexpression(np) = 1;
-          na = na + 1;
-          pname{np} = args{na};
-          na = na + 1;
-          pvalue{np} = args{na};
-          na = na + 1;
-          np = np + 1;
-        else
-          error ("findobj: inconsistent number of arguments");
-        endif
-      elseif (strcmpi (args{na}, "-property"))
-        if (na + 1 <= numel (args))
-          na = na + 1;
-          property(np) = 1;
-          pname{np} = args{na};
-          na = na + 1;
-          pvalue{np} = [];
-          np = np + 1;
-        else
-          error ("findobj: inconsistent number of arguments");
-        endif
-      elseif (! strcmp (args{na}(1), "-"))
-        ## Parameter/value pairs.
-        if (na + 1 <= numel (args))
-          pname{np} = args{na};
-          na = na + 1;
-          pvalue{np} = args{na};
-          na = na + 1;
-          if (na <= numel (args))
-            if (ischar (args{na}))
-              if (any (strcmpi (args{na}, operatorprecedence)))
-                logicaloperator{np} = args{na}(2:end);
-                na = na+1;
-              endif
-            else
-              error ("findobj: properties and options must be strings");
-            endif
-          else
-            logicaloperator{np} = "and";
-          endif
-          np = np + 1;
-        else
-          error ("findobj: inconsistent number of arguments");
-        endif
-      else
-        ## This is sloppy ... but works like Matlab.
-        if (strcmpi (args{na}, "-not"))
-          h = [];
-          return;
-        endif
-        na = na + 1;
-      endif
-    else
-      error ("findobj: properties and options must be strings");
-    endif
-  endwhile
-
-  numpairs = np - 1;
-  if (! isempty (logicaloperator))
-    logicaloperator = shift (logicaloperator, 1);
-  endif
-
-  ## Load all objects which qualify for being searched.
-  idepth = 0;
-  h = handles;
-  while (numel (handles) && ! (idepth >= depth))
-    children = [];
-    for n = 1 : numel (handles)
-      children = [children; get(handles(n), "children")];
-    endfor
-    handles = children;
-    h = [h; children];
-    idepth = idepth + 1;
-  endwhile
-
-  if (numpairs > 0)
-    match = true (numel (h), numpairs);
-    for nh = 1 : numel (h)
-      p = get (h(nh));
-      for np = 1 : numpairs
-        fields = fieldnames (p);
-        fieldindex = find (strcmpi (fields, pname{np}), 1);
-        if (numel (fieldindex))
-          pname{np} = fields{fieldindex};
-          if (property(np))
-            match(nh,np) = true;
-          else
-            if (regularexpression(np))
-              foo = regexp (p.(pname{np}), pvalue{np}, "once");
-              if (isempty (foo))
-                match(nh,np) = false;
-              else
-                match(nh,np) = foo;
-              endif
-            elseif (numel (p.(pname{np})) == numel (pvalue{np}))
-              if (ischar (pvalue{np}) && ischar (p.(pname{np})))
-                match(nh,np) = strcmpi (pvalue{np}, p.(pname{np}));
-              elseif (isnumeric (pvalue{np} && isnumeric (p.(pname{np}))))
-                match(nh,np) = (pvalue{np} == p.(pname{np}));
-              else
-                match(nh,np) = isequal (pvalue{np}, p.(pname{np}));
-              endif
-            else
-              match(nh,np) = false;
-            endif
-          endif
-        else
-          match(nh,np) = false;
-        endif
-      endfor
-    endfor
-
-    if (numpairs > 1)
-      for no = 1 : numel (operatorprecedence)
-        pairs = find (strcmp (logicaloperator(2:end), ...
-                              operatorprecedence{no}(2:end)));
-        for np = sort (pairs, "descend")
-          if (no == 1)
-            match(:,np+1) = ! match(:,np+1);
-            logicaloperator(np+1) = {"and"};
-          else
-            match(:,np) = feval (logicaloperator{np+1}, match(:,np), ...
-                                 match(:,np+1));
-            logicaloperator(np+1) = [];
-            match(:,np+1) = [];
-            numpairs = numpairs - 1;
-          endif
-          if (numpairs < 2)
-            break;
-          endif
-        endfor
-        if (numpairs < 2)
-          break;
-        endif
-      endfor
-    endif
-  else
-    match = true (numel (h), 1);
-  endif
-
-  h = h(match);
-  h = h(:);
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = findobj (gca (), "-property", "foo");
-%!   assert (isempty (h));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = plot (1:10);
-%!   set (h, "tag", "foobar");
-%!   g = findobj (gcf (), "tag", "foobar", "type", "line", "color", [0 0 1]);
-%!   assert (g, h);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   obj = findobj (hf, "type", "line");
-%!   assert (l, obj);
-%!   assert (gca, findobj (hf, "type", "axes"));
-%!   assert (hf, findobj (hf, "type", "figure"));
-%!   assert (isempty (findobj (hf, "type", "xyzxyz")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   subplot (2,2,1);
-%!    imagesc (rand (10));
-%!   subplot (2,2,2);
-%!    surf (peaks);
-%!   subplot (2,2,3);
-%!    contour (peaks);
-%!   subplot (2,2,4);
-%!    plot (peaks);
-%!   h1 = findobj (gcf (), "-regexp", "Type", "image|surface|hggroup");
-%!   h2 = findobj (gcf (), "Type", "image",
-%!                  "-or", "Type", "surface",
-%!                  "-or", "Type", "hggroup");
-%!   assert (h2, h1);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! toolkit = graphics_toolkit ("gnuplot");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h1 = subplot (2,2,1);
-%!   h2 = subplot (2,2,2);
-%!   h3 = subplot (2,2,3, "userdata", struct ("foo", "bar"));
-%!   h4 = subplot (2,2,4);
-%!   h = findobj (hf, "userdata", struct ("foo", "bar"));
-%!   assert (h, h3);
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
-%!test
-%! toolkit = graphics_toolkit ("gnuplot");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h1 = subplot (2,2,1, "tag", "1");
-%!   h2 = subplot (2,2,2, "tag", "2");
-%!   h3 = subplot (2,2,3, "tag", "3");
-%!   h4 = subplot (2,2,4, "tag", "4");
-%!   h = findobj (hf, "type", "axes", "-not", "tag", "1");
-%!   assert (h, [h4; h3; h2])
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h1 = subplot (2, 2, 1);
-%!   set (h1, "userdata", struct ("column", 1, "row", 1));
-%!   h2 = subplot (2, 2, 2);
-%!   set (h2, "userdata", struct ("column", 2, "row", 1));
-%!   h3 = subplot (2, 2, 3);
-%!   set (h3, "userdata", struct ("column", 1, "row", 2));
-%!   h4 = subplot (2, 2, 4);
-%!   set (h4, "userdata", struct ("column", 2, "row", 2));
-%!   h = findobj (hf, "type", "axes",
-%!                "-not", "userdata", struct ("column", 1, "row", 1));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-%! assert (h, [h4; h3; h2])
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ha = axes ();
-%!   plot (1:10);
-%!   h = findobj (hf, "type", "figure",
-%!                "-or", "parent", hf,
-%!                "-and", "type", "axes");
-%! unwind_protect_cleanup
-%!   close (hf)
-%! end_unwind_protect
-%! assert (h, [hf; ha])
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   set (hf, "tag", "foo");
-%!   h1 = subplot (2,2,1, "tag", "foo");
-%!   h2 = subplot (2,2,2, "tag", "bar");
-%!   h3 = subplot (2,2,3, "tag", "foo");
-%!   h4 = subplot (2,2,4, "tag", "bar");
-%!   h = findobj (hf, "type", "axes", "-xor", "tag", "foo");
-%!   assert (h, [hf; h4; h2]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   hax1 = subplot (2,1,1);
-%!    hl1 = plot (rand (10,1));
-%!   hax2 = subplot (2,1,2);
-%!    hl2 = plot (rand (10,1));
-%!   hobj = findobj (hf);
-%!   assert (hobj, [hf; hax2; hax1; hl2; hl1]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/fplot.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-## Copyright (C) 2005-2012 Paul Kienzle
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} fplot (@var{fn}, @var{limits})
-## @deftypefnx {Function File} {} fplot (@dots{}, @var{tol})
-## @deftypefnx {Function File} {} fplot (@dots{}, @var{n})
-## @deftypefnx {Function File} {} fplot (@dots{}, @var{fmt})
-## @deftypefnx {Function File} {[@var{x}, @var{y}] =} fplot (@dots{})
-## Plot a function @var{fn} within the range defined by @var{limits}.
-##
-## @var{fn} is a function handle, inline function, or string containing the
-## name of the function to evaluate.
-##
-## The limits of the plot are of the form @w{@code{[@var{xlo}, @var{xhi}]}} or
-## @w{@code{[@var{xlo}, @var{xhi}, @var{ylo}, @var{yhi}]}}.
-##
-## The next three arguments are all optional and any number of them may be
-## given in any order.
-##
-## @var{tol} is the relative tolerance to use for the plot and defaults
-## to 2e-3 (.2%).
-##
-## @var{n} is the minimum number of points to use.  When @var{n} is specified,
-## the maximum stepsize will be @code{@var{xhi} - @var{xlo} / @var{n}}.  More
-## than @var{n} points may still be used in order to meet the relative
-## tolerance requirement.
-##
-## The @var{fmt} argument specifies the linestyle to be used by the plot
-## command.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## With no output arguments the results are immediately plotted.  With two
-## output arguments the 2-D plot data is returned.  The data can subsequently
-## be plotted manually with @code{plot (@var{x}, @var{y})}.
-##
-## Example:
-##
-## @example
-## @group
-## fplot (@@cos, [0, 2*pi])
-## fplot ("[cos(x), sin(x)]", [0, 2*pi])
-## @end group
-## @end example
-##
-## Note: @code{fplot} works best with continuous functions.  Functions with
-## discontinuities are unlikely to plot well.  This restriction may be removed
-## in the future.
-## @seealso{ezplot, plot}
-## @end deftypefn
-
-## Author: Paul Kienzle <pkienzle@users.sf.net>
-
-function [X, Y] = fplot (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("fplot", varargin{:});
-
-  if (nargin < 2 || nargin > 5)
-    print_usage ();
-  endif
-
-  fn = varargin{1};
-  limits = varargin{2};
-  varargin = varargin(3:end);
-
-  if (strcmp (typeinfo (fn), "inline function"))
-    fn = vectorize (fn);
-    nam = formula (fn);
-  elseif (isa (fn, "function_handle"))
-    nam = func2str (fn);
-  elseif (all (isalnum (fn)))
-    nam = fn;
-  elseif (ischar (fn))
-    fn = vectorize (inline (fn));
-    nam = formula (fn);
-  else
-    error ("fplot: FN must be a function handle, inline function, or string");
-  endif
-
-  if (iscomplex (limits) || (numel (limits) != 2 && numel (limits) != 4))
-    error ("fplot: LIMITS must be a real vector with 2 or 4 elements");
-  endif
-
-  n = 5;
-  tol = 2e-3;
-  fmt = "";
-  for i = 1:numel (varargin)
-    arg = varargin{i};
-    if (ischar (arg))
-      fmt = arg;
-    elseif (isnumeric (arg) && isscalar (arg) && arg > 0)
-      if (arg == fix (arg))
-        n = arg;
-      else
-        tol = arg;
-      endif
-    else
-      error ("fplot: bad input in position %d", i+2);
-    endif
-  endfor
-
-  if (n != 5) 
-    ## n was specified 
-    x0 = linspace (limits(1), limits(2), n/2 + 1)';
-    y0 = feval (fn, x0);
-    x = linspace (limits(1), limits(2), n)';
-    y = feval (fn, x);
-  else
-    x0 = linspace (limits(1), limits(2), 5)';
-    y0 = feval (fn, x0);
-    n = 8;
-    x = linspace (limits(1), limits(2), n)';
-    y = feval (fn, x);
-  endif
-
-  if (rows (x0) != rows (y0))
-    ## FN is a constant value function
-    y0 = repmat (y0, size (x0));
-    y = repmat (y, size (x));
-  endif
-
-  err0 = Inf;
-
-  ## FIXME: This algorithm should really use adaptive scaling as the 
-  ##        the numerical quadrature algorithms do so that extra points are
-  ##        used where they are needed and not spread evenly over the entire
-  ##        x-range.  Try any function with a discontinuity, such as
-  ##        fplot (@tan, [-2, 2]) or fplot ("1./x", [-3, 2]), to see the
-  ##        problems with the current solution.
-
-  while (n < 2^18)    # Something is wrong if we need more than 250K points
-    yi = interp1 (x0, y0, x, "linear");
-    ## relative error calculation using average of [yi,y] as reference
-    ## since neither estimate is known a priori to be better than the other.
-    err = 0.5 * max (abs ((yi - y) ./ (yi + y))(:));
-    if (err < tol || abs (err - err0) < tol/2)
-      ## Either relative tolerance has been met OR
-      ## algorithm has stopped making any reasonable progress per iteration.
-      break;
-    endif
-    x0 = x;
-    y0 = y;
-    err0 = err;
-    n = 2 * (n - 1) + 1;
-    x = linspace (limits(1), limits(2), n)';
-    y = feval (fn, x);
-  endwhile
-
-  if (nargout == 2)
-    X = x;
-    Y = y;
-  else
-    if (isempty (hax))
-      hax = gca ();
-    endif
-    plot (hax, x, y, fmt);
-    axis (hax, limits);
-    if (isvector (y))
-      legend (hax, nam);
-    else
-      for i = 1:columns (y)
-        nams{i} = sprintf ("%s(:,%i)", nam, i);
-      endfor
-      legend (hax, nams{:});
-    endif
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! fplot (@cos, [0, 2*pi]);
-%! title ('fplot() single function');
-
-%!demo
-%! clf;
-%! fplot ('[cos(x), sin(x)]', [0, 2*pi]);
-%! title ('fplot() multiple functions');
-
-%!demo
-%! clf;
-%! %% sinc function
-%! fh = @(x) sin (pi*x) ./ (pi*x);
-%! fplot (fh, [-5, 5]);
-%! title ('fplot() sinc function');
-
-%!test
-%! [x, y] = fplot ("[cos(x), sin(x)]", [0, 2*pi]);
-%! assert (columns (y) == 2);
-%! assert (rows (x) == rows (y));
-%! assert (y, [cos(x), sin(x)], -2e-3);
-
-%% Test input validation
-%!error fplot (1)
-%!error fplot (1,2,3,4,5,6)
-%!error <FN must be a function handle> fplot (1, [0 1])
-%!error <LIMITS must be a real vector> fplot (@cos, [i, 2*i])
-%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1])
-%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1 2 3])
-%!error <bad input in position 3> fplot (@cos,[-1,1], {1})
-
--- a/scripts/plot/gca.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} gca ()
-## Return a handle to the current axis object.
-##
-## The current axis is the default target for graphics output.  In the case
-## of a figure with multiple axes, @code{gca} returns the last created axes
-## or the last axes that was clicked on with the mouse.
-##
-## If no current axes object exists, create one and return its handle.  The
-## handle may then be used to examine or set properties of the axes.  For
-## example,
-##
-## @example
-## @group
-## ax = gca ();
-## set (ax, "position", [0.5, 0.5, 0.5, 0.5]);
-## @end group
-## @end example
-##
-## @noindent
-## creates an empty axes object and then changes its location and size in the
-## figure window.
-##
-## Note: To find the current axis without creating a new axes object if it
-## does not exist, query the @qcode{"CurrentAxes"} property of a figure.
-##
-## @example
-## get (gcf, "currentaxes");
-## @end example
-## @seealso{gcf, gco, gcbf, gcbo, get, set}
-## @end deftypefn
-
-## Author: jwe
-
-function h = gca ()
-
-  if (nargin == 0)
-    h = get (gcf (), "currentaxes");
-    if (isempty (h))
-      h = axes ();
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! ax = axes;
-%! unwind_protect
-%!   assert (gca, ax);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/gcbf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{fig} =} gcbf ()
-## Return a handle to the figure containing the object whose callback is
-## currently executing.
-##
-## If no callback is executing, this function returns the empty matrix.  The
-## handle returned by this function is the same as the second output argument
-## of @code{gcbo}.
-##
-## @seealso{gcbo, gcf, gco, gca, get, set}
-## @end deftypefn
-
-function fig = gcbf ()
-
-  [~, fig] = gcbo ();
-
-endfunction
-
-
-%!assert (isempty (gcbf))
-
--- a/scripts/plot/gcbo.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} gcbo ()
-## @deftypefnx {Function File} {[@var{h}, @var{fig}] =} gcbo ()
-## Return a handle to the object whose callback is currently executing.
-## 
-## If no callback is executing, this function returns the empty matrix.  This
-## handle is obtained from the root object property @qcode{"CallbackObject"}.
-##
-## When called with a second output argument, return the handle of the figure
-## containing the object whose callback is currently executing.  If no callback
-## is executing the second output is also set to the empty matrix.
-##
-## @seealso{gcbf, gco, gca, gcf, get, set}
-## @end deftypefn
-
-function [h, fig] = gcbo ()
-
-  h = get (0, "callbackobject");
-  fig = [];
-
-  if (! isempty (h) && nargout > 1)
-    fig = ancestor (h, "figure");
-  endif
-
-endfunction
-
-
-%!test
-%! assert (isempty (gcbo));
-
--- a/scripts/plot/gcf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} gcf ()
-## Return a handle to the current figure.
-##
-## The current figure is the default target for graphics output.  If multiple
-## figures exist, @code{gcf} returns the last created figure or the last figure
-## that was clicked on with the mouse.
-##
-## If a current figure does not exist, create one and return its handle.  The
-## handle may then be used to examine or set properties of the figure.  For
-## example,
-##
-## @example
-## @group
-## fplot (@@sin, [-10, 10]);
-## fig = gcf ();
-## set (fig, "numbertitle", "off", "name", "sin plot")
-## @end group
-## @end example
-##
-## @noindent
-## plots a sine wave, finds the handle of the current figure, and then
-## renames the figure window to describe the contents.
-##
-## Note: To find the current figure without creating a new one if it does not
-## exist, query the @qcode{"CurrentFigure"} property of the root graphics
-## object.
-##
-## @example
-## get (0, "currentfigure");
-## @end example
-##
-## @seealso{gca, gco, gcbf, gcbo, get, set}
-## @end deftypefn
-
-## Author: jwe, Bill Denney
-
-function h = gcf ()
-
-  if (nargin == 0)
-    h = get (0, "currentfigure");
-    if (isempty (h) || h == 0)
-      ## We only have a root figure object, so create a new figure
-      ## object and make it the current figure.
-      h = figure ();
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (gcf, hf);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/gco.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} gco ()
-## @deftypefnx {Function File} {@var{h} =} gco (@var{fig})
-## Return a handle to the current object of the current figure, or a handle
-## to the current object of the figure with handle @var{fig}.
-##
-## The current object of a figure is the object that was last clicked on.  It
-## is stored in the @qcode{"CurrentObject"} property of the target figure.
-##
-## If the last mouse click did not occur on any child object of the figure,
-## then the current object is the figure itself.
-##
-## If no mouse click occurred in the target figure, this function returns an
-## empty matrix.
-##
-## Programming Note: The value returned by this function is not necessarily the
-## same as the one returned by @code{gcbo} during callback execution.  An
-## executing callback can be interrupted by another callback and the current
-## object may be changed.
-##
-## @seealso{gcbo, gca, gcf, gcbf, get, set}
-## @end deftypefn
-
-function h = gco ()
-
-  h = get (get (0, "currentfigure"), "currentobject");
-
-endfunction
-
--- a/scripts/plot/ginput.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput (@var{n})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput ()
-## Return the position and type of mouse button clicks and/or key strokes
-## in the current figure window.
-##
-## If @var{n} is defined, then capture @var{n} events before returning.
-## When @var{n} is not defined @code{ginput} will loop until the return key
-## @key{RET} is pressed.
-##
-## The return values @var{x}, @var{y} are the coordinates where the mouse
-## was clicked in the units of the current axes.  The return value @var{button}
-## is 1, 2, or 3 for the left, middle, or right button.  If a key is pressed
-## the ASCII value is returned in @var{button}.
-## @seealso{gtext, waitforbuttonpress}
-## @end deftypefn
-
-function varargout = ginput (n)
-
-  if (nargin > 1)
-    print_usage ();
-  endif
-
-  f = gcf ();
-  a = gca ();  # Create an axis, if necessary
-  drawnow ();
-  toolkit = get (f, "__graphics_toolkit__");
-
-  varargout = cell (1, nargout);
-  if (nargin == 0)
-    [varargout{:}] = feval (["__" toolkit "_ginput__"], f);
-  else
-    [varargout{:}] = feval (["__" toolkit "_ginput__"], f, n);
-  endif
-
-endfunction
-
-
-## Remove from test statistics.  No real tests possible.
-%!test
-%! assert (1);
-
--- a/scripts/plot/gnuplot_binary.in	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2008-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Loadable Function} {[@var{prog}, @var{args}] =} gnuplot_binary ()
-## @deftypefnx {Loadable Function} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{})
-## Query or set the name of the program invoked by the plot command
-## when the graphics toolkit is set to "gnuplot".  Additional arguments to
-## pass to the external plotting program may also be given.
-## The default value is @qcode{"gnuplot"} with no additional arguments.
-## @xref{Installation}.
-## @seealso{graphics_toolkit}
-## @end deftypefn
-
-## Author: jwe
-
-function [prog, args] = gnuplot_binary (new_prog, varargin)
-
-  persistent gp_binary = %OCTAVE_CONF_GNUPLOT%;
-  persistent gp_args = {};
-
-  if (nargout > 0 || nargin == 0)
-    prog = gp_binary;
-    args = gp_args;
-  endif
-
-  if (nargin == 1)
-    if (! ischar (new_prog) || isempty (new_prog))
-      error ("gnuplot_binary: NEW_PROG must be a non-empty string");
-    endif
-    gp_binary = new_prog;
-  endif
-
-  if (nargin > 1)
-    if (! iscellstr (varargin))
-      error ("gnuplot_binary: arguments must be character strings");
-    endif
-    gp_args = varargin;
-  endif
-
-endfunction
-
-
-%!test
-%! orig_val = gnuplot_binary ();
-%! old_val = gnuplot_binary ("X");
-%! assert (orig_val, old_val);
-%! assert (gnuplot_binary (), "X");
-%! gnuplot_binary (orig_val);
-%! assert (gnuplot_binary (), orig_val);
--- a/scripts/plot/graphics_toolkit.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{name} =} graphics_toolkit ()
-## @deftypefnx {Function File} {@var{name} =} graphics_toolkit (@var{hlist})
-## @deftypefnx {Function File} {} graphics_toolkit (@var{name})
-## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name})
-## Query or set the default graphics toolkit which is assigned to new figures.
-## 
-## With no inputs, return the current default graphics toolkit.  If the input
-## is a list of figure graphic handles, @var{hlist}, then return the name
-## of the graphics toolkit in use for each figure.
-## 
-## When called with a single input @var{name} set the default graphics toolkit
-## to @var{name}.  If the toolkit is not already loaded, it is initialized by
-## calling the function @code{__init_@var{name}__}.  If the first input
-## is a list of figure handles, @var{hlist}, then the graphics toolkit is set
-## to @var{name} for these figures only.
-## 
-## @seealso{available_graphics_toolkits}
-## @end deftypefn
-
-function retval = graphics_toolkit (name, hlist = [])
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  if (nargout > 0 || nargin == 0)
-    retval = get (0, "defaultfigure__graphics_toolkit__");
-  endif
-
-  if (nargin == 0)
-    return;
-  elseif (nargin == 1)
-    if (all (isfigure (name)))
-      hlist = name;
-      retval = get (hlist, "__graphics_toolkit__");
-      return;
-    elseif (! ischar (name))
-      error ("graphics_toolkit: invalid graphics toolkit NAME");
-    endif
-  elseif (nargin == 2)
-    ## Swap input arguments
-    [hlist, name] = deal (name, hlist);
-    if (! all (isfigure (hlist)))
-      error ("graphics_toolkit: invalid figure handle list HLIST");
-    elseif (! ischar (name))
-      error ("graphics_toolkit: invalid graphics toolkit NAME");
-    endif
-  endif
-
-  if (! any (strcmp (loaded_graphics_toolkits (), name)))
-    feval (["__init_", name, "__"]);
-    if (! any (strcmp (loaded_graphics_toolkits (), name)))
-      error ("graphics_toolkit: %s toolkit was not correctly loaded", name);
-    endif
-  endif
-
-  if (isempty (hlist))
-    set (0, "defaultfigure__graphics_toolkit__", name);
-  else
-    set (hlist, "__graphics_toolkit__", name);
-  endif
-
-endfunction
-
-
-%!testif HAVE_FLTK
-%! unwind_protect
-%!   hf = figure ("visible", "off");
-%!   toolkit = graphics_toolkit ();
-%!   assert (get (0, "defaultfigure__graphics_toolkit__"), toolkit);
-%!   graphics_toolkit (hf, "fltk");
-%!   assert (graphics_toolkit (hf), "fltk");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!testif HAVE_FLTK
-%! old_toolkit = graphics_toolkit ();
-%! switch (old_toolkit)
-%!   case {"gnuplot"}
-%!     new_toolkit = "fltk";
-%!   otherwise
-%!     new_toolkit = "gnuplot";
-%! endswitch
-%! assert (graphics_toolkit (new_toolkit), old_toolkit);
-%! assert (graphics_toolkit (old_toolkit), new_toolkit);
-
--- a/scripts/plot/grid.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} grid
-## @deftypefnx {Command} {} grid on
-## @deftypefnx {Command} {} grid off
-## @deftypefnx {Command} {} grid minor
-## @deftypefnx {Command} {} grid minor on
-## @deftypefnx {Command} {} grid minor off
-## @deftypefnx {Function File} {} grid (@var{hax}, @dots{})
-## Control the display of plot grid lines.
-##
-## The function state input may be either @qcode{"on"} or @qcode{"off"}.
-## If it is omitted, the current grid state is toggled.
-##
-## When the first argument is @qcode{"minor"} all subsequent commands
-## modify the minor grid rather than the major grid.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-##
-## To control the grid lines for an individual axis use the @code{set}
-## function.  For example:
-##
-## @example
-## set (gca, "ygrid", "on");
-## @end example
-## @seealso{axis, box}
-## @end deftypefn
-
-## Author: jwe
-
-function grid (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("grid", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  if (nargs > 2)
-    print_usage ();
-  endif
-
-  grid_on = (   strcmp (get (hax, "xgrid"), "on")
-             && strcmp (get (hax, "ygrid"), "on")
-             && strcmp (get (hax, "zgrid"), "on"));
-
-  minor_on = (   strcmp (get (hax, "xminorgrid"), "on")
-              && strcmp (get (hax, "yminorgrid"), "on")
-              && strcmp (get (hax, "zminorgrid"), "on"));
-
-  minor_auto = true;
-  if (nargs == 0)
-    grid_on = ! grid_on;
-  else
-    arg1 = varargin{1};
-    if (! ischar (arg1))
-      error ("grid: argument 1 must be an axis handle or a string");
-    endif
-    if (strcmpi (arg1, "off"))
-      grid_on = false;
-    elseif (strcmpi (arg1, "on"))
-      grid_on = true;
-    elseif (strcmpi (arg1, "minor"))
-      minor_auto = false;
-      if (nargs == 2)
-        arg2 = varargin{2};
-        if (strcmpi (arg2, "on"))
-          minor_on = true;
-          grid_on = true;
-        elseif (strcmpi (arg2, "off"))
-          minor_on = false;
-        else
-          print_usage ();
-        endif
-      else
-        minor_on = ! minor_on;
-        if (minor_on)
-          grid_on = true;
-        endif
-      endif
-    else
-      print_usage ();
-    endif
-  endif
-
-  if (grid_on)
-    set (hax, "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    if (minor_on)
-      set (hax, "xminorgrid", "on", "yminorgrid", "on", "zminorgrid", "on");
-    elseif (minor_auto)
-      xmg = ifelse (strcmp (get (hax, "xscale"), "log"), "on", "off");
-      ymg = ifelse (strcmp (get (hax, "yscale"), "log"), "on", "off");
-      zmg = ifelse (strcmp (get (hax, "zscale"), "log"), "on", "off");
-      set (hax, "xminorgrid", xmg, "yminorgrid", ymg, "zminorgrid", zmg);
-    else
-      set (hax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
-    endif
-  else
-    set (hax, "xgrid", "off", "ygrid", "off", "zgrid", "off",
-              "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! subplot (2,2,1);
-%!  plot (1:100);
-%!  grid off;
-%!  title ('no grid');
-%! subplot (2,2,2);
-%!  plot (1:100);
-%!  grid on;
-%!  title ('grid on');
-%! subplot (2,2,3);
-%!  plot (1:100);
-%!  grid minor;
-%!  title ('grid minor');
-%! subplot (2,2,4);
-%!  semilogy (1:100);
-%!  grid minor;
-%!  title ('grid minor');
-
--- a/scripts/plot/gtext.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} gtext (@var{s})
-## @deftypefnx {Function File} {} gtext (@{@var{s1}, @var{s2}, @dots{}@})
-## @deftypefnx {Function File} {} gtext (@{@var{s1}; @var{s2}; @dots{}@})
-## @deftypefnx {Function File} {} gtext (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} gtext (@dots{})
-## Place text on the current figure using the mouse.
-##
-## The text is defined by the string @var{s}.  If @var{s} is a cell string
-## organized as a row vector then each string of the cell array is written to a
-## separate line.  If @var{s} is organized as a column vector then one string
-## element of the cell array is placed for every mouse click.
-##
-## Optional property/value pairs are passed directly to the underlying text
-## objects.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## text object(s).
-## @seealso{ginput, text}
-## @end deftypefn
-
-function h = gtext (s, varargin)
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  if (! (ischar (s) || iscellstr (s)))
-    error ("gtext: S must be a string or cell array of strings");
-  endif
-
-  htmp = -1;
-  if (! isempty (s))
-    if (ischar (s) || isrow (s))
-      [x, y] = ginput (1);
-      htmp = text (x, y, s, varargin{:});
-    else
-      for i = 1:numel (s)
-        [x, y] = ginput (1);
-        htmp = text (x, y, s{i}, varargin{:});
-      endfor
-    endif
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/guidata.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{data} =} guidata (@var{h})
-## @deftypefnx {Function File} {} guidata (@var{h}, @var{data})
-## Query or set user-custom GUI data.
-##
-## The GUI data is stored in the figure handle @var{h}.  If @var{h} is not a
-## figure handle then it's parent figure will be used for storage.
-##
-## @var{data} must be a single object which means it is usually preferable
-## for it to be a data container such as a cell array or struct so that
-## additional data items can be added easily.
-##
-## @seealso{getappdata, setappdata, get, set, getpref, setpref}
-## @end deftypefn
-
-## Author: goffioul
-
-function dataout = guidata (h, data)
-
-  if (nargin < 1 || nargin > 2)
-    print_usage ();
-  endif
-
-  if (! ishandle (h))
-    error ("guidata: H must be a valid object handle");
-  endif
-  h = ancestor (h, "figure");
-  if (isempty (h))
-    error ("guidata: no ancestor figure of H found");
-  endif
-
-  if (nargin == 1)
-    dataout = get (h, "__guidata__");
-  else
-    set (h, "__guidata__", data);
-    if (nargout == 1)
-      dataout = data;
-    endif
-  endif
-
-endfunction
-
-
-%% Test input validation
-%!error guidata ()
-%!error guidata (1,2,3)
-%!error <H must be a valid object handle> guidata ({1})
-%!error <no ancestor figure of H found> guidata (0)
-
--- a/scripts/plot/guihandles.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{hdata} =} guihandles (@var{h})
-## @deftypefnx {Function File} {@var{hdata} =} guihandles
-## Return a structure of object handles for the figure associated with
-## handle @var{h}.
-## 
-## If no handle is specified the current figure returned by @code{gcf} is used.
-##
-## The fieldname for each entry of @var{hdata} is taken from the @qcode{"tag"}
-## property of the graphic object.  If the tag is empty then the handle is not
-## returned.  If there are multiple graphic objects with the same tag then
-## the entry in @var{hdata} will be a vector of handles.  @code{guihandles}
-## includes all possible handles, including those for
-## which @qcode{"HandleVisibility"} is @qcode{"off"}.
-## @seealso{guidata, findobj, findall, allchild}
-## @end deftypefn
-
-## Author: goffioul
-
-function hdata = guihandles (h)
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
-    if (! ishandle (h))
-      error ("guidata: H must be a valid object handle");
-    endif
-    h = ancestor (h, "figure");
-    if (isempty (h))
-      error ("guidata: no ancestor figure of H found");
-    endif
-  else
-    h = gcf ();
-  endif
-
-  hdata = __make_guihandles_struct__ (h, []);
-
-endfunction
-
-function hdata = __make_guihandles_struct__ (h, hdata)
-
-  tag = get (h, "tag");
-  if (! isempty (tag))
-    if (isfield (hdata, tag))
-      hdata.(tag) = [hdata.(tag), h];
-    else
-      try
-        hdata.(tag) = h;
-      catch
-      end_try_catch
-    endif
-  endif
-
-  kids = allchild (h);
-  for hkid = kids'
-    hdata = __make_guihandles_struct__ (hkid, hdata);
-  endfor
-
-endfunction
-
--- a/scripts/plot/hdl2struct.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-## Copyright (C) 2012 pdiribarne
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{s} =} hdl2struct (@var{h})
-## Return a structure, @var{s}, whose fields describe the properties
-## of the object, and its children, associated with the handle, @var{h}.
-##
-## The fields of the structure @var{s} are @qcode{"type"}, @qcode{"handle"},
-## @qcode{"properties"}, @qcode{"children"}, and @qcode{"special"}.
-## @seealso{struct2hdl, findobj}
-## @end deftypefn
-
-## Author: pdiribarne <pdiribarne@new-host.home>
-## Created: 2012-03-04
-
-function s = hdl2struct (h)
-
-  if (nargin != 1 || !ishandle (h))
-    print_usage ();
-  endif
-
-  hiddenh = get (0, "showhiddenhandles");
-  if (strcmp (hiddenh, "on"))
-    set (0, "showhiddenhandles", "off");
-  endif
-
-  ## main object
-  main = get (h);
-  s.handle = h;
-  s.type =  main.type;
-  s.properties  = getprops (h);
-  s.children = [];
-  s.special = [];
-
-  ## sweep all children but legends, colorbars, uimenu and hggroup children
-  ## in reverse order
-  kids = main.children;
-  lg = findobj (h, "-depth", 1, "tag", "legend");
-  cb = findobj (h, "-depth", 1, "tag", "colorbar");
-  ui = findobj (h, "-depth", 1, "type", "uimenu");
-  nkids = length (kids);
-  ii = 0;
-  while (nkids)
-    if (! any (kids (nkids) == lg) && ! any (kids (nkids) == cb)
-          && ! any (kids (nkids) == ui) && ! strcmp (main.type, "hggroup"))
-      ii++;
-      s.children(ii) = hdl2struct (kids(nkids));
-    endif
-    nkids--;
-  endwhile
-
-  ## add non "children" children objects (title, xlabel, ...) and
-  ## hggroup children and tag theim in "special"
-  special = [];
-  if (strcmp (main.type, "hggroup"))
-    special = main.children;
-  endif
-  special = [special getspecial(h)];
-  nsp = length (special);
-  while (nsp)
-    ii++;
-    s.children(ii) = hdl2struct (special(nsp));
-    s.special(nsp) = ii;
-    nsp--;
-  endwhile
-
-  ## look for legends and colorbars among "main"'s brothers and add them
-  ## to the children list
-  if (strcmp (main.type, "axes"))
-    par = main.parent;
-    lg = findobj (par, "-depth", 1, "tag", "legend");
-    if (! isempty (lg))
-      idx = arrayfun (@(x) get(x).userdata.handle(end) == h, lg);
-      lg = lg(find (idx));
-    endif
-    nlg = length (lg);
-    if (nlg == 1)
-      ii++;
-      s.children(ii) = hdl2struct (lg);
-    elseif (nlg > 1)
-      error ("hdl2struct: more than one legend found");
-    endif
-
-    cb = findobj (par, "-depth", 1, "tag", "colorbar");
-    if (! isempty (cb))
-      idx = arrayfun (@(x) get(x).axes == h, cb);
-      cb = cb(find (idx));
-    endif
-
-    ncb = length (cb);
-    if (ncb == 1)
-      ii++;
-      s.children(ii) = hdl2struct (cb);
-    elseif (nlg > 1)
-      error ("hdl2struct: more than one colorbar found");
-    endif
-  endif
-
-  set (0, "showhiddenhandles", hiddenh);
-
-endfunction
-
-function hdlist = getspecial (h)
-  obj = get (h);
-  ## return handles to special children
-  fields = fieldnames (obj);
-  hdlist = [];
-
-  regkids = get ( h, "children");
-  set (0, "showhiddenhandles", "on");
-  allkids = get ( h, "children");
-  set (0, "showhiddenhandles", "off");
-  speckids = arrayfun (@(x) ! any (x == regkids), allkids);
-  hdlist = allkids (find (speckids));
-  hdlist = reshape (hdlist, 1, numel (hdlist));
-
-endfunction
-
-function prpstr = getprops (h)
-  obj = get (h);
-  ## get usefull properties rejecting readonly, children, handles ...
-  fields = fieldnames (obj);
-  hdlist = [];
-
-  forbid = {"beingdeleted", "busyaction", "buttondownfcn", ...
-            "children", "clipping", "createfcn", ...
-            "deletefcn", "handlevisibility", "hittest", ...
-            "interruptible", "parent", "selected" ,...
-            "selectionhighlight", "type", "__modified__", ...
-            "uicontextmenu", "__graphics_toolkit__", "currentaxes", ...
-            "currentcharacter", "currentobject","tightinset", ...
-            "currentpoint", "extent"};
-
-  nflds = length (fields);
-  ii = 0;
-  while (nflds)
-    prop = fields{nflds};
-    val = obj.(fields{nflds});
-    ii++;
-    if (! any (strcmp (prop, forbid)))
-      prpstr.(prop) = val;
-    endif
-    nflds--;
-  endwhile
-
-  ## hidden properties
-  hidden = {"autopos_tag", "looseinset"};
-  for ii = 1:numel (hidden)
-    if (isprop (h, hidden{ii}))
-      prpstr.(hidden{ii}) = get (h, hidden{ii});
-    endif
-  endfor
-
-endfunction
-
-
-## FIXME: need validation tests
-
--- a/scripts/plot/hggroup.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} hggroup ()
-## @deftypefnx {Function File} {} hggroup (@var{hax})
-## @deftypefnx {Function File} {} hggroup (@dots{}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} hggroup (@dots{})
-## Create handle graphics group object with axes parent @var{hax}.
-##
-## If no parent is specified, the group is created in the current axes.
-##
-## Multiple property/value pairs may be specified for the hggroup, but they
-## must appear in pairs.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## hggroup object.
-##
-## Programming Note: An hggroup is a way to group base graphics objects such
-## as line objects or patch objects into a single unit which can react
-## appropriately.  For example, the individual lines of a contour plot are
-## collected into a single hggroup so that they can be made visible/invisible
-## with a single command, @code{set (hg_handle, "visible", "off")}.
-## 
-## @seealso{addproperty, addlistener}
-## @end deftypefn
-
-## Author: goffioul
-
-function h = hggroup (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("hggroup", varargin{:});
-  
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  htmp = __go_hggroup__ (hax, varargin{:});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = hggroup;
-%!   assert (findobj (hf, "type", "hggroup"), h);
-%!   assert (get (h, "type"), "hggroup");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/hidden.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} hidden
-## @deftypefnx {Command} {} hidden "on"
-## @deftypefnx {Command} {} hidden "off"
-## @deftypefnx {Function File} {@var{mode} =} hidden (@dots{})
-## Control mesh hidden line removal.
-##
-## When called with no argument the hidden line removal state is toggled.
-## When called with one of the modes @qcode{"on"} or @qcode{"off"} the state
-## is set accordingly.
-##
-## The optional output argument @var{mode} is the current state.
-##
-## Hidden Line Removal determines what graphic objects behind a mesh plot
-## are visible.  The default is for the mesh to be opaque and lines behind
-## the mesh are not visible.  If hidden line removal is turned off then
-## objects behind the mesh can be seen through the faces (openings) of the
-## mesh, although the mesh grid lines are still opaque.
-##
-## @seealso{mesh, meshc, meshz, ezmesh, ezmeshc, trimesh, waterfall}
-## @end deftypefn
-
-function state = hidden (mode = "toggle")
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (nargin == 1)
-    if (! ischar (mode))
-      error ("hidden: expecting MODE to be a string");
-    elseif (! any (strcmpi (mode, {"on", "off"})))
-      error ('hidden: MODE must be "on" or "off"');
-    endif
-  endif
-
-  for h = (get (gca (), "children")).';
-    htype = get (h, "type");
-    htag = get (h, "tag");
-    if (strcmp (htype, "surface") || strcmp (htag, "trimesh"))
-      fc = get (h, "facecolor");
-      if ((! ischar (fc) && is_white (fc))
-          || (ischar (fc) && strcmp (fc, "none")))
-        switch (mode)
-          case "on"
-            set (h, "facecolor", "w");
-          case "off"
-            set (h, "facecolor", "none");
-          case "toggle"
-            if (ischar (fc))
-              set (h, "facecolor", "w");
-              mode = "on";
-            else
-              set (h, "facecolor", "none");
-              mode = "off";
-            endif
-        endswitch
-      endif
-    endif
-  endfor
-
-  if (nargout > 0)
-    state = mode;
-  endif
-
-endfunction
-
-function retval = is_white (color)
-  retval = all (color == 1);
-endfunction
-
--- a/scripts/plot/hist.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} hist (@var{y})
-## @deftypefnx {Function File} {} hist (@var{y}, @var{x})
-## @deftypefnx {Function File} {} hist (@var{y}, @var{nbins})
-## @deftypefnx {Function File} {} hist (@var{y}, @var{x}, @var{norm})
-## @deftypefnx {Function File} {} hist (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} hist (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{nn}, @var{xx}] =} hist (@dots{})
-## Produce histogram counts or plots.
-##
-## With one vector input argument, @var{y}, plot a histogram of the values
-## with 10 bins.  The range of the histogram bins is determined by the
-## range of the data.  With one matrix input argument, @var{y}, plot a
-## histogram where each bin contains a bar per input column.
-##
-## Given a second vector argument, @var{x}, use that as the centers of
-## the bins, with the width of the bins determined from the adjacent
-## values in the vector.
-##
-## If scalar, the second argument, @var{nbins}, defines the number of bins.
-##
-## If a third argument is provided, the histogram is normalized such that
-## the sum of the bars is equal to @var{norm}.
-##
-## Extreme values are lumped into the first and last bins.
-##
-## The histogram's appearance may be modified by specifying property/value
-## pairs.  For example the face and edge color may be modified.
-##
-## @example
-## @group
-## hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b");
-## @end group
-## @end example
-##
-## @noindent
-## The histogram's colors also depend upon the current colormap.
-##
-## @example
-## @group
-## hist (rand (10, 3));
-## colormap (summer ());
-## @end group
-## @end example
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## With two output arguments, produce the values @var{nn} (numbers of elements)
-## and @var{xx} (bin centers) such that @code{bar (@var{xx}, @var{nn})} will
-## plot the histogram.
-##
-## @seealso{histc, bar, pie, rose}
-## @end deftypefn
-
-## Author: jwe
-
-function [nn, xx] = hist (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("hist", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-  
-  y = varargin{1};
-  varargin = varargin(2:end);
-
-  arg_is_vector = isvector (y);
-
-  if (arg_is_vector)
-    y = y(:);
-  endif
-
-  if (! isreal (y))
-    error ("hist: Y must be real valued");
-  endif
-
-  max_val = max (y(:));
-  min_val = min (y(:));
-
-  iarg = 1;
-  if (nargin == 1 || ischar (varargin{iarg}))
-    n = 10;
-    x = [0.5:n]'/n;
-    x = x * (max_val - min_val) + ones (size (x)) * min_val;
-  else
-    ## nargin is either 2 or 3
-    x = varargin{iarg++};
-    if (isscalar (x))
-      n = x;
-      if (n <= 0)
-        error ("hist: number of bins NBINS must be positive");
-      endif
-      x = [0.5:n]'/n;
-      x = x * (max_val - min_val) + ones (size (x)) * min_val;
-    elseif (isreal (x))
-      if (isvector (x))
-        x = x(:);
-      endif
-      xsort = sort (x);
-      if (any (xsort != x))
-        warning ("hist: bin values not sorted on input");
-        x = xsort;
-      endif
-    else
-      error ("hist: second argument must be a scalar or a vector");
-    endif
-  endif
-
-  ## Avoid issues with integer types for x and y
-  x = double (x);
-  y = double (y);
-
-  cutoff = (x(1:end-1,:) + x(2:end,:)) / 2;
-  n = rows (x);
-  y_nc = columns (y);
-  if (n < 30 && columns (x) == 1)
-    ## The following algorithm works fastest for n less than about 30.
-    chist = zeros (n+1, y_nc);
-    for i = 1:n-1
-      chist(i+1,:) = sum (y <= cutoff(i));
-    endfor
-    chist(n+1,:) = sum (! isnan (y));
-  else
-    ## The following algorithm works fastest for n greater than about 30.
-    ## Put cutoff elements between boundaries, integrate over all
-    ## elements, keep totals at boundaries.
-    [s, idx] = sort ([y; repmat(cutoff, 1, y_nc)]);
-    len = rows (y);
-    chist = cumsum (idx <= len);
-    chist = [(zeros (1, y_nc));
-             (reshape (chist(idx > len), rows (cutoff), y_nc));
-             (chist(end,:) - sum (isnan (y)))];
-  endif
-
-  freq = diff (chist);
-
-  if (nargin > 2 && ! ischar (varargin{iarg}))
-    ## Normalize the histogram.
-    norm = varargin{iarg++};
-    freq *= norm / sum (! isnan (y));
-  endif
-
-  if (nargout > 0)
-    if (arg_is_vector)  
-      ## Matlab compatibility requires a row vector return
-      nn = freq';  
-      xx = x';
-    else
-      nn = freq;
-      xx = x;
-    endif
-  else
-    if (isempty (hax))
-      hax = gca ();
-    endif
-    bar (hax, x, freq, "hist", varargin{iarg:end});
-  endif
-
-endfunction
-
-
-%!test
-%! [nn,xx] = hist ([1:4], 3);
-%! assert (xx, [1.5,2.5,3.5]);
-%! assert (nn, [2,1,1]);
-%!test
-%! [nn,xx] = hist ([1:4]', 3);
-%! assert (xx, [1.5,2.5,3.5]);
-%! assert (nn, [2,1,1]);
-%!test
-%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3]);
-%! assert (xx, [1,2,3]);
-%! assert (nn, [3,2,1]);
-%!test
-%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3], 6);
-%! assert (xx, [1,2,3]);
-%! assert (nn, [3,2,1]);
-%!test
-%! [nn,xx] = hist ([[1:4]', [1:4]'], 3);
-%! assert (xx, [1.5;2.5;3.5]);
-%! assert (nn, [[2,1,1]',[2,1,1]']);
-%!test
-%! for n = [10, 30, 100, 1000]
-%!   assert (sum (hist ([1:n], n)), n);
-%!   assert (sum (hist ([1:n], [2:n-1])), n);
-%!   assert (sum (hist ([1:n], [1:n])), n);
-%!   assert (sum (hist ([1:n], 29)), n);
-%!   assert (sum (hist ([1:n], 30)), n);
-%! endfor
-%!assert (hist (1,1), 1)
-%!assert (size (hist (randn (750,240), 200)), [200,240])
-
--- a/scripts/plot/hold.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} hold
-## @deftypefnx {Command} {} hold on
-## @deftypefnx {Command} {} hold off
-## @deftypefnx {Command} {} hold all
-## @deftypefnx {Function File} {} hold (@var{hax}, @dots{})
-## Toggle or set the @qcode{"hold"} state of the plotting engine which
-## determines whether new graphic objects are added to the plot or replace
-## the existing objects.
-##
-## @table @code
-## @item hold on
-## Retain plot data and settings so that subsequent plot commands are displayed
-## on a single graph.
-##
-## @item hold all
-## Retain plot line color, line style, data, and settings so that subsequent
-## plot commands are displayed on a single graph with the next line color and
-## style.
-##
-## @item hold off
-## Restore default graphics settings which clear the graph and reset axis
-## properties before each new plot command.  (default).
-##
-## @item hold
-## Toggle the current hold state.
-## @end table
-##
-## When given the additional argument @var{hax}, the hold state is modified
-## for this axis rather than the current axes returned by @code{gca}.
-##
-## To query the current hold state use the @code{ishold} function.
-## @seealso{ishold, cla, clf, newplot}
-## @end deftypefn
-
-function hold (varargin)
-
-  if (nargin > 0 && isscalar (varargin{1}) && isaxes (varargin{1}))
-    hax = varargin{1};
-    varargin(1) = [];
-    nargs = numel (varargin);
-    ## FIXME: Should this be ancestor (hax, "parent")?
-    hfig = get (hax, "parent");
-  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}))
-    print_usage ();
-  else
-    hax = gca ();
-    hfig = gcf ();
-    nargs = numel (varargin);
-  endif
-
-  hold_all = false;
-  if (nargs == 0)
-    turn_hold_off = ishold (hax);
-  elseif (nargs == 1)
-    state = tolower (varargin{1});
-    switch (state)
-      case "off"
-        turn_hold_off = true;
-      case "all"
-        turn_hold_off = false;
-        hold_all = true;
-      case "on"
-        turn_hold_off = false;
-      otherwise
-        error ("hold: invalid hold STATE");
-    endswitch
-  else
-    print_usage ();
-  endif
-
-  if (turn_hold_off)
-    set (hax, "nextplot", "replace");
-  else
-    set (hax, "nextplot", "add");
-    set (hfig, "nextplot", "add");
-  endif
-  set (hax, "__hold_all__", hold_all);
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t = linspace (0, 2*pi, 100);
-%! plot (t, sin (t));
-%! hold on;
-%! plot (t, cos (t));
-%! title ({'hold on', '2 plots shown on same graph'});
-%! hold off;
-
-%!demo
-%! clf;
-%! t = linspace (0, 2*pi, 100);
-%! plot (t, sin (t));
-%! hold all;
-%! plot (t, cos (t));
-%! title ({'hold all', '2 plots shown on same graph with linestyle also preserved'});
-%! hold off;
-
-%!demo
-%! clf;
-%! A = rand (100);
-%! [X, Y] = find (A > 0.95);
-%! imshow (A);
-%! hold on;
-%! plot (X, Y, 'o');
-%! hold off;
-%! title ('hold with image and plot');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! hold on;
-%! imagesc (1 ./ hilb (4));
-%! plot (1:4, '-s');
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! hold on;
-%! imagesc (1 ./ hilb (2));
-%! imagesc (1 ./ hilb (4));
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! hold on;
-%! plot (1:4, '-s');
-%! imagesc (1 ./ hilb (4));
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! t = linspace (-3, 3, 50);
-%! [x, y] = meshgrid (t, t);
-%! z = peaks (x, y);
-%! contourf (x, y, z, 10);
-%! hold on;
-%! plot (x(:), y(:), '^');
-%! patch ([-1.0 1.0 1.0 -1.0 -1.0], [-1.0 -1.0 1.0 1.0 -1.0], 'red');
-%! xlim ([-2.0 2.0]);
-%! ylim ([-2.0 2.0]);
-%! colorbar ('SouthOutside');
-%! title ('Test script for some plot functions');
-
-## hold on test
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   p = plot ([0 1]);
-%!   assert (! ishold);
-%!   hold on;
-%!   assert (ishold);
-%!   p1 = fill ([0 1 1], [0 0 1], "black");
-%!   p2 = fill ([0 1 0], [0 1 1], "red");
-%!   assert (length (get (hf, "children")), 1);
-%!   assert (length (get (gca, "children")), 3);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-## hold off test
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   p = plot ([0 1]);
-%!   assert (! ishold);
-%!   hold on;
-%!   assert (ishold);
-%!   p1 = fill ([0 1 1], [0 0 1], "black");
-%!   hold off;
-%!   p2 = fill ([0 1 0], [0 1 1], "red");
-%!   assert (length (get (hf, "children")), 1);
-%!   assert (length (get (gca, "children")), 1);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/isaxes.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-## Copyright (C) 2013 Rik Wehbring
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} isaxes (@var{h})
-## Return true if @var{h} is an axes graphics handle and false otherwise.
-##
-## If @var{h} is a matrix then return a logical array which is true where
-## the elements of @var{h} are axes graphics handles and false where
-## they are not.
-## @seealso{isaxes, ishandle}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = isaxes (h)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  hlist = ishandle (h);
-  if (any (hlist))
-    retval(hlist) = strcmp (get (h(hlist), "type"), "axes");
-  else
-    retval = hlist;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   hax = axes ();
-%!   assert (isaxes (hax));
-%!   assert (! isaxes (-hax));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/isfigure.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} isfigure (@var{h})
-## Return true if @var{h} is a figure graphics handle and false otherwise.
-##
-## If @var{h} is a matrix then return a logical array which is true where
-## the elements of @var{h} are figure graphics handles and false where
-## they are not.
-## @seealso{isaxes, ishandle}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = isfigure (h)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  hlist = ishandle (h);
-  if (any (hlist))
-    retval(hlist) = strcmp (get (h(hlist), "type"), "figure");
-  else
-    retval = hlist;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (isfigure (hf));
-%!   assert (! isfigure (-hf));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ishghandle.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} ishghandle (@var{h})
-## Return true if @var{h} is a graphics handle and false otherwise.
-##
-## This function is equivalent to @code{ishandle} and is provided for
-## compatibility with @sc{matlab}.
-## @seealso{ishandle}
-## @end deftypefn
-
-function retval = ishghandle (h)
-  ## This function is just included for compatibility as Octave has
-  ## no simulink equivalent.
-  retval = ishandle (h);
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (ishghandle (hf));
-%!   assert (! ishghandle (-hf));
-%!   l = line;
-%!   ax = gca;
-%!   assert (ishghandle (ax));
-%!   assert (! ishghandle (-ax));
-%!   assert (ishghandle (l));
-%!   assert (! ishghandle (-l));
-%!   p = patch;
-%!   assert (ishghandle (p));
-%!   assert (! ishghandle (-p));
-%!   s = surface;
-%!   assert (ishghandle (s));
-%!   assert (! ishghandle (-s));
-%!   t = text;
-%!   assert (ishghandle (t));
-%!   assert (! ishghandle (-t));
-%!   i = image ([1]);
-%!   assert (ishghandle (i));
-%!   assert (! ishghandle (-i));
-%!   hg = hggroup;
-%!   assert (ishghandle (hg));
-%!   assert (! ishghandle (-hg));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ishold.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} ishold
-## @deftypefnx {Function File} {} ishold (@var{hax})
-## @deftypefnx {Function File} {} ishold (@var{hfig})
-## Return true if the next plot will be added to the current plot, or
-## false if the plot device will be cleared before drawing the next plot.
-##
-## If the first argument is an axes handle @var{hax} or figure handle
-## @var{hfig} then operate on this plot rather than the current one.
-## @seealso{hold, newplot}
-## @end deftypefn
-
-function retval = ishold (h)
-
-  if (nargin > 1)
-    print_usage ();
-  endif
-
-  if (nargin == 0)
-    fig = gcf ();
-    ax = get (fig, "currentaxes");
-  else
-    if (ishandle (h))
-      if (strcmp (get (h, "type"), "figure"))
-        fig = h;
-        ax = get (fig, "currentaxes");
-      elseif (strcmp (get (h, "type"), "axes"))
-        ax = h;
-        fig = get (ax, "parent");
-      else
-        error ("ishold: H must be an axes or figure graphics handle");
-      endif
-    else
-      error ("ishold: H must be an axes or figure graphics handle");
-    endif
-  endif
-
-  retval = (strcmp (get (fig, "nextplot"), "add")
-            && ! isempty (ax) && strcmp (get (ax, "nextplot"), "add"));
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (! ishold);
-%!   assert (isempty (get (hf, "currentaxes")));
-%!   assert (get (hf, "NextPlot"), "add");
-%!   l = plot ([0 1]);
-%!   assert (! ishold);
-%!   assert (! ishold (gca));
-%!   assert (get (gca, "NextPlot"), "replace");
-%!   assert (get (hf, "NextPlot"), "add");
-%!   hold;
-%!   assert (ishold);
-%!   assert (ishold (gca));
-%!   assert (get (gca, "NextPlot"), "add");
-%!   assert (get (hf, "NextPlot"), "add");
-%!   p = fill ([0 1 1], [0 0 1],"black");
-%!   assert (length (get (hf, "children")), 1);
-%!   assert (length (get (gca, "children")), 2);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/isocolors.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{cd}] =} isocolors (@var{c}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{c}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{r}, @var{g}, @var{b}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{r}, @var{g}, @var{b}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@dots{}, @var{p})
-## @deftypefnx {Function File} {} isocolors (@dots{})
-##
-## If called with one output argument and the first input argument
-## @var{c} is a three-dimensional array that contains color values and
-## the second input argument @var{v} keeps the vertices of a geometry
-## then return a matrix @var{cd} with color data information for the
-## geometry at computed points
-## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
-## @var{cd} can be taken to manually set FaceVertexCData of a patch.
-##
-## If called with further input arguments @var{x}, @var{y} and @var{z}
-## which are three--dimensional arrays of the same size than @var{c}
-## then the color data is taken at those given points.  Instead of the
-## color data @var{c} this function can also be called with RGB values
-## @var{r}, @var{g}, @var{b}.  If input argumnets @var{x}, @var{y},
-## @var{z} are not given then again @command{meshgrid} computed values
-## are taken.
-##
-## Optionally, the patch handle @var{p} can be given as the last input
-## argument to all variations of function calls instead of the vertices
-## data @var{v}.  Finally, if no output argument is given then directly
-## change the colors of a patch that is given by the patch handle
-## @var{p}.
-##
-## For example:
-##
-## @example
-## function [] = isofinish (p)
-##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##             "PlotBoxAspectRatio", [1 1 1]);
-##   set (p, "FaceColor", "interp");
-##   ## set (p, "FaceLighting", "flat");
-##   ## light ("Position", [1 1 5]); ## Available with JHandles
-## endfunction
-##
-## N = 15;    # Increase number of vertices in each direction
-## iso = .4;  # Change isovalue to .1 to display a sphere
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-## figure (); # Open another figure window
-##
-## subplot (2,2,1); view (-38, 20);
-## [f, v] = isosurface (x, y, z, c, iso);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## cdat = rand (size (c));       # Compute random patch color data
-## isocolors (x, y, z, cdat, p); # Directly set colors of patch
-## isofinish (p);                # Call user function isofinish
-##
-## subplot (2,2,2); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## [r, g, b] = meshgrid (lin, 2-lin, 2-lin);
-## cdat = isocolors (x, y, z, c, v); # Compute color data vertices
-## set (p, "FaceVertexCData", cdat); # Set color data manually
-## isofinish (p);
-##
-## subplot (2,2,3); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## cdat = isocolors (r, g, b, c, p); # Compute color data patch
-## set (p, "FaceVertexCData", cdat); # Set color data manually
-## isofinish (p);
-##
-## subplot (2,2,4); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## r = g = b = repmat ([1:N] / N, [N, 1, N]); # Black to white
-## cdat = isocolors (x, y, z, r, g, b, v);
-## set (p, "FaceVertexCData", cdat);
-## isofinish (p);
-## @end example
-##
-## @seealso{isosurface, isonormals}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function varargout = isocolors (varargin)
-  calc_rgb = false;
-  switch (nargin)
-    case 2
-      c = varargin{1};
-      vp = varargin{2};
-      x = 1:size (c, 2);
-      y = 1:size (c, 1);
-      z = 1:size (c, 3);
-    case 4
-      calc_rgb = true;
-      R = varargin{1};
-      G = varargin{2};
-      B = varargin{3};
-      vp = varargin{4};
-      x = 1:size (R, 1);
-      y = 1:size (R, 2);
-      z = 1:size (R, 3);
-    case 5
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-      c = varargin{4};
-      vp = varargin{5};
-    case 7
-      calc_rgb = true;
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-      R = varargin{4};
-      G = varargin{5};
-      B = varargin{6};
-      vp = varargin{7};
-    otherwise
-      print_usage ();
-  endswitch
-  if (ismatrix (vp) && columns (vp) == 3)
-    pa = [];
-    v = vp;
-  elseif ( ishandle (vp) )
-    pa = vp;
-    v = get (pa, "Vertices");
-  else
-    error ("isocolors: last argument is not a vertex list or patch handle");
-  endif
-  if (calc_rgb)
-    new_col = zeros (rows (v), 3);
-    new_col(:,1) = __interp_cube__ (x, y, z, R, v, "values" );
-    new_col(:,2) = __interp_cube__ (x, y, z, G, v, "values" );
-    new_col(:,3) = __interp_cube__ (x, y, z, B, v, "values" );
-  else
-    new_col = __interp_cube__ (x, y, z, c, v, "values" );
-  endif
-  switch (nargout)
-    case 0
-      if (!isempty (pa))
-        set (pa, "FaceVertexCData", new_col);
-      endif
-    case 1
-      varargout = {new_col};
-    otherwise
-      print_usage ();
-  endswitch
-endfunction
-
-
-%!test
-%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
-%! c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
-%! [f, v] = isosurface (x, y, z, c, .4);
-%! cdat = isocolors (x, y, z, c, v);
-%! assert (rows (cdat) == rows (v));
-## Can't create a patch handle for tests without a figure
-
--- a/scripts/plot/isonormals.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{n}] =} isonormals (@var{val}, @var{v})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{val}, @var{p})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{p})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@dots{}, "negate")
-## @deftypefnx {Function File} {} isonormals (@dots{}, @var{p})
-##
-## If called with one output argument and the first input argument
-## @var{val} is a three-dimensional array that contains the data for an
-## isosurface geometry and the second input argument @var{v} keeps the
-## vertices of an isosurface then return the normals @var{n} in form of
-## a matrix with the same size than @var{v} at computed points
-## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
-## @var{n} can be taken to manually set @var{VertexNormals} of a patch.
-##
-## If called with further input arguments @var{x}, @var{y} and @var{z}
-## which are three--dimensional arrays with the same size than @var{val}
-## then the volume data is taken at those given points.  Instead of the
-## vertices data @var{v} a patch handle @var{p} can be passed to this
-## function.
-##
-## If given the string input argument @qcode{"negate"} as last input argument
-## then compute the reverse vector normals of an isosurface geometry.
-##
-## If no output argument is given then directly redraw the patch that is
-## given by the patch handle @var{p}.
-##
-## For example:
-## @c Set example in small font to prevent overfull line
-##
-## @smallexample
-## function [] = isofinish (p)
-##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##             "PlotBoxAspectRatio", [1 1 1]);
-##   set (p, "VertexNormals", -get (p,"VertexNormals")); # Revert normals
-##   set (p, "FaceColor", "interp");
-##   ## set (p, "FaceLighting", "phong");
-##   ## light ("Position", [1 1 5]); # Available with JHandles
-## endfunction
-##
-## N = 15;    # Increase number of vertices in each direction
-## iso = .4;  # Change isovalue to .1 to display a sphere
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-## figure (); # Open another figure window
-##
-## subplot (2,2,1); view (-38, 20);
-## [f, v, cdat] = isosurface (x, y, z, c, iso, y);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## isofinish (p); ## Call user function isofinish
-##
-## subplot (2,2,2); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## isonormals (x, y, z, c, p); # Directly modify patch
-## isofinish (p);
-##
-## subplot (2,2,3); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## n = isonormals (x, y, z, c, v); # Compute normals of isosurface
-## set (p, "VertexNormals", n);    # Manually set vertex normals
-## isofinish (p);
-##
-## subplot (2,2,4); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## isonormals (x, y, z, c, v, "negate"); # Use reverse directly
-## isofinish (p);
-## @end smallexample
-##
-## @seealso{isosurface, isocolors}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function varargout = isonormals (varargin)
-  na = nargin;
-  negate = false;
-  if (ischar (varargin{nargin}))
-    na = nargin-1;
-    if (strcmp (lower (varargin{nargin}), "negate"))
-      negate = true;
-    else
-      error ("isonormals: Unknown option '%s'", varargin{nargin});
-    endif
-  endif
-  switch (na)
-    case 2
-      c = varargin{1};
-      vp = varargin{2};
-      x = 1:size (c, 2);
-      y = 1:size (c, 1);
-      z = 1:size (c, 3);
-    case 5
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-      c = varargin{4};
-      vp = varargin{5};
-    otherwise
-      print_usage ();
-  endswitch
-  if (ismatrix (vp) && columns (vp) == 3)
-    pa = [];
-    v = vp;
-  elseif (ishandle (vp))
-    pa = vp;
-    v = get (pa, "Vertices");
-  else
-    error ("isonormals: Last argument is not a vertex list or a patch handle");
-  endif
-  if (negate)
-    normals = -__interp_cube__ (x, y, z, c, v, "normals");
-  else
-    normals = __interp_cube__ (x, y, z, c, v, "normals");
-  endif
-  switch (nargout)
-    case 0
-      if (!isempty (pa))
-        set (pa, "VertexNormals", normals);
-      endif
-    case 1
-      varargout = {normals};
-    otherwise
-      print_usage ();
-  endswitch
-endfunction
-
-
-%!test
-%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
-%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
-%! n = isonormals (x, y, z, c, v);
-%! assert (size (v), size (n));
-%!test
-%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
-%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
-%! np = isonormals (x, y, z, c, v);
-%! nn = isonormals (x, y, z, c, v, "negate");
-%! assert (np, -nn);
-
--- a/scripts/plot/isosurface.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{fv}] =} isosurface (@var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@dots{}, "noshare", "verbose")
-## @deftypefnx {Function File} {[@var{fvc}] =} isosurface (@dots{}, @var{col})
-## @deftypefnx {Function File} {[@var{f}, @var{v}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{f}, @var{v}, @var{c}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
-## @deftypefnx {Function File} {} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col}, @var{opt})
-##
-## If called with one output argument and the first input argument
-## @var{val} is a three-dimensional array that contains the data of an
-## isosurface geometry and the second input argument @var{iso} keeps the
-## isovalue as a scalar value then return a structure array @var{fv}
-## that contains the fields @var{Faces} and @var{Vertices} at computed
-## points @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output
-## argument @var{fv} can directly be taken as an input argument for the
-## @command{patch} function.
-##
-## If called with further input arguments @var{x}, @var{y} and @var{z}
-## which are three--dimensional arrays with the same size than @var{val}
-## then the volume data is taken at those given points.
-##
-## The string input argument @qcode{"noshare"} is only for compatibility and
-## has no effect.  If given the string input argument
-## @qcode{"verbose"} then print messages to the command line interface about the
-## current progress.
-##
-## If called with the input argument @var{col} which is a
-## three-dimensional array of the same size than @var{val} then take
-## those values for the interpolation of coloring the isosurface
-## geometry.  Add the field @var{FaceVertexCData} to the structure
-## array @var{fv}.
-##
-## If called with two or three output arguments then return the
-## information about the faces @var{f}, vertices @var{v} and color data
-## @var{c} as separate arrays instead of a single structure array.
-##
-## If called with no output argument then directly process the
-## isosurface geometry with the @command{patch} command.
-##
-## For example,
-##
-## @example
-## @group
-## [x, y, z] = meshgrid (1:5, 1:5, 1:5);
-## val = rand (5, 5, 5);
-## isosurface (x, y, z, val, .5);
-## @end group
-## @end example
-##
-## @noindent
-## will directly draw a random isosurface geometry in a graphics window.
-## Another example for an isosurface geometry with different additional
-## coloring
-## @c Set example in small font to prevent overfull line
-##
-## @smallexample
-## N = 15;    # Increase number of vertices in each direction
-## iso = .4;  # Change isovalue to .1 to display a sphere
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-## figure (); # Open another figure window
-##
-## subplot (2,2,1); view (-38, 20);
-## [f, v] = isosurface (x, y, z, c, iso);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceColor", "green", "FaceLighting", "phong");
-## # light ("Position", [1 1 5]); # Available with the JHandles package
-##
-## subplot (2,2,2); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "blue");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceColor", "none", "FaceLighting", "phong");
-## # light ("Position", [1 1 5]);
-##
-## subplot (2,2,3); view (-38, 20);
-## [f, v, c] = isosurface (x, y, z, c, iso, y);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceLighting", "phong");
-## # light ("Position", [1 1 5]);
-##
-## subplot (2,2,4); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
-##            "FaceColor", "interp", "EdgeColor", "blue");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceLighting", "phong");
-## # light ("Position", [1 1 5]);
-## @end smallexample
-##
-## @seealso{isonormals, isocolors}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function varargout = isosurface (varargin)
-
-  if (nargin < 2 || nargin > 8 || nargout > 3)
-    print_usage ();
-  endif
-
-  calc_colors = false;
-  f = v = c = [];
-  verbose = false;
-  noshare = false;
-  if (nargin >= 5)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    val = varargin{4};
-    iso = varargin{5};
-    if (nargin >= 6 && ismatrix (varargin{6}))
-      colors = varargin{6};
-      calc_colors = true;
-    endif
-  else
-    val = varargin{1};
-    [n2, n1, n3] = size (val);
-    [x, y, z] = meshgrid (1:n1, 1:n2, 1:n3);
-    iso = varargin{2};
-    if (nargin >= 3 && ismatrix (varargin{3}))
-        colors = varargin{3};
-        calc_colors = true;
-    endif
-  endif
-  if (calc_colors)
-    if (nargout == 2)
-      warning ("isosurface: colors will be calculated, but no output argument to receive it.");
-    endif
-    [fvc.faces, fvc.vertices, fvc.facevertexcdata] = __marching_cube__ (x, y, z, val, iso, colors);
-  else
-    [fvc.faces, fvc.vertices] = __marching_cube__ (x, y, z, val, iso);
-  endif
-
-  if (isempty (fvc.vertices) || isempty (fvc.faces))
-    warning ("isosurface: triangulation is empty");
-  endif
-
-  switch (nargout)
-    case 0
-      ## plot the calculated surface
-      hax = newplot ();
-      if (calc_colors)
-        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
-                    "FaceVertexCData", fvc.facevertexcdata,
-                    "FaceColor", "flat", "EdgeColor", "none");
-      else
-        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
-                    "FaceColor", "g", "EdgeColor", "k");
-      endif
-      if (! ishold ())
-        set (hax, "view", [-37.5, 30],
-                  "xgrid", "on", "ygrid", "on", "zgrid", "on");
-      endif
-    case 1
-      varargout = {fvc};
-    case 2
-      varargout = {fvc.faces, fvc.vertices};
-    case 3
-      varargout = {fvc.faces, fvc.vertices, fvc.facevertexcdata};
-    otherwise
-      print_usage ();
-  endswitch
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
-%! v = x.^2 + y.^2 + z.^2;
-%! isosurface (x, y, z, v, 1);
-%! title ('isosurface of a sphere');
-
-%!shared x, y, z, val
-%! [x, y, z]  = meshgrid (0:1, 0:1, 0:1); # Points for single
-%! val        = [0, 0; 0, 0];             # cube and a 3-D
-%! val(:,:,2) = [0, 0; 1, 0];             # array of values
-
-%!test
-%! fv = isosurface (x, y, z, val, 0.3);
-%! assert (isfield (fv, "vertices"), true);
-%! assert (isfield (fv, "faces"), true);
-%! assert (size (fv.vertices), [3 3]);
-%! assert (size (fv.faces), [1 3]);
-
-%!test
-%! fvc = isosurface (x, y, z, val, .3, y);
-%! assert (isfield (fvc, "vertices"), true);
-%! assert (isfield (fvc, "faces"), true);
-%! assert (isfield (fvc, "facevertexcdata"), true);
-%! assert (size (fvc.vertices), [3 3]);
-%! assert (size (fvc.faces), [1 3]);
-%! assert (size (fvc.facevertexcdata), [3 1]);
-
-%!test
-%! [f, v] = isosurface (x, y, z, val, .3);
-%! assert (size (f), [1 3]);
-%! assert (size (v), [3 3]);
-
-%!test
-%! [f, v, c] = isosurface (x, y, z, val, .3, y);
-%! assert (size (f), [1 3]);
-%! assert (size (v), [3 3]);
-%! assert (size (c), [3 1]);
-
--- a/scripts/plot/isprop.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{res} =} isprop (@var{h}, "@var{prop}")
-## Return true if @var{prop} is a property of the object with handle @var{h}.
-##
-## @var{h} may also be an array of handles in which case @var{res} will be a
-## logical array indicating whether each handle has the property @var{prop}.
-## @seealso{get, set}
-## @end deftypefn
-
-## Author: Ben Abbott  <bpabbott@mac.com>
-
-function res = isprop (h, prop)
-
-  if (nargin != 2)
-    print_usage ();
-  endif
-
-  if (! all (ishandle (h)))
-    error ("isprop: H must be a graphics handle or vector of handles");
-  elseif (! ischar (prop))
-    error ("isprop: PROP name must be a string");
-  endif
-
-  res = false (size (h));
-  for i = 1:numel (res)
-    try
-      v = get (h(i), prop);
-      res(i) = true;
-    end_try_catch
-  endfor
-endfunction
-
-
-%!assert (isprop (0, "foobar"), false)
-%!assert (isprop (0, "screenpixelsperinch"), true)
-%!assert (isprop (zeros (2, 3), "visible"), true (2, 3))
-
-%!error isprop ()
-%!error isprop (1)
-%!error isprop (1,2,3)
-%!error <H must be a graphics handle> isprop ({1}, "visible")
-%!error <PROP name must be a string> isprop (0, {"visible"})
-
--- a/scripts/plot/legend.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1595 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} legend (@var{str1}, @var{str2}, @dots{})
-## @deftypefnx {Function File} {} legend (@var{matstr})
-## @deftypefnx {Function File} {} legend (@var{cellstr})
-## @deftypefnx {Function File} {} legend (@dots{}, "location", @var{pos})
-## @deftypefnx {Function File} {} legend (@dots{}, "orientation", @var{orient})
-## @deftypefnx {Function File} {} legend (@var{hax}, @dots{})
-## @deftypefnx {Function File} {} legend (@var{hobjs}, @dots{})
-## @deftypefnx {Function File} {} legend (@var{hax}, @var{hobjs}, @dots{})
-## @deftypefnx {Function File} {} legend ("@var{option}")
-## @deftypefnx {Function File} {[@var{hleg}, @var{hleg_obj}, @var{hplot}, @var{labels}] =} legend (@dots{})
-##
-## Display a legend for the current axes using the specified strings as labels.
-##
-## Legend entries may be specified as individual character string arguments,
-## a character array, or a cell array of character strings.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.  If the handles,
-## @var{hobjs}, are not specified then the legend's strings will be associated
-## with the axes' descendants.  @code{legend} works on line graphs,
-## bar graphs, etc.  A plot must exist before legend is called.
-##
-## The optional parameter @var{pos} specifies the location of the legend
-## as follows:
-##
-## @multitable @columnfractions 0.06 0.14 0.80
-## @headitem @tab pos @tab location of the legend
-## @item @tab north @tab center top
-## @item @tab south @tab center bottom
-## @item @tab east @tab right center
-## @item @tab west @tab left center
-## @item @tab northeast @tab right top (default)
-## @item @tab northwest @tab left top
-## @item @tab southeast @tab right bottom
-## @item @tab southwest @tab left bottom
-## @item
-## @item @tab outside @tab can be appended to any location string
-## @end multitable
-##
-## The optional parameter @var{orient} determines if the key elements
-## are placed vertically or horizontally.  The allowed values are
-## @qcode{"vertical"} (default) or @qcode{"horizontal"}.
-##
-## The following customizations are available using @var{option}:
-##
-## @table @asis
-## @item @qcode{"show"}
-##   Show legend on the plot
-##
-## @item @qcode{"hide"}
-##   Hide legend on the plot
-##
-## @item @qcode{"toggle"}
-##   Toggles between @qcode{"hide"} and @qcode{"show"}
-##
-## @item @qcode{"boxon"}
-##   Show a box around legend (default)
-##
-## @item @qcode{"boxoff"}
-##   Hide the box around legend
-##
-## @item @qcode{"right"}
-##   Place label text to the right of the keys (default)
-##
-## @item @qcode{"left"}
-##   Place label text to the left of the keys
-##
-## @item @qcode{"off"}
-##   Delete the legend object
-## @end table
-##
-## The optional output values are
-##
-## @table @var
-## @item hleg
-##   The graphics handle of the legend object.
-##
-## @item hleg_obj
-##   Graphics handles to the text and line objects which make up the legend.
-##
-## @item hplot
-##   Graphics handles to the plot objects which were used in making the legend.
-##
-## @item labels
-##   A cell array of strings of the labels in the legend.
-## @end table
-##
-## The legend label text is either provided in the call to @code{legend} or
-## is taken from the DisplayName property of graphics objects.  If no
-## labels or DisplayNames are available, then the label text is simply
-## @qcode{"data1"}, @qcode{"data2"}, @dots{}, @nospell{@qcode{"dataN"}}.
-##
-## Implementation Note: A legend is implemented as an additional axes object
-## of the current figure with the @qcode{"tag"} set to @qcode{"legend"}.
-## Properties of the legend object may be manipulated directly by using
-## @code{set}.
-## @end deftypefn
-
-function [hleg, hleg_obj, hplot, labels] = legend (varargin)
-
-  if (nargin > 0
-      && (! ishandle (varargin{1})
-          || (strcmp (get (varargin{1}, "type"), "axes")
-              && ! strcmp (get (varargin{1}, "tag"), "legend"))))
-    [ca, varargin, nargin] = __plt_get_axis_arg__ ("legend", varargin{:});
-    if (isempty (ca))
-      ca = gca ();
-    endif
-    fig = get (ca, "parent");
-  else
-    fig = get (0, "currentfigure");
-    if (isempty (fig))
-      fig = gcf ();
-    endif
-    ca = gca ();
-  endif
-
-  ## Special handling for plotyy which has two axes objects
-  if (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
-    plty = get (ca, "__plotyy_axes__");
-    if (isscalar (plty) && ishandle (plty))
-      ca = [ca, plty];
-    elseif (iscell (plty))
-      ca = [ca, plty{:}];
-    elseif (all (ishandle (plty)))
-      ca = [ca, plty(:).'];
-    else
-      error ("legend.m: This should not happen. File a bug report.");
-    endif
-    ## Remove duplicates while preserving order
-    [~, n] = unique (ca);
-    ca = ca(sort (n));
-  endif
-
-  if (nargin > 0 && all (ishandle (varargin{1})))
-    kids = flipud (varargin{1}(:));
-    varargin(1) = [];
-  else
-    kids = ca;
-    kids(strcmp (get (ca, "tag"), "legend")) = [];
-    if (isscalar (kids))
-      kids = get (kids, "children")(:);
-    else
-      kids = flipud ([get(kids, "children"){:}](:));
-    endif
-  endif
-  nargs = numel (varargin);
-  nkids = numel (kids);
-
-  orientation = "default";
-  location = "default";
-  show = "create";
-  textpos = "default";
-  box = "default";
-
-  ## Process old way of specifying location with a number rather than a string.
-  if (nargs > 0)
-    pos = varargin{nargs};
-    if (isnumeric (pos) && isscalar (pos) && pos == fix (pos))
-      if (pos >= -1 && pos <= 4)
-        location = [{"northeastoutside", "best", "northeast",
-                     "northwest", "southwest", "southeast"}] {pos + 2};
-        nargs--;
-      else
-        error ("legend: invalid location specified");
-      endif
-    endif
-  endif
-
-  ## Find location and orientation property/value pairs
-  while (nargs > 1)
-    pos = varargin{nargs-1};
-    str = varargin{nargs};
-    if (strcmpi (pos, "location") && ischar (str))
-      location = lower (str);
-      nargs -= 2;
-    elseif (strcmpi (pos, "orientation") && ischar (str))
-      orientation = lower (str);
-      nargs -= 2;
-    else
-      break;
-    endif
-  endwhile
-
-  ## Validate the orientation
-  switch (orientation)
-    case {"vertical", "horizontal", "default"}
-      ## These are all accepted orientations.
-    otherwise
-      error ("legend: unrecognized legend orientation");
-  endswitch
-
-  ## Validate the location type
-  outside = false;
-  inout = strfind (location, "outside");
-  if (! isempty (inout))
-    outside = true;
-    location = location(1:inout-1);
-  else
-    outside = false;
-  endif
-
-  switch (location)
-    case {"north", "south", "east", "west", "northeast", "northwest", ...
-          "southeast", "southwest", "default"}
-    case "best"
-      warning ("legend: 'best' not yet implemented for location specifier\n");
-      location = "northeast";
-    otherwise
-      error ("legend: unrecognized legend location");
-  endswitch
-
-  ## Find any existing legend object on figure
-  hlegend = [];
-  fkids = get (fig, "children");
-  for i = 1 : numel (fkids)
-    if (   strcmp (get (fkids(i), "type"), "axes")
-        && strcmp (get (fkids(i), "tag"), "legend"))
-      udata = get (fkids(i), "userdata");
-      if (any (udata.handle == ca))
-        hlegend = fkids(i);
-        break;
-      endif
-    endif
-  endfor
-
-  if (nargs == 1)
-    arg = varargin{1};
-    if (ischar (arg))
-      if (rows (arg) == 1)
-        str = tolower (strtrim (arg));
-        switch (str)
-          case "off"
-            delete (hlegend);
-            return;
-          case "hide"
-            show = "off";
-            nargs--;
-          case "show"
-            if (! isempty (hlegend))
-              show = "on";
-            else
-              show = "create";
-              textpos = "right";
-            endif
-            nargs--;
-          case "toggle"
-            if (isempty (hlegend))
-              show = "create";
-              textpos = "right";
-            elseif (strcmp (get (hlegend, "visible"), "off"))
-              show = "on";
-            else
-              show = "off";
-            endif
-            nargs--;
-          case "boxon"
-            box = "on";
-            nargs--;
-          case "boxoff"
-            box = "off";
-            nargs--;
-          case "left"
-            textpos = "left";
-            nargs--;
-          case "right"
-            textpos = "right";
-            nargs--;
-        endswitch
-      else
-        ## Character matrix of labels
-        varargin = cellstr (arg);
-        nargs = numel (varargin);
-      endif
-    elseif (iscellstr (arg))
-      ## Cell array of labels
-      varargin = arg;
-      nargs = numel (varargin);
-    else
-      error ("legend: expecting argument to be a character string");
-    endif
-  elseif (nargs > 1 && iscellstr (varargin{1}))
-    ## Cell array of labels followed by property/value pairs
-    varargin = {varargin{1}{:}, varargin{2:end}};
-    nargs = numel (varargin);
-  endif
-
-  have_labels = (nargs > 0);
-
-  if (strcmp (show, "off"))
-    if (! isempty (hlegend))
-      set (findobj (hlegend), "visible", "off");
-      hlegend = [];
-    endif
-    hobjects = [];
-    hplots  = [];
-    text_strings = {};
-  elseif (strcmp (show, "on"))
-    if (! isempty (hlegend))
-      set (findobj (hlegend), "visible", "on");
-      ## NOTE - Matlab sets both "visible", and "box" to "on"
-      set (hlegend, "visible", get (hlegend, "box"));
-    else
-      hobjects = [];
-      hplots  = [];
-      text_strings = {};
-    endif
-  elseif (strcmp (box, "on"))
-    if (! isempty (hlegend))
-      set (hlegend, "box", "on", "visible", "on");
-    endif
-  elseif (strcmp (box, "off"))
-    if (! isempty (hlegend))
-      set (hlegend, "box", "off", "visible", "off");
-    endif
-  elseif (! have_labels && ! (strcmp (location, "default") &&
-                              strcmp (orientation, "default")))
-    ## Changing location or orientation of existing legend
-    if (! isempty (hlegend))
-      if (strcmp (location, "default"))
-        set (hlegend, "orientation", orientation);
-      elseif (strcmp (orientation, "default"))
-        if (outside)
-          set (hlegend, "location", [location "outside"]);
-        else
-          set (hlegend, "location", location);
-        endif
-      else
-        if (outside)
-          set (hlegend, "location", [location "outside"],
-                        "orientation", orientation);
-        else
-          set (hlegend, "location", location,
-                        "orientation", orientation);
-        endif
-      endif
-    endif
-  else
-    ## Create new legend
-    hobjects = [];
-    hplots  = [];
-    text_strings = {};
-
-    if (have_labels)
-      ## Check for valid data that can be labeled.
-      have_data = false;
-      have_dname = false;
-      for k = 1 : nkids
-        typ = get (kids(k), "type");
-        if (any (strcmp (typ, {"line", "patch", "surface", "hggroup"})))
-          have_data = true;
-          break;
-        endif
-      endfor
-
-      if (! have_data)
-        warning ("legend: plot data is empty; setting key labels has no effect");
-      endif
-    else
-      ## No labels.  Search for DisplayName property.
-      have_dname = false;
-      for k = 1 : nkids
-        hkid = kids(k);
-        typ = get (hkid, "type");
-        if (any (strcmp (typ, {"line", "patch", "surface"})))
-          if (! isempty (get (hkid, "displayname")))
-            have_dname = true;
-            break;
-          endif
-        elseif (strcmp (typ, "hggroup"))
-          hgkids = get (hkid, "children");
-          for j = 1 : length (hgkids)
-            try
-              dname = get (hgkids(j), "DisplayName");
-              if (! isempty (dname))
-                have_dname = true;
-                break;  # break from j-loop over hgkids
-              endif
-            end_try_catch
-          endfor
-          if (have_dname)
-            break;  # break from k loop over nkids
-          endif
-        endif  # elseif hggroup
-      endfor   # for loop k = 1 : nkids
-    endif      # else branch of if (have_labels)
-
-    if (have_labels || ! have_dname)
-      k = nkids;
-      if (! have_labels)
-        varargin = arrayfun (@(x) sprintf ("data%d", x), [1:nkids]',
-                             "uniformoutput", false);
-        have_labels = true;
-        nargs = nkids;
-      endif
-      for i = 1 : nargs
-        arg = varargin{i};
-        if (ischar (arg))
-          typ = get (kids(k), "type");
-          while (k > 0
-                 && ! any (strcmp (typ, {"line","patch","surface","hggroup"})))
-            typ = get (kids(--k), "type");
-          endwhile
-          if (k > 0)
-            if (strcmp (get (kids(k), "type"), "hggroup"))
-              hgkids = get (kids(k), "children");
-              for j = 1 : length (hgkids)
-                hgobj = get (hgkids(j));
-                if (isfield (hgobj, "displayname"))
-                  if (have_labels)
-                    set (hgkids(j), "displayname", arg);
-                  endif
-                  hplots(end+1) = hgkids(j);
-                  text_strings(end+1) = arg;
-                  break;
-                endif
-              endfor
-            else
-              if (have_labels)
-                set (kids(k), "displayname", arg);
-              endif
-              hplots(end+1) = kids(k);
-              text_strings(end+1) = arg;
-            endif
-
-            if (--k == 0)
-              break;
-            endif
-          else
-            break;  # k = 0, no further handles to process
-          endif
-        else
-          error ("legend: expecting argument to be a character string");
-        endif
-      endfor
-      if (have_labels && i < nargs)
-        warning ("legend: ignoring extra labels");
-      endif
-    else
-      ## No labels specified but objects have DisplayName property set.
-      k = nkids;
-      while (k > 0)
-        typ = get (kids(k), "type");
-        while (k > 1
-               && ! any (strcmp (typ, {"line","patch","surface","hggroup"})))
-          typ = get (kids(--k), "type");
-        endwhile
-        if (! any (strcmp (typ, {"line","patch","surface","hggroup"})))
-          break;
-        endif
-        if (k > 0)
-          if (strcmp (get (kids(k), "type"), "hggroup"))
-            hgkids = get (kids(k), "children");
-            for j = 1 : length (hgkids)
-              hgobj = get (hgkids(j));
-              if (isfield (hgobj, "displayname")
-                  && ! isempty (hgobj.displayname))
-                hplots(end+1) = hgkids(j);
-                text_strings(end+1) = hgobj.displayname;
-                break;
-              endif
-            endfor
-          else
-            if (! isempty (get (kids(k), "displayname")))
-              hplots(end+1) = kids(k);
-              text_strings(end+1) = get (kids(k), "displayname");
-            endif
-          endif
-          if (--k == 0)
-            break;
-          endif
-        endif
-      endwhile
-    endif
-
-    if (isempty (hplots))
-      if (! isempty (hlegend))
-        fkids = get (fig, "children");
-        delete (fkids(fkids == hlegend));
-        hlegend = [];
-        hobjects = [];
-        hplots  = [];
-        text_strings = {};
-      endif
-    else
-      ## Preserve the old legend if it exists
-      if (! isempty (hlegend))
-        if (strcmp (textpos, "default"))
-          textpos = get (hlegend, "textposition");
-        endif
-        if (strcmp (location, "default"))
-          location = get (hlegend, "location");
-          inout = strfind (location, "outside");
-          if (! isempty (inout))
-            outside = true;
-            location = location(1:inout-1);
-          else
-            outside = false;
-          endif
-        endif
-        if (strcmp (orientation, "default"))
-          orientation = get (hlegend, "orientation");
-        endif
-        box = get (hlegend, "box");
-      else
-        if (strcmp (textpos, "default"))
-          textpos = "right";
-        endif
-        if (strcmp (location, "default"))
-          location = "northeast";
-        endif
-        if (strcmp (orientation, "default"))
-          orientation = "vertical";
-        endif
-        box = "on";
-      endif
-
-      ## Get axis size and fontsize in points.
-      ## Rely on listener to handle coversion.
-      units = get (ca(1), "units");
-      unwind_protect
-        set (ca(1), "units", "points");
-        set (ca(1), "fontunits", "points");
-        if (isempty (hlegend) || ! isprop (hlegend, "unmodified_axes_position"))
-          unmodified_axes_position = get (ca(1), "position");
-          unmodified_axes_outerposition = get (ca(1), "outerposition");
-        else
-          unmodified_axes_position = get (hlegend, "unmodified_axes_position");
-          unmodified_axes_outerposition = get (hlegend, ...
-                                               "unmodified_axes_outerposition");
-        endif
-        ca_pos = unmodified_axes_position;
-        ca_outpos = unmodified_axes_outerposition;
-        tightinset = get (ca(1), "tightinset");
-        for i = 2 : numel (ca)
-          tightinset = max (tightinset, get (ca(i), "tightinset"));
-        endfor
-      unwind_protect_cleanup
-        set (ca(1), "units", units);
-      end_unwind_protect
-
-      ## Padding between legend entries horizontally and vertically
-      xpad = 2;
-      ypad = 2;
-
-      linelength = 15;
-
-      ## Create the axis first
-      curaxes = get (fig, "currentaxes");
-      unwind_protect
-        ud = ancestor (hplots, "axes");
-        if (! isscalar (ud))
-          ud = unique ([ud{:}]);
-        endif
-        if (isempty (hlegend))
-          addprops = true;
-          hlegend = axes ("tag", "legend", "userdata", struct ("handle", ud),
-                          "box", box,
-                          "xtick", [], "ytick", [],
-                          "xlim", [0, 1], "ylim", [0, 1],
-                          "visible", ifelse (strcmp (box, "on"), "on", "off"),
-                          "activepositionproperty", "position",
-                          "interpreter", "tex");
-          ## Inherit properties from current axis
-          ## "fontunits" shoud be first because it affects interpretation
-          ## of "fontsize" property
-          proplist = {"fontunits", "fontangle", "fontname", "fontsize", ...
-                      "fontweight"};
-          ca_props = get (ca(1), proplist); 
-          set (hlegend, proplist, ca_props);
-        else
-          addprops = false;
-          axes (hlegend);
-          delete (get (hlegend, "children"));
-        endif
-        if (addprops)
-          addproperty ("edgecolor", hlegend, "color", [0, 0, 0]);
-          addproperty ("textcolor", hlegend, "color", [0, 0, 0]);
-          locations = {"north", "south", "east", "west", ...
-                       "{northeast}", "southeast", "northwest", "southwest", ...
-                       "northoutside", "southoutside", ...
-                       "eastoutside", "westoutside", ...
-                       "northeastoutside", "southeastoutside", ...
-                       "northwestoutside", "southwestoutside"};
-          addproperty ("location", hlegend, "radio", strjoin (locations, "|"));
-          addproperty ("orientation", hlegend, "radio",
-                       "{vertical}|horizontal");
-          addproperty ("string", hlegend, "any", text_strings);
-          addproperty ("textposition", hlegend, "radio", "left|{right}");
-        endif
-        ## Inherit visual properties from legend object
-        fontunits = get (hlegend, "fontunits");
-        fontangle = get (hlegend, "fontangle");
-        fontname = get (hlegend, "fontname");
-        fontsize = get (hlegend, "fontsize");
-        fontweight = get (hlegend, "fontweight");
-        interpreter = get (hlegend, "interpreter");
-        textcolor = get (hlegend, "textcolor");
-        ## Add text label to the axis first, checking their extents
-        nentries = numel (hplots);
-        texthandle = [];
-        maxwidth = 0;
-        maxheight = 0;
-        for k = 1 : nentries
-          halign = ifelse (strcmp (textpos, "right"), "left", "right");
-          texthandle(end+1) = text (0, 0, text_strings{k},
-                                    "color", textcolor,
-                                    "horizontalalignment", halign,
-                                    "interpreter", interpreter,
-                                    "fontunits", fontunits,
-                                    "fontangle", fontangle,
-                                    "fontname", fontname,
-                                    "fontsize", fontsize,
-                                    "fontweight", fontweight,
-                                    "userdata", hplots(k));
-          units = get (texthandle(end), "units");
-          unwind_protect
-            set (texthandle(end), "units", "points");
-            extents = get (texthandle(end), "extent");
-            maxwidth = max (maxwidth, extents(3));
-            maxheight = max (maxheight, extents(4));
-          unwind_protect_cleanup
-            set (texthandle(end), "units", units);
-          end_unwind_protect
-        endfor
-
-        num1 = nentries;
-        if (strcmp (orientation, "vertical"))
-          height = nentries * (ypad + maxheight);
-          if (outside)
-            if (height > ca_pos(4))
-              ## Avoid shrinking the height of the axis to zero if outside
-              num1 = ca_pos(4) / (maxheight + ypad) / 2;
-            endif
-          else
-            if (height > 0.9 * ca_pos(4))
-              num1 = 0.9 * ca_pos(4) / (maxheight + ypad);
-            endif
-          endif
-        else
-          width = nentries * (ypad + maxwidth);
-          if (outside)
-            if (width > ca_pos(3))
-              ## Avoid shrinking the width of the axis to zero if outside
-              num1 = ca_pos(3) / (maxwidth + ypad) / 2;
-            endif
-          else
-            if (width > 0.9 * ca_pos(3))
-              num1 = 0.9 * ca_pos(3) / (maxwidth + ypad);
-            endif
-          endif
-        endif
-        num2 = ceil (nentries / num1);
-
-        xstep = 3 * xpad + (maxwidth + linelength);
-        if (strcmp (textpos, "right"))
-          xoffset = xpad;
-          txoffset = 2 * xpad + linelength;
-        else
-          xoffset = 2 * xpad + maxwidth;
-          txoffset = xpad + maxwidth;
-        endif
-        ystep = (ypad + maxheight);
-        yoffset = ystep / 2;
-
-        ## Place the legend in the desired location
-        if (strcmp (orientation, "vertical"))
-          lpos = [0, 0, num2 * xstep, num1 * ystep];
-        else
-          lpos = [0, 0, num1 * xstep, num2 * ystep];
-        endif
-
-        gnuplot = strcmp (get (fig, "__graphics_toolkit__"), "gnuplot");
-        if (gnuplot)
-          ## Gnuplot places the key (legend) at edge of the figure window.
-          ## OpenGL places the legend box at edge of the unmodified axes
-          ## position.
-          if (isempty (strfind (location, "east")))
-            gnuplot_offset = unmodified_axes_outerposition(1) ...
-                           + unmodified_axes_outerposition(3) ...
-                           - unmodified_axes_position(1) ...
-                           - unmodified_axes_position(3);
-          else
-            gnuplot_offset = unmodified_axes_position(1) ...
-                           - unmodified_axes_outerposition(1);
-          endif
-          ## FIXME: The "fontsize" is added to match the behavior of OpenGL.
-          ## This implies that a change in fontsize should trigger a listener
-          ## to update the legend.  The "2" was determined using a long legend
-          ## key in the absence of any subplots.
-          gnuplot_offset = gnuplot_offset - 2 * fontsize;
-        else
-          gnuplot_offset = 0;
-        endif
-
-        ## For legend's outside the associated axes postion,
-        ## align their edge to the unmodified_axes_outerpostion,
-        ## and adjust the axes postion accordingly.
-        switch (location)
-          case "north"
-            if (outside)
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_outpos(2) + ca_outpos(4) - lpos(4) - ypad, lpos(3), ...
-                      lpos(4)];
-
-              new_pos = [ca_pos(1), ca_pos(2), ca_pos(3), ca_pos(4) - lpos(4)];
-            else
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
-            endif
-          case "south"
-            if (outside)
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_outpos(2) + ypad, lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), lpos(2) + lpos(4) + 2 * ypad ...
-                      + tightinset(2), ca_pos(3), ...
-                         ca_pos(4) - lpos(4)];
-            else
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_pos(2) + ypad, lpos(3), lpos(4)];
-            endif
-          case "east"
-            if (outside)
-              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), ca_pos(2), ...
-                         lpos(1) - 2 * xpad - ca_pos(1) - tightinset(3), ...
-                         ca_pos(4)];
-              new_pos(3) = new_pos(3) + gnuplot_offset;
-            else
-              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
-            endif
-          case "west"
-            if (outside)
-              lpos = [ca_outpos(1) + ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, ...
-                      lpos(3), lpos(4)];
-              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
-                         ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
-              new_pos(1) = new_pos(1) - gnuplot_offset;
-              new_pos(3) = new_pos(3) + gnuplot_offset;
-            else
-              lpos = [ca_pos(1) +  ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
-            endif
-          case "northeast"
-            if (outside)
-              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4), lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), ca_pos(2), ...
-                         lpos(1) - 2 * xpad - tightinset(3) - ca_pos(1), ...
-                         ca_pos(4)];
-              new_pos(3) = new_pos(3) + gnuplot_offset;
-            else
-              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
-            endif
-          case "northwest"
-            if (outside)
-              lpos = [ca_outpos(1) + ypad , ca_pos(2) + ca_pos(4) - lpos(4), ...
-                      lpos(3), lpos(4)];
-              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
-              ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
-              new_pos(1) = new_pos(1) - gnuplot_offset;
-              new_pos(3) = new_pos(3) + gnuplot_offset;
-            else
-              lpos = [ca_pos(1) + ypad, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
-            endif
-          case "southeast"
-            if (outside)
-              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
-                      ca_pos(2), lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), ca_pos(2), ...
-                         lpos(1) - 2 * xpad - ca_pos(1) - tightinset(3), ...
-                         ca_pos(4)];
-              new_pos(3) = new_pos(3) + gnuplot_offset;
-            else
-              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + ypad, lpos(3), lpos(4)];
-            endif
-          case "southwest"
-            if (outside)
-              lpos = [ca_outpos(1) + ypad, ca_pos(2), lpos(3), lpos(4)];
-              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
-              ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
-              new_pos(1) = new_pos(1) - gnuplot_offset;
-              new_pos(3) = new_pos(3) + gnuplot_offset;
-            else
-              lpos = [ca_pos(1) + ypad, ca_pos(2) + ypad, lpos(3), lpos(4)];
-            endif
-        endswitch
-
-        units = get (hlegend, "units");
-        unwind_protect
-          set (hlegend, "units", "points");
-          set (hlegend, "position", lpos);
-        unwind_protect_cleanup
-          set (hlegend, "units", units);
-        end_unwind_protect
-
-        ## Now write the line segments and place the text objects correctly
-        xk = 0;
-        yk = 0;
-        for k = 1 : numel (hplots)
-          hobjects(end+1) = texthandle(k);
-          switch (get (hplots(k), "type"))
-
-            case "line"
-              color = get (hplots(k), "color");
-              style = get (hplots(k), "linestyle");
-              if (! strcmp (style, "none"))
-                l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3),
-                           "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4),
-                           "color", color, "linestyle", style,
-                           "marker", "none",
-                           "userdata", hplots(k));
-                hobjects(end+1) = l1;
-              endif
-              marker = get (hplots(k), "marker");
-              if (! strcmp (marker, "none"))
-                l1 = line ("xdata", (xoffset + 0.5 * linelength  + xk * xstep) / lpos(3),
-                           "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4),
-                           "color", color, "linestyle", "none",
-                           "marker", marker,
-                           "markeredgecolor",get (hplots(k), "markeredgecolor"),
-                           "markerfacecolor",get (hplots(k), "markerfacecolor"),
-                           "markersize", get (hplots(k), "markersize"),
-                           "userdata", hplots(k));
-                hobjects(end+1) = l1;
-              endif
-
-              if (addprops)
-                addlistener (hplots(k), "color",
-                             {@updateline, hlegend, linelength, false});
-                addlistener (hplots(k), "linestyle",
-                             {@updateline, hlegend, linelength, false});
-                addlistener (hplots(k), "marker",
-                             {@updateline, hlegend, linelength, false});
-                addlistener (hplots(k), "markeredgecolor",
-                             {@updateline, hlegend, linelength, false});
-                addlistener (hplots(k), "markerfacecolor",
-                             {@updateline, hlegend, linelength, false});
-                addlistener (hplots(k), "markersize",
-                             {@updateline, hlegend, linelength, false});
-                addlistener (hplots(k), "displayname",
-                             {@updateline, hlegend, linelength, true});
-              endif
-
-            case "patch"
-              facecolor = get (hplots(k), "facecolor");
-              edgecolor = get (hplots(k), "edgecolor");
-              cdata = get (hplots(k), "cdata");
-              if (! strcmp (facecolor, "none") || ! strcmp (edgecolor, "none"))
-                p1 = patch ("xdata", ([0, linelength, linelength, 0] +
-                                      xoffset + xk * xstep) / lpos(3),
-                            "ydata", (lpos(4) - yoffset -
-                                      [yk-0.3, yk-0.3, yk+0.3, yk+0.3] .* ystep) / lpos(4),
-                           "facecolor", facecolor, "edgecolor", edgecolor,
-                           "cdata", cdata, "userdata", hplots(k));
-                hobjects(end+1) = p1;
-              endif
-              ## FIXME: Probably need listeners, as for line objects
-
-            case "surface"
-              facecolor = get (hplots(k), "facecolor");
-              edgecolor = get (hplots(k), "edgecolor");
-              cdata = sum (get (ca(1), "clim")) / 2;
-              if (! strcmp (facecolor, "none") || ! strcmp (edgecolor, "none"))
-                p1 = patch ("xdata", ([0, linelength, linelength, 0] +
-                                      xoffset + xk * xstep) / lpos(3),
-                            "ydata", (lpos(4) - yoffset -
-                                      [yk-0.3, yk-0.3, yk+0.3, yk+0.3] .* ystep) / lpos(4),
-                           "facecolor", facecolor, "edgecolor", edgecolor,
-                           "cdata", cdata, "userdata", hplots(k));
-                hobjects(end+1) = p1;
-              endif
-              ## FIXME: Probably need listeners, as for line objects
-
-          endswitch
-
-          set (texthandle(k), "position",
-                              [(txoffset + xk * xstep) / lpos(3), ...
-                               (lpos(4) - yoffset - yk * ystep) / lpos(4)]);
-          if (strcmp (orientation, "vertical"))
-            yk++;
-            if (yk > num1)
-              yk = 0;
-              xk++;
-            endif
-          else
-            xk++;
-            if (xk > num1)
-              xk = 0;
-              yk++;
-            endif
-          endif
-        endfor
-
-        ## Add an invisible text object to original axis
-        ## that when it is destroyed will remove the legend
-        props = {"parent", ca(1), "tag", "legend", ...
-                 "handlevisibility", "off", "visible", "off", ...
-                 "xliminclude", "off", "yliminclude", "off"};
-        t1 = findall (ca(1), "tag", "legend", "type", "text");
-        if (isempty (t1))
-          t1 = text (0, 0, "", props{:});
-          set (t1, "deletefcn", {@deletelegend1, hlegend});
-        endif
-        if (isprop (hlegend, "unmodified_axes_position"))
-          set (hlegend, "unmodified_axes_position",
-                         unmodified_axes_position,
-                        "unmodified_axes_outerposition",
-                         unmodified_axes_outerposition);
-        else
-          addproperty ("unmodified_axes_position", hlegend,
-                       "data", unmodified_axes_position);
-          addproperty ("unmodified_axes_outerposition", hlegend,
-                       "data", unmodified_axes_outerposition);
-        endif
-
-        ## Resize the axis that the legend is attached to if the legend is
-        ## "outside" the plot and create a listener to resize axis to original
-        ## size if the legend is deleted, hidden, or shown.
-        if (outside)
-          for i = 1 : numel (ca)
-            units = get (ca(i), "units");
-            unwind_protect
-              set (ca(i), "units", "points");
-              if (gnuplot && numel (ca) == 1)
-                ## Let Gnuplot handle the positioning of the keybox.
-                ## This violates strict Matlab compatibility, but reliably
-                ## renders an esthetic result.
-                set (ca(i), "position",  unmodified_axes_position);
-                set (ca(i), "activepositionproperty", "outerposition")
-              else
-                ## numel (ca) > 1 for axes overlays (like plotyy)
-                set (ca(i), "position", new_pos);
-              endif
-            unwind_protect_cleanup
-              set (ca(i), "units", units);
-            end_unwind_protect
-          endfor
-
-          set (hlegend, "deletefcn", {@deletelegend2, ca, ...
-                                      unmodified_axes_position, ...
-                                      unmodified_axes_outerposition, ...
-                                      t1, hplots});
-          addlistener (hlegend, "visible", {@hideshowlegend, ca, ...
-                                            unmodified_axes_position, ...
-                                            new_pos});
-        else
-          set (hlegend, "deletefcn", {@deletelegend2, ca, [], [], t1, hplots});
-        endif
-
-        if (! addprops)
-          ## Remove listeners on existing legend temporarily to stop recursion.
-          dellistener (hlegend, "location");
-          dellistener (hlegend, "orientation");
-          dellistener (hlegend, "string");
-          dellistener (hlegend, "textposition");
-        endif
-
-        if (! addprops)
-          set (hlegend, "string", text_strings);
-        endif
-
-        if (outside)
-          set (hlegend, "location", [location "outside"],
-                        "orientation", orientation, "textposition", textpos);
-        else
-          set (hlegend, "location", location, "orientation", orientation,
-                        "textposition", textpos);
-        endif
-
-        if (addprops)
-          addlistener (hlegend, "edgecolor", @updatelegendtext);
-          addlistener (hlegend, "fontangle", @updatelegendtext);
-          addlistener (hlegend, "fontname", @updatelegendtext);
-          addlistener (hlegend, "fontweight", @updatelegendtext);
-          addlistener (hlegend, "textcolor", @updatelegendtext);
-          ## Properties which could change size of box, such as fontsize,
-          ## require legend to be redrawn.
-          addlistener (hlegend, "fontsize", @updatelegend);
-          addlistener (hlegend, "fontunits", @updatelegend);
-          addlistener (hlegend, "interpreter", @updatelegend);
-          addlistener (hlegend, "location", @updatelegend);
-          addlistener (hlegend, "orientation", @updatelegend);
-          addlistener (hlegend, "string", @updatelegend);
-          addlistener (hlegend, "textposition", @updatelegend);
-          ## FIXME: need to add listeners for tightinset and position
-          ##        addlistener (ca, "tightinset", @update????);
-          ##        addlistener (ca, "position", @update????);
-        else
-          ## Restore certain listeners
-          addlistener (hlegend, "location", @updatelegend);
-          addlistener (hlegend, "orientation", @updatelegend);
-          addlistener (hlegend, "string", @updatelegend);
-          addlistener (hlegend, "textposition", @updatelegend);
-        endif
-      unwind_protect_cleanup
-        set (fig, "currentaxes", curaxes);
-      end_unwind_protect
-    endif
-  endif
-
-  if (nargout > 0)
-    hleg = hlegend;
-    hleg_obj = hobjects;
-    hplot = hplots;
-    labels = text_strings;
-  endif
-
-endfunction
-
-function updatelegend (h, ~)
-  persistent recursive = false;
-
-  if (! recursive)
-    recursive = true;
-    unwind_protect
-      hax = getfield (get (h, "userdata"), "handle");
-      [hplots, ~] = __getlegenddata__ (h);
-      position = get (h, "unmodified_axes_position");
-      outerposition = get (h, "unmodified_axes_outerposition");
-      units = get (hax, "units");
-      set (hax, "units", "points");
-      switch (get (hax, "activepositionproperty"))
-        case "position"
-          set (hax, "outerposition", outerposition);
-          set (hax, "position", position);
-        case "outerposition"
-          set (hax, "position", position);
-          set (hax, "outerposition", outerposition);
-      endswitch
-      set (hax, "units", units);
-      h = legend (hax, hplots, get (h, "string"));
-    unwind_protect_cleanup
-      recursive = false;
-    end_unwind_protect
-  endif
-
-endfunction
-
-function updatelegendtext (h, ~)
-  kids = get (h, "children");
-  htext = [];
-  for i = 1:numel (kids)
-    if (strcmp (get (kids(i), "type"), "text"))
-      htext(end+1) = kids(i);
-    endif
-  endfor
-
-  tprops = {"fontangle", "fontname", "fontweight", "color"};
-  lprops = {"fontangle", "fontname", "fontweight", "textcolor"};
-  set (htext, tprops, get (h, lprops));
-
-  ec = get (h, "edgecolor");
-  set (h, "xcolor", ec, "ycolor", ec);
-endfunction
-
-function hideshowlegend (h, ~, ca, pos1, pos2)
-  isvisible = strcmp (get (h, "visible"), "off");
-  if (! isvisible)
-    kids = get (h, "children");
-    if (any (! strcmp (get (kids, "visible"), "off")))
-      isvisible = true;
-    endif
-  endif
-
-  for i = 1 : numel (ca)
-    if (isaxes (ca(i))
-        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
-        && strcmp (get (ca(i), "beingdeleted"), "off"))
-      units = get (ca(i), "units");
-      unwind_protect
-        set (ca(i), "units", "points");
-        if (isvisible)
-          set (ca(i), "position", pos2);
-        else
-          set (ca(i), "position", pos1);
-        endif
-      unwind_protect_cleanup
-        set (ca(i), "units", units);
-      end_unwind_protect
-    endif
-  endfor
-endfunction
-
-function deletelegend1 (h, ~, ca)
-  if (isaxes (ca)
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
-      && strcmp (get (ca, "beingdeleted"), "off"))
-    delete (ca);
-  endif
-endfunction
-
-function deletelegend2 (h, ~, ca, pos, outpos, t1, hplots)
-  for i = 1 : numel (ca)
-    if (isaxes (ca(i))
-        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
-        && strcmp (get (ca(i), "beingdeleted"), "off"))
-      if (! isempty (pos) && ! isempty (outpos))
-        units = get (ca(i), "units");
-        unwind_protect
-          set (ca(i), "units", "points");
-          set (ca(i), "position", pos, "deletefcn", "");
-        unwind_protect_cleanup
-          set (ca(i), "units", units);
-        end_unwind_protect
-      endif
-    endif
-  endfor
-  set (t1, "deletefcn", "");
-  delete (t1);
-  for i = 1 : numel (hplots)
-    if (ishandle (hplots(i)) && strcmp (get (hplots(i), "type"), "line"))
-      dellistener (hplots(i), "color");
-      dellistener (hplots(i), "linestyle");
-      dellistener (hplots(i), "marker");
-      dellistener (hplots(i), "markeredgecolor");
-      dellistener (hplots(i), "markerfacecolor");
-      dellistener (hplots(i), "markersize");
-      dellistener (hplots(i), "displayname");
-    endif
-  endfor
-endfunction
-
-function updateline (h, ~, hlegend, linelength, update_name)
-
-  if (update_name)
-    ## When string changes, have to rebuild legend completely
-    [hplots, text_strings] = __getlegenddata__ (hlegend);
-    legend (hplots, text_strings);
-  else
-    kids = get (hlegend, "children");
-    ll = lm = [];
-    for i = 1 : numel (kids)
-      if (get (kids(i), "userdata") == h
-          && strcmp (get (kids(i), "type"), "line"))
-        if (strcmp (get (kids(i), "marker"), "none"))
-          ll = kids(i);
-        else
-          lm = kids(i);
-        endif
-      endif
-    endfor
-
-    [linestyle, marker, displayname] = ...
-      get (h, {"linestyle", "marker", "displayname"}){:};
-
-    if (! isempty (ll))
-      [xpos1, ypos1] = get (ll, {"xdata", "ydata"}){:};
-      xpos2 = sum (xpos1) / 2;
-      ypos2 = ypos1(1);
-      delete (ll);
-      if (! isempty (lm))
-        delete (lm);
-      endif
-    else
-      [xpos2, ypos2] = get (lm, {"xdata", "ydata"}){:};
-      xpos1 = xpos2 + [-0.5, 0.5] * linelength;
-      ypos1 = [ypos2, ypos2];
-      delete (lm);
-    endif
-
-    if (! strcmp (linestyle, "none"))
-      line ("xdata", xpos1, "ydata", ypos1, "color", get (h, "color"),
-            "linestyle", get (h, "linestyle"), "marker", "none",
-            "userdata", h, "parent", hlegend);
-    endif
-    if (! strcmp (marker, "none"))
-      line ("xdata", xpos2, "ydata", ypos2, "color", get (h, "color"),
-            "marker", marker, "markeredgecolor", get (h, "markeredgecolor"),
-            "markerfacecolor", get (h, "markerfacecolor"),
-            "markersize", get (h, "markersize"), "linestyle", "none",
-            "userdata", h, "parent", hlegend);
-    endif
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! plot (rand (2));
-%! title ('legend called with cellstr and string inputs for labels');
-%! h = legend ({'foo'}, 'bar');
-%! legend location northeastoutside
-%! set (h, 'fontsize', 20);
-
-%!demo
-%! clf;
-%! plot (rand (3));
-%! title ('legend() without inputs creates default labels');
-%! h = legend ();
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! plot (x,x,';I am Blue;', x,2*x, x,3*x,';I am Red;');
-%! legend location northeastoutside
-%! ## Placing legend inside should return axes to original size
-%! legend location northeast
-%! title ('Blue and Red keys, with Green missing');
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('incline is blue and decline is green');
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend hide
-%! legend show
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend with keys in horizontal orientation');
-%! legend ({'I am blue', 'I am green'}, ...
-%!         'location', 'east', 'orientation', 'horizontal');
-%! legend boxoff
-%! legend boxon
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend with box off');
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend boxoff
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend with text to the left of key');
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend left
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ({'Use properties to place legend text to the left of key', ...
-%!         'Legend text color is magenta'});
-%! h = legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend ('right');
-%! set (h, 'textposition', 'left');
-%! set (h, 'textcolor', [1 0 1]);
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend is hidden')
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend hide
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! plot (x,x,';I am Blue;', x,2*x,';I am Green;', x,3*x,';I am Red;');
-%! title ({'Labels are embedded in call to plot', ...
-%!         'Legend is hidden and then shown'});
-%! legend boxon
-%! legend hide
-%! legend show
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! plot (x, x, ';\alpha;',  ...
-%!       x, 2*x, ';\beta=2\alpha;',  ...
-%!       x, 3*x, ';\gamma=3\alpha;');
-%! h = legend ();
-%! set (h, 'interpreter', 'tex');
-%! title ('Labels with interpreted Greek text');
-
-%!demo
-%! clf;
-%! plot (rand (2));
-%! title ('Labels with TeX interpreter turned off');
-%! h = legend ('Hello_World', 'foo^bar');
-%! set (h, 'interpreter', 'none');
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10);
-%! title ('a very long label can sometimes cause problems');
-%! legend ('hello very big world', 'location', 'northeastoutside');
-
-%!demo
-%! clf;
-%! labels = {};
-%! colororder = get (gca, 'colororder');
-%! for i = 1:5
-%!   h = plot (1:100, i + rand (100,1)); hold on;
-%!   set (h, 'color', colororder(i,:));
-%!   labels = {labels{:}, ['Signal ', num2str(i)]};
-%! end
-%! hold off;
-%! title ({'Signals with random offset and uniform noise';
-%!         'Legend shown below and outside of plot'});
-%! xlabel ('Sample Nr [k]'); ylabel ('Amplitude [V]');
-%! legend (labels, 'location', 'southoutside');
-
-%!demo
-%! clf;
-%! x = linspace (0, 10);
-%! plot (x, x);
-%! hold on;
-%! stem (x, x.^2, 'g');
-%! title ('First created object gets first label');
-%! legend ('linear');
-%! hold off;
-
-%!demo
-%! clf;
-%! x = linspace (0, 10);
-%! plot (x, x, x, x.^2);
-%! title ('First created object gets first label');
-%! legend ('linear');
-
-%!demo
-%! clf;
-%! x = linspace (0, 10);
-%! plot (x, x, x, x.^2);
-%! title ('Labels are applied in order of object creation');
-%! legend ('linear', 'quadratic');
-
-%!demo
-%! clf;
-%! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382];
-%! bar (rand_2x3_data1);
-%! ylim ([0 1.0]);
-%! title ('legend() works for bar graphs (hggroups)');
-%! legend ({'1st Bar', '2nd Bar', '3rd Bar'});
-
-%!demo
-%! clf;
-%! rand_2x3_data2 = [0.44804, 0.84368, 0.23012; 0.72311, 0.58335, 0.90531];
-%! bar (rand_2x3_data2);
-%! ylim ([0 1.2]);
-%! title ('legend() works for bar graphs (hggroups)');
-%! legend ('1st Bar', '2nd Bar', '3rd Bar');
-%! legend right;
-
-%!demo
-%! clf;
-%! x = 0:0.1:7;
-%! h = plot (x,sin(x), x,cos(x), x,sin(x.^2/10), x,cos(x.^2/10));
-%! title ('Only the sin() objects have keylabels');
-%! legend (h([1, 3]), {'sin (x)', 'sin (x^2/10)'}, 'location', 'southwest');
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! plot (x, sin (x), ';sin (x);');
-%! hold all;
-%! plot (x, cos (x), ';cos (x);');
-%! hold off;
-%! title ('legend constructed from multiple plot calls');
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! plot (x, sin (x), ';sin (x);');
-%! hold all;
-%! plot (x, cos (x), ';cos (x);');
-%! hold off;
-%! title ('Specified label text overrides previous labels');
-%! legend ({'Sine', 'Cosine'}, 'location', 'northeastoutside');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! plot (x, rand (11));
-%! xlabel ('Indices');
-%! ylabel ('Random Values');
-%! title ('Legend ''off'' deletes the legend');
-%! legend (cellstr (num2str ((1:10)')), 'location', 'northeastoutside');
-%! legend off;
-%! axis ([0, 10, 0 1]);
-
-%!demo
-%! clf;
-%! x = (1:5)';
-%! subplot (2,2,1);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'northwestoutside');
-%! subplot (2,2,2);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'northeastoutside');
-%! subplot (2,2,3);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'southwestoutside');
-%! subplot (2,2,4);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'southeastoutside');
-
-%!demo
-%! clf;
-%! plot (rand (2));
-%! title ('legend() will warn if extra labels are specified');
-%! legend ('Hello', 'World', 'interpreter', 'foobar');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! y1 = rand (size (x));
-%! y2 = rand (size (x));
-%! [ax, h1, h2] = plotyy (x, y1, x, y2);
-%! title ('plotyy legend test #1: Blue and Green labels');
-%! legend ([h1, h2], {'Blue', 'Green'}, 'location', 'south');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! y1 = rand (size (x));
-%! y2 = rand (size (x));
-%! [ax, h1, h2] = plotyy (x, y1, x, y2);
-%! title ('plotyy legend test #2: Blue and Green labels');
-%! legend ({'Blue', 'Green'}, 'location', 'south');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! y1 = rand (size (x));
-%! y2 = rand (size (x));
-%! [ax, h1, h2] = plotyy (x, y1, x, y2);
-%! title ('plotyy legend test #3: Blue and Green labels');
-%! legend ('Blue', 'Green', 'location', 'south');
-
-%!demo % bug 36408
-%! clf;
-%! option = 'right';
-%! subplot (3,1,1);
-%!  plot (rand (1,4));
-%!  xlabel xlabel;
-%!  ylabel ylabel;
-%!  title ('Subplots should adjust to the legend placed outside');
-%!  legend ({'1'}, 'location', 'northeastoutside');
-%!  legend (option);
-%! subplot (3,1,2);
-%!  plot (rand (1,4));
-%!  xlabel xlabel;
-%!  ylabel ylabel;
-%!  legend ({'1234567890'}, 'location', 'eastoutside');
-%!  legend (option);
-%! subplot (3,1,3);
-%!  plot (rand (1,4));
-%!  xlabel xlabel;
-%!  ylabel ylabel;
-%!  legend ({'12345678901234567890'}, 'location', 'southeastoutside');
-%!  legend (option);
-
-%!demo % bug 36408
-%! clf;
-%! option = 'right';
-%! subplot (3,1,1);
-%!  plot (rand (1,4));
-%!  title ('Subplots should adjust to the legend placed outside');
-%!  legend ({'1'}, 'location', 'northwestoutside');
-%!  legend (option);
-%! subplot (3,1,2);
-%!  plot (rand (1,4));
-%!  legend ({'1234567890'}, 'location', 'westoutside');
-%!  legend (option);
-%! subplot (3,1,3);
-%!  plot (rand (1,4));
-%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
-%!  legend (option);
-
-%!demo % bug 36408
-%! clf;
-%! option = 'right';
-%! subplot (3,1,1);
-%!  plot (rand (1,4));
-%!  set (gca (), 'yaxislocation', 'right');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  title ('Subplots should adjust to the legend placed outside');
-%!  legend ({'1'}, 'location', 'northeastoutside');
-%!  legend (option);
-%! subplot (3,1,2);
-%!  plot (rand (1,4));
-%!  set (gca (), 'yaxislocation', 'right');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  legend ({'1234567890'}, 'location', 'eastoutside');
-%!  legend (option);
-%! subplot (3,1,3);
-%!  plot (rand (1,4));
-%!  set (gca (), 'yaxislocation', 'right');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  legend ({'12345678901234567890'}, 'location', 'southeastoutside');
-%!  legend (option);
-
-%!demo % bug 36408
-%! clf;
-%! option = 'right';
-%! subplot (3,1,1);
-%!  plot (rand (1,4));
-%!  set (gca (), 'yaxislocation', 'right');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  title ('Subplots should adjust to the legend placed outside');
-%!  legend ({'1'}, 'location', 'northwestoutside');
-%!  legend (option);
-%! subplot (3,1,2);
-%!  plot (rand (1,4));
-%!  set (gca (), 'yaxislocation', 'right');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  legend ({'1234567890'}, 'location', 'westoutside');
-%!  legend (option);
-%! subplot (3,1,3);
-%!  plot (rand (1,4));
-%!  set (gca (), 'yaxislocation', 'right');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
-%!  legend (option);
-
-%!demo % bug 36408;
-%! clf;
-%! option = 'right';
-%! subplot (3,1,1);
-%!  plot (rand (1,4));
-%!  set (gca (), 'xaxislocation', 'top');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  title ('Subplots should adjust to the legend placed outside');
-%!  legend ({'1'}, 'location', 'northwestoutside');
-%!  legend (option);
-%! subplot (3,1,2);
-%!  plot (rand (1,4));
-%!  set (gca (), 'xaxislocation', 'top');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  legend ({'1234567890'}, 'location', 'westoutside');
-%!  legend (option);
-%! subplot (3,1,3);
-%!  plot (rand (1,4));
-%!  set (gca (), 'xaxislocation', 'top');
-%!  xlabel ('xlabel');
-%!  ylabel ('ylabel');
-%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
-%!  legend (option);
-
-%!demo % bug 39697
-%! clf;
-%! plot (1:10);
-%! legend ('Legend Text');
-%! title ({'Multi-line', 'titles', 'are a', 'problem'});
-
-%!demo
-%! clf;
-%! colormap (cool (64));
-%! surf (peaks ());
-%! legend ('peaks()')
-%! title ('legend() works for surface objects too');
-
-%!test
-%! toolkit = graphics_toolkit ("gnuplot");
-%! h = figure ("visible", "off");
-%! unwind_protect
-%!   position = get (h, "position");
-%!   plot (rand (3));
-%!   legend ();
-%!   filename = sprintf ("%s.eps", tmpnam ());
-%!   print (filename);
-%!   unlink (filename);
-%!   assert (get (h, "position"), position);
-%! unwind_protect_cleanup
-%!   close (h);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
--- a/scripts/plot/line.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} line ()
-## @deftypefnx {Function File} {} line (@var{x}, @var{y})
-## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} line (@var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} line (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} line (@dots{})
-## Create line object from @var{x} and @var{y} (and possibly @var{z}) and
-## insert in the current axes.
-##
-## Multiple property-value pairs may be specified for the line object, but they
-## must appear in pairs.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle (or vector of handles)
-## to the line objects created.
-##
-## @seealso{image, patch, rectangle, surface, text}
-## @end deftypefn
-
-## Author: jwe
-
-function h = line (varargin)
-
-  ## Get axis argument which may be in a 'parent' PROP/VAL pair
-  [hax, varargin] = __plt_get_axis_arg__ ("line", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-
-  htmp = __line__ (hax, varargin{:});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf
-%! x = 0:0.3:10;
-%! y1 = cos (x);
-%! y2 = sin (x);
-%! subplot (3,1,1);
-%!  args = {'color', 'b', 'marker', 's'};
-%!  line ([x(:), x(:)], [y1(:), y2(:)], args{:});
-%!  title ('Test broadcasting for line()');
-%! subplot (3,1,2);
-%!  line (x(:), [y1(:), y2(:)], args{:});
-%! subplot (3,1,3);
-%!  line ([x(:), x(:)+pi/2], y1(:), args{:});
-%!  xlim ([0 10]);
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = line;
-%!   assert (findobj (hf, "type", "line"), h);
-%!   assert (get (h, "xdata"), [0 1], eps);
-%!   assert (get (h, "ydata"), [0 1], eps);
-%!   assert (get (h, "type"), "line");
-%!   assert (get (h, "color"), get (0, "defaultlinecolor"));
-%!   assert (get (h, "linestyle"), get (0, "defaultlinelinestyle"));
-%!   assert (get (h, "linewidth"), get (0, "defaultlinelinewidth"), eps);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/linkprop.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{hlink} =} linkprop (@var{h}, @var{prop})
-## @deftypefnx {Function File} {@var{hlink} =} linkprop (@var{h}, @{@var{prop1}, @var{prop2}, @dots{}@})
-## Link graphics object properties, such that a change in one is
-## propagated to the others.
-##
-## @var{prop} can be a string for a single property, or a cell array of strings
-## for multiple properties.  @var{h} is an array of graphics handles which
-## will have their properties linked.
-##
-## An example of the use of @code{linkprop} is
-##
-## @example
-## @group
-## x = 0:0.1:10;
-## subplot (1,2,1);
-## h1 = plot (x, sin (x));
-## subplot (1,2,2);
-## h2 = plot (x, cos (x));
-## hlink = linkprop ([h1, h2], @{"color","linestyle"@});
-## set (h1, "color", "green");
-## set (h2, "linestyle", "--");
-## @end group
-## @end example
-##
-## @end deftypefn
-
-function hlink = linkprop (h, prop)
-  if (ischar (prop))
-    prop = {prop};
-  elseif (!iscellstr (prop))
-    error ("linkprop: properties must be a string or cell string array");
-  endif
-
-  for i = 1 : numel (h)
-    for j = 1 : numel (prop)
-      addlistener (h(i), prop{j}, {@update_prop, h, prop{j}});
-    endfor
-  endfor
-
-  ## This should be an object that when destroyed removes the links
-  ## The below is not quite right. As when you call "clear hlink" the
-  ## hggroup continues to exist.
-  hlink = hggroup ();
-  set (hlink, "deletefcn", {@delete_prop, h, prop});
-endfunction
-
-function update_prop (h, d, hlist, prop)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      val = get (h, prop);
-      for hh = hlist(:)'
-        if (hh != h)
-          oldval = get (hh, prop);
-          if (! isequal (val, oldval))
-            set (hh, prop, val);
-          endif
-        endif
-      endfor
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function delete_prop (h, d, hlist, prop)
-  ## FIXME. Actually need to delete the linked properties.
-  ## However, only warn if the graphics objects aren't being deleted.
-  warn = false;
-  for h = hlist(:)'
-    if (ishandle (h) && !strcmpi (get (h, "beingdeleted"), "on"))
-      warn = true;
-      break;
-    endif
-  endfor
-  if (warn)
-    warning ("linkprop: can not remove linked properties");
-  endif
-endfunction
-
--- a/scripts/plot/loglog.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} loglog (@var{y})
-## @deftypefnx {Function File} {} loglog (@var{x}, @var{y})
-## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{prop}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} loglog (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} loglog (@dots{})
-## Produce a 2-D plot using logarithmic scales for both axes.
-##
-## See the documentation of @code{plot} for a description of the arguments
-## that @code{loglog} will accept.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{plot, semilogx, semilogy}
-## @end deftypefn
-
-## Author: jwe
-
-function h = loglog (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    set (hax, "xscale", "log", "yscale", "log");
-    if (! ishold (hax))
-      set (hax, "xminortick", "on", "yminortick", "on");
-    endif
-
-    htmp = __plt__ ("loglog", hax, varargin{:});
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t = 1:0.01:10;
-%! x = sort ((t .* (1 + rand (size (t)))) .^ 2);
-%! y = (t .* (1 + rand (size (t)))) .^ 2;
-%! loglog (x, y);
-%! title ({'loglog() plot', 'Both axes are logarithmic'});
-
-%!demo
-%! clf;
-%! a = logspace (-5, 1, 10);
-%! b =-logspace (-5, 1, 10);
-%!
-%! subplot (1,2,1);
-%!  loglog (a, b);
-%!  xlabel ('loglog (a, b)');
-%!
-%! subplot (1,2,2);
-%!  loglog (a, abs (b));
-%!  set (gca, 'ydir', 'reverse');
-%!  xlabel ('loglog (a, abs (b))');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   loglog (a, b);
-%!   assert (get (gca, "yscale"), "log");
-%!   assert (get (gca, "xscale"), "log");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b =-logspace (-5, 1, 10);
-%!   loglog (a, b);
-%!   axis tight;
-%!   assert (all (get (gca, "ytick") < 0));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/loglogerr.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} loglogerr (@var{args})
-## @deftypefnx {Function File} {} loglogerr (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} loglogerr (@dots{})
-## Produce 2-D plots on a double logarithm axis with errorbars.
-##
-## Many different combinations of arguments are possible.  The most common
-## form is
-##
-## @example
-## loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
-## @end example
-##
-## @noindent
-## which produces a double logarithm plot of @var{y} versus @var{x}
-## with errors in the @var{y}-scale defined by @var{ey} and the plot
-## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
-## formats and additional information.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-## @seealso{errorbar, semilogxerr, semilogyerr}
-## @end deftypefn
-
-## Created: 20.2.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function h = loglogerr (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    set (hax, "xscale", "log", "yscale", "log");
-    if (! ishold (hax))
-      set (hax, "xminortick", "on", "yminortick", "on");
-    endif
-    htmp = __errcomm__ ("loglogerr", hax, varargin{:});
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = exp (log (0.01):0.2:log (10));
-%! y = wblpdf (x, 3, 2);
-%! eyu = 2*rand (size (y)) .* y;
-%! eyl = 0.5*rand (size (y)) .* y;
-%! loglogerr (x, y, eyl, eyu, '#~x-');
-%! xlim (x([1, end]));
-%! title ({'loglogerr(): loglog() plot with errorbars', ...
-%!         'Both axes are logarithmic'});
-
--- a/scripts/plot/mesh.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} mesh (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} mesh (@var{z})
-## @deftypefnx {Function File} {} mesh (@dots{}, @var{c})
-## @deftypefnx {Function File} {} mesh (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} mesh (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} mesh (@dots{})
-## Plot a 3-D wireframe mesh.
-##
-## The wireframe mesh is plotted using rectangles.  The vertices of the
-## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
-## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If only a single @var{z} matrix is
-## given, then it is plotted over the meshgrid
-## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
-## Thus, columns of @var{z} correspond to different @var{x} values and rows
-## of @var{z} correspond to different @var{y} values.
-##
-## The color of the mesh is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally, the color of the mesh can be specified independently of @var{z}
-## by supplying a color matrix, @var{c}.
-##
-## Any property/value pairs are passed directly to the underlying surface
-## object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## @seealso{ezmesh, meshc, meshz, trimesh, contour, surf, surface, meshgrid, hidden, shading, colormap, caxis}
-## @end deftypefn
-
-## Author: jwe
-
-function h = mesh (varargin)
-
-  if (! all (cellfun ("isreal", varargin)))
-    error ("mesh: X, Y, Z, C arguments must be real");
-  endif
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("mesh", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    htmp = surface (varargin{:});
-
-    set (htmp, "facecolor", "w");
-    set (htmp, "edgecolor", "flat");
-    if (! ishold ())
-      set (hax, "view", [-37.5, 30],
-                "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = logspace (0,1,11);
-%! z = x'*x;
-%! mesh (x, x, z);
-%! xlabel 'X-axis';
-%! ylabel 'Y-axis';
-%! zlabel 'Z-axis';
-%! title ('mesh() with color proportional to height');
-
-%!demo
-%! clf;
-%! x = logspace (0,1,11);
-%! z = x'*x;
-%! mesh (x, x, z, z.^2);
-%! xlabel 'X-axis';
-%! ylabel 'Y-axis';
-%! zlabel 'linear scale';
-%! title ('mesh() with color proportional to Z^2');
-
-%!demo
-%! clf;
-%! x = logspace (0,1,11);
-%! z = x'*x;
-%! mesh (x, x, z, z.^2);
-%! set (gca, 'zscale', 'log');
-%! xlabel 'X-axis';
-%! ylabel 'Y-axis';
-%! zlabel 'log scale';
-%! title ({'mesh() with color proportional to Z^2', 'Z-axis is log scale'});
-%! if (strcmp (get (gcf, '__graphics_toolkit__'), 'gnuplot'))
-%!   title ({'Gnuplot: mesh color is wrong', 'This is a Gnuplot bug'});
-%! endif
-
--- a/scripts/plot/meshc.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} meshc (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} meshc (@var{z})
-## @deftypefnx {Function File} {} meshc (@dots{}, @var{c})
-## @deftypefnx {Function File} {} meshc (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} meshc (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} meshc (@dots{})
-## Plot a 3-D wireframe mesh with underlying contour lines.
-##
-## The wireframe mesh is plotted using rectangles.  The vertices of the
-## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
-## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If only a single @var{z} matrix is
-## given, then it is plotted over the meshgrid
-## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
-## Thus, columns of @var{z} correspond to different @var{x} values and rows
-## of @var{z} correspond to different @var{y} values.
-## 
-## The color of the mesh is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally the color of the mesh can be specified independently of @var{z}
-## by supplying a color matrix, @var{c}.
-##
-## Any property/value pairs are passed directly to the underlying surface
-## object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a 2-element vector with a graphics
-## handle to the created surface object and to the created contour plot.
-##
-## @seealso{ezmeshc, mesh, meshz, contour, surfc, surface, meshgrid, hidden, shading, colormap, caxis}
-## @end deftypefn
-
-function h = meshc (varargin)
-
-  if (! all (cellfun ("isreal", varargin)))
-    error ("meshc: X, Y, Z, C arguments must be real");
-  endif
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshc", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    htmp = surface (varargin{:});
-
-    ## FIXME - gnuplot does not support a filled surface and a
-    ## non-filled contour.  3D filled patches are also not supported.
-    ## Thus, the facecolor will be transparent for the gnuplot backend.
-    set (htmp, "facecolor", "w");
-    set (htmp, "edgecolor", "flat");
-    if (! ishold ())
-      set (hax, "view", [-37.5, 30],
-                "xgrid", "on", "ygrid", "on", "zgrid", "on",
-                "xlimmode", "manual", "ylimmode", "manual");
-    endif
-
-    drawnow ();
-
-    zmin = get (hax, "zlim")(1);
-    [~, htmp2] = __contour__ (hax, zmin, varargin{:});
-
-    htmp = [htmp; htmp2];
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X, Y] = meshgrid (linspace (-3, 3, 40));
-%! Z = sqrt (abs (X .* Y)) ./ (1 + X.^2 + Y.^2);
-%! meshc (X, Y, Z);
-%! title ('meshc() combines mesh/contour plots');
-
--- a/scripts/plot/meshgrid.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}, @var{y})
-## @deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x})
-## @deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x})
-## Given vectors of @var{x} and @var{y} coordinates, return matrices @var{xx}
-## and @var{yy} corresponding to a full 2-D grid.
-##
-## The rows of @var{xx} are copies of @var{x}, and the columns of @var{yy} are
-## copies of @var{y}.  If @var{y} is omitted, then it is assumed to be the same
-## as @var{x}.
-##
-## If the optional @var{z} input is given, or @var{zz} is requested, then the
-## output will be a full 3-D grid.
-##
-## @code{meshgrid} is most frequently used to produce input for a 2-D or 3-D
-## function that will be plotted.  The following example creates a surface
-## plot of the ``sombrero'' function.
-##
-## @example
-## @group
-## f = @@(x,y) sin (sqrt (x.^2 + y.^2)) ./ sqrt (x.^2 + y.^2);
-## range = linspace (-8, 8, 41);
-## [@var{X}, @var{Y}] = meshgrid (range, range);  
-## Z = f (X, Y);
-## surf (X, Y, Z);
-## @end group
-## @end example
-##
-## Programming Note: @code{meshgrid} is restricted to 2-D or 3-D grid
-## generation.  The @code{ndgrid} function will generate 1-D through N-D
-## grids.  However, the functions are not completely equivalent.  If @var{x}
-## is a vector of length M and @var{y} is a vector of length N, then
-## @code{meshgrid} will produce an output grid which is NxM@.  @code{ndgrid}
-## will produce an output which is @nospell{MxN} (transpose) for the same
-## input.  Some core functions expect @code{meshgrid} input and others expect
-## @code{ndgrid} input.  Check the documentation for the function in question
-## to determine the proper input format.
-## @seealso{ndgrid, mesh, contour, surf}
-## @end deftypefn
-
-## Author: jwe
-
-function [xx, yy, zz] = meshgrid (x, y, z)
-
-  if (nargin == 0 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin < 2)
-    y = x;
-  endif
-
-  ## Use repmat to ensure that result values have the same type as the inputs
-
-  if (nargout < 3)
-    if (! (isvector (x) && isvector (y)))
-      error ("meshgrid: X and Y must be vectors");
-    endif
-    xx = repmat (x(:).', length (y), 1);
-    yy = repmat (y(:), 1, length (x));
-  else
-    if (nargin < 3)
-      z = y;
-    endif
-    if (! (isvector (x) && isvector (y) && isvector (z)))
-      error ("meshgrid: X, Y, and Z must be vectors");
-    endif
-    lenx = length (x);
-    leny = length (y);
-    lenz = length (z);
-    xx = repmat (repmat (x(:).', leny, 1), [1, 1, lenz]);
-    yy = repmat (repmat (y(:), 1, lenx), [1, 1, lenz]);
-    zz = reshape (repmat (z(:).', lenx*leny, 1)(:), leny, lenx, lenz);
-  endif
-
-endfunction
-
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! z = 1:4;
-%! [XX, YY, ZZ] = meshgrid (x, y, z);
-%! assert (size_equal (XX, YY, ZZ));
-%! assert (ndims (XX), 3);
-%! assert (size (XX), [3, 2, 4]);
-%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
-%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! [XX, YY] = meshgrid (x, y);
-%! assert (size_equal (XX, YY));
-%! assert (ndims (XX), 2);
-%! assert (size (XX), [3, 2]);
-%! assert (XX(1) * YY(1), x(1) * y(1));
-%! assert (XX(end) * YY(end), x(end) * y(end));
-
-%!test
-%! x = 1:3;
-%! [XX1, YY1] = meshgrid (x, x);
-%! [XX2, YY2] = meshgrid (x);
-%! assert (size_equal (XX1, XX2, YY1, YY2));
-%! assert (ndims (XX1), 2);
-%! assert (size (XX1), [3, 3]);
-%! assert (XX1, XX2);
-%! assert (YY1, YY2);
-
-%% Test input validation
-%!error meshgrid ()
-%!error meshgrid (1,2,3,4)
-%!error <X and Y must be vectors> meshgrid (ones (2,2), 1:3)
-%!error <X and Y must be vectors> meshgrid (1:3, ones (2,2))
-%!error <X, Y, and Z must be vectors> [X,Y,Z] = meshgrid (1:3, 1:3, ones (2,2))
-
--- a/scripts/plot/meshz.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} meshz (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} meshz (@var{z})
-## @deftypefnx {Function File} {} meshz (@dots{}, @var{c})
-## @deftypefnx {Function File} {} meshz (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} meshz (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} meshz (@dots{})
-## Plot a 3-D wireframe mesh with a surrounding curtain.
-##
-## The wireframe mesh is plotted using rectangles.  The vertices of the
-## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
-## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If only a single @var{z} matrix is
-## given, then it is plotted over the meshgrid
-## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
-## Thus, columns of @var{z} correspond to different @var{x} values and rows
-## of @var{z} correspond to different @var{y} values.
-##
-## The color of the mesh is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally the color of the mesh can be specified independently of @var{z}
-## by supplying a color matrix, @var{c}.
-##
-## Any property/value pairs are passed directly to the underlying surface
-## object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## @seealso{mesh, meshc, contour, surf, surface, waterfall, meshgrid, hidden, shading, colormap, caxis}
-## @end deftypefn
-
-function h = meshz (varargin)
-
-  if (! all (cellfun ("isreal", varargin)))
-    error ("meshz: X, Y, Z, C arguments must be real");
-  endif
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshz", varargin{:});
-
-  ## Find where property/value pairs start
-  charidx = find (cellfun ("isclass", varargin, "char"), 1);
-
-  have_c = false;
-  if (isempty (charidx))
-    if (nargin == 2 || nargin == 4) 
-      have_c = true;
-      charidx = nargin;   # bundle C matrix back into varargin 
-    else
-      charidx = nargin + 1;
-    endif
-  endif
-
-  if (charidx == 2)
-    z = varargin{1};
-    [m, n] = size (z);
-    x = 1:n;
-    y = (1:m).';
-  else
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-  endif
-
-  if (isvector (x) && isvector (y))
-    x = [x(1), x(:).', x(end)];
-    y = [y(1); y(:); y(end)];
-  else
-    x = [x(1,1), x(1,:), x(1,end);
-         x(:,1), x, x(:,end);
-         x(end,1), x(end,:), x(end,end)];
-    y = [y(1,1), y(1,:), y(1,end);
-         y(:,1), y, y(:,end);
-         y(end,1), y(end,:), y(end,end)];
-  endif
-
-  zref = min (z(isfinite (z)));
-  z = [zref .* ones(1, columns(z) + 2);
-       zref .* ones(rows(z), 1), z, zref .* ones(rows(z), 1);
-       zref .* ones(1, columns(z) + 2)];
-
-  if (have_c)
-    c = varargin{charidx};
-    cref = min (c(isfinite (c)));
-    c = [cref .* ones(1, columns(c) + 2);
-         cref .* ones(rows(c), 1), c, cref .* ones(rows(c), 1);
-         cref .* ones(1, columns(c) + 2)];
-    varargin(charidx) = c;
-  endif
-    
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    htmp = mesh (x, y, z, varargin{charidx:end});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = peaks ();
-%! meshz (Z);
-%! title ('meshz() plot of peaks() function');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = peaks ();
-%! subplot (1,2,1)
-%!  mesh (Z);
-%!  daspect ([2.5, 2.5, 1]);
-%!  title ('mesh() plot');
-%! subplot (1,2,2)
-%!  meshz (Z);
-%!  daspect ([2.5, 2.5, 1]);
-%!  title ('meshz() plot');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X,Y,Z] = peaks ();
-%! [fx, fy] = gradient (Z); 
-%! C = sqrt (fx.^2 + fy.^2);
-%! meshz (X,Y,Z,C);
-%! title ('meshz() plot with color determined by gradient');
-
--- a/scripts/plot/ndgrid.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-## Copyright (C) 2006-2012 Alexander Barth
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x1}, @var{x2}, @dots{}, @var{x}n)
-## @deftypefnx {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x})
-## Given n vectors @var{x1}, @dots{}, @var{x}n, @code{ndgrid} returns
-## n arrays of dimension n.  The elements of the i-th output argument
-## contains the elements of the vector @var{x}i repeated over all
-## dimensions different from the i-th dimension.  Calling ndgrid with
-## only one input argument @var{x} is equivalent to calling ndgrid with
-## all n input arguments equal to @var{x}:
-##
-## [@var{y1}, @var{y2}, @dots{}, @var{y}n] = ndgrid (@var{x}, @dots{}, @var{x})
-##
-## Programming Note: @code{ndgrid} is very similar to the function
-## @code{meshgrid} except that the first two dimensions are transposed in
-## comparison to @code{meshgrid}.  Some core functions expect @code{meshgrid}
-## input and others expect @code{ndgrid} input.  Check the documentation for
-## the function in question to determine the proper input format.
-## @seealso{meshgrid}
-## @end deftypefn
-
-## Author: Alexander Barth <abarth@marine.usf.edu>
-
-function varargout = ndgrid (varargin)
-
-  if (nargin == 0)
-    print_usage ();
-  elseif (nargin == 1)
-    n = max ([nargout, 1]);
-    ## If only one input argument is given, repeat it n-times
-    varargin(1:n) = varargin(1);
-  elseif (nargin >= nargout)
-    n = max ([nargin, 1]);
-  else
-    error ("ndgrid: wrong number of input arguments");
-  endif
-
-  ## Determine the size of the output arguments
-
-  shape = zeros (1, n);
-  for i = 1:n
-    if (! isvector (varargin{i}) && ! isempty (varargin{i}))
-      error ("ndgrid: arguments must be vectors");
-    endif
-    shape(i) = length (varargin{i});
-  endfor
-
-  for i = 1:n
-    ## size for reshape
-    r = ones (1, n);
-    r(i) = shape(i);
-
-    ## size for repmat
-    s = shape;
-    s(i) = 1;
-
-    varargout{i} = repmat (reshape (varargin{i}, r), s);
-  endfor
-
-endfunction
-
-
-%!test
-%! x = 1:3;
-%! assert (isequal (ndgrid (x), x(:)));
-
-%!test
-%! x = 1:3;
-%! [XX, YY] = ndgrid (x);
-%! assert (size_equal (XX, YY));
-%! assert (isequal (XX, repmat(x(:), 1, numel(x))));
-%! assert (isequal (YY, repmat(x, numel(x), 1)));
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! z = 1:4;
-%! [XX, YY, ZZ] = ndgrid (x, y, z);
-%! assert (size_equal (XX, YY, ZZ));
-%! assert (ndims (XX), 3);
-%! assert (size (XX), [2, 3, 4]);
-%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
-%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! [XX1, YY1] = meshgrid (x, y);
-%! [XX2, YY2] = ndgrid (x, y);
-%! assert (size_equal (XX1, YY1));
-%! assert (size_equal (XX2, YY2));
-%! assert (ndims (XX1), 2);
-%! assert (size (XX1), [3, 2]);
-%! assert (size (XX2), [2, 3]);
-%! assert (XX2(1) * YY2(1), x(1) * y(1));
-%! assert (XX2(end) * YY2(end), x(end) * y(end));
-%! assert (XX1, XX2.');
-%! assert (YY1, YY2.');
-
-%!assert (ndgrid ([]), zeros(0,1))
-%!assert (ndgrid ([], []), zeros(0,0))
-
-%% Test input validation
-%!error ndgrid ()
-%!error <wrong number of input arguments> [a,b,c] = ndgrid (1:3,1:3)
-%!error <arguments must be vectors> ndgrid (ones (2,2))
-
--- a/scripts/plot/newplot.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} newplot ()
-## @deftypefnx {Function File} {} newplot (@var{hfig})
-## @deftypefnx {Function File} {} newplot (@var{hax})
-## @deftypefnx {Function File} {@var{hax} =} newplot (@dots{})
-## Prepare graphics engine to produce a new plot.
-##
-## This function is called at the beginning of all high-level plotting
-## functions.  It is not normally required in user programs.  @code{newplot}
-## queries the @qcode{"NextPlot"} field of the current figure and axis to
-## determine what to do.
-##
-## @multitable @columnfractions .25 .75
-## @headitem Figure NextPlot @tab Action
-## @item @qcode{"new"} @tab Create a new figure and make it the current figure.
-##
-## @item @qcode{"add"} (default) @tab Add new graphic objects to the current figure.
-##
-## @item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
-## set to @qcode{"on"}.  Set NextPlot property to @qcode{"add"}.  This
-## typically clears a figure, but leaves in place hidden objects such as
-## menubars.  This is equivalent to @code{clf}.
-##
-## @item @qcode{"replace"} @tab Delete all child objects of the figure and
-## reset all figure properties to their defaults.  However, the following
-## four properties are not reset: Position, Units, PaperPosition, PaperUnits.
-##  This is equivalent to @code{clf reset}.
-## @end multitable
-##
-## @multitable @columnfractions .25 .75
-## @headitem Axis NextPlot @tab Action
-## @item @qcode{"add"} @tab Add new graphic objects to the current axes.  This is
-## equivalent to @code{hold on}.
-##
-## @item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
-## set to @qcode{"on"}, but leave axis properties unmodified.  This typically
-## clears a plot, but preserves special settings such as log scaling for
-## axes.  This is equivalent to @code{cla}.
-##
-## @item @qcode{"replace"} (default) @tab Delete all child objects of the
-## axis and reset all axis properties to their defaults.  However, the
-## following properties are not reset: Position, Units.  This is equivalent
-## to @code{cla reset}.
-## @end multitable
-##
-## If the optional input @var{hfig} or @var{hax} is given then prepare the
-## specified figure or axes rather than the current figure and axes.
-##
-## The optional return value @var{hax} is a graphics handle to the created
-## axes object (not figure).
-##
-## @strong{Caution:} Calling @code{newplot} may change the current figure and
-## current axis.
-## @end deftypefn
-
-## FIXME: The Matlab function takes an optional list of file handles, hsave,
-##        which are not deleted when the figure and axes are prepared.
-##        I'm sure there is a good reason for that, but coding such
-##        compatibility is really tricky and doesn't serve much purpose since
-##        newplot is nearly exclusively used by Octave's internal plotting
-##        functions.  In Octave's case the argument is almost always null,
-##        or occasionally the axis handle to plot into.
-
-function hax = newplot (hsave = [])
-
-  if (nargin > 1)
-    print_usage ();
-  endif
-
-  cf = [];
-  ca = [];
-
-  if (! isempty (hsave))
-    ## Find the first valid axes 
-    ca = ancestor (hsave, "axes", "toplevel"); 
-    ca = ca(find (ca, 1));
-    ## Next, find the figure associated with any axis found
-    if (! isempty (ca))
-      cf = ancestor (ca, "figure", "toplevel");
-    else
-      cf = ancestor (hsave, "figure", "toplevel"); 
-      cf = cf(find (cf, 1));
-    endif
-  endif
-
-  if (isempty (cf))
-    ## get current figure, or create a new one if necessary
-    cf = gcf ();
-  else
-    ## switch to figure provided without causing other updates
-    set (0, "currentfigure", cf);
-  endif
-
-  fnp = get (cf, "nextplot");
-  switch (fnp)
-    case "add"
-      ## Default case.  Doesn't require action.
-    case "new"
-      ## Ordinarily, create a new figure to hold plot.
-      ## But, if user has requested preparing a specific axis, then
-      ## use the existing figure to hold the requested axis.
-      if (isempty (ca))
-        cf = figure ();
-      endif
-    case "replacechildren"
-      kids = get (cf, "children");
-      if (! isempty (ca))
-        kids(kids == ca) = [];
-      endif
-      delete (kids);
-    case "replace"
-      kids = allchild (cf);
-      if (! isempty (ca))
-        kids(kids == ca) = [];
-      endif
-      delete (kids);
-      reset (cf);
-  endswitch
-  set (cf, "nextplot", "add");  # Matlab compatibility
-
-  if (isempty (ca))
-    ca = gca ();
-  else
-    set (cf, "currentaxes", ca);
-  endif
-
-  ## FIXME: Is this necessary anymore?
-  ##        It seems like a kluge that belongs somewhere else.
-  if (strcmp (get (ca, "__hold_all__"), "off"))
-    __next_line_color__ (true);
-    __next_line_style__ (true);
-  else
-    __next_line_color__ (false);
-    __next_line_style__ (false);
-  endif
-
-  anp = get (ca, "nextplot");
-  switch (anp)
-    case "add"
-      ## Default case.  Doesn't require action.
-    case "replacechildren"
-      delete (get (ca, "children"));
-    case "replace"
-      __go_axes_init__ (ca, "replace");
-      __request_drawnow__ ();
-      ## FIXME: The code above should perform the following:
-      ###########################
-      ## delete (allchild (ca));
-      ## reset (ca);
-      ###########################
-      ## Actually, __go_axes_init__ does both less and more.
-      ## It doesn't really remove all children since it re-instantiates
-      ## xlabel, ylabel, zlabel, and title text objects.
-      ## Also it preserves font properties like fontsize.
-      ## For the time being, in order to have axis labels and title work,
-      ## the above code is is required.
-  endswitch
-
-  if (nargout > 0)
-    hax = ca;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   p = plot ([0, 1]);
-%!   hax = newplot ();
-%!   assert (hax, gca);
-%!   assert (isempty (get (gca, "children")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/orient.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-## Copyright (C) 2001-2012 Paul Kienzle
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} orient (@var{orientation})
-## @deftypefnx {Function File} {} orient (@var{hfig}, @var{orientation})
-## @deftypefnx {Function File} {@var{orientation} =} orient ()
-## @deftypefnx {Function File} {@var{orientation} =} orient (@var{hfig})
-## Query or set the default print orientation.
-##
-## Valid values for @var{orientation} are @qcode{"landscape"},
-## @qcode{"portrait"}, and @qcode{"tall"}.
-##
-## The @qcode{"tall"} option sets the orientation to portrait and fills
-## the page with the plot, while leaving a 0.25 inch border.
-##
-## When called with no arguments, return the default print orientation.
-##
-## If the first argument @var{hfig} is a figure handle, then operate on this
-## figure rather than the current figure returned by @code{gcf}.
-## @seealso{print, saveas}
-## @end deftypefn
-
-## Author: Paul Kienzle
-## Adapted-By: jwe
-
-function retval = orient (varargin)
-
-  nargs = nargin;
-
-  if (nargs > 0 && numel (varargin{1}) == 1 && isfigure (varargin{1}))
-    cf = varargin{1};
-    varargin(1) = [];
-    nargs--;
-  else
-    cf = gcf ();
-  endif
-
-  if (nargs == 0)
-    retval = get (cf, "paperorientation");
-  elseif (nargin == 1)
-    orientation = varargin{1};
-    if (strcmpi (orientation, "landscape") || strcmpi (orientation, "portrait"))
-      if (! strcmpi (get (cf, "paperorientation"), orientation))
-        ## FIXME: with the proper listeners in place there won't be a need to
-        ##        set the papersize and paperpostion here.
-        papersize = get (cf, "papersize");
-        paperposition = get (cf, "paperposition");
-        set (cf, "paperorientation", orientation);
-        set (cf, "papersize", papersize([2, 1]));
-        set (cf, "paperposition", paperposition([2, 1, 4, 3]));
-      endif
-    elseif (strcmpi (varargin{1}, 'tall'))
-      orient ("portrait");
-      papersize = get (cf, "papersize");
-      set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]);
-    else
-      error ("orient: unknown ORIENTATION");
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!shared papersize, paperposition, tallpaperposition, hfig
-%! papersize = [8.5, 11];
-%! paperposition = [0.25, 2.5, 8, 6];
-%! tallpaperposition = [0.25, 0.25, (papersize-0.5)];
-%! hfig = figure ("visible", "off");
-%! set (hfig, "paperorientation", "portrait");
-%! set (hfig, "papersize", papersize);
-%! set (hfig, "paperposition", paperposition);
-
-%!test
-%! orient portrait;
-%! assert (orient, "portrait")   # default
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), paperposition);
-
-%!test
-%! orient landscape;
-%! assert (orient,"landscape")   # change to landscape
-%! assert (get (hfig, "papersize"), papersize([2, 1]));
-%! assert (get (hfig, "paperposition"), paperposition([2, 1, 4, 3]));
-
-%!test
-%! orient portrait   # change back to portrait
-%! assert (orient, "portrait");
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), paperposition);
-
-%!test
-%! orient landscape;
-%! orient tall;
-%! assert (orient, "portrait");
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), tallpaperposition);
-
-%!fail ("orient ('nobody')", "unknown ORIENTATION")
-
-%!test
-%! orient portrait   # errors don't change the state
-%! assert (orient, "portrait");
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), tallpaperposition);
-
-%!test
-%! close (hfig);
-
--- a/scripts/plot/pareto.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-## Copyright (C) 2003 Alberto Terruzzi
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pareto (@var{y})
-## @deftypefnx {Function File} {} pareto (@var{y}, @var{x})
-## @deftypefnx {Function File} {} pareto (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} pareto (@dots{})
-## Draw a Pareto chart.
-##
-## A Pareto chart is a bar graph that arranges information in such a way
-## that priorities for process improvement can be established; It organizes
-## and displays information to show the relative importance of data.  The chart
-## is similar to the histogram or bar chart, except that the bars are arranged
-## in decreasing magnitude from left to right along the x-axis.
-##
-## The fundamental idea (Pareto principle) behind the use of Pareto
-## diagrams is that the majority of an effect is due to a small subset of the
-## causes.  For quality improvement, the first few contributing causes 
-## (leftmost bars as presented on the diagram) to a problem usually account for
-## the majority of the result.  Thus, targeting these "major causes" for
-## elimination results in the most cost-effective improvement scheme.
-##
-## Typically only the magnitude data @var{y} is present in which case
-## @var{x} is taken to be the range @code{1 : length (@var{y})}.  If @var{x}
-## is given it may be a string array, a cell array of strings, or a numerical
-## vector.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a 2-element vector with a graphics
-## handle for the created bar plot and a second handle for the created line
-## plot.
-##
-## An example of the use of @code{pareto} is
-##
-## @example
-## @group
-## Cheese = @{"Cheddar", "Swiss", "Camembert", ...
-##           "Munster", "Stilton", "Blue"@};
-## Sold = [105, 30, 70, 10, 15, 20];
-## pareto (Sold, Cheese);
-## @end group
-## @end example
-## @seealso{bar, barh, hist, pie, plot}
-## @end deftypefn
-
-function h = pareto (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pareto", varargin{:});
-
-  if (nargin != 1 && nargin != 2)
-    print_usage ();
-  endif
-
-  y = varargin{1}(:).';
-  if (nargin == 2)
-    x = varargin{2}(:).';
-    if (! iscell (x))
-      if (ischar (x))
-        x = cellstr (x);
-      else
-        x = cellstr (num2str (x(:)));
-      endif
-    endif
-  else
-    x = cellstr (int2str ([1:numel(y)]'));
-  endif
-
-  [y, idx] = sort (y, "descend");
-  x = x(idx);
-  cdf = cumsum (y);
-  maxcdf = cdf(end);
-  cdf ./= maxcdf;
-  idx95 = find (cdf < 0.95, 1, "last") + 1;
-
-  if (isempty (hax))
-    [ax, hbar, hline] = plotyy (1 : idx95, y(1:idx95),
-                                1 : length (cdf), 100 * cdf,
-                                @bar, @plot);
-  else
-    [ax, hbar, hline] = plotyy (hax, 1 : idx95, y(1:idx95),
-                                     1 : length (cdf), 100 * cdf,
-                                     @bar, @plot);
-  endif
-
-  axis (ax(1), [1 - 0.6, idx95 + 0.6, 0, maxcdf]);
-  axis (ax(2), [1 - 0.6, idx95 + 0.6, 0, 100]);
-  set (ax(2), "ytick", [0, 20, 40, 60, 80, 100],
-              "yticklabel", {"0%", "20%", "40%", "60%", "80%", "100%"});
-  set (ax(1:2), "xtick", 1:idx95, "xticklabel", x(1:idx95));
-
-  if (nargout > 0)
-    h = [hbar; hline];
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! Cheese = {'Cheddar', 'Swiss', 'Camembert', 'Munster', 'Stilton', 'Blue'};
-%! Sold = [105, 30, 70, 10, 15, 20];
-%! pareto (Sold, Cheese);
-
-%!demo
-%! clf;
-%! % Suppose that we want establish which products makes 80% of turnover.
-%! Codes = {'AB4','BD7','CF8','CC5','AD11','BB5','BB3','AD8','DF3','DE7'};
-%! Value = [2.35 7.9 2.45 1.1 0.15 13.45 5.4 2.05 0.85  1.65]';
-%! SoldUnits = [54723 41114 16939 1576091 168000 687197 120222 168195, ...
-%!              1084118 55576]';
-%! pareto (Value.*SoldUnits, Codes);
-
--- a/scripts/plot/patch.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,270 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} patch ()
-## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c})
-## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
-## @deftypefnx {Function File} {} patch (@var{fv})
-## @deftypefnx {Function File} {} patch ("Faces", @var{faces}, "Vertices", @var{verts}, @dots{})
-## @deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} patch (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} patch (@dots{})
-## Create patch object in the current axes with vertices at locations
-## (@var{x}, @var{y}) and of color @var{c}.
-##
-## If the vertices are matrices of size @nospell{MxN} then each polygon patch
-## has M vertices and a total of N polygons will be created.  If some polygons
-## do not have M vertices use NaN to represent "no vertex".  If the @var{z}
-## input is present then 3-D patches will be created.
-##
-## The color argument @var{c} can take many forms.  To create polygons
-## which all share a single color use a string value (e.g., @qcode{"r"} for
-## red), a scalar value which is scaled by @code{caxis} and indexed into the
-## current colormap, or a 3-element RGB vector with the precise TrueColor.
-##
-## If @var{c} is a vector of length N then the ith polygon will have a color
-## determined by scaling entry @var{c}(i) according to @code{caxis} and then
-## indexing into the current colormap.  More complicated coloring situations
-## require directly manipulating patch property/value pairs.
-##
-## Instead of specifying polygons by matrices @var{x} and @var{y}, it is
-## possible to present a unique list of vertices and then a list of polygon
-## faces created from those vertices.  In this case the
-## @qcode{"Vertices"} matrix will be an @nospell{Nx2} (2-D patch) or
-## @nospell{Nx3} (3-D path).  The @nospell{MxN} @qcode{"Faces"} matrix
-## describes M polygons having N vertices---each row describes a
-## single polygon and each column entry is an index into the
-## @qcode{"Vertices"} matrix to identify a vertex.  The patch object
-## can be created by directly passing the property/value pairs
-## @qcode{"Vertices"}/@var{verts}, @qcode{"Faces"}/@var{faces} as
-## inputs.
-##
-## A third input form is to create a structure @var{fv} with the fields
-## @qcode{"vertices"}, @qcode{"faces"}, and optionally
-## @qcode{"facevertexcdata"}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created patch
-## object.
-##
-## Implementation Note: Patches are highly configurable objects.  To truly
-## customize them requires setting patch properties directly.  Useful patch
-## properties are: @qcode{"cdata"}, @qcode{"edgecolor"},
-## @qcode{"facecolor"}, @qcode{"faces"}, @qcode{"facevertexcdata"}.
-## @seealso{fill, get, set}
-## @end deftypefn
-
-## Author: jwe
-
-function h = patch (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
-  
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  [htmp, failed] = __patch__ (hax, varargin{:});
-
-  if (failed)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! %% Patches with same number of vertices
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! patch ([x1,x2], [y1,y2], 'r');
-
-%!demo
-%! %% Unclosed patch
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! patch ([[x1;NaN(8,1)],x2], [[y1;NaN(8,1)],y2], 'r');
-
-%!demo
-%! %% Specify vertices and faces separately
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! vert = [x1, y1; x2, y2];
-%! fac = [1:8,NaN(1,8);9:24];
-%! patch ('Faces',fac, 'Vertices',vert, 'FaceColor','r');
-
-%!demo
-%! %% Specify vertices and faces separately
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! vert = [x1, y1; x2, y2];
-%! fac = [1:8,NaN(1,8);9:24];
-%! patch ('Faces',fac, 'Vertices',vert, 'FaceVertexCData',[0, 1, 0; 0, 0, 1]);
-
-%!demo
-%! %% Property change on multiple patches
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1]));
-%! pause (1);
-%! set (h, 'FaceColor', 'r');
-
-%!demo
-%! clf;
-%! vertices = [0, 0, 0;
-%!             1, 0, 0;
-%!             1, 1, 0;
-%!             0, 1, 0;
-%!             0.5, 0.5, 1];
-%! faces = [1, 2, 5;
-%!          2, 3, 5;
-%!          3, 4, 5;
-%!          4, 1, 5];
-%! patch ('Vertices', vertices, 'Faces', faces, ...
-%!        'FaceVertexCData', jet (4), 'FaceColor', 'flat');
-%! view (-37.5, 30);
-
-%!demo
-%! clf;
-%! vertices = [0, 0, 0;
-%!             1, 0, 0;
-%!             1, 1, 0;
-%!             0, 1, 0;
-%!             0.5, 0.5, 1];
-%! faces = [1, 2, 5;
-%!          2, 3, 5;
-%!          3, 4, 5;
-%!          4, 1, 5];
-%! patch  ('Vertices', vertices, 'Faces', faces, ...
-%!        'FaceVertexCData', jet (5), 'FaceColor', 'interp');
-%! view (-37.5, 30);
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [0 1 1 0];
-%! y = [0 0 1 1];
-%! subplot (2,1,1);
-%!  title ('Blue, Light-Green, and Red Horizontal Bars');
-%!  patch (x, y + 0, 1);
-%!  patch (x, y + 1, 2);
-%!  patch (x, y + 2, 3);
-%! subplot (2,1,2);
-%!  title ('Blue, Light-Green, and Red Vertical Bars');
-%!  patch (x + 0, y, 1 * ones (size (x)));
-%!  patch (x + 1, y, 2 * ones (size (x)));
-%!  patch (x + 2, y, 3 * ones (size (x)));
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [0 1 1 0];
-%! y = [0 0 1 1];
-%! subplot (2,1,1);
-%!  title ('Blue horizontal bars: Dark to Light');
-%!  patch (x, y + 0, 1, 'cdatamapping', 'direct');
-%!  patch (x, y + 1, 9, 'cdatamapping', 'direct');
-%!  patch (x, y + 2, 17, 'cdatamapping', 'direct');
-%! subplot (2,1,2);
-%!  title ('Blue vertical bars: Dark to Light');
-%!  patch (x + 0, y, 1 * ones (size (x)), 'cdatamapping', 'direct');
-%!  patch (x + 1, y, 9 * ones (size (x)), 'cdatamapping', 'direct');
-%!  patch (x + 2, y, 17 * ones (size (x)), 'cdatamapping', 'direct');
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [ 0 0; 1 1; 1 0 ];
-%! y = [ 0 0; 0 1; 1 1 ];
-%! p = patch (x, y, 'facecolor', 'b');
-%! set (p, 'cdatamapping', 'direct', 'facecolor', 'flat', 'cdata', [1 32]);
-%! title ('Direct mapping of colors: Light-Green UL and Blue LR triangles');
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [ 0 0; 1 1; 1 0 ];
-%! y = [ 0 0; 0 1; 1 1 ];
-%! p = patch (x, y, [1 32]);
-%! title ('Autoscaling of colors: Red UL and Blue LR triangles');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = patch ();
-%!   assert (findobj (hf, "type", "patch"), h);
-%!   assert (get (h, "xdata"), [0; 1; 0], eps);
-%!   assert (get (h, "ydata"), [1; 1; 0], eps);
-%!   assert (isempty (get (h, "zdata")));
-%!   assert (isempty (get (h, "cdata")));
-%!   assert (get (h, "faces"), [1, 2, 3], eps);
-%!   assert (get (h, "vertices"), [0 1; 1 1; 0 0], eps);
-%!   assert (get (h, "type"), "patch");
-%!   assert (get (h, "facecolor"), [0 0 0]);
-%!   assert (get (h, "linestyle"), get (0, "defaultpatchlinestyle"));
-%!   assert (get (h, "linewidth"), get (0, "defaultpatchlinewidth"), eps);
-%!   assert (get (h, "marker"), get (0, "defaultpatchmarker"));
-%!   assert (get (h, "markersize"), get (0, "defaultpatchmarkersize"));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! c = 0.9;
-%! unwind_protect
-%!   h = patch ([0 1 0], [0 1 1], c);
-%!   assert (get (gca, "clim"), [c - 1, c + 1]);
-%!   h = patch ([0 1 0], [0 1 1], 2 * c);
-%!   assert (get (gca, "clim"), [c, 2 * c]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/pbaspect.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( )
-## @deftypefnx {Function File} {} pbaspect (@var{plot_box_aspect_ratio})
-## @deftypefnx {Function File} {} pbaspect (@var{mode})
-## @deftypefnx {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode")
-## @deftypefnx {Function File} {} pbaspect (@var{hax}, @dots{})
-##
-## Query or set the plot box aspect ratio of the current axes.
-##
-## The aspect ratio is a normalized 3-element vector representing the rendered
-## lengths of the x, y, and z axes.
-##
-## @code{pbaspect(@var{mode})}
-##
-## Set the plot box aspect ratio mode of the current axes.  @var{mode} is
-## either @qcode{"auto"} or @qcode{"manual"}.
-##
-## @code{pbaspect ("mode")}
-##
-## Return the plot box aspect ratio mode of the current axes.
-##
-## @code{pbaspect (@var{hax}, @dots{})}
-##
-## Operate on the axes in handle @var{hax} instead of the current axes.
-##
-## @seealso{axis, daspect, xlim, ylim, zlim}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-01-26
-
-function pbratio = pbaspect (varargin)
-
-  ## Grab axes handle if present
-  if (nargin > 0)
-    if (isscalar (varargin{1}) && isaxes (varargin{1}))
-      hax = varargin{1};
-      varargin = varargin(2:end);
-    else
-      hax = gca ();
-    endif
-  else
-    hax = gca ();
-  endif
-
-  nargin = numel (varargin);
-  if (nargin > 1)
-    print_usage ();
-  endif
-
-  if (nargin == 0)
-    pbratio = get (hax, "plotboxaspectratio");
-  else
-    arg = varargin{1};
-    if (isreal (arg))
-      if (numel (arg) == 2)
-        set (hax, "plotboxaspectratio", [arg, 1]);
-      elseif (numel (arg) == 3)
-        set (hax, "plotboxaspectratio", arg);
-      else
-        error ("pbaspect: PLOT_BOX_ASPECT_RATIO must be a 2 or 3 element vector");
-      endif
-    elseif (ischar (arg))
-      arg = tolower (arg);
-      switch (arg)
-        case "auto"
-          set (hax, "plotboxaspectratiomode", "auto");
-        case "manual"
-          set (hax, "plotboxaspectratiomode", "manual");
-        case "mode"
-          pbratio = get (hax, "plotboxaspectratiomode");
-        otherwise
-          error ("pbaspect: Invalid mode <%s>", arg);
-      endswitch
-    else
-      print_usage ();
-    endif
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! pbaspect ([1 1 1]);
-%! title ('plot box is square');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;;
-%! plot (x,cos(x), x,sin(x));
-%! pbaspect ([2 1 1]);
-%! title ('plot box aspect ratio is 2x1');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! daspect ([1 1 1]);
-%! pbaspect ([2 1 1]);
-%! title ('plot box is 2x1, and axes [0 4 -1 1]');
-
--- a/scripts/plot/pcolor.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pcolor (@var{x}, @var{y}, @var{c})
-## @deftypefnx {Function File} {} pcolor (@var{c})
-## @deftypefnx {Function File} {} pcolor (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} pcolor (@dots{})
-## Produce a 2-D density plot.
-##
-## A @code{pcolor} plot draws rectangles with colors from the matrix @var{c}
-## over the two-dimensional region represented by the matrices @var{x} and
-## @var{y}.  @var{x} and @var{y} are the coordinates of the mesh's vertices
-## and are typically the output of @code{meshgrid}.  If @var{x} and @var{y} are
-## vectors, then a typical vertex is (@var{x}(j), @var{y}(i), @var{c}(i,j)).
-## Thus, columns of @var{c} correspond to different @var{x} values and rows
-## of @var{c} correspond to different @var{y} values.
-##
-## The values in @var{c} are scaled to span the range of the current
-## colormap.  Limits may be placed on the color axis by the command
-## @code{caxis}, or by setting the @code{clim} property of the parent axis.
-##
-## The face color of each cell of the mesh is determined by interpolating
-## the values of @var{c} for each of the cell's vertices; Contrast this with
-## @code{imagesc} which renders one cell for each element of @var{c}.
-##
-## @code{shading} modifies an attribute determining the manner by which the
-## face color of each cell is interpolated from the values of @var{c},
-## and the visibility of the cells' edges.  By default the attribute is
-## @qcode{"faceted"}, which renders a single color for each cell's face with
-## the edge visible.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## @seealso{caxis, shading, meshgrid, contour, imagesc}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function h = pcolor (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pcolor", varargin{:});
-
-  if (nargin == 1)
-    c = varargin{1};
-    [nr, nc] = size (c);
-    [x, y] = meshgrid (1:nc, 1:nr);
-    z = zeros (nr, nc);
-  elseif (nargin == 3)
-    x = varargin{1};
-    y = varargin{2};
-    c = varargin{3};
-    z = zeros (size (c));
-  else
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    htmp = surface (x, y, z, c);
-
-    set (htmp, "facecolor", "flat");
-    if (! ishold ())
-      set (hax, "view", [0, 90], "box", "on");
-    endif
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = peaks ();
-%! pcolor (Z);
-%! title ('pcolor() of peaks with facet shading');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X,Y,Z] = sombrero ();
-%! [Fx,Fy] = gradient (Z);
-%! pcolor (X,Y,Fx+Fy);
-%! shading interp;
-%! axis tight;
-%! title ('pcolor() of peaks with interp shading');
-
--- a/scripts/plot/peaks.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-## Copyright (C) 2007-2012 Paul Kienzle
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} peaks ()
-## @deftypefnx {Function File} {} peaks (@var{n})
-## @deftypefnx {Function File} {} peaks (@var{x}, @var{y})
-## @deftypefnx {Function File} {@var{z} =} peaks (@dots{})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} peaks (@dots{})
-## Plot a function with lots of local maxima and minima.
-##
-## The function has the form
-##
-## @tex
-## $$f(x,y) = 3 (1 - x) ^ 2 e ^ {\left(-x^2 - (y+1)^2\right)} - 10 \left({x \over 5} - x^3 - y^5)\right) - {1 \over 3} e^{\left(-(x+1)^2 - y^2\right)}$$
-## @end tex
-## @ifnottex
-## @verbatim
-## f(x,y) = 3*(1-x)^2*exp(-x^2 - (y+1)^2) ...
-##          - 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2) ...
-##          - 1/3*exp(-(x+1)^2 - y^2)
-## @end verbatim
-## @end ifnottex
-##
-## Called without a return argument, @code{peaks} plots the surface of the
-## above function using @code{surf}.
-## 
-## If @var{n} is a scalar, @code{peaks} plots the value of the above
-## function on an @var{n}-by-@var{n} mesh over the range [-3,3].  The
-## default value for @var{n} is 49.
-##
-## If @var{n} is a vector, then it represents the grid values over which
-## to calculate the function.  If @var{x} and @var{y} are specified then
-## the function value is calculated over the specified grid of vertices.
-##
-## When called with output arguments, return the data for the function
-## evaluated over the meshgrid.  This can subsequently be plotted with
-## @code{surf (@var{x}, @var{y}, @var{z})}.
-## 
-## @seealso{sombrero, meshgrid, mesh, surf}
-## @end deftypefn
-
-## Expression for the peaks function was taken from the following paper:
-## http://www.control.hut.fi/Kurssit/AS-74.115/Material/GENALGgoga.pdf
-
-function [X_out, Y_out, Z_out] = peaks (x, y)
-
-  if (nargin == 0)
-    x = y = linspace (-3, 3, 49);
-  elseif (nargin == 1)
-    if (length (x) > 1)
-      y = x;
-    else
-      x = y = linspace (-3, 3, x);
-    endif
-  endif
-
-  if (isvector (x) && isvector (y))
-    [X, Y] = meshgrid (x, y);
-  else
-    X = x;
-    Y = y;
-  endif
-
-  Z = 3 * (1 - X) .^ 2 .* exp (- X .^ 2 - (Y + 1) .^ 2) ...
-      - 10 * (X / 5 - X .^ 3 - Y .^ 5) .* exp (- X .^ 2 - Y .^ 2) ...
-      - 1 / 3 * exp (- (X + 1) .^ 2 - Y .^ 2);
-
-  if (nargout == 0)
-    surf (x, y, Z);
-  elseif (nargout == 1)
-    X_out = Z;
-  else
-    X_out = X;
-    Y_out = Y;
-    Z_out = Z;
-  endif
-
-endfunction
-
--- a/scripts/plot/pie.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pie (@var{x})
-## @deftypefnx {Function File} {} pie (@dots{}, @var{explode})
-## @deftypefnx {Function File} {} pie (@dots{}, @var{labels})
-## @deftypefnx {Function File} {} pie (@var{hax}, @dots{});
-## @deftypefnx {Function File} {@var{h} =} pie (@dots{});
-## Plot a 2-D pie chart.
-##
-## When called with a single vector argument, produce a pie chart of the
-## elements in @var{x}.  The size of the ith slice is the percentage that the
-## element @var{x}i represents of the total sum of @var{x}:
-## @code{pct = @var{x}(i) / sum (@var{x})}. 
-##
-## The optional input @var{explode} is a vector of the same length as @var{x}
-## that, if non-zero, "explodes" the slice from the pie chart.
-##
-## The optional input @var{labels} is a cell array of strings of the same
-## length as @var{x} specifying the label for each slice.
-## 
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a list of handles to the patch
-## and text objects generating the plot.
-##
-## Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
-## interpreted as percentages directly and are not normalized by @code{sum (x)}.
-## Furthermore, if the sum is less than 1 then there will be a missing slice
-## in the pie plot to represent the missing, unspecified percentage.
-##
-## @seealso{pie3, bar, hist, rose}
-## @end deftypefn
-
-## Very roughly based on pie.m from octave-forge whose author was
-## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
-
-function h = pie (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pie", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    htmp = __pie__ ("pie", hax, varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! pie ([3, 2, 1], [0, 0, 1]);
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! title ('pie() with exploded wedge');
-
-%!demo
-%! clf;
-%! pie ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-%! title ('pie() with labels');
-
-
-%!demo
-%! clf;
-%! pie ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-%! title ('pie() with missing slice');
-
--- a/scripts/plot/pie3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-## Copyright (C) 2010 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pie3 (@var{x})
-## @deftypefnx {Function File} {} pie3 (@dots{}, @var{explode})
-## @deftypefnx {Function File} {} pie3 (@dots{}, @var{labels})
-## @deftypefnx {Function File} {} pie3 (@var{hax}, @dots{});
-## @deftypefnx {Function File} {@var{h} =} pie3 (@dots{});
-## Plot a 3-D pie chart.
-##
-## Called with a single vector argument, produces a 3-D pie chart of the
-## elements in @var{x}.  The size of the ith slice is the percentage that the
-## element @var{x}i represents of the total sum of @var{x}:
-## @code{pct = @var{x}(i) / sum (@var{x})}. 
-##
-## The optional input @var{explode} is a vector of the same length as @var{x}
-## that, if non-zero, "explodes" the slice from the pie chart.
-##
-## The optional input @var{labels} is a cell array of strings of the same
-## length as @var{x} specifying the label for each slice.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a list of graphics handles to the
-## patch, surface, and text objects generating the plot.
-##
-## Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
-## interpreted as percentages directly and are not normalized by @code{sum (x)}.
-## Furthermore, if the sum is less than 1 then there will be a missing slice
-## in the pie plot to represent the missing, unspecified percentage.
-##
-## @seealso{pie, bar, hist, rose}
-## @end deftypefn
-
-## Very roughly based on pie.m from octave-forge whose author was
-## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
-
-function h = pie3 (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pie3", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    htmp = __pie__ ("pie3", hax, varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! pie3 ([5:-1:1], [0, 0, 1, 0, 0]);
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! title ('pie3() with exploded wedge');
-
-%!demo
-%! clf;
-%! pie3 ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-%! title ('pie3() with labels');
-
-%!demo
-%! clf;
-%! pie3 ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-%! title ('pie3() with missing slice');
-
--- a/scripts/plot/plot.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} plot (@var{y})
-## @deftypefnx {Function File} {} plot (@var{x}, @var{y})
-## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} plot (@dots{}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} plot (@var{x1}, @var{y1}, @dots{}, @var{xn}, @var{yn})
-## @deftypefnx {Function File} {} plot (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} plot (@dots{})
-## Produce 2-D plots.
-##
-## Many different combinations of arguments are possible.  The simplest
-## form is
-##
-## @example
-## plot (@var{y})
-## @end example
-##
-## @noindent
-## where the argument is taken as the set of @var{y} coordinates and the
-## @var{x} coordinates are taken to be the range @code{1:numel (@var{y})}.
-##
-## If more than one argument is given, they are interpreted as
-##
-## @example
-## plot (@var{y}, @var{property}, @var{value}, @dots{})
-## @end example
-##
-## @noindent
-## or
-##
-## @example
-## plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @end example
-##
-## @noindent
-## or
-##
-## @example
-## plot (@var{x}, @var{y}, @var{fmt}, @dots{})
-## @end example
-##
-## @noindent
-## and so on.  Any number of argument sets may appear.  The @var{x} and
-## @var{y} values are interpreted as follows:
-##
-## @itemize @bullet
-## @item
-## If a single data argument is supplied, it is taken as the set of @var{y}
-## coordinates and the @var{x} coordinates are taken to be the indices of
-## the elements, starting with 1.
-##
-## @item
-## If @var{x} and @var{y} are scalars, a single point is plotted.
-##
-## @item
-## @code{squeeze()} is applied to arguments with more than two dimensions,
-## but no more than two singleton dimensions.
-## 
-## @item
-## If both arguments are vectors, the elements of @var{y} are plotted versus
-## the elements of @var{x}.
-##
-## @item
-## If @var{x} is a vector and @var{y} is a matrix, then
-## the columns (or rows) of @var{y} are plotted versus @var{x}.
-## (using whichever combination matches, with columns tried first.)
-##
-## @item
-## If the @var{x} is a matrix and @var{y} is a vector,
-## @var{y} is plotted versus the columns (or rows) of @var{x}.
-## (using whichever combination matches, with columns tried first.)
-##
-## @item
-## If both arguments are matrices, the columns of @var{y} are plotted
-## versus the columns of @var{x}.  In this case, both matrices must have
-## the same number of rows and columns and no attempt is made to transpose
-## the arguments to make the number of rows match.
-## @end itemize
-##
-## Multiple property-value pairs may be specified, but they must appear
-## in pairs.  These arguments are applied to the line objects drawn by
-## @code{plot}.  Useful properties to modify are @qcode{"linestyle"},
-## @qcode{"linewidth"}, @qcode{"color"}, @qcode{"marker"},
-## @qcode{"markersize"}, @qcode{"markeredgecolor"}, @qcode{"markerfacecolor"}.
-##
-## The @var{fmt} format argument can also be used to control the plot style.
-## The format is composed of three parts: linestyle, markerstyle, color. 
-## When a markerstyle is specified, but no linestyle, only the markers are
-## plotted.  Similarly, if a linestyle is specified, but no markerstyle, then
-## only lines are drawn.  If both are specified then lines and markers will
-## be plotted.  If no @var{fmt} and no @var{property}/@var{value} pairs are
-## given, then the default plot style is solid lines with no markers and the
-## color determined by the @qcode{"colororder"} property of the current axes.
-##
-## Format arguments:
-##
-## @table @asis
-## @item linestyle
-##
-## @multitable @columnfractions 0.06 0.94
-## @item @samp{-}  @tab Use solid lines (default).
-## @item @samp{--} @tab Use dashed lines.
-## @item @samp{:}  @tab Use dotted lines.
-## @item @samp{-.} @tab Use dash-dotted lines.
-## @end multitable
-##
-## @item markerstyle
-##
-## @multitable @columnfractions 0.06 0.94
-## @item @samp{+} @tab crosshair
-## @item @samp{o} @tab circle
-## @item @samp{*} @tab star
-## @item @samp{.} @tab point
-## @item @samp{x} @tab cross
-## @item @samp{s} @tab square
-## @item @samp{d} @tab diamond
-## @item @samp{^} @tab upward-facing triangle
-## @item @samp{v} @tab downward-facing triangle
-## @item @samp{>} @tab right-facing triangle
-## @item @samp{<} @tab left-facing triangle
-## @item @samp{p} @tab pentagram
-## @item @samp{h} @tab hexagram
-## @end multitable
-##
-## @item color
-##
-## @multitable @columnfractions 0.06 0.94
-## @item @samp{k} @tab blacK
-## @item @samp{r} @tab Red
-## @item @samp{g} @tab Green
-## @item @samp{b} @tab Blue
-## @item @samp{m} @tab Magenta
-## @item @samp{c} @tab Cyan
-## @item @samp{w} @tab White
-## @end multitable
-##
-## @item @qcode{";key;"}
-## Here @qcode{"key"} is the label to use for the plot legend.
-## @end table
-##
-## The @var{fmt} argument may also be used to assign legend keys.
-## To do so, include the desired label between semicolons after the
-## formatting sequence described above, e.g., @qcode{"+b;Key Title;"}.
-## Note that the last semicolon is required and Octave will generate
-## an error if it is left out.
-##
-## Here are some plot examples:
-##
-## @example
-## plot (x, y, "or", x, y2, x, y3, "m", x, y4, "+")
-## @end example
-##
-## This command will plot @code{y} with red circles, @code{y2} with solid
-## lines, @code{y3} with solid magenta lines, and @code{y4} with points
-## displayed as @samp{+}.
-##
-## @example
-## plot (b, "*", "markersize", 10)
-## @end example
-##
-## This command will plot the data in the variable @code{b},
-## with points displayed as @samp{*} and a marker size of 10.
-##
-## @example
-## @group
-## t = 0:0.1:6.3;
-## plot (t, cos(t), "-;cos(t);", t, sin(t), "-b;sin(t);");
-## @end group
-## @end example
-##
-## This will plot the cosine and sine functions and label them accordingly
-## in the legend.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of graphics handles to
-## the created line objects.
-##
-## To save a plot, in one of several image formats such as PostScript
-## or PNG, use the @code{print} command.
-##
-## @seealso{axis, box, grid, hold, legend, title, xlabel, ylabel, xlim, ylim, ezplot, errorbar, fplot, line, plot3, polar, loglog, semilogx, semilogy, subplot}
-## @end deftypefn
-
-## Author: jwe
-
-function h = plot (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    htmp = __plt__ ("plot", hax, varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! x = 1:5;  y = 1:5;
-%! plot (x,y,'g');
-%! title ('plot() of green line at 45 degrees');
-
-%!demo
-%! x = 1:5;  y = 1:5;
-%! plot (x,y,'g*');
-%! title ('plot() of green stars along a line at 45 degrees');
-
-%!demo
-%! x1 = 1:5;  y1 = 1:5;
-%! x2 = 5:9; y2 = 5:-1:1;
-%! plot (x1,y1,'bo-', x2,y2,'rs-');
-%! axis ('tight');
-%! title ({'plot() of blue circles ascending and red squares descending';
-%!         'connecting lines drawn'}); 
-
-%!demo
-%! x = 0:10;
-%! plot (x, rand (numel (x), 3))
-%! axis ([0 10 0 1])
-%! title ({'Three random variables', 'x[1x11], y[11x3]'})
-
-%!demo
-%! x = 0:10;
-%! plot (x, rand (3, numel (x)))
-%! axis ([0 10 0 1])
-%! title ({'Three random variables', 'x[1x11], y[3x11]'})
-
-%!demo
-%! x = 0:10;
-%! plot (repmat (x, 2, 1), rand (2, numel (x)), '-s')
-%! axis ([0 10 0 1])
-%! title ({'Vertical lines with random height and lengths', ...
-%!         'x[2x11], y[2,11]'})
-
-%!demo
-%! x = 0:10;
-%! plot (repmat (x(:), 1, 2), rand (numel (x), 2))
-%! axis ([0 10 0 1])
-%! title ({'Two random variables', 'x[11x2], y[11x2]'})
-
-%!demo
-%! x = 0:10;
-%! shape = [1, 1, numel(x), 2];
-%! x = reshape (repmat (x(:), 1, 2), shape);
-%! y = rand (shape);
-%! plot (x, y)
-%! axis ([0 10 0 1])
-%! title ({'Two random variables', 'squeezed from 4-d arrays'})
-
--- a/scripts/plot/plot3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,388 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} plot3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{prop}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{fmt})
-## @deftypefnx {Function File} {} plot3 (@var{x}, @var{cplx})
-## @deftypefnx {Function File} {} plot3 (@var{cplx})
-## @deftypefnx {Function File} {} plot3 (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} plot3 (@dots{})
-## Produce 3-D plots.
-##
-## Many different combinations of arguments are possible.  The simplest
-## form is
-##
-## @example
-## plot3 (@var{x}, @var{y}, @var{z})
-## @end example
-##
-## @noindent
-## in which the arguments are taken to be the vertices of the points to
-## be plotted in three dimensions.  If all arguments are vectors of the
-## same length, then a single continuous line is drawn.  If all arguments
-## are matrices, then each column of is treated as a separate line.  No attempt
-## is made to transpose the arguments to make the number of rows match.
-##
-## If only two arguments are given, as
-##
-## @example
-## plot3 (@var{x}, @var{cplx})
-## @end example
-##
-## @noindent
-## the real and imaginary parts of the second argument are used
-## as the @var{y} and @var{z} coordinates, respectively.
-##
-## If only one argument is given, as
-##
-## @example
-## plot3 (@var{cplx})
-## @end example
-##
-## @noindent
-## the real and imaginary parts of the argument are used as the @var{y}
-## and @var{z} values, and they are plotted versus their index.
-##
-## Arguments may also be given in groups of three as
-##
-## @example
-## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{})
-## @end example
-##
-## @noindent
-## in which each set of three arguments is treated as a separate line or
-## set of lines in three dimensions.
-##
-## To plot multiple one- or two-argument groups, separate each group
-## with an empty format string, as
-##
-## @example
-## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{})
-## @end example
-##
-## Multiple property-value pairs may be specified which will affect the line
-## objects drawn by @code{plot3}.  If the @var{fmt} argument is supplied it
-## will format the line objects in the same manner as @code{plot}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## Example:
-##
-## @example
-## @group
-## z = [0:0.05:5];
-## plot3 (cos (2*pi*z), sin (2*pi*z), z, ";helix;");
-## plot3 (z, exp (2i*pi*z), ";complex sinusoid;");
-## @end group
-## @end example
-## @seealso{ezplot3, plot}
-## @end deftypefn
-
-## Author: Paul Kienzle
-##         (modified from __plt__.m)
-
-function retval = plot3 (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("plot3", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    x_set = 0;
-    y_set = 0;
-    z_set = 0;
-    property_set = 0;
-    fmt_set = 0;
-    properties = {};
-    tlgnd = {};
-    hlgnd = [];
-    idx = 0;
-
-    ## Gather arguments, decode format, and plot lines.
-    arg = 0;
-    while (arg++ < nargs)
-      new = varargin{arg};
-      new_cell = varargin(arg);
-
-      if (property_set)
-        properties = [properties, new_cell];
-        property_set = 0;
-        continue;
-      endif
-
-      if (ischar (new))
-        if (! z_set)
-          if (! y_set)
-            if (! x_set)
-              error ("plot3: needs X, [ Y, [ Z ] ]");
-            else
-              y = real (x);
-              z = imag (x);
-              y_set = 1;
-              z_set = 1;
-              if (rows (x) > 1)
-                x = repmat ((1:rows (x))', 1, columns (x));
-              else
-                x = 1:columns (x);
-              endif
-            endif
-          else
-            z = imag (y);
-            y = real (y);
-            z_set = 1;
-          endif
-        endif
-
-        if (! fmt_set)
-          [options, valid] = __pltopt__ ("plot3", new, false);
-          if (! valid)
-            properties = [properties, new_cell];
-            property_set = 1;
-            continue;
-          else
-            fmt_set = 1;
-            while (arg < nargs && ischar (varargin{arg+1}))
-              if (nargs - arg < 2)
-                error ("plot3: properties must appear followed by a value");
-              endif
-              properties = [properties, varargin(arg+1:arg+2)];
-              arg += 2;
-            endwhile
-          endif
-        else
-          properties = [properties, new_cell];
-          property_set = 1;
-          continue;
-        endif
-
-        if (isvector (x) && isvector (y))
-          if (isvector (z))
-            x = x(:);
-            y = y(:);
-            z = z(:);
-          elseif (length (x) == rows (z) && length (y) == columns (z))
-            [x, y] = meshgrid (x, y);
-          else
-            error ("plot3: [length(X), length(Y)] must match size (Z)");
-          endif
-        endif
-
-        if (! size_equal (x, y, z))
-          error ("plot3: X, Y, and Z must have the same shape");
-        elseif (ndims (x) > 2)
-          error ("plot3: X, Y, and Z must not have more than two dimensions");
-        endif
-
-        for i = 1 : columns (x)
-          linestyle = options.linestyle;
-          marker = options.marker;
-          if (isempty (marker) && isempty (linestyle))
-             [linestyle, marker] = __next_line_style__ ();
-          endif
-          color = options.color;
-          if (isempty (color))
-            color = __next_line_color__ ();
-          endif
-
-          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                              "color", color, "linestyle", linestyle,
-                              "marker", marker, properties{:});
-          key = options.key;
-          if (! isempty (key))
-            hlgnd = [hlgnd, htmp(idx)];
-            tlgnd = {tlgnd{:}, key};
-          endif
-        endfor
-
-        x_set = 0;
-        y_set = 0;
-        z_set = 0;
-        fmt_set = 0;
-        properties = {};
-      elseif (! x_set)
-        x = new;
-        x_set = 1;
-      elseif (! y_set)
-        y = new;
-        y_set = 1;
-      elseif (! z_set)
-        z = new;
-        z_set = 1;
-      else
-        if (isvector (x) && isvector (y))
-          if (isvector (z))
-            x = x(:);
-            y = y(:);
-            z = z(:);
-          elseif (length (x) == rows (z) && length (y) == columns (z))
-            [x, y] = meshgrid (x, y);
-          else
-            error ("plot3: [length(X), length(Y)] must match size (Z)");
-          endif
-        endif
-
-        if (! size_equal (x, y, z))
-          error ("plot3: X, Y, and Z must have the same shape");
-        elseif (ndims (x) > 2)
-          error ("plot3: X, Y, and Z must not have more than two dimensions");
-        endif
-
-        options = __default_plot_options__ ();
-        for i = 1 : columns (x)
-          linestyle = options.linestyle;
-          marker = options.marker;
-          if (isempty (marker) && isempty (linestyle))
-            [linestyle, marker] = __next_line_style__ ();
-          endif
-          color = options.color;
-          if (isempty (color))
-            color = __next_line_color__ ();
-          endif
-
-          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                              "color", color, "linestyle", linestyle,
-                              "marker", marker, properties{:});
-          key = options.key;
-          if (! isempty (key))
-            hlgnd = [hlgnd, htmp(idx)];
-            tlgnd = {tlgnd{:}, key};
-          endif
-        endfor
-
-        x = new;
-        y_set = 0;
-        z_set = 0;
-        fmt_set = 0;
-        properties = {};
-      endif
-
-    endwhile
-
-    if (property_set)
-      error ("plot3: properties must appear followed by a value");
-    endif
-
-    ## Handle last plot.
-
-    if (x_set)
-      if (y_set)
-        if (! z_set)
-          z = imag (y);
-          y = real (y);
-          z_set = 1;
-        endif
-      else
-        y = real (x);
-        z = imag (x);
-        y_set = 1;
-        z_set = 1;
-        if (rows (x) > 1)
-          x = repmat ((1:rows (x))', 1, columns (x));
-        else
-          x = 1:columns (x);
-        endif
-      endif
-
-      if (isvector (x) && isvector (y))
-        if (isvector (z))
-          x = x(:);
-          y = y(:);
-          z = z(:);
-        elseif (length (x) == rows (z) && length (y) == columns (z))
-          [x, y] = meshgrid (x, y);
-        else
-          error ("plot3: [length(X), length(Y)] must match size (Z)");
-        endif
-      endif
-
-      if (! size_equal (x, y, z))
-        error ("plot3: X, Y, and Z must have the same shape");
-      elseif (ndims (x) > 2)
-        error ("plot3: X, Y, and Z must not have more than two dimensions");
-      endif
-
-      options = __default_plot_options__ ();
-
-      for i = 1 : columns (x)
-        linestyle = options.linestyle;
-        marker = options.marker;
-        if (isempty (marker) && isempty (linestyle))
-          [linestyle, marker] = __next_line_style__ ();
-        endif
-        color = options.color;
-        if (isempty (color))
-          color = __next_line_color__ ();
-        endif
-
-        htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                            "color", color, "linestyle", linestyle,
-                            "marker", marker, properties{:});
-        key = options.key;
-        if (! isempty (key))
-          hlgnd = [hlgnd, htmp(idx)];
-          tlgnd = {tlgnd{:}, key};
-        endif
-      endfor
-    endif
-
-    if (! isempty (hlgnd))
-      legend (hax, hlgnd, tlgnd);
-    endif
-
-    if (! ishold ())
-      set (hax, "view", [-37.5, 30]);
-    endif
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0 && idx > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! z = [0:0.05:5];
-%! plot3 (cos (2*pi*z), sin (2*pi*z), z, ';helix;');
-%! title ('plot3() of a helix');
-
-%!demo
-%! clf;
-%! z = [0:0.05:5];
-%! plot3 (z, exp (2i*pi*z), ';complex sinusoid;');
-%! title ('plot3() with complex input');
-
--- a/scripts/plot/plotmatrix.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} plotmatrix (@var{x}, @var{y})
-## @deftypefnx {Function File} {} plotmatrix (@var{x})
-## @deftypefnx {Function File} {} plotmatrix (@dots{}, @var{style})
-## @deftypefnx {Function File} {} plotmatrix (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{h}, @var{ax}, @var{bigax}, @var{p}, @var{pax}] =} plotmatrix (@dots{})
-## Scatter plot of the columns of one matrix against another.
-##
-## Given the arguments @var{x} and @var{y}, that have a matching number of
-## rows, @code{plotmatrix} plots a set of axes corresponding to
-##
-## @example
-## plot (@var{x}(:, i), @var{y}(:, j))
-## @end example
-##
-## Given a single argument @var{x} this is equivalent to
-##
-## @example
-## plotmatrix (@var{x}, @var{x})
-## @end example
-##
-## @noindent
-## except that the diagonal of the set of axes will be replaced with the
-## histogram @code{hist (@var{x}(:, i))}.
-##
-## The marker to use can be changed with the @var{style} argument, that is a
-## string defining a marker in the same manner as the @code{plot} command.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} provides handles to the individual
-## graphics objects in the scatter plots, whereas @var{ax} returns the
-## handles to the scatter plot axis objects.  @var{bigax} is a hidden
-## axis object that surrounds the other axes, such that the commands
-## @code{xlabel}, @code{title}, etc., will be associated with this hidden
-## axis.  Finally, @var{p} returns the graphics objects associated with
-## the histogram and @var{pax} the corresponding axes objects.
-##
-## Example:
-##
-## @example
-## plotmatrix (randn (100, 3), "g+")
-## @end example
-##
-## @seealso{scatter, plot}
-## @end deftypefn
-
-function [h, ax, bigax, p, pax] = plotmatrix (varargin)
-
-  [bigax2, varargin, nargin] = __plt_get_axis_arg__ ("plotmatrix", varargin{:});
-
-  if (nargin > 3 || nargin < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (bigax2))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    bigax2 = newplot (bigax2);
-
-    [h2, ax2, p2, pax2] = __plotmatrix__ (bigax2, varargin{:});
-
-    axes (bigax2);
-    ctext = text (0, 0, "", "visible", "off",
-                  "handlevisibility", "off", "xliminclude", "off",
-                  "yliminclude", "off", "zliminclude", "off",
-                  "deletefcn", {@plotmatrixdelete, [ax2; pax2]});
-    set (bigax2, "visible", "off");
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = h2;
-    ax = ax2;
-    bigax = bigax2;
-    p = p2;
-    pax = pax2;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! plotmatrix (randn (100, 3), 'g+');
-
-
-function plotmatrixdelete (h, d, ax)
-  for i = 1 : numel (ax)
-    hc = ax(i);
-    if (isaxes (hc) && strcmpi (get (hc, "beingdeleted"), "off"))
-      parent = get (hc, "parent");
-      ## If the parent is invalid or being deleted, then do nothing
-      if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off"))
-        delete (hc);
-      endif
-    endif
-  endfor
-endfunction
-
-function [h, ax, p, pax] = __plotmatrix__ (bigax, varargin)
-  have_line_spec = false;
-  have_hist = false;
-  parent = get (bigax, "parent");
-  for i = 1 : nargin - 1
-    arg = varargin{i};
-    if (ischar (arg) || iscellstr (arg))
-      [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false);
-      if (valid)
-        have_line_spec = true;
-        linespec = varargin(i);
-        varargin(i) = [];
-        nargin = nargin - 1;
-        break;
-      else
-        print_usage ("plotmatrix");
-      endif
-    endif
-  endfor
-
-  if (nargin == 2)
-    X = varargin{1};
-    Y = X;
-    have_hist = true;
-  elseif (nargin == 3)
-    X = varargin{1};
-    Y = varargin{2};
-  else
-    print_usage ("plotmatrix");
-  endif
-
-  if (rows (X) != rows (Y))
-    error ("plotmatrix: dimension mismatch in the arguments");
-  endif
-
-  [dummy, m] = size (X);
-  [dummy, n] = size (Y);
-
-  h = [];
-  ax = [];
-  p = [];
-  pax = [];
-
-  xsize = 0.9 / m;
-  ysize = 0.9 / n;
-  xoff = 0.05;
-  yoff = 0.05;
-  border = [0.130, 0.110, 0.225, 0.185] .* [xsize, ysize, xsize, ysize];
-  border(3:4) = - border(3:4) - border(1:2);
-
-  for i = 1 : m
-    for j = 1 : n
-      pos = [xsize * (i - 1) + xoff, ysize * (n - j) + yoff, xsize, ysize];
-      tmp = axes ("outerposition", pos, "position", pos + border,
-                  "parent", parent);
-      if (i == j && have_hist)
-        pax = [pax ; tmp];
-        [nn, xx] = hist (X(:, i));
-        tmp = bar (xx, nn, 1.0);
-        p = [p; tmp];
-      else
-        ax = [ax ; tmp];
-        if (have_line_spec)
-          tmp = plot (X (:, i), Y (:, j), linespec);
-        else
-          tmp = plot (X (:, i), Y (:, j), ".");
-        endif
-        h = [h ; tmp];
-      endif
-    endfor
-  endfor
-endfunction
-
--- a/scripts/plot/plotyy.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,364 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2})
-## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun})
-## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun1}, @var{fun2})
-## @deftypefnx {Function File} {} plotyy (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{})
-## Plot two sets of data with independent y-axes.
-##
-## The arguments @var{x1} and @var{y1} define the arguments for the first plot
-## and @var{x1} and @var{y2} for the second.
-##
-## By default the arguments are evaluated with
-## @code{feval (@@plot, @var{x}, @var{y})}.  However the type of plot can be
-## modified with the @var{fun} argument, in which case the plots are
-## generated by @code{feval (@var{fun}, @var{x}, @var{y})}.  @var{fun} can be
-## a function handle, an inline function, or a string of a function name.
-##
-## The function to use for each of the plots can be independently defined
-## with @var{fun1} and @var{fun2}.
-##
-## If the first argument @var{hax} is an axes handle, then it defines
-## the principal axis in which to plot the @var{x1} and @var{y1} data.
-##
-## The return value @var{ax} is a vector with the axis handles of the two
-## y axes.  @var{h1} and @var{h2} are handles to the objects generated by the
-## plot commands.
-##
-## @example
-## @group
-## x = 0:0.1:2*pi;
-## y1 = sin (x);
-## y2 = exp (x - 1);
-## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy);
-## xlabel ("X");
-## ylabel (ax(1), "Axis 1");
-## ylabel (ax(2), "Axis 2");
-## @end group
-## @end example
-## @seealso{plot}
-## @end deftypefn
-
-function [Ax, H1, H2] = plotyy (varargin)
-
-  ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy
-  if (nargin > 1 && length (varargin{1}) == 2 && ishandle (varargin{1}(1))
-      && ishandle (varargin{1}(2))
-      && all (floor (varargin{1}) != varargin{1}))
-    obj1 = get (varargin{1}(1));
-    obj2 = get (varargin{1}(2));
-    if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes"))
-      ax = [obj1, obj2];
-      varargin(1) = [];
-      if (isempty (varargin))
-        varargin = {};
-      endif
-    else
-      error ("plotyy: expecting first argument to be axes handle");
-    endif
-    oldh = gca ();
-  else
-    f = get (0, "currentfigure");
-    if (isempty (f))
-      f = figure ();
-    endif
-    ca = get (f, "currentaxes");
-    if (isempty (ca))
-      ax = [];
-    elseif (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
-      ax = get (ca, "__plotyy_axes__");
-    else
-      ax = ca;
-    endif
-    if (length (ax) > 2)
-      for i = 3 : length (ax)
-        delete (ax (i));
-      endfor
-      ax = ax(1:2);
-    elseif (length (ax) == 1)
-      ax(2) = axes ();
-      set (ax(2), "nextplot", get (ax(1), "nextplot"));
-    elseif (isempty (ax))
-      ax(1) = axes ();
-      ax(2) = axes ();
-      ca = ax(2);
-    endif
-    if (nargin < 2)
-      varargin = {};
-    endif
-    oldh = ca;
-  endif
-
-  if (nargin < 4)
-    print_usage ();
-  endif
-
-  unwind_protect
-    [ax, h1, h2] = __plotyy__ (ax, varargin{:});
-  unwind_protect_cleanup
-    ## Only change back to the old axis if we didn't delete it
-    if (isaxes (oldh))
-      axes (oldh);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    Ax = ax;
-    H1 = h1;
-    H2 = h2;
-  endif
-
-endfunction
-
-function [ax, h1, h2] = __plotyy__ (ax, x1, y1, x2, y2, varargin)
-  if (nargin > 5)
-    fun1 = varargin{1};
-  else
-    fun1 = @plot;
-  endif
-  if (nargin > 6)
-    fun2 = varargin{2};
-  else
-    fun2 = fun1;
-  endif
-
-  xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])];
-
-  if (isaxes (ax(1)))
-    axes (ax(1));
-  else
-    ax(1) = axes ();
-  endif
-  newplot ();
-  h1 = feval (fun1, x1, y1);
-
-  set (ax(1), "ycolor", getcolor (h1(1)));
-  set (ax(1), "xlim", xlim);
-  set (ax(1), "color", "none");
-
-  cf = gcf ();
-  set (cf, "nextplot", "add");
-
-  if (isaxes (ax(2)))
-    axes (ax(2));
-  else
-    ax(2) = axes ();
-    set (ax(2), "nextplot", get (ax(1), "nextplot"));
-  endif
-  newplot ();
-
-  colors = get (ax(1), "colororder");
-  set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]);
-
-  if (strcmp (get (ax(1), "autopos_tag"), "subplot"))
-    set (ax(2), "autopos_tag", "subplot");
-  else
-    set (ax, "activepositionproperty", "position");
-  endif
-
-  ## Kluge, until __plt_get_axis_arg__ and newplot are reworked. 
-  set (ax(2), "nextplot", "replacechildren");
-  h2 = feval (fun2, ax(2), x2, y2);
-  set (ax(2), "yaxislocation", "right");
-  set (ax(2), "ycolor", getcolor (h2(1)));
-
-  if (strcmp (get(ax(1), "activepositionproperty"), "position"))
-    set (ax(2), "position", get (ax(1), "position"));
-  else
-    set (ax(2), "outerposition", get (ax(1), "outerposition"));
-    set (ax(2), "looseinset", get (ax(1), "looseinset"));
-  endif
-
-  set (ax(2), "xlim", xlim);
-  set (ax(2), "color", "none");
-  set (ax(2), "box", "off");
-
-  ## Add invisible text objects that when destroyed,
-  ## also remove the other axis
-  t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy",
-             "handlevisibility", "off", "visible", "off",
-             "xliminclude", "off", "yliminclude", "off");
-  t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy",
-             "handlevisibility", "off", "visible", "off",
-             "xliminclude", "off", "yliminclude", "off");
-
-  set (t1, "deletefcn", {@deleteplotyy, ax(2), t2});
-  set (t2, "deletefcn", {@deleteplotyy, ax(1), t1});
-
-  addlistener (ax(1), "position", {@update_position, ax(2)});
-  addlistener (ax(2), "position", {@update_position, ax(1)});
-  addlistener (ax(1), "outerposition", {@update_position, ax(2)});
-  addlistener (ax(2), "outerposition", {@update_position, ax(1)});
-  addlistener (ax(1), "looseinset", {@update_position, ax(2)});
-  addlistener (ax(2), "looseinset", {@update_position, ax(1)});
-  addlistener (ax(1), "view", {@update_position, ax(2)});
-  addlistener (ax(2), "view", {@update_position, ax(1)});
-  addlistener (ax(1), "plotboxaspectratio", {@update_position, ax(2)});
-  addlistener (ax(2), "plotboxaspectratio", {@update_position, ax(1)});
-  addlistener (ax(1), "plotboxaspectratiomode", {@update_position, ax(2)});
-  addlistener (ax(2), "plotboxaspectratiomode", {@update_position, ax(1)});
-  addlistener (ax(1), "nextplot", {@update_nextplot, ax(2)});
-  addlistener (ax(2), "nextplot", {@update_nextplot, ax(1)});
-
-  ## Store the axes handles for the sister axes.
-  if (ishandle (ax(1)) && ! isprop (ax(1), "__plotyy_axes__"))
-    addproperty ("__plotyy_axes__", ax(1), "data", ax);
-  elseif (ishandle (ax(1)))
-    set (ax(1), "__plotyy_axes__", ax);
-  else
-    error ("plotyy.m: This shouldn't happen. File a bug report.");
-  endif
-  if (ishandle (ax(2)) && ! isprop (ax(2), "__plotyy_axes__"))
-    addproperty ("__plotyy_axes__", ax(2), "data", ax);
-  elseif (ishandle (ax(2)))
-    set (ax(2), "__plotyy_axes__", ax);
-  else
-    error ("plotyy.m: This shouldn't happen. File a bug report.");
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.1:2*pi;
-%! y1 = sin (x);
-%! y2 = exp (x - 1);
-%! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
-%! xlabel ('X');
-%! ylabel (ax(1), 'Axis 1');
-%! ylabel (ax(2), 'Axis 2');
-%! axes (ax(1));
-%! text (0.5, 0.5, 'Left Axis', ...
-%!       'color', [0 0 1], 'horizontalalignment', 'center');
-%! axes (ax(2));
-%! text (4.5, 80, 'Right Axis', ...
-%!       'color', [0 0.5 0], 'horizontalalignment', 'center');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = linspace (-1, 1, 201);
-%! subplot (2,2,1);
-%!  plotyy (x,sin(pi*x), x,10*cos(pi*x));
-%! subplot (2,2,2);
-%!  surf (peaks (25));
-%! subplot (2,2,3);
-%!  contour (peaks (25));
-%! subplot (2,2,4);
-%!  plotyy (x,10*sin(2*pi*x), x,cos(2*pi*x));
-%! axis square;
-
-%!demo
-%! clf;
-%! x = linspace (-1, 1, 201);
-%! hax = plotyy (x, sin (pi*x), x, cos (pi*x));
-%! ylabel (hax(1), 'Blue on the Left');
-%! ylabel (hax(2), 'Green on the Right');
-%! xlabel ('xlabel');
-
-%!demo
-%! clf
-%! hold on
-%! t = (0:0.1:9);
-%! x = sin (t);
-%! y = 5 * cos (t);
-%! [hax, h1, h2] = plotyy (t, x, t, y);
-%! [~, h3, h4] = plotyy (t+1, x, t+1, y);
-%! set ([h3, h4], 'linestyle', '--');
-%! xlabel (hax(1), 'xlabel');
-%! title (hax(2), 'title');
-%! ylabel (hax(1), 'Left axis is Blue');
-%! ylabel (hax(2), 'Right axis is Green');
-
-function deleteplotyy (h, d, ax2, t2)
-  if (isaxes (ax2)
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
-      && strcmp (get (ax2, "beingdeleted"), "off"))
-    set (t2, "deletefcn", []);
-    delete (ax2);
-  endif
-endfunction
-
-function update_nextplot (h, d, ax2)
-  persistent recursion = false;
-  prop = "nextplot";
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      set (ax2, prop, get (h, prop));
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_position (h, d, ax2)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      view = get (h, "view");
-      oldview = get (ax2, "view");
-      plotboxaspectratio = get (h, "plotboxaspectratio");
-      oldplotboxaspectratio = get (ax2, "plotboxaspectratio");
-      plotboxaspectratiomode = get (h, "plotboxaspectratiomode");
-      oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode");
-
-      if (strcmp (get(h, "activepositionproperty"), "position"))
-        position = get (h, "position");
-        oldposition = get (ax2, "position");
-        if (! (isequal (position, oldposition) && isequal (view, oldview)))
-          set (ax2, "position", position, "view", view);
-        endif
-      else
-        outerposition = get (h, "outerposition");
-        oldouterposition = get (ax2, "outerposition");
-        if (! (isequal (outerposition, oldouterposition) && isequal (view, oldview)))
-          set (ax2, "outerposition", outerposition, "view", view);
-        endif
-      endif
-
-      if (! (isequal (plotboxaspectratio, oldplotboxaspectratio)
-             && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode)))
-        set (ax2, "plotboxaspectratio", plotboxaspectratio);
-        set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode);
-      endif
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function color = getcolor (ax)
-  obj = get (ax);
-  if (isfield (obj, "color"))
-    color = obj.color;
-  elseif (isfield (obj, "facecolor") && ! ischar (obj.facecolor))
-    color = obj.facecolor;
-  elseif (isfield (obj, "edgecolor") && !  ischar (obj.edgecolor))
-    color = obj.edgecolor;
-  else
-    color = [0, 0, 0];
-  endif
-endfunction
-
--- a/scripts/plot/polar.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} polar (@var{theta}, @var{rho})
-## @deftypefnx {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt})
-## @deftypefnx {Function File} {} polar (@var{cplx})
-## @deftypefnx {Function File} {} polar (@var{cplx}, @var{fmt})
-## @deftypefnx {Function File} {} polar (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} polar (@dots{})
-## Create a 2-D plot from polar coordinates @var{theta} and @var{rho}.
-##
-## If a single complex input @var{cplx} is given then the real part is used
-## for @var{theta} and the imaginary part is used for @var{rho}.
-##
-## The optional argument @var{fmt} specifies the line format in the same way
-## as @code{plot}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @seealso{rose, compass, plot}
-## @end deftypefn
-
-## Author: jwe
-
-function h = polar (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    if (nargs == 3)
-      if (! ischar (varargin{3}))
-        error ("polar: FMT argument must be a string");
-      endif
-      htmp = __plr2__ (hax, varargin{:});
-      maxr = max (varargin{2}(:));
-    elseif (nargs == 2)
-      if (ischar (varargin{2}))
-        htmp = __plr1__ (hax, varargin{:});
-        if (iscomplex (varargin{1}))
-          maxr = max (imag (varargin{1})(:));
-        else
-          maxr = max (varargin{1}(:));
-        endif
-      else
-        fmt = "";
-        htmp = __plr2__ (hax, varargin{:}, fmt);
-        maxr = max (varargin{2}(:));
-      endif
-    elseif (nargs == 1)
-      fmt = "";
-      htmp = __plr1__ (hax, varargin{:}, fmt);
-      if (iscomplex (varargin{1}))
-        maxr = max (imag (varargin{1})(:));
-      else
-        maxr = max (varargin{1}(:));
-      endif
-    else
-      print_usage ();
-    endif
-
-    set (hax, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr],
-              "xaxislocation", "zero", "yaxislocation", "zero",
-              "plotboxaspectratio", [1, 1, 1]);
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-function retval = __plr1__ (h, theta, fmt)
-
-  theta = theta(:);
-  if (iscomplex (theta))
-    rho = imag (theta);
-    theta = real (theta);
-  else
-    rho = theta;
-    theta = (1:rows (rho))';
-  endif
-
-  retval = __plr2__ (h, theta, rho, fmt);
-
-endfunction
-
-function retval = __plr2__ (h, theta, rho, fmt)
-
-  if (ndims (theta) > 2 || ndims (rho) > 2)
-    error ("polar: THETA and RHO must be 2-D objects");
-  endif
-  theta = real (theta);
-  rho = real (rho);
-
-  if (isscalar (theta))
-    if (isscalar (rho))
-      x = rho * cos (theta);
-      y = rho * sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    else
-      error ("polar: Can't plot constant THETA with varying RHO");
-    endif
-  elseif (isvector (theta))
-    if (isvector (rho))
-      if (length (theta) != length (rho))
-        error ("polar: THETA and RHO vector lengths must match");
-      endif
-      rho = rho(:);
-      theta = theta(:);
-      x = rho .* cos (theta);
-      y = rho .* sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    elseif (ismatrix (rho))
-      theta = theta(:);
-      t_nr = rows (theta);
-      [r_nr, r_nc] = size (rho);
-      if (t_nr != r_nr)
-        rho = rho';
-        r_nr = r_nc;
-      endif
-      if (t_nr != r_nr)
-        error ("polar: THETA vector and RHO matrix sizes must match");
-      endif
-      x = diag (cos (theta)) * rho;
-      y = diag (sin (theta)) * rho;
-      retval = __plt__ ("polar", h, x, y, fmt);
-    else
-      error ("polar: invalid data for plotting");
-    endif
-  elseif (ismatrix (theta))
-    if (isvector (rho))
-      rho = rho(:);
-      r_nr = rows (rho);
-      [t_nr, t_nc] = size (theta);
-      if (r_nr != t_nr)
-        theta = theta';
-        t_nr = t_nc;
-      endif
-      if (r_nr != t_nr)
-        error ("polar: THETA matrix and RHO vector sizes must match");
-      endif
-      diag_r = diag (rho);
-      x = diag_r * cos (theta);
-      y = diag_r * sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    elseif (ismatrix (rho))
-      if (! size_equal (rho, theta))
-        error ("polar: THETA and RHO matrix dimensions must match");
-      endif
-      x = rho .* cos (theta);
-      y = rho .* sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    else
-      error ("polar: invalid data for plotting");
-    endif
-  else
-    error ("polar: invalid data for plotting");
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! theta = linspace (0,2*pi,1000);
-%! rho = sin (7*theta);
-%! polar (theta, rho);
-%! title ('polar() plot');
-
-%!demo
-%! clf;
-%! theta = linspace (0,2*pi,1000);
-%! cplx = theta + i*sin (7*theta);
-%! polar (cplx, 'g');
-%! title ('polar() plot of complex data');
-
-%!demo
-%! clf;
-%! theta = linspace (0,8*pi,1000);
-%! rho = sin (5/4*theta);
-%! polar (theta, rho);
-%! title ('polar() plot');
-
--- a/scripts/plot/print.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,710 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} print ()
-## @deftypefnx {Function File} {} print (@var{options})
-## @deftypefnx {Function File} {} print (@var{filename}, @var{options})
-## @deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options})
-## Print a plot, or save it to a file.
-##
-## Both output formatted for printing (PDF and PostScript), and many bitmapped
-## and vector image formats are supported.
-##
-## @var{filename} defines the name of the output file.  If the
-## file name has no suffix, one is inferred from the specified
-## device and appended to the file name.  If no filename is
-## specified, the output is sent to the printer.
-##
-## @var{h} specifies the handle of the figure to print.  If no handle is
-## specified the current figure is used.
-##
-## For output to a printer, PostScript file, or PDF file,
-## the paper size is specified by the figure's @code{papersize}
-## property.  The location and size of the image on the page are
-## specified by the figure's @code{paperposition} property.  The
-## orientation of the page is specified by the figure's
-## @code{paperorientation} property.
-##
-## The width and height of images are specified by the figure's
-## @code{paperpositon(3:4)} property values.
-##
-## The @code{print} command supports many @var{options}:
-##
-## @table @code
-## @item -f@var{h}
-##   Specify the handle, @var{h}, of the figure to be printed.  The
-## default is the current figure.
-##
-## @item -P@var{printer}
-##   Set the @var{printer} name to which the plot is sent if no
-## @var{filename} is specified.
-##
-## @item -G@var{ghostscript_command}
-##   Specify the command for calling Ghostscript.  For Unix and Windows
-## the defaults are @qcode{"gs"} and @qcode{"gswin32c"}, respectively.
-##
-## @item  -color
-## @itemx -mono
-##   Color or monochrome output.
-##
-## @item  -solid
-## @itemx -dashed
-##   Force all lines to be solid or dashed, respectively.
-##
-## @item  -portrait
-## @itemx -landscape
-##   Specify the orientation of the plot for printed output.  For
-## non-printed output the aspect ratio of the output corresponds to
-## the plot area defined by the @qcode{"paperposition"} property in the
-## orientation specified.  This option is equivalent to changing
-## the figure's @qcode{"paperorientation"} property.
-##
-## @item  -TextAlphaBits=@var{n}
-## @itemx -GraphicsAlphaBits=@var{n}
-##   Octave is able to produce output for various printers, bitmaps, and
-## vector formats by using Ghostscript.
-## For bitmap and printer output anti-aliasing is applied using
-## Ghostscript's TextAlphaBits and GraphicsAlphaBits options.
-## The default number of bits for each is 4.
-## Allowed values for @var{N} are 1, 2, or 4.
-##
-## @item -d@var{device}
-##   The available output format is specified by the option @var{device},
-## and is one of:
-##
-##   @table @code
-##   @item  ps
-##   @itemx ps2
-##   @itemx psc
-##   @itemx psc2
-##     PostScript (level 1 and 2, mono and color).  The FLTK graphics
-## toolkit generates PostScript level 3.0.
-##
-##   @item  eps
-##   @itemx eps2
-##   @itemx epsc
-##   @itemx epsc2
-##     Encapsulated PostScript (level 1 and 2, mono and color).  The FLTK
-## graphic toolkit generates PostScript level 3.0.
-##
-##   @item  tex
-##   @itemx epslatex
-##   @itemx epslatexstandalone
-##   @itemx pstex
-##   @itemx pslatex
-##   @itemx pdflatex
-##     Generate a @LaTeX{} (or @TeX{}) file for labels and eps/ps/pdf
-## for graphics.  The file produced by @code{epslatexstandalone} can be
-## processed directly by @LaTeX{}.  The other formats are intended to
-## be included in a @LaTeX{} (or @TeX{}) document.  The @code{tex} device
-## is the same as the @code{epslatex} device.  The @code{pdflatex} device
-## is only available for the FLTK graphics toolkit.
-##
-##   @item tikz
-##     Generate a @LaTeX{} file using PGF/TikZ@.  For the FLTK toolkit
-## the result is PGF.
-##
-##   @item  ill
-##   @itemx aifm
-##     Adobe Illustrator (Obsolete for Gnuplot versions > 4.2)
-##
-##   @item  cdr
-##   @itemx @nospell{corel}
-##     CorelDraw
-##
-##   @item dxf
-##     AutoCAD
-##
-##   @item  emf
-##   @itemx meta
-##     Microsoft Enhanced Metafile
-##
-##   @item fig
-##     XFig.  For the Gnuplot graphics toolkit, the additional options
-## @option{-textspecial} or @option{-textnormal} can be used to control
-## whether the special flag should be set for the text in
-## the figure.  (default is @option{-textnormal})
-##
-##   @item hpgl
-##     HP plotter language
-##
-##   @item mf
-##     Metafont
-##
-##   @item png
-##     Portable network graphics
-##
-##   @item  jpg
-##   @itemx jpeg
-##     JPEG image
-##
-##   @item gif
-##     GIF image (only available for the Gnuplot graphics toolkit)
-##
-##   @item pbm
-##     PBMplus
-##
-##   @item svg
-##     Scalable vector graphics
-##
-##   @item pdf
-##     Portable document format
-##   @end table
-##
-##   If the device is omitted, it is inferred from the file extension,
-## or if there is no filename it is sent to the printer as PostScript.
-##
-## @item -d@var{ghostscript_device}
-##   Additional devices are supported by Ghostscript.
-## Some examples are;
-##
-##   @table @code
-##   @item ljet2p
-##     HP LaserJet @nospell{IIP}
-##
-##   @item ljet3
-##     HP LaserJet III
-##
-##   @item deskjet
-##     HP DeskJet and DeskJet Plus
-##
-##   @item cdj550
-##     HP DeskJet 550C
-##
-##   @item paintjet
-##     HP PointJet
-##
-##   @item pcx24b
-##     24-bit color PCX file format
-##
-##   @item ppm
-##     Portable Pixel Map file format
-##
-##   @item pdfwrite
-##     Produces pdf output from eps
-##   @end table
-##
-##   For a complete list, type @code{system ("gs -h")} to see what formats
-## and devices are available.
-##
-##   When Ghostscript output is sent to a printer the size is determined
-## by the figure's @qcode{"papersize"} property.  When the output
-## is sent to a file the size is determined by the plot box defined by
-## the figure's @qcode{"paperposition"} property.
-##
-## @item -append
-##   Append PostScript or PDF output to a pre-existing file of the same type.
-##
-## @item -r@var{NUM}
-##   Resolution of bitmaps in pixels per inch.  For both metafiles and
-## SVG the default is the screen resolution; for other formats it is 150 dpi.
-## To specify screen resolution, use @qcode{"-r0"}.
-##
-## @item  -loose
-## @itemx -tight
-##   Force a tight or loose bounding box for eps files.  The default is loose.
-##
-## @item -@var{preview}
-##   Add a preview to eps files.  Supported formats are:
-##
-##   @table @code
-##   @item -interchange
-##     Provide an interchange preview.
-##
-##   @item -metalfile
-##     Provide a metafile preview.
-##
-##   @item -pict
-##     Provide pict preview.
-##
-##   @item -tiff
-##     Provide a tiff preview.
-##   @end table
-##
-## @item -S@var{xsize},@var{ysize}
-##   Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG@.  For
-## PS, EPS, PDF, and other vector formats the plot size is in points.
-## This option is equivalent to changing the size of the plot box
-## associated with the @qcode{"paperposition"} property.  When using the
-## command form of the print function you must quote the
-## @var{xsize},@var{ysize} option.  For example, by writing @w{"-S640,480"}.
-##
-## @item  -F@var{fontname}
-## @itemx -F@var{fontname}:@var{size}
-## @itemx -F:@var{size}
-##   Use @var{fontname} and/or @var{fontsize} for all text.
-## @var{fontname} is ignored for some devices: dxf, fig, hpgl, etc.
-## @end table
-##
-## The filename and options can be given in any order.
-##
-## Example: Print to a file using the svg device.
-##
-## @example
-## @group
-## figure (1);
-## clf ();
-## surf (peaks);
-## print -dsvg figure1.svg
-## @end group
-## @end example
-##
-## Example: Print to an HP DeskJet 550C.
-##
-## @example
-## @group
-## clf ();
-## surf (peaks);
-## print -dcdj550
-## @end group
-## @end example
-##
-## @seealso{saveas, orient, figure}
-## @end deftypefn
-
-function print (varargin)
-
-  opts = __print_parse_opts__ (varargin{:});
-
-  opts.pstoedit_cmd = @pstoedit;
-  opts.fig2dev_cmd = @fig2dev;
-  opts.latex_standalone = @latex_standalone;
-  opts.lpr_cmd = @lpr;
-  opts.epstool_cmd = @epstool;
-
-  if (! isfigure (opts.figure))
-    error ("print: no figure to print");
-  endif
-
-  orig_figure = get (0, "currentfigure");
-  set (0, "currentfigure", opts.figure);
-
-  if (opts.append_to_file)
-    [~, ~, ext] = fileparts (opts.ghostscript.output);
-    opts.ghostscript.prepend = strcat (tmpnam (), ext);
-    copyfile (opts.ghostscript.output, opts.ghostscript.prepend);
-  endif
-
-  unwind_protect
-
-    ## Modify properties as specified by options
-    props = [];
-
-    drawnow ();
-
-    ## print() requires figure units to be "pixels"
-    props(1).h = opts.figure;
-    props(1).name = "units";
-    props(1).value = {get(opts.figure, "units")};
-    set (opts.figure, "units", "pixels");
-
-    ## graphics toolkit tranlates figure position to eps bbox in points
-    fpos = get (opts.figure, "position");
-    props(2).h = opts.figure;
-    props(2).name = "position";
-    props(2).value = {fpos};
-    fpos(3:4) = opts.canvas_size;
-    set (opts.figure, "position", fpos);
-
-    ## Set figure background to none. This is done both for
-    ## consistency with Matlab and to elliminate the visible
-    ## box along the figure's perimeter.
-    props(3).h = opts.figure;
-    props(3).name = "color";
-    props(3).value{1} = get (props(3).h, props(3).name);
-    set (props(3).h, "color", "none");
-
-    if (opts.force_solid != 0)
-      h = findall (opts.figure, "-property", "linestyle");
-      m = numel (props);
-      for n = 1:numel (h)
-        props(m+n).h = h(n);
-        props(m+n).name = "linestyle";
-        props(m+n).value = {get(h(n), "linestyle")};
-      endfor
-      if (opts.force_solid > 0)
-        linestyle = "-";
-      else
-        linestyle = "--";
-      endif
-      set (h, "linestyle", linestyle);
-    endif
-
-    if (opts.use_color < 0
-        && ! strcmp (get (opts.figure, "__graphics_toolkit__"), "gnuplot"))
-      color_props = {"color", "facecolor", "edgecolor", "colormap"};
-      for c = 1:numel (color_props)
-        h = findall (opts.figure, "-property", color_props{c});
-        hnone = findall (opts.figure, color_props{c}, "none");
-        h = setdiff (h, hnone);
-        m = numel (props);
-        for n = 1:numel (h)
-          if (ishandle (h(n)))
-            ## Need to verify objects exist since callbacks may delete objects
-            ## as the colors for others are modified.
-            rgb = get (h(n), color_props{c});
-            props(end+1).h = h(n);
-            props(end).name = color_props{c};
-            props(end).value = {get(h(n), color_props{c})};
-            if (isnumeric (rgb))
-              ## convert RGB color to RGB gray scale
-              xfer = repmat ([0.30, 0.59, 0.11], rows (rgb), 1);
-              ggg = repmat (sum (xfer .* rgb, 2), 1, 3);
-              set (h(n), color_props{c}, ggg);
-            endif
-          endif
-        endfor
-      endfor
-    endif
-
-    if (! isempty (opts.font) || ! isempty (opts.fontsize))
-      h = findall (opts.figure, "-property", "fontname");
-      m = numel (props);
-      for n = 1:numel (h)
-        if (ishandle (h(n)))
-          if (! isempty (opts.font))
-            props(end+1).h = h(n);
-            props(end).name = "fontname";
-            props(end).value = {get(h(n), "fontname")};
-          endif
-        endif
-        if (ishandle (h(n)))
-          if (! isempty (opts.fontsize))
-            props(end+1).h = h(n);
-            props(end).name = "fontsize";
-            props(end).value = {get(h(n), "fontsize")};
-          endif
-        endif
-      endfor
-      if (! isempty (opts.font))
-        set (h(ishandle (h)), "fontname", opts.font);
-      endif
-      if (! isempty (opts.fontsize))
-        if (ischar (opts.fontsize))
-          fontsize = str2double (opts.fontsize);
-        else
-          fontsize = opts.fontsize;
-        endif
-        if (! isempty (opts.scalefontsize) && ! opts.scalefontsize != 1)
-          ## This is done to work around the bbox being whole numbers.
-          fontsize = fontsize * opts.scalefontsize;
-        endif
-        set (h(ishandle (h)), "fontsize", fontsize);
-      endif
-    endif
-
-    ## call the graphcis toolkit print script
-    switch (get (opts.figure, "__graphics_toolkit__"))
-      case "gnuplot"
-        opts = __gnuplot_print__ (opts);
-      otherwise
-        opts = __fltk_print__ (opts);
-    endswitch
-
-  unwind_protect_cleanup
-    ## restore modified properties
-    if (isstruct (props))
-      for n = numel (props):-1:1
-        if (ishandle (props(n).h))
-          set (props(n).h, props(n).name, props(n).value{1});
-        endif
-      endfor
-    endif
-
-    ## Unlink temporary files
-    for n = 1:numel (opts.unlink)
-      [status, output] = unlink (opts.unlink{n});
-      if (status != 0)
-        warning ("print.m: %s, '%s'", output, opts.unlink{n});
-      endif
-    endfor
-  end_unwind_protect
-
-  if (isfigure (orig_figure))
-    set (0, "currentfigure", orig_figure);
-  endif
-
-endfunction
-
-function cmd = epstool (opts, filein, fileout)
-  ## As epstool does not work with pipes, a subshell is used to
-  ## permit piping. Since this solution does not work with the DOS
-  ## command shell, the -tight and -preview options are disabled if
-  ## output must be piped.
-
-  ## DOS Shell:
-  ##   gs.exe [...] -sOutputFile=<filein> - & epstool -bbox -preview-tiff <filein> <fileout> & del <filein>
-  ## Unix Shell;
-  ##   cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein>
-
-  dos_shell = (ispc () && ! isunix ());
-
-  cleanup = "";
-  if (nargin < 3)
-    fileout = opts.name;
-  elseif (isempty (fileout))
-    fileout = "-";
-  endif
-
-  if (nargin < 2 || strcmp (filein, "-") || isempty (filein))
-    pipein = true;
-    filein = strcat (tmpnam (), ".eps");
-    if (dos_shell)
-      cleanup = sprintf ("& del %s ", strrep (filein, '/', '\'));
-    else
-      cleanup = sprintf ("; rm %s ", filein);
-    endif
-  else
-    pipein = false;
-    filein = strcat ("'", strtrim (filein), "'");
-  endif
-  if (strcmp (fileout, "-"))
-    pipeout = true;
-    fileout = strcat (tmpnam (), ".eps");
-    if (dos_shell)
-      cleanup = horzcat (cleanup, sprintf ("& del %s ", strrep (fileout, '/', '\')));
-    else
-      cleanup = horzcat (cleanup, sprintf ("; rm %s ", fileout));
-    endif
-  else
-    pipeout = false;
-    fileout = strcat ("'", strtrim (fileout), "'");
-  endif
-
-  if (! isempty (opts.preview) && opts.tight_flag)
-    warning ("print:previewandtight",
-             "print.m: eps preview may not be combined with -tight");
-  endif
-  if (! isempty (opts.preview) || opts.tight_flag)
-    if (! isempty (opts.epstool_binary))
-      if (opts.tight_flag)
-        cmd = "--copy --bbox";
-      elseif (! isempty (opts.preview))
-        switch (opts.preview)
-          case "tiff"
-            cmd = sprintf ("--add-%s-preview --device tiffg3", opts.preview);
-          case {"tiff6u", "tiff6p", "metafile"}
-            cmd = sprintf ("--add-%s-preview --device bmpgray", opts.preview);
-          case {"tiff4", "interchange"}
-            cmd = sprintf ("--add-%s-preview", opts.preview);
-          case "pict"
-            cmd = sprintf ("--add-%s-preview --mac-single", opts.preview);
-          otherwise
-            error ("print:invalidpreview",
-                   "print.m: epstool cannot include preview for format '%s'",
-                   opts.preview);
-        endswitch
-        if (! isempty (opts.ghostscript.resolution))
-          cmd = sprintf ("%s --dpi %d", cmd, opts.ghostscript.resolution);
-        endif
-      else
-        cmd = "";
-      endif
-      if (! isempty (cmd))
-        cmd = sprintf ("%s --quiet %s %s %s ", opts.epstool_binary,
-                       cmd, filein, fileout);
-      endif
-      if (pipein)
-        if (dos_shell)
-          filein(filein=="'") = "\"";
-          gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
-                                    "device", "epswrite",
-                                    "source", "-",
-                                    "output", filein);
-          cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd);
-        else
-          cmd = sprintf ("cat > %s ; %s", filein, cmd);
-        endif
-      endif
-      if (pipeout)
-        if (dos_shell)
-          cmd = sprintf ("%s & type %s", cmd, fileout);
-        else
-          cmd = sprintf ("%s ; cat %s", cmd, fileout);
-        endif
-      endif
-      if (! isempty (cleanup))
-        if (pipeout && dos_shell)
-          error ("print:epstoolpipe",
-                 "print.m: cannot pipe output of 'epstool' for DOS shell");
-        elseif (pipeout)
-          cmd = sprintf ("( %s %s )", cmd, cleanup);
-        else
-          cmd = sprintf ("%s %s", cmd, cleanup);
-        endif
-      endif
-    elseif (isempty (opts.epstool_binary))
-      error ("print:noepstool", "print.m: 'epstool' not found in PATH");
-    endif
-  else
-    if (pipein && pipeout)
-      if (dos_shell)
-        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
-                               "device", "epswrite",
-                               "source", "-",
-                               "output", "-");
-      else
-        cmd = " cat ";
-      endif
-    elseif (pipein && ! pipeout)
-      if (dos_shell)
-        ## ghostscript expects double, not single, quotes
-        fileout(fileout=="'") = "\"";
-        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
-                               "device", "epswrite",
-                               "source", "-",
-                               "output", fileout);
-      else
-        cmd = sprintf (" cat > %s ", fileout);
-      endif
-    elseif (! pipein && pipeout)
-      if (dos_shell)
-        cmd = sprintf (" type %s ", filein);
-      else
-        cmd = sprintf (" cat %s ", filein);
-      endif
-    else
-      if (dos_shell)
-        cmd = sprintf (" copy %s %s ", filein, fileout);
-      else
-        cmd = sprintf (" cp %s %s ", filein, fileout);
-      endif
-    endif
-  endif
-  if (opts.debug)
-    fprintf ("epstool command: '%s'\n", cmd);
-  endif
-endfunction
-
-function cmd = fig2dev (opts, devopt)
-  if (nargin < 2)
-    devopt =  opts.devopt;
-  endif
-  dos_shell = (ispc () && ! isunix ());
-  if (! isempty (opts.fig2dev_binary))
-    if (dos_shell)
-      ## FIXME - is this the right thing to do for DOS?
-      cmd = sprintf ("%s -L %s 2> NUL", opts.fig2dev_binary, devopt);
-    else
-      cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt);
-    endif
-  elseif (isempty (opts.fig2dev_binary))
-    error ("print:nofig2dev", "print.m: 'fig2dev' not found in PATH");
-  endif
-  if (opts.debug)
-    fprintf ("fig2dev command: '%s'\n", cmd);
-  endif
-endfunction
-
-function latex_standalone (opts)
-  n = find (opts.name == ".", 1, "last");
-  if (! isempty (n))
-    opts.name = opts.name(1:n-1);
-  endif
-  latexfile = strcat (opts.name, ".tex");
-  switch (opts.devopt)
-    case {"pdflatexstandalone"}
-      packages = "\\usepackage{graphicx,color}";
-      graphicsfile = strcat (opts.name, "-inc.pdf");
-    case {"pslatexstandalone"}
-      packages = "\\usepackage{epsfig,color}";
-      graphicsfile = strcat (opts.name, "-inc.ps");
-    otherwise
-      packages = "\\usepackage{epsfig,color}";
-      graphicsfile = strcat (opts.name, "-inc.eps");
-  endswitch
-  papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}",
-                       opts.canvas_size, opts.canvas_size);
-  prepend = {"\\documentclass{minimal}";
-             packages;
-             papersize;
-             "\\begin{document}";
-             "\\centering"};
-  postpend = {"\\end{document}"};
-  fid = fopen (latexfile, "r");
-  if (fid >= 0)
-    latex = fscanf (fid, "%c", Inf);
-    status = fclose (fid);
-    if (status != 0)
-      error ("print:errorclosingfile",
-             "print.m: error closing file '%s'", latexfile);
-    endif
-    ## TODO - should this be fixed in GL2PS?
-    latex = strrep (latex, "\\includegraphics{}",
-                    sprintf ("\\includegraphics{%s}", graphicsfile));
-  else
-    error ("print:erroropeningfile",
-           "print.m: error opening file '%s'", latexfile);
-  endif
-  fid = fopen (latexfile, "w");
-  if (fid >= 0)
-    fprintf (fid, "%s\n", prepend{:});
-    fprintf (fid, "%s", latex);
-    fprintf (fid, "%s\n", postpend{:});
-    status = fclose (fid);
-    if (status != 0)
-      error ("print:errorclosingfile",
-             "print.m: error closing file '%s'", latexfile);
-    endif
-  else
-    error ("print:erroropeningfile",
-           "print.m: error opening file '%s'", latexfile);
-  endif
-endfunction
-
-function cmd = lpr (opts)
-  if (nargin < 2)
-    devopt =  opts.devopt;
-  endif
-  if (! isempty (opts.lpr_binary))
-    cmd = opts.lpr_binary;
-    if (! isempty (opts.lpr_options))
-      cmd = sprintf ("%s %s", cmd, opts.lpr_options);
-    endif
-    if (! isempty (opts.printer))
-      cmd = sprintf ("%s -P %s", cmd, opts.printer);
-    endif
-  elseif (isempty (opts.lpr_binary))
-    error ("print:nolpr", "print.m: 'lpr' not found in PATH");
-  endif
-  if (opts.debug)
-    fprintf ("lpr command: '%s'\n", cmd);
-  endif
-endfunction
-
-function cmd = pstoedit (opts, devopt)
-  if (nargin < 2)
-    devopt =  opts.devopt;
-  endif
-  dos_shell = (ispc () && ! isunix ());
-  if (! isempty (opts.pstoedit_binary))
-    if (dos_shell)
-      cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt);
-    else
-      ## FIXME - is this the right thing to do for DOS?
-      cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt);
-    endif
-  elseif (isempty (opts.pstoedit_binary))
-    error ("print:nopstoedit", "print.m: 'pstoedit' not found in PATH");
-  endif
-  if (opts.debug)
-    fprintf ("pstoedit command: '%s'\n", cmd);
-  endif
-endfunction
-
--- a/scripts/plot/printd.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-## Copyright (C) 2013 Michael D. Godfrey
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public
-## License as published by the Free Software Foundation;
-## either version 3 of the License, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied
-## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-## PURPOSE. See the GNU General Public License for more
-## details.
-##
-## You should have received a copy of the GNU General Public
-## License along with Octave; see the file COPYING. If not,
-## see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} printd (@var{obj}, @var{filename})
-## @deftypefnx {Function File} {@var{out_file} =} printd (@dots{})
-##
-## Convert any object acceptable to @code{disp} into the format
-## selected by the suffix of @var{filename}.  If the return argument
-## @var{out_file} is given, the name of the created file is returned.
-##
-## This function is intended to facilitate manipulation of the output
-## of functions such as @code{stemleaf}.
-## @seealso{stemleaf}
-## @end deftypefn
-
-## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
-## Description: Convert objects into other file formats.
-
-function pr_out = printd (obj, filename)
-  ## Convert any object acceptable to disp() into various display formats.
-  ## obj is the input object.
-  ## filename is the output file (with required suffix).
-
-  ## Extract .suffix from filename
-  if ((sufix = rindex (filename, ".")) <= 0)
-    error ("The output filename: %s requires a suffix.\nOptions are: pdf ps eps txt jpg jpeg", filename);
-  endif
-  opt = substr (filename, sufix+1);
-  [pf, tempf, mag] = mkstemp ("oct-XXXXXX", 1);  # Safe version of tmpnam()
-  fprintf (pf, "%s", disp (obj));
-  frewind (pf);
-
-  ## It seems best to only use convert for image output.  Its ps and pdf
-  ## are badly rendered.
-  opt = lower (opt);
-  switch (opt)
-    case "pdf"
-      enscr = sprintf (
-                       "enscript --no-header -o %s.ps %s ; ps2pdf %s.ps %s.pdf; mv %s.pdf %s;exit",...
-                       tempf, tempf, tempf, tempf, tempf, filename);
-      system (enscr);
-      delete ([tempf ".ps"]);
-    case "ps"
-      enscr = sprintf ("enscript --no-header -o %s %s ; exit", filename, tempf);
-      system (enscr);
-    case "eps"
-      enscr = sprintf (
-                       "enscript --no-header -o %s.ps %s ; ps2eps --ignoreBB %s.ps; mv %s.eps %s; exit",...
-                       tempf, tempf, tempf, tempf, filename);
-      system (enscr);
-      delete ([tempf ".ps"]);
-    case "txt"
-      enscr = sprintf ("cp %s %s", tempf, filename);
-      system (enscr);
-    case {"jpg", "jpeg"}
-      enscr = sprintf ("convert -trim txt:%s  jpg:%s", tempf, filename);
-      system (enscr);
-    otherwise
-      fclose (pf);
-      delete (tempf);
-      error ("Unknown conversion type: %s.\nOptions are: pdf ps eps txt jpg jpeg", opt);
-
-  endswitch
-  fclose (pf);
-  delete (tempf);
-  pr_out =  sprintf ("%s file %s written\n", opt, filename);
-endfunction
-
-
-%!demo
-%! r2 = char (
-%! 'stem step: 10, data: unsorted.',
-%! 'Hinges:    lo: 12, hi: 42'     ,
-%! '   1 | 22118'                  ,
-%! '   2 | 28'                     ,
-%! '   3 | 98'                     ,
-%! '   4 | 244'                    ,
-%! '   5 | 2'                      );
-%! printd (r2, 'test_p.txt');
-%! system ('cat test_p.txt');
-%! delete ('test_p.txt');
-
-%!test
-%! r2 = char (
-%! "stem step: 10, data: unsorted.",
-%! "Hinges:    lo: 12, hi: 42"     ,
-%! "   1 | 22118"                  ,
-%! "   2 | 28"                     ,
-%! "   3 | 98"                     ,
-%! "   4 | 244"                    ,
-%! "   5 | 2"                      );
-%! printd (r2, "test_p.txt");
-%! r4 = fileread ("test_p.txt");
-%! delete ("test_p.txt");
-%! r2 = disp (r2);
-%! assert (r4, r2);
-
--- a/scripts/plot/private/__actual_axis_position__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} __actual_axis_position__ (@var{h})
-## @deftypefnx {Function File} {} __actual_axis_position__ (@var{axis_struct})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott
-
-function pos = __actual_axis_position__ (h)
-
-  if (ishandle (h))
-    axis_obj = get (h);
-  elseif (isstruct (h))
-    axis_obj = h;
-    h = axis_obj.__cbar_hax__;
-  endif
-
-  ## Get figure size in pixels
-  orig_fig_units = get (axis_obj.parent, "units");
-  orig_fig_position = get (axis_obj.parent, "position");
-  unwind_protect
-    set (axis_obj.parent, "units", "pixels");
-    fig_position = get (axis_obj.parent, "position");
-  unwind_protect_cleanup
-    set (axis_obj.parent, "units", orig_fig_units);
-    set (axis_obj.parent, "position", orig_fig_position);
-  end_unwind_protect
-  ## Get axes size in pixels
-  if (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
-      && strcmp (axis_obj.activepositionproperty, "outerposition"))
-    pos_in_pixels = axis_obj.outerposition .* fig_position([3, 4, 3, 4]);
-  else
-    pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]);
-  endif
-
-  nd = __calc_dimensions__ (h);
-
-  if (strcmp (axis_obj.plotboxaspectratiomode, "manual")
-      || strcmp (axis_obj.dataaspectratiomode, "manual"))
-    ## When using {rltb}margin, Gnuplot does not handle the specified
-    ## aspect ratio properly, so handle it here.
-    if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
-      aspect_ratio_2d = axis_obj.plotboxaspectratio(1:2);
-    else
-      ## FIXME: This works for "axis square", but has not been
-      ##        thoroughly tested for other aspect ratios.
-      aspect_ratio_2d = [max(axis_obj.plotboxaspectratio(1:2)), ...
-                             axis_obj.plotboxaspectratio(3)/sqrt(2)];
-    endif
-    orig_aspect_ratio_2d = pos_in_pixels(3:4);
-    rel_aspect_ratio_2d =  aspect_ratio_2d ./ orig_aspect_ratio_2d;
-    rel_aspect_ratio_2d = rel_aspect_ratio_2d ./ max (rel_aspect_ratio_2d);
-    if (rel_aspect_ratio_2d(1) < rel_aspect_ratio_2d(2));
-      dx = (1.0 - rel_aspect_ratio_2d(1)) * pos_in_pixels(3);
-      pos_in_pixels = pos_in_pixels + dx*[0.5, 0.0, -1.0, 0.0];
-    elseif (rel_aspect_ratio_2d(1) > rel_aspect_ratio_2d(2))
-      dy = (1.0 - rel_aspect_ratio_2d(2)) * pos_in_pixels(4);
-      pos_in_pixels = pos_in_pixels + dy*[0.0, 0.5, 0.0, -1.0];
-    endif
-    pos = pos_in_pixels ./ fig_position([3, 4, 3, 4]);
-  elseif (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
-          && strcmp (axis_obj.activepositionproperty, "outerposition"))
-    pos = axis_obj.outerposition;
-  else
-    pos = axis_obj.position;
-  endif
-endfunction
-
--- a/scripts/plot/private/__add_datasource__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{newargs} =} __add_datasource__ (@var{fcn}, @var{h}, @var{data}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-function newargs = __add_datasource__ (fcn, h, data, varargin)
-
-  if (ischar (data))
-    data = {data};
-  endif
-
-  for i = 1 : numel (data)
-    addproperty (strcat (data{i}, "datasource"), h, "string", "");
-  endfor
-
-  i = 0;
-  newargs = {};
-  while (i < numel (varargin))
-    arg = varargin{++i};
-    if (i != numel (varargin) && ischar (arg)
-        && length (arg) > 9 && strcmpi (arg(end-9:end), "datasource"))
-      arg = tolower (arg);
-      val = varargin{++i};
-      if (ischar (val))
-        set (h, arg, val);
-      else
-        error ("%s: expecting data source to be a string", fcn);
-      endif
-    else
-      newargs{end + 1} = arg;
-    endif
-  endwhile
-endfunction
-
--- a/scripts/plot/private/__add_default_menu__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __add_default_menu__ (@var{fig})
-## Add default menu to figure.  All uimenu handles have
-## their @qcode{"HandleVisibility"} property set to @qcode{"off"}.
-## @end deftypefn
-
-## Author: Kai Habel
-
-function __add_default_menu__ (fig)
-
-  ## Only FLTK toolkit currently provides menubar
-  if (! strcmp (get (fig, "__graphics_toolkit__"), "fltk"))
-    return;
-  endif
-
-  obj = findall (fig, "-depth", 1, "tag", "__default_menu__", "label", "&File");
-  if (isempty (obj))
-    ## FIXME: uimenu() will cause menubar to be displayed, even though property
-    ##        menubar remains set at "none".  So, forcibly turn menubar status
-    ##        on and then off to force figure to hide menubar.
-    menubar_state = get (fig, "menubar");
-    set (fig, "menubar", "figure");
-
-    __f = uimenu (fig, "label", "&File", "handlevisibility", "off",
-                       "tag", "__default_menu__");
-      uimenu (__f, "label", "Save &As", "callback", @save_cb);
-      uimenu (__f, "label", "&Save", "callback", @save_cb);
-      uimenu (__f, "label", "&Close", "callback", "close (gcf)");
-
-    __e = uimenu (fig, "label", "&Edit", "handlevisibility", "off",
-                       "tag", "__default_menu__");
-      uimenu (__e, "label", "&Grid", "callback", @grid_cb);
-      uimenu (__e, "label", "Auto&scale", "callback", @autoscale_cb);
-      gm = uimenu (__e, "label", "GUI &Mode");
-        uimenu (gm, "label", "Pan+Zoom", "callback", @guimode_cb);
-        uimenu (gm, "label", "Rotate+Zoom", "callback", @guimode_cb);
-        uimenu (gm, "label", "None", "callback", @guimode_cb);
-
-    __h = uimenu (fig, "label", "&Help", "handlevisibility", "off",
-                       "tag", "__default_menu__");
-      uimenu (__h, "label", "A&bout", "enable", "off");
-
-    ## FIXME: This drawnow () must occur after at least one menu item has
-    ##        been defined to avoid sizing issues in new figures.
-    ##        This may lead to flicker.  The real fix must be in the C++ code. 
-    drawnow ();
-
-    set (fig, "menubar", menubar_state);
-  endif
-
-endfunction
-
-function save_cb (h, e)
-  lbl = get (gcbo, "label");
-  if (strcmp (lbl, "&Save"))
-    fname = get (gcbo, "userdata");
-    if (isempty (fname))
-      __save_as__ (gcbo);
-    else
-      saveas (gcbo, fname);
-    endif
-  elseif (strcmp (lbl, "Save &As"))
-    __save_as__ (gcbo);
-  endif
-endfunction
-
-function __save_as__ (caller)
-  [filename, filedir] = uiputfile ({"*.pdf;*.ps;*.gif;*.png;*.jpg",
-                                    "Supported Graphic Formats"},
-                                   "Save Figure",
-                                   pwd);
-  if (filename != 0)
-    fname = [filedir filesep() filename];
-    obj = findall (gcbf, "label", "&Save");
-    if (! isempty (obj))
-      set (obj(1), "userdata", fname);
-    endif
-    saveas (caller, fname);
-  endif
-endfunction
-
-function grid_cb (h, e)
-  grid;
-endfunction
-
-function autoscale_cb (h, e)
-  axis ("auto");
-endfunction
-
-function guimode_cb (h, e)
-  lbl = get (h, "label");
-  switch (lbl)
-    case "Pan+Zoom"
-      gui_mode ("2D");
-    case "Rotate+Zoom"
-      gui_mode ("3D");
-    case "None"
-      gui_mode ("None");
-  endswitch
-endfunction
-
--- a/scripts/plot/private/__axes_limits__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __axes_limits__ (@var{fcn}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function retval = __axes_limits__ (fcn, varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ (fcn, varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-
-  if (nargin == 0)
-    retval = get (hax, fcn);
-  else
-    retval = [];
-    fcnmode = [fcn "mode"];
-    arg = varargin{1};
-    if (ischar (arg))
-      if (strcmpi (arg, "mode"))
-        retval = get (hax, fcnmode);
-      elseif (any (strcmpi (arg, {"auto", "manual"})))
-        set (hax, fcnmode, arg);
-      endif
-    else
-      if (!isnumeric (arg) && any (size (arg(:)) != [2, 1]))
-        error ("%s: LIMITS must be a 2-element vector", fcn);
-      else
-        if (arg(1) >= arg(2))
-          error ("%s: axis limits must be increasing", fcn);
-        else
-          set (hax, fcn, arg(:));
-        endif
-      endif
-    endif
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__axis_label__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __axis_label__ (@var{caller}, @var{h}, @var{txt}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function retval = __axis_label__ (hax, caller, txt, varargin)
-
-  h = get (hax, caller);
-
-  set (h, "fontangle", get (hax, "fontangle"),
-          "fontname", get (hax, "fontname"),
-          "fontunits", get (hax, "fontunits"),   # must precede fontsize
-          "fontsize", get (hax, "fontsize"),
-          "fontweight", get (hax, "fontweight"),
-          "string", txt,
-          varargin{:});
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__bar__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,479 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __bar__ (@var{vertical}, @var{func}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function varargout = __bar__ (vertical, func, varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ (func, varargin{:});
-
-  ## Slightly smaller than 0.8 to avoid clipping issue in gnuplot 4.0
-  width = 0.8 - 10 * eps;
-  group = true;
-  histc = NA;
-  bv = 0;  # BaseValue
-
-  if (nargin > 1 && isnumeric (varargin{2}))
-    x = varargin{1};
-    if (isvector (x))
-      x = x(:);
-    endif
-    y = varargin{2};
-    if (isvector (y))
-      y = y(:);
-    endif
-    if (rows (x) != rows (y))
-      y = varargin{1};
-      if (isvector (y))
-        y = y(:);
-      endif
-      x = [1:rows(y)]';
-      idx = 2;
-    else
-      if (! isvector (x))
-        error ("%s: X must be a vector", func);
-      endif
-      idx = 3;
-    endif
-  else
-    y = varargin{1};
-    if (isvector (y))
-      y = y(:);
-    endif
-    x = [1:rows(y)]';
-    idx = 2;
-  endif
-
-  newargs = {};
-  have_line_spec = false;
-  while (idx <= nargin)
-    if (ischar (varargin{idx}) && strcmpi (varargin{idx}, "grouped"))
-      group = true;
-      idx++;
-    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "stacked"))
-      group = false;
-      idx++;
-    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "histc"))
-      group = true;
-      histc = true; 
-      idx++;
-    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "hist"))
-      group = true;
-      histc = false;
-      idx++;
-    else
-      if ((ischar (varargin{idx}) || iscellstr (varargin{idx}))
-          && ! have_line_spec)
-        [linespec, valid] = __pltopt__ (func, varargin{idx}, false);
-        if (valid)
-          have_line_spec = true;
-          ## FIXME: strange parse error requires semicolon to be spaced
-          ##        away from closing ']' on next line.
-          newargs = [{"facecolor", linespec.color}, newargs] ;
-          idx++;
-          continue;
-        endif
-      endif
-      if (isscalar (varargin{idx}))
-        width = varargin{idx++};
-      elseif (idx == nargin)
-        newargs = [newargs, varargin(idx++)];
-      elseif (ischar (varargin{idx})
-              && strcmpi (varargin{idx}, "basevalue")
-              && isscalar (varargin{idx+1}))
-        bv = varargin{idx+1};
-        idx += 2;
-      else
-        newargs = [newargs, varargin(idx:idx+1)];
-        idx += 2;
-      endif
-    endif
-  endwhile
-
-  ngrp = rows (x);
-  if (ngrp != rows (y))
-    error ("%s: length of X and Y must be equal", func);
-  endif
-  if (any (x(2:end) < x(1:end-1)))
-    error ("%s: X vector values must be in ascending order", func);
-  endif
-
-  nbars = columns (y);
-
-  ## Column width is 1 for 'hist*' styles.  Otherwise, same as group width.
-  if (nbars == 1)
-    cwidth = 1;
-    gwidth = width;
-  elseif (islogical (histc))
-    cwidth = 1;
-    gwidth = width^2;
-  else
-    cwidth = gwidth = width;
-  endif
-
-  ## Complicated algorithm sizes bars with unitless parameter width.
-  ## If width is 1.0, adjacent bars in a group are touching.
-  ## Otherwise, bar size is cwidth and the remaining space is split evenly on
-  ## either side of the bar.  For the default 0.8, spacing is [0.1 0.8 0.1].
-  ## Groups of bars are spaced by gwidth.  If gwidth is 1.0 then adjacent
-  ## groups will just touch.
-  if (numel (x) > 1)
-    cutoff = min (diff (double (x))) / 2;
-  else
-    cutoff = 1;
-  endif
-  if (group)
-    gdelta = cutoff * gwidth / nbars; 
-    cdelta = repmat ((1 - ((1 - cwidth) / 2)) * gdelta, size (x));
-  else
-    cdelta = repmat (cutoff * gwidth, size (x));
-  endif
-  x1 = (x - cdelta)(:)';
-  x2 = (x + cdelta)(:)';
-  xb = repmat ([x1; x1; x2; x2](:), 1, nbars);
-
-  if (group)
-    if (islogical (histc) && histc)
-      offset = 2*cdelta * [0:(nbars-1)] + cdelta(1);  # not centered
-    else
-      offset = 2*cdelta * [-(nbars - 1) / 2 : (nbars - 1) / 2];
-    endif
-
-    xb(1:4:4*ngrp,:) += offset + (1-cwidth) / 2 * (2 * gdelta);
-    xb(2:4:4*ngrp,:) += offset + (1-cwidth) / 2 * (2 * gdelta);
-    xb(3:4:4*ngrp,:) += offset - (1-cwidth) / 2 * (2 * gdelta);
-    xb(4:4:4*ngrp,:) += offset - (1-cwidth) / 2 * (2 * gdelta);
-
-    y0 = zeros (size (y)) + bv;
-    y1 = y;
-  else
-    y1 = cumsum (y,2);
-    y0 = [zeros(ngrp,1)+bv, y1(:,1:end-1)];
-  endif
-
-  yb = zeros (4*ngrp, nbars);
-  yb(1:4:4*ngrp,:) = y0;
-  yb(2:4:4*ngrp,:) = y1;
-  yb(3:4:4*ngrp,:) = y1;
-  yb(4:4:4*ngrp,:) = y0;
-
-  xb = reshape (xb, [4, ngrp, nbars]);
-  yb = reshape (yb, [4, ngrp, nbars]);
-
-  if (nargout < 2)
-    oldfig = [];
-    if (! isempty (hax))
-      oldfig = get (0, "currentfigure");
-    endif
-    unwind_protect
-      hax = newplot (hax);
-
-      htmp = bars (hax, vertical, x, y, xb, yb, gwidth, group,
-                   have_line_spec, bv, newargs{:});
-
-      if (! ishold (hax))
-        if (all (x(:,1) == fix (x(:,1))))
-          if (vertical)
-            set (hax, "xtick", x(:,1));
-          else
-            set (hax, "ytick", x(:,1));
-          endif
-        endif
-        ## Hack prevents color and xlim setting changes when basevalue changes.
-        if (vertical)
-          set (hax, "clim", [0 1], "xlimmode", "manual");
-        else
-          set (hax, "clim", [0 1], "ylimmode", "manual");
-        endif
-      endif
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-    if (nargout == 1)
-      varargout{1} = htmp;
-    endif
-  else
-    if (vertical)
-      varargout{1} = xb;
-      varargout{2} = yb;
-    else
-      varargout{1} = yb;
-      varargout{2} = xb;
-    endif
-  endif
-
-endfunction
-
-function hglist = bars (hax, vertical, x, y, xb, yb, width, group, have_color_spec, base_value, varargin)
-
-  nbars = columns (y);
-  clim = get (hax, "clim");
-  hglist = [];
-
-  for i = 1:nbars
-    hg = hggroup ();
-    hglist = [hglist; hg];
-    args = __add_datasource__ ("bar", hg, {"x", "y"}, varargin{:});
-
-    if (vertical)
-      if (! have_color_spec)
-        if (nbars == 1)
-          lev = clim(1);
-        else
-          lev = (i - 1) * (clim(2) - clim(1)) / (nbars - 1) - clim(1);
-        endif
-        h = patch (hax, xb(:,:,i), yb(:,:,i),
-                        "FaceColor", "flat", "cdata", lev, "parent", hg);
-      else
-        h = patch (hax, xb(:,:,i), yb(:,:,i), "parent", hg);
-      endif
-    else
-      if (! have_color_spec)
-        if (nbars == 1)
-          lev = clim(1);
-        else
-          lev = (i - 1) * (clim(2) - clim(1)) / (nbars - 1) - clim(1);
-        endif
-        h = patch (hax, yb(:,:,i), xb(:,:,i),
-                        "FaceColor", "flat", "cdata", lev, "parent", hg);
-      else
-        h = patch (hax, yb(:,:,i), xb(:,:,i), "parent", hg);
-      endif
-    endif
-
-    if (i == 1)
-      ## Add baseline object the first time through loop
-      x_axis_range = get (hax, "xlim");
-      h_baseline = line (hax, x_axis_range, [base_value, base_value],
-                             "color", [0, 0, 0]);
-      set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
-      set (h_baseline, "parent", get (hg, "parent"));
-    endif
-
-    ## Setup the hggroup and listeners
-    addproperty ("showbaseline", hg, "radio", "{on}|off");
-    addproperty ("basevalue", hg, "data", base_value);
-    addproperty ("baseline", hg, "data", h_baseline);
-
-    addlistener (hg, "showbaseline", {@show_baseline, "showbl"});
-    addlistener (hg, "visible", {@show_baseline, "visib"});
-    addlistener (hg, "basevalue", @move_baseline);
-
-    addproperty ("barwidth", hg, "data", width);
-    if (group)
-      addproperty ("barlayout", hg, "radio", "stacked|{grouped}", "grouped");
-    else
-      addproperty ("barlayout", hg, "radio", "{stacked}|grouped", "stacked");
-    endif
-    if (vertical)
-      addproperty ("horizontal", hg, "radio", "on|{off}", "off");
-    else
-      addproperty ("horizontal", hg, "radio", "{on}|off", "on");
-    endif
-
-    addlistener (hg, "barwidth", @update_group);
-    addlistener (hg, "barlayout", @update_group);
-    addlistener (hg, "horizontal", @update_group);
-
-    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
-    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
-    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
-    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
-
-    addlistener (hg, "edgecolor", @update_props);
-    addlistener (hg, "facecolor", @update_props);
-    addlistener (hg, "linestyle", @update_props);
-    addlistener (hg, "linewidth", @update_props);
-
-    if (isvector (x))
-      addproperty ("xdata", hg, "data", x);
-    else
-      addproperty ("xdata", hg, "data", x(:, i));
-    endif
-    addproperty ("ydata", hg, "data", y(:, i));
-
-    addlistener (hg, "xdata", @update_data);
-    addlistener (hg, "ydata", @update_data);
-
-    addproperty ("bargroup", hg, "data");
-    set (hglist, "bargroup", hglist);
-
-    ## Matlab property, although Octave does not implement it.
-    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-    if (! isempty (args))
-      set (hg, args{:});
-    endif
-  endfor
-
-  update_xlim (hax, []);
-  ## Add listeners outside of for loop to prevent constant updating during
-  ## creation of plot when patch objects are added.
-  addlistener (hax, "xlim", @update_xlim);
-  addlistener (h_baseline, "ydata", @update_baseline);
-  addlistener (h_baseline, "visible", @update_baseline);
-
-endfunction
-
-function update_xlim (h, ~)
-  kids = get (h, "children");
-  xlim = get (h, "xlim");
-
-  for i = 1 : length (kids)
-    obj = get (kids(i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
-      if (any (get (obj.baseline, "xdata") != xlim))
-        set (obj.baseline, "xdata", xlim);
-      endif
-    endif
-  endfor
-endfunction
-
-function update_baseline (h, ~)
-  visible = get (h, "visible");
-  ydata = get (h, "ydata")(1);
-
-  ## Search axis for a bargroup that contains this baseline handle
-  kids = get (get (h, "parent"), "children");
-  for i = 1 : length (kids)
-    obj = get (kids(i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
-        && obj.baseline == h)
-      set (obj.bargroup, "showbaseline", visible, "basevalue", ydata);
-      break;
-    endif
-  endfor
-endfunction
-
-function show_baseline (h, ~, prop = "")
-  persistent recursion = false;
-  
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "bargroup");
-      if (strcmp (prop, "showbl"))
-        showbaseline = get (h, "showbaseline");
-        hlist = hlist(hlist != h);  # remove current handle being updated
-        set (hlist, "showbaseline", showbaseline);
-      elseif (strcmp (prop, "visib"))
-        showbaseline = "on";
-        if (all (strcmp (get (hlist, "visible"), "off")))
-          showbaseline = "off";
-        endif
-      endif
-      set (get (h, "baseline"), "visible", showbaseline);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function move_baseline (h, ~)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    recursion = true;
-    unwind_protect
-      b0 = get (h, "basevalue");
-      bl = get (h, "baseline");
-      set (bl, "ydata", [b0, b0]);
-
-      if (strcmp (get (h, "barlayout"), "grouped"))
-        update_data (h);
-      endif
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_props (h, ~)
-  kids = get (h, "children");
-  set (kids, {"edgecolor", "linewidth", "linestyle", "facecolor"},
-       get (h, {"edgecolor", "linewidth", "linestyle", "facecolor"}));
-endfunction
-
-function update_data (h, ~)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "bargroup");
-      x = get (h, "xdata");
-      if (! isvector (x))
-        x = x(:);
-      endif
-      ydat = get (hlist, "ydata");
-      if (iscell (ydat))
-        y = cell2mat (ydat.');
-      else
-        y = ydat;
-      endif
-
-      [xb, yb] = bar (x, y, get (h, "barwidth"), get (h, "barlayout"),
-                      "basevalue", get (h, "basevalue"));
-
-      vertical = strcmp (get (h, "horizontal"), "off");
-      for i = 1:columns (y)
-        hp = get (hlist(i), "children");
-        if (vertical)
-          set (hp, "xdata", xb(:,:,i), "ydata", yb(:,:,i));
-        else
-          set (hp, "xdata", yb(:,:,i), "ydata", xb(:,:,i));
-        endif
-      endfor
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_group (h, ~)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "bargroup");
-      barwidth = get (h, "barwidth");
-      barlayout = get (h, "barlayout");
-      horizontal = get (h, "horizontal");
-
-      hlist = hlist(hlist != h);  # remove current handle being updated
-      set (hlist, "barwidth", barwidth, "barlayout", barlayout,
-                  "horizontal", horizontal);
-      update_data (h);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
--- a/scripts/plot/private/__clabel__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __clabel__ (@var{c}, @var{v}, @var{hparent}, @var{label_spacing}, @var{z}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-function h = __clabel__ (c, v, hparent, label_spacing, z, varargin)
-
-  hax = ancestor (hparent, "axes");
-  units = get (hax, "units");
-  set (hax, "units", "points");
-  axpos = get (hax, "position");
-  set (hax, "units", units);
-  lims = axis ();
-  xspacing = axpos(3) / (lims(2) - lims (1));
-  yspacing = axpos(4) / (lims(4) - lims (3));
-
-  if (isscalar (hparent) && ishandle (hparent)
-      && strcmp (get (hparent, "type"), "hggroup"))
-    x = get (hparent, "xdata");
-    xmin = min (x(:));
-    xmax = max (x(:));
-    y = get (hparent, "ydata");
-    ymin = min (y(:));
-    ymax = max (y(:));
-  else
-    xmin = xmax = ymin = ymax = NaN;
-    i = 1;
-    while (i < length (c))
-      clen = c(2,i);
-      data = c(:, i+(1:clen));
-
-      xmin = min ([xmin, data(1,:)]);
-      xmax = max ([xmax, data(1,:)]);
-      ymin = min ([ymin, data(2,:)]);
-      ymax = max ([ymax, data(2,:)]);
-
-      i += clen+1;
-    endwhile
-  endif
-
-  ## Decode contourc output format and place labels.
-  h = [];
-  i = 1;
-  while (i < length (c))
-    clev = c(1,i);
-    clen = c(2,i);
-
-    if (! isempty (v) && ! any (v == clev))
-      i += clen+1;
-      continue;
-    endif
-
-    p = bsxfun (@times, c(:, i+(1:clen)), [xspacing; yspacing]);
-    d = sqrt (sumsq (diff (p, 1, 2)));
-    cumd = cumsum (d);
-    td = cumd(end);
-    ntag = ceil (td / label_spacing);
-
-    if (all (c(:,i+1) == c(:,i+clen)))
-      ## Closed contour
-      ## FIXME: This spreads the tags uniformly around the contour which
-      ## looks nice, but it does not respect the label_spacing attribute.
-      ## Should we follow user input, which can result in two labels being
-      ## quite close to each other?
-      spacing = td / ntag;
-      pos = spacing/2 + spacing*[0:ntag-1];
-    else
-      ## Open contour
-      pos = zeros (1, ntag);
-      pos(1) = (td - label_spacing*(ntag - 1)) / 2;
-      pos(2:ntag) = pos(1) + label_spacing*[1:ntag-1];
-    endif
-
-    tlabel = sprintf ("%.5g", clev);
-
-    for tagpos = pos
-
-      j = find (cumd > tagpos, 1);
-      if (isempty (j))
-        j = clen;
-      endif
-      tpos = sum (c(:,i+j-1:i+j), 2) / 2;
-
-      if (   tpos(1) != xmin && tpos(1) != xmax
-          && tpos(2) != ymin && tpos(2) != ymax)
-        trot = 180 / pi * atan2 (diff (c(2,i+j-1:i+j)),
-                                 diff (c(1,i+j-1:i+j)));
-        if (abs (trot) > 90)
-          trot += 180;
-        endif
-        if (ischar (z))
-          ht = text (tpos(1), tpos(2), clev, tlabel, "rotation", trot,
-                     "horizontalalignment", "center", "userdata", clev,
-                     "parent", hparent, varargin{:});
-        elseif (! isempty (z))
-          ht = text (tpos(1), tpos(2), z, tlabel, "rotation", trot,
-                     "horizontalalignment", "center", "userdata", clev,
-                     "parent", hparent, varargin{:});
-        else
-          ht = text (tpos(1), tpos(2), tlabel, "rotation", trot,
-                     "horizontalalignment", "center", "userdata", clev,
-                     "parent", hparent, varargin{:});
-        endif
-        h = [h; ht];
-      endif
-    endfor
-    i += clen+1;
-  endwhile
-
-endfunction
-
--- a/scripts/plot/private/__contour__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,558 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{c}, @var{hg}] =} __contour__ (@dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function [c, hg] = __contour__ (varargin)
-  ax = varargin{1};
-  zlevel = varargin{2};
-  filled = "off";
-
-  linespec.color = "auto";
-  linespec.linestyle = "-";
-  for i = 3:2:nargin
-    arg = varargin{i};
-    if (ischar (arg) || iscellstr (arg))
-      [lspec, valid] = __pltopt__ ("__contour__", arg, false);
-      if (valid)
-        have_line_spec = true;
-        varargin(i) = [];
-        linespec = lspec;
-        if (isempty (linespec.color))
-          linespec.color = "auto";
-        endif
-        if (isempty (linespec.linestyle))
-          linespec.linestyle = "-";
-        endif
-        break;
-      endif
-    endif
-  endfor
-
-  opts = {};
-  i = 3;
-  while (i < length (varargin))
-    if (ischar (varargin{i}))
-      if (strcmpi (varargin{i}, "fill"))
-        filled = varargin{i+1};
-        varargin(i:i+1) = [];
-      elseif (strcmpi (varargin{i}, "linecolor"))
-        linespec.color = varargin{i+1};
-        varargin(i:i+1) = [];
-      else
-        opts(end+(1:2)) = varargin(i:i+1);
-        varargin(i:i+1) = [];
-      endif
-    else
-      i++;
-    endif
-  endwhile
-
-  if (length (varargin) < 5)
-    z1 = varargin{3};
-    x1 = 1 : columns (z1);
-    y1 = 1 : rows (z1);
-  else
-    x1 = varargin{3};
-    y1 = varargin{4};
-    z1 = varargin{5};
-  endif
-  if (! ismatrix (z1) || ! ismatrix (x1) || ! ismatrix (y1))
-    error ("__contour__: X, Y, and Z must be matrices");
-  endif
-  if (length (varargin) == 4 || length (varargin) == 6)
-    vn = varargin{end};
-    vnauto = false;
-  else
-    vn = 10;
-    vnauto = true;
-  endif
-
-  if (isscalar (vn))
-    ## FIXME: The levels should be determined similarly to {x,y,z}ticks
-    ##        so that they aren't set at extremely odd values.
-    lvl = linspace (min (z1(!isinf (z1))), max (z1(!isinf (z1))), vn + 2);
-    ## Strip off max outlier, min must stay for contourf hole algorithm.
-    lvl = lvl(1:end-1);
-  else
-    lvl = sort (vn);
-  endif
-
-  if (strcmpi (filled, "on"))
-    if (isvector (x1) || isvector (y1))
-      [x1, y1] = meshgrid (x1, y1);
-    endif
-    [nr, nc] = size (z1);
-    x0 = prepad (x1, nc+1, 2 * x1(1, 1) - x1(1, 2), 2);
-    x0 = postpad (x0, nc+2, 2 * x1(1, nc) - x1(1, nc - 1), 2);
-    x0 = [x0(1, :); x0; x0(1, :)];
-    y0 = prepad (y1, nr+1, 2 * y1(1, 1) - y1(2, 1), 1);
-    y0 = postpad (y0, nr+2, 2 * y1(nr, 1) - y1(nr - 1, 1));
-    y0 = [y0(:, 1), y0, y0(:, 1)];
-    z0 = -Inf (nr+2, nc+2);
-    z0(2:nr+1, 2:nc+1) = z1;
-    [c, lev] = contourc (x0, y0, z0, lvl);
-  else
-    [c, lev] = contourc (x1, y1, z1, lvl);
-  endif
-
-  hg = hggroup ();
-  opts = __add_datasource__ ("__countour__", hg, {"x", "y", "z"}, opts{:});
-
-  addproperty ("xdata", hg, "data", x1);
-  addproperty ("ydata", hg, "data", y1);
-  addproperty ("zdata", hg, "data", z1);
-  addproperty ("contourmatrix", hg, "data", c);
-
-  addlistener (hg, "xdata", @update_data);
-  addlistener (hg, "ydata", @update_data);
-  addlistener (hg, "zdata", @update_data);
-  addlistener (hg, "contourmatrix", @update_data);
-
-  addproperty ("fill", hg, "radio", "on|{off}", filled);
-
-  ## The properties zlevel and zlevelmode don't exist in matlab, but allow the
-  ## use of contourgroups with the contour3, meshc, and surfc functions.
-  if (isnumeric (zlevel))
-    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", "manual");
-    addproperty ("zlevel", hg, "data", zlevel);
-  else
-    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", zlevel);
-    addproperty ("zlevel", hg, "data", 0.);
-  endif
-
-  lvlstep = sum (diff (lvl)) / (length (lvl) - 1);
-
-  addproperty ("levellist", hg, "data", lev);
-  addproperty ("levelstep", hg, "double", lvlstep);
-  if (vnauto)
-    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
-    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
-  elseif (isscalar (vn))
-    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
-    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "manual");
-  else
-    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "manual");
-    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
-  endif
-
-  addproperty ("labelspacing", hg, "double", 144);
-  addproperty ("textlist", hg, "data", lev);
-  addproperty ("textlistmode", hg, "radio", "{auto}|manual", "auto");
-  addproperty ("textstep", hg, "double", lvlstep);
-  addproperty ("textstepmode", hg, "radio", "{auto}|manual", "auto");
-  addproperty ("showtext", hg, "radio", "on|{off}", "off");
-
-  addproperty ("linecolor", hg, "color", linespec.color, "{auto}|none");
-  addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
-  addproperty ("linewidth", hg, "linelinewidth", 0.5);
-
-  ## Matlab property, although Octave does not implement it.
-  addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-  addlistener (hg, "fill", {@update_data, "fill"});
-
-  addlistener (hg, "zlevelmode", @update_zlevel);
-  addlistener (hg, "zlevel", @update_zlevel);
-
-  addlistener (hg, "levellist", {@update_data, "levellist"});
-  addlistener (hg, "levelstep", {@update_data, "levelstep"});
-  addlistener (hg, "levellistmode", @update_data);
-  addlistener (hg, "levelstepmode", @update_data);
-
-  addlistener (hg, "labelspacing", @update_text);
-  addlistener (hg, "textlist", {@update_text, "textlist"});
-  addlistener (hg, "textlistmode", @update_text);
-  addlistener (hg, "textstep", {@update_text, "textstep"});
-  addlistener (hg, "textstepmode", @update_text);
-  addlistener (hg, "showtext", @update_text);
-
-  addlistener (hg, "linecolor", @update_line);
-  addlistener (hg, "linestyle", @update_line);
-  addlistener (hg, "linewidth", @update_line);
-
-  ## Set axis before adding patches so that each new patch does not trigger
-  ## new axis calculation.  No need if mode is already "manual".
-  if (all (strcmp (get (gca (), {"xlimmode", "ylimmode"}), "auto")))
-    axis ([min(x1(:)) max(x1(:)) min(y1(:)) max(y1(:))]);
-  endif
-
-  add_patch_children (hg);
-
-  if (! isempty (opts))
-    set (hg, opts{:});
-  endif
-
-endfunction
-
-function add_patch_children (hg)
-  c = get (hg, "contourmatrix");
-  lev = get (hg, "levellist");
-  fill = get (hg, "fill");
-  zlev = get (hg, "zlevel");
-  zmode = get (hg, "zlevelmode");
-  lc = get (hg, "linecolor");
-  lw = get (hg, "linewidth");
-  ls = get (hg, "linestyle");
-  filled = get (hg, "fill");
-  ca = gca ();
-
-  ## Turn off automatic updating of clim while adding patches
-  climmode = get (ca, "climmode");
-  set (ca, "climmode", "manual"); 
-
-  if (strcmp (lc, "auto"))
-    lc = "flat";
-  endif
-
-  if (strcmp (filled, "on"))
-
-    lvl_eps = get_lvl_eps (lev);
-
-    ## Decode contourc output format.
-    i = 1;
-    ncont = 0;
-    while (i < columns (c))
-      ncont++;
-      cont_lev(ncont) = c(1, i);
-      cont_len(ncont) = c(2, i);
-      cont_idx(ncont) = i+1;
-      ii = i + (1:cont_len(ncont));
-      cont_area(ncont) = polyarea (c(1, ii), c(2, ii));
-      i += cont_len(ncont) + 1;
-    endwhile
-
-    ## Handle for each level the case where we have (a) hole(s) in a patch.
-    ## Those are to be filled with the color of level below or with the
-    ## background colour.
-    for k = 1:numel (lev)
-      lvl_idx = find (abs (cont_lev - lev(k)) < lvl_eps);
-      len = numel (lvl_idx);
-      if (len > 1)
-        mark = false (size (lvl_idx));
-        a = 1;
-        while (a < len)
-          ## take 1st patch
-          pa_idx = lvl_idx(a);
-          ## get pointer to contour start, and contour length
-          curr_ct_idx = cont_idx(pa_idx);
-          curr_ct_len = cont_len(pa_idx);
-          ## get contour
-          curr_ct = c(:, curr_ct_idx:curr_ct_idx+curr_ct_len-1);
-          b_vec = (a+1):len;
-          next_ct_pt_vec = c(:, cont_idx(lvl_idx(b_vec)));
-          in = inpolygon (next_ct_pt_vec(1,:), next_ct_pt_vec(2,:),
-                          curr_ct(1, :), curr_ct(2, :));
-          mark(b_vec(in)) = ! mark(b_vec(in));
-          a++;
-        endwhile
-        if (numel (mark) > 0)
-          ## All marked contours describe a hole in a larger contour of
-          ## the same level and must be filled with colour of level below.
-          ma_idx = lvl_idx(mark);
-          if (k > 1)
-            ## Find color of level below.
-            tmp = find (abs (cont_lev - lev(k - 1)) < lvl_eps);
-            lvl_bel_idx = tmp(1);
-            ## Set color of patches found.
-            cont_lev(ma_idx) = cont_lev(lvl_bel_idx);
-          else
-            ## Set lowest level contour to NaN.
-            cont_lev(ma_idx) = NaN;
-          endif
-        endif
-      endif
-    endfor
-
-    ## The algorithm can create patches with the size of the plotting
-    ## area, we would like to draw only the patch with the highest level.
-    del_idx = [];
-    max_idx = find (cont_area == max (cont_area));
-    if (numel (max_idx) > 1)
-      ## delete double entries
-      del_idx = max_idx(1:end-1);
-      cont_area(del_idx) = cont_lev(del_idx) = [];
-      cont_len(del_idx) = cont_idx(del_idx) = [];
-    endif
-
-    ## Now we have everything together and can start plotting the patches
-    ## beginning with largest area.
-    [~, svec] = sort (cont_area);
-    len = ncont - numel (del_idx);
-    h = [];
-    for n = len:-1:1
-      idx = svec(n);
-      ctmp = c(:, cont_idx(idx):cont_idx(idx) + cont_len(idx) - 1);
-      if (all (ctmp(:,1) == ctmp(:,end)))
-        ## patch() doesn't need/want closed contour.  It will do it itself.
-        ctmp(:,end) = [];
-      endif
-      if (isnan (cont_lev(idx)))
-        fc = get (ca, "color");
-        if (strcmp (fc, "none"))
-          fc = get (ancestor (ca, "figure"), "color");
-        endif
-      else
-        fc = "flat";
-      endif
-      h = [h; __go_patch__(ca, "xdata", ctmp(1, :)(:), "ydata", ctmp(2, :)(:),
-                           "vertices", ctmp.', "faces", 1:(cont_len(idx)-1),
-                           "facevertexcdata", cont_lev(idx), "facecolor", fc,
-                           "cdata", cont_lev(idx), "edgecolor", lc,
-                           "linestyle", ls, "linewidth", lw,
-                           "parent", hg)];
-    endfor
-
-    if (min (lev) == max (lev))
-      set (ca, "clim", [min(lev)-1, max(lev)+1], "layer", "top");
-    else
-      set (ca, "clim", [min(lev), max(lev)], "layer", "top");
-    endif
-  else
-    ## Decode contourc output format.
-    h = [];
-    i = 1;
-    while (i < length (c))
-      clev = c(1,i);
-      clen = c(2,i);
-
-      if (all (c(:,i+1) == c(:,i+clen)))
-        p = c(:, i+1:i+clen-1).';
-      else
-        p = [c(:, i+1:i+clen), NaN(2, 1)].';
-      endif
-
-      switch (zmode)
-        case "none"
-          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
-                               "zdata", [],
-                               "vertices", p, "faces", 1:rows (p),
-                               "facevertexcdata", clev, "facecolor", "none",
-                               "cdata", clev, "edgecolor", lc,
-                               "linestyle", ls, "linewidth", lw,
-                               "parent", hg)];
-        case "auto"
-          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
-                               "zdata", clev * ones (rows (p),1),
-                               "vertices", [p, clev * ones(rows(p),1)],
-                               "faces", 1:rows(p),
-                               "facevertexcdata", clev, "facecolor", "none",
-                               "cdata", clev, "edgecolor", lc,
-                               "linestyle", ls, "linewidth", lw,
-                               "parent", hg)];
-        otherwise
-          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
-                               "zdata", zlev * ones (rows (p), 1),
-                               "vertices", [p, zlev * ones(rows(p),1)],
-                               "faces", 1:rows (p),
-                               "facevertexcdata", clev, "facecolor", "none",
-                               "cdata", clev, "edgecolor", lc,
-                               "linestyle", ls, "linewidth", lw,
-                               "parent", hg)];
-      endswitch
-      i += clen + 1;
-    endwhile
-  endif
-
-  set (ca, "climmode", climmode);
-
-endfunction
-
-function update_zlevel (h, ~)
-  z = get (h, "zlevel");
-  zmode = get (h, "zlevelmode");
-  kids = get (h, "children");
-
-  switch (zmode)
-    case "none"
-      set (kids, "zdata", []);
-    case "auto"
-      for i = 1 : length (kids)
-        set (kids(i), "zdata", get (kids(i), "cdata") .*
-             ones (size (get (kids(i), "xdata"))));
-      endfor
-    otherwise
-      for i = 1 : length (kids)
-        set (kids(i), "zdata", z .* ones (size (get (kids(i), "xdata"))));
-      endfor
-  endswitch
-endfunction
-
-function update_line (h, ~)
-  lc = get (h, "linecolor");
-  if (strcmp (lc, "auto"))
-    lc = "flat";
-  endif
-  set (findobj (h, "type", "patch"), "edgecolor", lc,
-       "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"));
-endfunction
-
-function update_data (h, ~, prop = "")
-  persistent recursive = false;
-
-  if (! recursive)
-    recursive = true;
-
-    delete (get (h, "children"));
-
-    switch (prop)
-      case "levellist"
-        set (h, "levellistmode", "manual")
-      case "levelstep"
-        set (h, "levelstepmode", "manual")
-      case "fill"
-        ## Switching from filled ('k' linespec) to unfilled, reset linecolor
-        if (strcmp (get (h, "fill"), "off"))
-          set (h, "linecolor", "auto");
-        else
-          set (h, "linecolor", "black");
-        endif
-    endswitch
-
-    if (strcmp (get (h, "levellistmode"), "manual")
-        && ! strcmp (prop, "levelstep"))
-      lvl = get (h, "levellist");
-    elseif (strcmp (get (h, "levelstepmode"), "manual"))
-      z = get (h, "zdata");
-      lvs = get (h, "levelstep");
-      lvl(1) = ceil (min (z(:)) / lvs) * lvs;
-      lvl(2) = floor (max (z(:)) / lvs) * lvs;
-      if (lvl(1) >= lvl(2))
-        lvl = median (z(:));
-      else
-        lvl = lvl(1) : lvs : lvl(2);
-      endif
-      set (h, "levellist", lvl);
-      set (h, "levellistmode", "auto");
-    else
-      z = get (h, "zdata");
-      ## FIXME: The levels should be determined similarly to {x,y,z}ticks
-      ##        so that they aren't set at extremely odd values.
-      lvl = linspace (min (z(!isinf (z))), max (z(!isinf (z))), 10 + 2);
-      ## Strip off max outlier, min must stay for contourf hole algorithm.
-      lvl = lvl(1:end-1);
-    endif
-
-    if (strcmp (get (h, "fill"), "on"))
-      X = get (h, "xdata");
-      Y = get (h, "ydata");
-      Z = get (h, "zdata");
-      if (isvector (X) || isvector (Y))
-        [X, Y] = meshgrid (X, Y);
-      endif
-      [nr, nc] = size (Z);
-      X0 = prepad (X, nc+1, 2 * X(1, 1) - X(1, 2), 2);
-      X0 = postpad (X0, nc+2, 2 * X(1, nc) - X(1, nc - 1), 2);
-      X0 = [X0(1, :); X0; X0(1, :)];
-      Y0 = prepad (Y, nr+1, 2 * Y(1, 1) - Y(2, 1), 1);
-      Y0 = postpad (Y0, nr+2, 2 * Y(nr, 1) - Y(nr - 1, 1));
-      Y0 = [Y0(:, 1), Y0, Y0(:, 1)];
-      Z0 = -Inf (nr+2, nc+2);
-      Z0(2:nr+1, 2:nc+1) = Z;
-      [c, lev] = contourc (X0, Y0, Z0, lvl);
-    else
-      [c, lev] = contourc (get (h, "xdata"), get (h, "ydata"),
-                           get (h, "zdata"), lvl);
-    endif
-    set (h, "contourmatrix", c);
-
-    if (strcmp (get (h, "levellistmode"), "manual"))
-      ## Do nothing
-    elseif (strcmp (get (h, "levelstepmode"), "manual"))
-      set (h, "levellist", lev);
-    else
-      set (h, "levellist", lev);
-      lvlstep = sum (diff (lvl)) / (length (lvl) - 1);
-      set (h, "levelstep", lvlstep);
-    endif
-
-    add_patch_children (h);
-    update_text (h);
-    recursive = false;
-  endif
-
-endfunction
-
-function update_text (h, ~, prop = "")
-  persistent recursive = false;
-
-  if (! recursive)
-    recursive = true;
-
-    delete (findobj (h, "type", "text"));
-
-    switch (prop)
-      case "textlist"
-        set (h, "textlistmode", "manual")
-      case "textstep"
-        set (h, "textstepmode", "manual")
-    endswitch
-
-    if (strcmp (get (h, "textlistmode"), "manual"))
-      lvl = get (h, "textlist");
-    elseif (strcmp (get (h, "textstepmode"), "manual"))
-      lev = get (h, "levellist");
-
-      lvl_eps = get_lvl_eps (lev);
-
-      stp = get (h, "textstep");
-      t = [0, floor(cumsum(diff (lev)) / (abs(stp) - lvl_eps))];
-      lvl = lev([true, t(1:end-1) != t(2:end)]);
-      set (h, "textlist", lvl);
-    else
-      lvl = get (h, "levellist");
-      set (h, "textlist", lvl, "textstep", get (h, "levelstep"));
-    endif
-
-    if (strcmp (get (h, "showtext"), "on"))
-      switch (get (h, "zlevelmode"))
-        case "manual"
-          __clabel__ (get (h, "contourmatrix"), lvl, h,
-                      get (h, "labelspacing"), get (h, "zlevel"));
-        case "auto"
-          __clabel__ (get (h, "contourmatrix"), lvl, h,
-                      get (h, "labelspacing"), "auto");
-        otherwise
-          __clabel__ (get (h, "contourmatrix"), lvl, h,
-                      get (h, "labelspacing"), []);
-      endswitch
-    endif
-
-    recursive = false;
-  endif
-endfunction
-
-function lvl_eps = get_lvl_eps (lev)
-  ## FIXME: is this the right thing to do for this tolerance?  Should
-  ## it be an absolute or relative tolerance, or switch from one to the
-  ## other depending on the value of lev?
-  if (isscalar (lev))
-    lvl_eps = abs (lev) * sqrt (eps) + sqrt (eps);
-  else
-    tmp = min (abs (diff (lev)));
-    if (tmp < 10*eps)
-      lvl_eps = sqrt (eps);
-    else
-      lvl_eps = tmp / 1000.0;
-    endif
-  endif
-endfunction
-
--- a/scripts/plot/private/__default_plot_options__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{options} =} __default_plot_options__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function options = __default_plot_options__ ()
-
-  options.key = "";
-  options.color = [];
-  options.linestyle = [];
-  options.marker = [];
-  options.errorstyle = [];
-
-endfunction
-
--- a/scripts/plot/private/__errcomm__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-## Copyright (C) 2001-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __errcomm__ (@var{caller}, @var{hax}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Created: 20.02.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function retval = __errcomm__ (caller, hax, varargin)
-
-  if (nargin < 4)
-    print_usage (caller);
-  endif
-
-  retval = [];
-  data = cell (6,1);
-  nargs = numel (varargin);
-  k = 1;
-  while (k <= nargs)
-    arg = varargin{k++};
-    if (! ismatrix (arg))
-      error ("%s: data argument %d must be numeric", caller, k-1);
-    endif
-    if (isvector (arg))
-      arg = arg(:);
-    endif
-    sz = size (arg);
-    ndata = 1;
-    data{ndata} = arg;
-    while (k <= nargs)
-      arg = varargin{k++};
-      if (ischar (arg) || iscellstr (arg))
-        retval(end+1,1) = __errplot__(arg, hax, data{1:ndata});
-        break;
-      endif
-      if (! ismatrix (arg))
-        error ("%s: data argument %d must be numeric", caller, k-1);
-      endif
-      if (isvector (arg))
-        arg = arg(:);
-      endif
-      if (any (size (arg) != sz))
-        error ("%s: size of argument %d does not match others", caller, k-1);
-      endif
-      data{++ndata} = arg;
-      if (ndata > 6)
-        error ("%s: too many arguments to plot", caller);
-      endif
-    endwhile
-  endwhile
-
-  ## No format code found, use yerrorbar
-  if (! (ischar (arg) || iscellstr (arg)))
-    retval = [retval; __errplot__("~", hax, data{1:ndata})];
-  endif
-
-  drawnow ();
-
-endfunction
-
--- a/scripts/plot/private/__errplot__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __errplot__ (@var{fstr}, @var{hax}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Created: 18.7.2000
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function h = __errplot__ (fstr, hax, varargin)
-
-  fmt = __pltopt__ ("__errplot__", fstr);
-
-  ## Set the plot type based on linestyle.
-  switch (fmt.errorstyle) 
-    case "~"
-      ifmt = "yerr";
-    case ">"
-      ifmt = "xerr";
-    case "~>"
-      ifmt = "xyerr";
-    case "#"
-      ifmt = "box";
-    case "#~"
-      ifmt = "boxy";
-    case "#~>"
-      ifmt = "boxxy";
-    otherwise
-      ifmt = "yerr";
-  endswitch
-
-  h = [];
-  nplots = columns (varargin{1});
-  for i = 1:nplots
-
-    if (isempty (fmt.color))
-      lc = __next_line_color__ ();
-    else
-      lc = fmt.color ();
-    endif
-    if (isempty (fmt.marker) && isempty (fmt.linestyle))
-      [ls, mk] = __next_line_style__ ();
-    else
-      ls = fmt.linestyle;
-      mk = fmt.marker;
-    endif
-
-    ## Must occur after __next_line_color__ in order to work correctly.
-    hg = hggroup ("parent", hax);
-    h = [h; hg];
-    args = __add_datasource__ ("__errplot__", hg,
-                               {"x", "y", "l", "u", "xl", "xu"});
-
-    hl = [(__line__ (hg, "color", lc, "linestyle", ls, "marker", mk)),
-          (__line__ (hg, "color", lc, "linestyle", "-", "marker", "none"))];
-
-    switch (numel (varargin))
-      case 2
-        ydata = varargin{1}(:,i);
-        xdata = 1:numel (ydata);
-        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
-          ldata  = varargin{2}(:,i);
-          udata  = ldata;
-          xldata = [];
-          xudata = [];
-        elseif (strcmp (ifmt, "xerr") || strcmp (ifmt, "box"))
-          xldata = varargin{2}(:,i);
-          xudata = ldata;
-          ldata  = [];
-          udata  = [];
-        else
-          error ("errorbar: 2 column errorplot is only valid for xerr or yerr");
-        endif
-      case 3
-        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
-          xdata  = varargin{1}(:,i);
-          ydata  = varargin{2}(:,i);
-          ldata  = varargin{3}(:,i);
-          udata  = ldata;
-          xldata = [];
-          xudata = [];
-        elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
-          ydata  = varargin{1}(:,i);
-          xdata  = 1:numel (ydata);
-          xldata = varargin{2}(:,i);
-          xudata = xldata;
-          ldata  = varargin{3}(:,i);
-          udata  = ldata;
-        else  # xerr or box
-          xdata  = varargin{1}(:,i);
-          ydata  = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = xldata;
-          ldata  = [];
-          udata  = [];
-        endif
-      case 4
-        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
-          xdata  = varargin{1}(:,i);
-          ydata  = varargin{2}(:,i);
-          ldata  = varargin{3}(:,i);
-          udata  = varargin{4}(:,i);
-          xldata = [];
-          xudata = [];
-        elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
-          xdata  = varargin{1}(:,i);
-          ydata  = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = xldata;
-          ldata  = varargin{4}(:,i);
-          udata  = ldata;
-        else  # xerr or box
-          xdata  = varargin{1}(:,i);
-          ydata  = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = varargin{4}(:,i);
-          ldata  = [];
-          udata  = [];
-        endif
-      case 6  # xyerr, boxxy
-        if (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
-          xdata  = varargin{1}(:,i);
-          ydata  = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = varargin{4}(:,i);
-          ldata  = varargin{5}(:,i);
-          udata  = varargin{6}(:,i);
-        else
-          error ("errorbar: error plot with 6 columns only valid for xyerr and boxxy");
-        endif
-      otherwise
-        error ("errorbar: error plot requires 2, 3, 4, or 6 arguments");
-    endswitch
-
-    addproperty ("xdata", hg, "data", xdata(:));
-    addproperty ("ydata", hg, "data", ydata(:));
-    addproperty ("ldata", hg, "data", ldata(:));
-    addproperty ("udata", hg, "data", udata(:));
-    addproperty ("xldata", hg, "data", xldata(:));
-    addproperty ("xudata", hg, "data", xudata(:));
-    addproperty ("format", hg, "string", ifmt);
-
-    addproperty ("color", hg, "linecolor", get (hl(1), "color"));
-    addproperty ("linestyle", hg, "linelinestyle", get (hl(1), "linestyle"));
-    addproperty ("linewidth", hg, "linelinewidth", get (hl(1), "linewidth"));
-    addproperty ("marker", hg, "linemarker", get (hl(1), "marker"));
-    addproperty ("markeredgecolor", hg, "linemarkerfacecolor",
-                 get (hl(1), "markeredgecolor"));
-    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
-                 get (hl(1), "markerfacecolor"));
-    addproperty ("markersize", hg, "linemarkersize",
-                 get (hl(1), "markersize"));
-
-    ## Matlab property, although Octave does not implement it.
-    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-    fcn = {@update_props, hl};
-    addlistener (hg, "color", fcn);
-    addlistener (hg, "linestyle", fcn);
-    addlistener (hg, "linewidth", fcn);
-    addlistener (hg, "marker", fcn);
-    addlistener (hg, "markeredgecolor", fcn);
-    addlistener (hg, "markerfacecolor", fcn);
-    addlistener (hg, "markersize", fcn);
-
-    fcn = {@update_data, hl};
-    addlistener (hg, "xdata", fcn);
-    addlistener (hg, "ydata", fcn);
-    addlistener (hg, "ldata", fcn);
-    addlistener (hg, "udata", fcn);
-    addlistener (hg, "xldata", fcn);
-    addlistener (hg, "xudata", fcn);
-    addlistener (hg, "format", fcn);
-
-    hax = ancestor (hg, "axes");
-    addlistener (hax, "xscale", fcn);
-    addlistener (hax, "yscale", fcn);
-
-    update_data (hg, [], hl);
-
-  endfor
-
-  ## Process legend key
-  if (! isempty (fmt.key))    
-    hlegend = [];
-    fkids = get (gcf (), "children");
-    for i = 1 : numel (fkids)
-      if (   strcmp (get (fkids(i), "type"), "axes")
-          && strcmp (get (fkids(i), "tag"), "legend"))
-        udata = get (fkids(i), "userdata");
-        if (! isempty (intersect (udata.handle, gca ())))
-          hlegend = fkids (i);
-          break;
-        endif
-      endif
-    endfor
-
-    if (isempty (hlegend))
-      hlgnd = [];
-      tlgnd = {};
-    else
-      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
-    endif
- 
-    hlgnd(end+1) = hg;
-    tlgnd(end+1) = fmt.key;
-
-    legend (gca (), hlgnd, tlgnd);
-  endif
-
-endfunction
-
-function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata,
-                                         xldata, xudata, ifmt,
-                                         xscale, yscale)
-  if (strcmp (xscale, "linear"))
-    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
-    xlo = xdata - dx;
-    xhi = xdata + dx;
-  else
-    n = xdata > 0;
-    if (! any (n))
-      n = xdata < 0;
-    endif
-    logdata = log (abs (xdata(n)));
-    rx = exp (0.01 * (max (logdata) - min (logdata)));
-    xlo = xdata/rx;
-    xhi = xdata*rx;
-  endif
-  if (strcmp (yscale, "linear"))
-    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
-    ylo = ydata - dy;
-    yhi = ydata + dy;
-  else
-    n = ydata > 0;
-    if (! any (n))
-      n = ydata < 0;
-    endif
-    logdata = log (abs (ydata(n)));
-    ry = exp (0.01 * (max (logdata) - min (logdata)));
-    ylo = ydata/ry;
-    yhi = ydata*ry;
-  endif
-  nans = NaN + xdata(:);  # fast way to do NaN (size (xdata(:)))
-  if (strcmp (ifmt, "yerr"))
-    xdata = [xdata, xdata, nans, ...
-             xlo, xhi, nans, ...
-             xlo, xhi, nans];
-    ydata = [ydata-ldata, ydata+udata, nans, ...
-             ydata+udata, ydata+udata, nans, ...
-             ydata-ldata, ydata-ldata, nans];
-  elseif (strcmp (ifmt, "xerr"))
-    xdata = [xdata-xldata, xdata+xudata, nans, ...
-             xdata+xudata, xdata+xudata, nans, ...
-             xdata-xldata, xdata-xldata, nans];
-    ydata = [ydata, ydata, nans, ...
-             ylo, yhi, nans, ...
-             ylo, yhi, nans];
-  elseif (strcmp (ifmt, "boxy"))
-    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
-    xdata = [xlo, xhi, xhi, xlo, xlo, nans];
-    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
-             ydata-ldata, nans];
-  elseif (strcmp (ifmt, "box"))
-    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
-    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
-             xdata-xldata, nans];
-    ydata = [ylo, ylo, yhi, yhi, ylo, nans];
-  elseif (strcmp (ifmt, "boxxy"))
-    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
-             xdata-xldata, nans];
-    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
-             ydata-ldata, nans];
-  elseif (strcmp (ifmt, "xyerr"))
-    [x1, y1] = errorbar_data (xdata, ydata, ldata, udata,
-                              xldata, xudata, "xerr", xscale, yscale);
-    [x2, y2] = errorbar_data (xdata, ydata, ldata, udata,
-                              xldata, xudata, "yerr", xscale, yscale);
-    xdata = [x1; x2];
-    ydata = [y1; y2];
-    return;
-  else
-    error ("errorbar: valid error bar types are xerr, yerr, xyerr, box, boxy, boxxy");
-  endif
-
-  xdata = xdata.'(:);
-  ydata = ydata.'(:);
-
-endfunction
-
-function update_props (hg, ~, hl)
-  set (hl, "color", get (hg, "color"),
-           "linewidth", get (hg, "linewidth"));
-  set (hl(1), "linestyle", get (hg, "linestyle"),
-              "marker", get (hg, "marker"),
-              "markeredgecolor", get (hg, "markeredgecolor"),
-              "markerfacecolor", get (hg, "markerfacecolor"),
-              "markersize", get (hg, "markersize"));
-endfunction
-
-function update_data (hg, ~, hl)
-
-  if (strcmp (get (hg, "type"), "axes"))
-    hax = hg;
-    hg = ancestor (hl(1), "hggroup");
-  else
-    hax = ancestor (hg, "axes");
-  endif
-  xscale = get (hax, "xscale");
-  yscale = get (hax, "yscale");
-
-  xdata  = get (hg, "xdata");
-  ydata  = get (hg, "ydata");
-  ldata  = get (hg, "ldata");
-  udata  = get (hg, "udata");
-  xldata = get (hg, "xldata");
-  xudata = get (hg, "xudata");
-  ifmt = get (hg, "format");
-
-  set (hl(1), "xdata", xdata);
-  set (hl(1), "ydata", ydata);
-
-  [errorbar_xdata, errorbar_ydata] = ...
-          errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, ...
-                         ifmt, xscale, yscale);
-
-  set (hl(2), "xdata", errorbar_xdata);
-  set (hl(2), "ydata", errorbar_ydata);
-
-endfunction
-
--- a/scripts/plot/private/__ezplot__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,565 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{h}, @var{needusage}] =} __ezplot__ (@var{pltfunc}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-## Overview: This function is the back-end for the 9 ez* plot functions.
-##           As such, most of the function is actually dedicated to sorting
-##           out the inputs and verifying that the particular ez* function
-##           called was called correctly.  The actual plotting occurs near
-##           the end in an unwind_protect block. 
-
-function [h, needusage] = __ezplot__ (pltfunc, varargin)
-
-  ezfunc = ["ez" pltfunc];
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ (ezfunc, varargin{:});
-
-  ## Define outputs early in case of shorting out of function with return;
-  h = [];
-  needusage = false;
-  if (nargin < 1)
-    needusage = true;
-    return;
-  endif
-
-  iscontour = strncmp (pltfunc, "contour", 7);
-
-  ## Defaults for ezplot
-  isplot  = true;
-  isplot3 = false;
-  ispolar = false;
-  nargs = 1;
-  switch (pltfunc)
-    case "plot"
-      ## defaults already set
-
-    case "plot3"
-      isplot  = false;
-      isplot3 = true;
-  
-    case "polar"
-      isplot  = false;
-      ispolar = true;
-    
-    otherwise
-      ## contour, mesh, surf plots
-      isplot  = false;
-      nargs = 2;
-
-  endswitch
-
-  parametric = false;
-  fun = varargin{1};
-  if (ischar (fun))
-    if (exist (fun, "file") || exist (fun, "builtin"))
-      fun = inline ([fun "(t)"]);
-    else
-      fun = vectorize (inline (fun));
-    endif
-    argids = argnames (fun);
-    if (isplot && length (argids) == 2)
-      nargs = 2;
-    elseif (numel (argids) != nargs)
-      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-    endif
-    fstr = formula (fun);
-    if (isplot)
-      xarg = argids{1};
-      if (nargs == 2)
-        yarg = argids{2};
-      else
-        yarg = "";
-      endif
-    elseif (isplot3)
-      xarg = "x";
-      yarg = "y";
-    elseif (ispolar)
-      xarg = "";
-      yarg = "";
-    else
-      xarg = argids{1};
-      yarg = argids{2};
-    endif
-  elseif (strcmp (typeinfo (fun), "inline function"))
-    argids = argnames (fun);
-    if (isplot && length (argids) == 2)
-      nargs = 2;
-    elseif (numel (argids) != nargs)
-      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-    endif
-    fun = vectorize (fun);
-    fstr = formula (fun);
-    if (isplot)
-      xarg = argids{1};
-      if (nargs == 2)
-        yarg = argids{2};
-      else
-        yarg = "";
-      endif
-    elseif (isplot3)
-      xarg = "x";
-      yarg = "y";
-    elseif (isplot || ispolar)
-      xarg = "";
-      yarg = "";
-    else
-      xarg = argids{1};
-      yarg = argids{2};
-    endif
-  elseif (isa (fun, "function_handle"))
-    fstr = func2str (fun);
-    idx = index (fstr, ')');
-    if (idx != 0)
-      args = regexp (fstr(3:(idx-1)), '\w+', 'match');
-      fstr = fstr(idx+2:end);  # remove '@(x) ' from string name
-    else
-      args = {"x"};
-    endif
-    if (isplot && length (args) == 2)
-      nargs = 2;
-    elseif (numel (args) != nargs)
-      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-    endif
-    if (isplot)
-      xarg = args{1};
-      if (nargs == 2)
-        yarg = args{2};
-      else
-        yarg = "";
-      endif
-    elseif (isplot3)
-      xarg = "x";
-      yarg = "y";
-    elseif (ispolar)
-      xarg = "";
-      yarg = "";
-    else
-      xarg = args{1};
-      yarg = args{2};
-    endif
-  else
-    error ("%s: expecting string, inline function, or function handle", ezfunc);
-  endif
-
-  if (nargin > 2 || (nargin == 2 && isplot))
-    funx = fun;
-    fstrx = fstr;
-    funy = varargin{2};
-    if (ischar (funy) && ! strcmp (funy, "circ") && ! strcmp (funy, "animate"))
-      parametric = true;
-      if (exist (funy, "file") || exist (funy, "builtin"))
-        funy = inline ([funy "(t)"]);
-      else
-        funy = vectorize (inline (funy));
-      endif
-      if (numel (argnames (funy)) != nargs)
-        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-      endif
-      fstry = formula (funy);
-    elseif (strcmp (typeinfo (funy), "inline function"))
-      parametric = true;
-      if (numel (argnames (funy)) != nargs)
-        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-      endif
-      funy = vectorize (funy);
-      fstry = formula (funy);
-    elseif (isa (funy, "function_handle"))
-      parametric = true;
-      fstry = func2str (funy);
-      idx = index (fstry, ')');
-      if (idx != 0)
-        args = regexp (fstry(3:(idx-1)), '\w+', 'match');
-        fstry = fstry(idx+2:end);  # remove '@(x) ' from string name
-      else
-        args = {"y"};
-      endif
-      if (numel (args) != nargs)
-        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-      endif
-    endif
-
-    if (! parametric && isplot3)
-      needusage = true;  # Can't call non-parametric ezplot3
-      return;
-    elseif (parametric && isplot)
-      if (nargs == 2)
-        error ("%s: can not define a parametric function in this manner", ezfunc);
-      else
-        xarg = "x";
-        yarg = "y";
-      endif
-    elseif (parametric)
-      funz = varargin{3};
-      if (ischar (funz) && ! strcmp (funz, "circ")
-          && ! strcmp (funz, "animate"))
-        if (exist (funz, "file") || exist (funz, "builtin"))
-          funz = inline ([funz "(t)"]);
-        else
-          funz = vectorize (inline (funz));
-        endif
-        if (numel (argnames (funz)) > nargs)
-          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-        endif
-        fstrz = formula (funz);
-      elseif (strcmp (typeinfo (funz), "inline function"))
-        if (numel (argnames (funz)) != nargs)
-          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-        endif
-        funz = vectorize (funz);
-        fstrz = formula (funz);
-      elseif (isa (funz, "function_handle"))
-        fstrz = func2str (funz);
-        idx = index (fstrz, ')');
-        if (idx != 0)
-          args = regexp (fstrz(3:(idx-1)), '\w+', 'match');
-          fstrz = fstrz(idx+2:end);  # remove '@(x) ' from string name
-        else
-          args = {"z"};
-        endif
-        if (numel (args) != nargs)
-          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
-        endif
-      else
-        error ("%s: parametric plots expect 3 functions", ezfunc);
-      endif
-    endif
-  endif
-
-  if ((isplot && nargs != 2) || isplot3 || ispolar)
-    n = 500;   # default for point-style functions like plot
-  else
-    n = 60;    # default for meshgrid style functions like contour, surf
-  endif
-  domain = [];
-  circ = false;
-  animate = false;
-  if (parametric)
-    if (isplot)
-      iarg = 3;
-    else
-      iarg = 4;
-    endif
-  else
-    iarg = 2;
-  endif
-  while (iarg <= nargin)
-    arg = varargin{iarg++};
-    if (ischar (arg) && strcmp (arg, "circ"))
-      circ = true;
-    elseif (ischar (arg) && strcmp (arg, "animate"))
-      animate = true;
-    elseif (isscalar (arg))
-      n = arg;
-    elseif (numel (arg) == 2)
-      domain = [arg(1) arg(2) arg(1) arg(2)];
-    elseif (numel (arg) == 4)
-      domain = arg(:).';
-    else
-      error ("%s: expecting scalar, 2-, or 4-element vector", ezfunc);
-    endif
-  endwhile
-
-  if (circ && (iscontour || isplot3 || isplot))
-    needusage = true;
-    return;
-  elseif (circ && parametric)
-    error ("%s: can not have both circular domain and parametric function",
-           ezfunc);
-  endif
-
-  if (animate && ! isplot3)
-    error ("%s: animate option only valid for ezplot3", ezfunc);
-  endif
-
-  if (parametric)
-    ## Make the label strings pretty by removing extra spaces between base
-    ## and exponent, the '.' in vectorized code, and the '*' for multiply.
-    fstrx = regexprep (regexprep (regexprep (fstrx,
-           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
-    fstry = regexprep (regexprep (regexprep (fstry,
-           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
-    if (isplot)
-      fstr = ["x = " fstrx ", y = " fstry];
-    else
-      fstrz = regexprep (regexprep (regexprep (fstrz,
-           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
-      fstr = ["x = " fstrx ",y = " fstry ", z = " fstrz];
-    endif
-  else
-    fstr = regexprep (regexprep (regexprep (fstr,
-           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
-    if (isplot && nargs == 2)
-      fstr = [fstr " = 0"];  # make title string of implicit function
-    endif
-  endif
-
-  if (isempty (domain))
-    auto_domain = true;
-    if (isplot3 || ispolar)
-      domain = [0, 2*pi, 0, 2*pi];
-    else
-      domain = [-2*pi, 2*pi, -2*pi, 2*pi];
-    endif
-  else
-    auto_domain = false;
-  endif
-
-  auto_domain_done = false;
-  do
-    domain_ok = true;
-
-    if ((isplot && nargs == 1) || isplot3 || ispolar)
-      X = linspace (domain(1), domain(2), n);
-    elseif (isplot && numel (domain) == 2)
-      x = linspace (domain(1), domain(2), n);
-      [X, Y] = meshgrid (x, x);
-    elseif (circ)
-      ## To plot on circular domain develop grid in polar coordinates
-      ## and then switch these to Cartesian coordinates.
-      cent = [domain(1) + domain(2), domain(3) + domain(4)] / 2;
-      rmax = sqrt ((domain(2) - cent(1))^2 + (domain(4) - cent(2))^2);
-      r = linspace (0, rmax, n);
-      t = linspace (0, 2*pi, n);
-      [T, R] = meshgrid (t, r);
-      X = R .* cos (T) + cent(1);
-      Y = R .* sin (T) + cent(2);
-      domain = [-rmax+cent(1), +rmax+cent(1), -rmax+cent(2), +rmax+cent(2)];
-    else  # contour, mesh, surf plots
-      x = linspace (domain(1), domain(2), n);
-      y = linspace (domain(3), domain(4), n);
-      [X, Y] = meshgrid (x, y);
-    endif
-
-    if (parametric)
-      if (isplot)
-        XX = feval (funx, X);
-        Z = feval (funy, X);
-        X = XX;
-      elseif (isplot3)
-        Z = feval (funz, X);
-        XX = feval (funx, X);
-        YY = feval (funy, X);
-        X = XX;
-        Y = YY;
-      else
-        Z = feval (funz, X, Y);
-        XX = feval (funx, X, Y);
-        YY = feval (funy, X, Y);
-        X = XX;
-        Y = YY;
-
-        ## Eliminate the singularities
-        X = __eliminate_sing__ (X);
-        Y = __eliminate_sing__ (Y);
-        Z = __eliminate_sing__ (Z);
-      endif
-    else  ## non-parametric plots
-      if (isplot && nargs == 2)
-        Z = feval (fun, X, Y);
-
-        ## Matlab returns line objects for this case and so can't call
-        ## contour directly as it returns patch objects to allow colormaps
-        ## to work with contours.  Therefore recreate the lines from the
-        ## output for contourc, and store in cell arrays.
-        [c, ~] = contourc (X, Y, Z, [0, 0]);
-
-        i = 1;
-        XX = YY = {};
-        while (i < length (c))
-          clev = c(1,i);
-          clen = c(2,i);
-          XX = [XX, {c(1, i+1:i+clen)}];
-          YY = [YY, {c(2, i+1:i+clen)}];
-          i += clen+1;
-        endwhile
-      else
-        if (ispolar)
-          Z = feval (fun, X);
-          ## FIXME: Why aren't singularities eliminated for polar plots?
-        elseif (isplot)
-          Z = feval (fun, X);
-          ## Eliminate the singularities
-          Z = __eliminate_sing__ (Z);
-          domain = find_valid_domain (X, [], Z);
-        elseif (iscontour)
-          Z = feval (fun, X, Y);
-          Z = __eliminate_sing__ (Z);
-        else  #  mesh, surf plots
-          Z = feval (fun, X, Y);
-          Z = __eliminate_sing__ (Z);
-          if (circ)
-            ## Use domain calculated at the start.
-            ## The X, Y grids are non-monotonic after conversion from polar
-            ## coordinates and find_valid_domain fails.
-
-          elseif (auto_domain && ! auto_domain_done)
-            valid_domain = find_valid_domain (X, Y, Z);
-            domain_ok = isequal (domain, valid_domain);
-            domain = valid_domain;
-            auto_domain_done = true;  # ensures only 1 round of do loop done
-          else
-            if (! auto_domain_done)
-              domain = find_valid_domain (X, Y, Z);
-            endif
-          endif
-        endif
-      endif
-    endif
-  until (domain_ok)
-
-  ## Now, actually call the correct plot function with valid data and domain.
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    if (iscontour)
-      [~, h] = feval (pltfunc, hax, X, Y, Z);
-    elseif (isplot && nargs == 2)
-      h = zeros (length (XX), 1);
-      hold_state = get (hax, "nextplot");
-      for i = 1 : length (XX)
-        h(i) = plot(hax, XX{i}, YY{i});
-        if (i == 1)
-          set (hax, "nextplot", "add");
-        endif
-      endfor
-      set (hax, "nextplot", hold_state);
-      axis (hax, domain);
-    elseif (isplot || ispolar)
-      h = feval (pltfunc, hax, X, Z);
-      if (isplot && ! parametric)
-        axis (hax, domain);
-      endif
-    elseif (isplot3)
-      if (animate)
-        ## draw animation, then replace with true plot3
-        comet3 (hax, X, Y, Z, .05);
-      endif
-      h = feval (pltfunc, hax, X, Y, Z);
-      set (hax, "box", "off");
-      grid (hax, "on");
-      zlabel (hax, "z");
-    else  # mesh and surf plots
-      h = feval (pltfunc, hax, X, Y, Z);
-      ## FIXME: surf, mesh should really do a better job of setting zlim
-      if (! parametric)
-        axis (hax, domain);
-      endif
-    endif
-    xlabel (hax, xarg);
-    ylabel (hax, yarg);
-    title (hax, fstr);
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-endfunction
-
-## Eliminate bad data (complex values, infinities, singularities)
-function x = __eliminate_sing__ (x)
-  if (iscomplex (x))
-    x(imag (x) != 0) = NaN;
-  endif
-  x(isinf (x)) = NaN;
-  ## High rates of curvature are treated as singularities
-  threshold = 0.2 * (max (x(:)) - min (x(:)));
-  x(abs (del2 (x)) > threshold) = NaN;
-endfunction
-
-## Find: 1) range of function where there are not NaN values,
-##       2) function is changing (not just flat surface)
-function domain = find_valid_domain (X, Y, Z);
-
-  if (isvector (Z))
-    ## 2-D data for isplot
-    domain = [X(1) X(end)];
-
-    ## Guess a range which includes the "mass" of the data by using a 
-    ## median-based approach.  The center 3/4 of the data is used to
-    ## determine the range of the data.
-    ## This seems to be vaguely what Matlab does, but can't be sure.
-    XX = sort (Z(isfinite (Z)));
-    if (length (X) > 4)
-      irlo = XX(fix (1/8 * length (XX)));
-      irhi = XX(fix (7/8 * length (XX)));
-      d = irhi - irlo;
-      domain(3) = max (XX(1) - d/8, irlo - d);
-      domain(4) = min (XX(end) + d/8, irhi + d);
-    else
-      domain(3:4) = [XX(1), XX(end)];
-    endif
-
-    #{
-    ## FIXME: Old algorithm for removing singularities
-    ## Deprecated in 3.8.  Can be removed if no problems appear in ezplot.
-    idx = 2 : length (Z);
-    idx = find (((Z(idx) > yrange(2) / 2) & (Z(idx-1) < yrange(1) / 2)) |
-                ((Z(idx) < yrange(1) / 2) & (Z(idx-1) > yrange(2) / 2)));
-    Z(idx) = NaN;
-    #}
-
-  else
-    ## 3-D data such as mesh, surf
-    Zfinite = ! isnan (Z); 
-    Zrows = any (Zfinite, 2); 
-    rmin = find (Zrows, 1, "first"); 
-    rmax = find (Zrows, 1, "last"); 
-    Zcols = any (Zfinite, 1); 
-    cmin = find (Zcols, 1, "first"); 
-    cmax = find (Zcols, 1, "last"); 
-
-    ## Handle nasty case of all NaNs 
-    if (isempty (rmin))
-      rmin = 1, rmax = rows (Z);
-    endif
-    if (isempty (cmin))
-      cmin = 1, cmax = columns (Z);
-    endif
-
-    if (   ! any (isnan (Z([rmin, rmax],:)(:)))
-        && ! any (isnan (Z(:, [cmin, cmax])(:))))
-      ## Exclude surfaces along borders which are flat (gradient =~ 0).
-      ## Technically, this calculation might be better done with actual
-      ## deltaX, deltaY values.  But, data is usually meshgridded
-      ## (constant spacing) so working with deltaROW#, deltaCOL# is fine.
-      [Zx, Zy] = gradient (Z(rmin:rmax, cmin:cmax));
-      Zgrad = sqrt (Zx.^2 + Zy.^2);
-      slope = ((max (Z(:)) - min (Z(:)))
-                / sqrt ((rmax - rmin)^2 + (cmax - cmin)^2));
-      slope /= 125;  # threshold for discarding points.
-      Zrows = any (Zgrad > slope, 2); 
-      rmin += find (Zrows, 1, "first") - 1; 
-      rmax += find (Zrows, 1, "last") - rows (Zrows); 
-      Zcols = any (Zgrad > slope, 1); 
-      cmin += find (Zcols, 1, "first") - 1; 
-      cmax += find (Zcols, 1, "last") - columns (Zcols); 
-    endif
-
-    domain = [X(1,cmin) X(1,cmax) Y(rmin,1) Y(rmax,1)];
-  endif
-  
-endfunction
-
--- a/scripts/plot/private/__file_filter__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __file_filter__ (@var{file_filter})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Kai Habel
-
-function [retval, defname, defdir] = __file_filter__ (file_filter, name)
-
-  revtal = {};
-  defname = "";
-  defdir = "";
-
-  if (iscell (file_filter))
-    [r, c] = size (file_filter);
-    if (c != 1 && c != 2)
-      error ("%s: invalid filter specification", name);
-    endif
-    if (c == 1)
-      retval = cell (r, 2);
-      for i = 1:r
-        retval{i, 1} = file_filter{i};
-        retval{i, 2} = __default_filtername__ (file_filter{i});
-      endfor
-    else
-      retval = file_filter;
-      for i = 1:r
-        if (isempty (retval{i, 2}))
-          retval{i, 2} = __default_filtername__ (retval{i, 1});
-        endif
-      endfor
-    endif
-  elseif (ischar (file_filter))
-    [defdir, fname, fext] = fileparts (file_filter);
-    if (! strcmp (fname, "*"))
-      defname = strcat (fname, fext);
-    endif
-    if (length (fext) > 0)
-      fext = strcat ("*", fext);
-      retval = {fext, __default_filtername__(fext)};
-    endif
-  endif
-
-  retval(end+1,:) = {"*", __default_filtername__("*")};
-
-endfunction
-
-function name = __default_filtername__ (filterext)
-
-  name = "";
-
-  switch (filterext)
-    case "*"
-      name = "All Files";
-    case "*.m"
-      name = "Octave Source Files";
-    case "*.c"
-      name = "C Source Files";
-    case {"*.cc" "*.c++" "*.cpp"}
-      name = "C++ Source Files";
-    case "*.oct"
-      name = "Octave Compiled Files";
-  endswitch
-
-  if (isempty (name))
-    extlist = ostrsplit (filterext, ";");
-    extlist = strrep (extlist, "*.", "");
-    extlist = toupper (extlist);
-    extlist(end+1, :) = repmat ({","}, 1, length (extlist));
-    extlist = strcat (extlist{:});
-    extlist = extlist(1:end-1);
-    name = strcat (extlist, "-Files");
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__fltk_file_filter__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{filterspec} =} __fltk_file_filter__ (@var{filter})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function retval = __fltk_file_filter__ (file_filter)
-
-  retval = "";
-  [r, c] = size (file_filter);
-  if ((c == 0) || (c > 2))
-    error ("expecting 1 or to 2 columns for file filter cell");
-  endif
-  fltk_str = "";
-  for idx = 1 : r
-
-    curr_ext = file_filter{idx, 1};
-    curr_ext = ostrsplit (curr_ext, ";");
-
-    if (length (curr_ext) > 1)
-      curr_ext = regexprep (curr_ext, '\*\.', ',');
-      curr_ext = strcat (curr_ext{:})(2 : end);
-      curr_ext = strcat ("*.{", curr_ext, "}");
-    else
-      curr_ext = curr_ext{:};
-    endif
-
-    curr_desc = strcat (curr_ext(3:end), "-Files");
-
-    if (c == 2)
-      curr_desc = file_filter{idx, 2};
-      curr_desc = regexprep (curr_desc, '\(', '<');
-      curr_desc = regexprep (curr_desc, '\)', '>');
-    endif
-
-    if (length (fltk_str) > 0)
-      fltk_str = strcat (fltk_str, "\t", curr_desc, " (", curr_ext, ")");
-    else
-      fltk_str = strcat (curr_desc, " (", curr_ext, ")");
-    endif
-
-  endfor
-  retval = fltk_str;
-
-endfunction
-
--- a/scripts/plot/private/__fltk_ginput__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-## Copyright (C) 2010-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __fltk_ginput__ (@var{f}, @var{n})
-## Undocumented internal function.
-## @end deftypefn
-
-## This is ginput.m implementation for fltk.
-
-function [x, y, button] = __fltk_ginput__ (f, n = -1)
-
-  if (isempty (get (f, "currentaxes")))
-    error ("ginput: must have at least one axes");
-  endif
-
-  x = y = button = [];
-  ginput_accumulator (0, 0, 0, 0);  # initialize accumulator
-
-  unwind_protect
-
-    orig_windowbuttondownfcn = get (f, "windowbuttondownfcn");
-    set (f, "windowbuttondownfcn", @ginput_windowbuttondownfcn);
-
-    orig_ginput_keypressfcn = get (f, "keypressfcn");
-    set (f, "keypressfcn", @ginput_keypressfcn);
-
-    do
-      __fltk_redraw__ ();
-
-      ## Release CPU.
-      sleep (0.01);
-
-      [x, y, n0, button] = ginput_accumulator (-1, 0, 0, 0);
-    until (n0 == n || n0 < 0)
-
-  unwind_protect_cleanup
-    set (f, "windowbuttondownfcn", orig_windowbuttondownfcn);
-    set (f, "keypressfcn", orig_ginput_keypressfcn);
-  end_unwind_protect
-
-endfunction
-
-function [x, y, n, button] = ginput_accumulator (mode, xn, yn, btn)
-  persistent x y n button;
-
-  if (mode == 0)
-    ## Initialize.
-    x = y = button = [];
-    n = 0;
-  elseif (mode == 1)
-    ## Append mouse button or key press.
-    x = [x; xn];
-    y = [y; yn];
-    button = [button; btn];
-    n += 1;
-  elseif (mode == 2)
-    ## The end due to Enter.
-    n = -1;
- endif
-
-endfunction
-
-function ginput_windowbuttondownfcn (src, data)
-  point = get (get (src,"currentaxes"), "currentpoint");
-  button = data;
-  ginput_accumulator (1, point(1,1), point(2,1), button);
-endfunction
-
-function ginput_keypressfcn (src, evt)
-  point = get (get (src, "currentaxes"), "currentpoint");
-  key = evt.Key;
-  if (key == 10)
-    ## Enter key stops ginput.
-    ginput_accumulator (2, NaN, NaN, NaN);
-  else
-    ginput_accumulator (1, point(1,1), point(2,1), key);
-  endif
-endfunction
-
--- a/scripts/plot/private/__fltk_print__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-## Copyright (C) 2010-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __fltk_print__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-function opts = __fltk_print__ (opts)
-
-  dos_shell = (ispc () && ! isunix ());
-
-  set (0, "currentfigure", opts.figure);
-  drawnow ("expose");
-  __fltk_redraw__ ();
-
-  if (! isempty (opts.fig2dev_binary))
-    ## fig2dev is prefered for conversion to emf
-    fig2dev_devices = {"pstex", "mf", "emf"};
-  else
-    fig2dev_devices = {"pstex", "mf"};
-  endif
-
-  gl2ps_device = {};
-  pipeline = {};
-  switch (lower (opts.devopt))
-    case {"eps", "eps2", "epsc", "epsc2"}
-      ## format GL2PS_EPS
-      gl2ps_device = {"eps"};
-      ## FIXME: use epstool to tighten bbox and provide preview.
-      pipeline = {opts.epstool_cmd(opts, "-", opts.name)};
-    case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ...
-          "pslatexstandalone", "pdflatexstandalone"}
-      ## format GL2PS_TEX
-      n = find (opts.devopt == "l", 1);
-      suffix = opts.devopt(1:n-1);
-      dot = find (opts.name == ".", 1, "last");
-      if ((! isempty (dot))
-          && any (strcmpi (opts.name(dot:end), ...
-                  {strcat(".", suffix), ".tex", "."})))
-        name = opts.name(1:dot-1);
-        if (dot < numel (opts.name)
-            && any (strcmpi (opts.name(dot+1:end), {"eps", "ps", "pdf"})))
-          ## If user provides eps/ps/pdf suffix, use it.
-          suffix = opts.name(dot+1:end);
-        endif
-      else
-        error ("print:invalid-suffix", 
-               "invalid suffix '%s' for device '%s'.",
-               opts.name(dot:end), lower (opts.devopt));
-      endif
-      gl2ps_device = {sprintf("%snotxt", lower (suffix))};
-      gl2ps_device{2} = "tex";
-      if (dos_shell)
-        ## FIXME: this will only work on MinGW with the MSYS shell
-        pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
-        pipeline{2} = sprintf ("cat > %s.tex", name);
-      else
-        pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
-        pipeline{2} = sprintf ("cat > %s.tex", name);
-      endif
-    case "tikz"
-      ## format GL2PS_PGF
-      gl2ps_device = {"pgf"};
-      pipeline = {sprintf("cat > %s", opts.name)};
-    case "svg"
-      ## format GL2PS_SVG
-      gl2ps_device = {"svg"};
-      pipeline = {sprintf("cat > %s", opts.name)};
-    case fig2dev_devices
-      cmd_pstoedit = opts.pstoedit_cmd (opts, "fig");
-      cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt);
-      if (strcmp (opts.devopt, "pstex"))
-        [~, ~, ext] = fileparts (opts.name);
-        if (any (strcmpi (ext, {".ps", ".tex", "."})))
-          opts.name = opts.name(1:end-numel(ext));
-        endif
-        opts.name = strcat (opts.name, ".ps");
-        cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
-        gl2ps_device = {"eps"};
-        pipeline = {cmd};
-        cmd_fig2dev = opts.fig2dev_cmd (opts, "pstex_t");
-        gl2ps_device{2} = "eps";
-        pipeline{2} = sprintf ("%s | %s > %s", cmd_pstoedit,
-                               cmd_fig2dev, strrep(opts.name, ".ps", ".tex"));
-      else
-        cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
-        gl2ps_device = {"eps"};
-        pipeline = {cmd};
-      endif
-    case "aifm"
-      cmd = opts.pstoedit_cmd (opts, "ps2ai");
-      gl2ps_device = {"eps"};
-      pipeline = {sprintf("%s > %s", cmd, opts.name)};
-    case {"dxf", "emf", "fig", "hpgl"}
-      cmd = opts.pstoedit_cmd (opts);
-      gl2ps_device = {"eps"};
-      pipeline = {sprintf("%s > %s", cmd, opts.name)};
-    case {"corel", "gif"}
-      error ("print:unsupporteddevice",
-             "print.m: %s output is not available for the FLTK graphics toolkit",
-             upper (opts.devopt));
-    case opts.ghostscript.device
-      opts.ghostscript.source = "-";
-      opts.ghostscript.output = opts.name;
-      if (opts.send_to_printer)
-        opts.unlink(strcmp (opts.unlink, opts.ghostscript.output)) = [];
-        opts.ghostscript.output = "-";
-      endif
-      [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
-      if (opts.send_to_printer || isempty (opts.name))
-        cmd_lpr = opts.lpr_cmd (opts);
-        cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr);
-      else
-        cmd = sprintf ("%s", cmd_gs);
-      endif
-      if (! isempty (cmd_cleanup))
-        gl2ps_device = {"eps"};
-        if (dos_shell)
-          pipeline = {sprintf("%s & %s", cmd, cmd_cleanup)};
-        else
-          pipeline = {sprintf("%s ; %s", cmd, cmd_cleanup)};
-        endif
-      else
-        gl2ps_device = {"eps"};
-        pipeline = {cmd};
-      endif
-    otherwise
-      error (sprintf ("print:no%soutput", opts.devopt),
-             "print.m: %s output is not available for GL2PS output",
-             upper (opts.devopt));
-  endswitch
-
-  opts.pipeline = pipeline;
-
-  ## Tell gl2ps to use different rendering options for 2D plots
-  haxes = findall (opts.figure, "type", "axes");
-  vw = get (haxes, "view");
-  if (iscell (vw))
-    vw = vertcat (vw{:});
-  endif
-  is2D = all (abs (vw(:,2)) == 90);
-  if (is2D)
-    gl2ps_device{end} = [gl2ps_device{end}, "is2D"];
-  endif
-
-  for n = 1:numel (pipeline)
-    if (opts.debug)
-      fprintf ("fltk-pipeline: '%s'\n", pipeline{n});
-    endif
-    drawnow (gl2ps_device{n}, strcat ('|',pipeline{n}));
-  endfor
-
-  if (! isempty (strfind (opts.devopt, "standalone")))
-    opts.latex_standalone (opts);
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__getlegenddata__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{hplots}, @var{strings}]} = __getlegenddata__ (@var{h})
-## Undocumented internal function.
-## @end deftypefn
-
-function [hplots, text_strings] = __getlegenddata__ (hlegend)
-
-  hplots = [];
-  text_strings = {};
-  ca = getfield (get (hlegend, "userdata"), "handle");
-  if (numel (ca) == 1)
-    kids = get (ca, "children");
-  else
-    kids = [get(kids, "children"){:}];
-  endif
-
-  for i = numel (kids):-1:1
-    typ = get (kids(i), "type");
-    if (any (strcmp (typ, {"line", "patch", "surface", "hggroup"})))
-      if (strcmp (typ, "hggroup"))
-        hgkids = get (kids(i), "children");
-        for j = 1 : length (hgkids)
-          try
-            dname = get (hgkids(j), "DisplayName");
-            if (! isempty (dname))
-              hplots(end+1) = hgkids(j);
-              text_strings(end+1) = dname;
-              break;  # break from j-loop over hgkids
-            endif
-          end_try_catch
-        endfor
-      else
-        dname = get (kids(i), "DisplayName");
-        if (! isempty (dname))
-          hplots(end+1) = kids(i);
-          text_strings(end+1) = dname;
-        endif
-      endif
-    endif
-  endfor
-
-endfunction
-
--- a/scripts/plot/private/__ghostscript__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __ghostscript__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-07-26
-
-function [gs_cmd, cleanup_cmd] = __ghostscript__ (varargin);
-
-  opts.binary = "";
-  opts.source = "-";
-  opts.output = "-";
-  opts.device = "";
-  opts.epscrop = false;
-  opts.antialiasing  = false;
-  opts.antialiasing_textalphabits = 4;,
-  opts.antialiasing_graphicsalphabits = 4;
-  opts.resolution = 150;
-  opts.papersize = "";
-  opts.pageoffset = [0 0];
-  opts.debug = false;
-  opts.level = [];
-  opts.prepend = "";
-
-  offsetfile = "";
-  offset_ps = {};
-  cleanup_cmd = "";
-
-  args = varargin;
-  n = find (cellfun ("isclass", args, "struct"));
-  if (! isempty (n))
-    f = fieldnames (args{n});
-    for m = 1:numel (f)
-      opts.(f{m}) = args{n}.(f{m});
-    endfor
-    args(n) = [];
-  endif
-  for n = 1:2:numel (args)
-    opts.(args{n}) = args{n+1};
-  endfor
-
-  if (isempty (opts.papersize))
-    format_for_printer = false;
-  else
-    format_for_printer = true;
-  endif
-
-  gs_opts = sprintf ("-dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=%s", opts.device);
-
-  if (! isempty (opts.level) && ismember (opts.level, [1, 2, 3]))
-    gs_opts = sprintf ("%s -dLanguageLevel=%d", gs_opts, round (opts.level));
-  endif
-
-  if (opts.antialiasing && isempty (strfind (opts.device, "write")))
-    ## Apply anti-aliasing to all bitmap formats/devices
-    gs_opts = sprintf ("%s -dTextAlphaBits=%d -dGraphicsAlphaBits=%d",
-                       gs_opts, opts.antialiasing_textalphabits,
-                       opts.antialiasing_graphicsalphabits);
-    gs_opts = sprintf ("%s -r%dx%d", gs_opts, [1, 1] * opts.resolution);
-  elseif (any (strcmp (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
-    gs_opts = sprintf ("%s -dEmbedAllFonts=true", gs_opts);
-    if (strcmp (opts.device, "pdfwrite"))
-      ## Optimize for loading
-      gs_opts = sprintf ("%s -dOptimize=true", gs_opts);
-    endif
-  endif
-
-  if (opts.epscrop)
-    ## papersize is specified by the eps bbox
-    gs_opts = sprintf ("%s -dEPSCrop", gs_opts);
-  endif
-  if (format_for_printer)
-    if (ischar (opts.papersize))
-      gs_opts = sprintf ("%s -sPAPERSIZE=%s", gs_opts, opts.papersize);
-    elseif (isnumeric (opts.papersize) && numel (opts.papersize) == 2)
-      gs_opts = sprintf ("%s -dDEVICEWIDTHPOINTS=%d -dDEVICEHEIGHTPOINTS=%d",
-                         gs_opts, opts.papersize);
-      if (opts.papersize(1) > opts.papersize(2))
-        ## Lanscape mode: This option will result in automatic rotation of the
-        ##                document page if the requested page size matches one
-        ##                of the default page sizes
-        gs_opts = sprintf ("%s -dNORANGEPAGESIZE", gs_opts);
-      endif
-    else
-      error ("print:badpapersize", "__ghostscript__.m: invalid 'papersize'");
-    endif
-    gs_opts = sprintf ("%s -dFIXEDMEDIA", gs_opts);
-    ## "pageoffset" is relative to the coordinates, not the BBox LLHC.
-    str = sprintf ("%s [%d %d] %s", "<< /Margins [0 0] /.HWMargins [0 0 0 0] /PageOffset",
-                   opts.pageoffset, ">> setpagedevice");
-    offset_ps = {"%!PS-Adobe-3.0", str, "%%EOF"};
-    if (isfield (opts, "offsetfile"))
-      offsetfile = opts.offsetfile;
-      cleanup_cmd = "";
-    else
-      offsetfile = strcat (tmpnam (), ".ps");
-      cleanup_cmd = sprintf ("rm %s", offsetfile);
-    endif
-    unwind_protect
-      fid = fopen (offsetfile, "w");
-      if (fid == -1)
-        error ("print:fopenfailed", "__ghostscript__.m: fopen () failed");
-      endif
-      fprintf (fid, "%s\n", offset_ps{:});
-    unwind_protect_cleanup
-      status = fclose (fid);
-      if (status == -1)
-        error ("print:fclosefailed", "__ghostscript__.m: fclose () failed");
-      endif
-    end_unwind_protect
-    if (opts.debug)
-      fprintf ("---- begin %s ----\n", offsetfile);
-      fprintf ("%s\n", offset_ps{:});
-      fprintf ("----- end %s -----\n", offsetfile);
-    endif
-  endif
-
-  if (isempty (opts.binary))
-    error ("print:no_ghostscript", "__ghostscript__.m: ghostscript is required.");
-  elseif (isempty (opts.output))
-    cmd = sprintf ("%s %s", opts.binary, gs_opts);
-  else
-    cmd = sprintf ("%s %s -sOutputFile=\"%s\"", opts.binary, gs_opts, opts.output);
-  endif
-  if (! isempty (opts.prepend)
-      && any (strcmpi (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
-    ## FIXME - Fonts get may be mangled when appending ps/ps2.
-    ##         See "How to concatenate several PS files" at the link,
-    ##         http://en.wikibooks.org/wiki/PostScript_FAQ
-    cmd = sprintf ("%s %s", cmd, opts.prepend);
-    if (isempty (cleanup_cmd))
-      cleanup_cmd = sprintf ("rm %s", opts.prepend);
-    else
-      cleanup_cmd = sprintf ("%s ; rm %s", cleanup_cmd, opts.prepend);
-    endif
-  endif
-  if (! isempty (offsetfile) && format_for_printer)
-    cmd = sprintf ("%s %s", cmd, offsetfile);
-  endif
-  if (! isempty (opts.source))
-    cmd = sprintf ("%s %s", cmd, opts.source);
-  endif
-
-  if (opts.debug)
-    fprintf ("Ghostscript command: '%s'\n", cmd);
-  endif
-
-  gs_cmd = cmd;
-
-endfunction
-
-
--- a/scripts/plot/private/__gnuplot_get_var__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{value} =} __gnuplot_get_var__ (@var{h}, @var{name}, @var{fmt})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2009-02-07
-
-function gp_var_value = __gnuplot_get_var__ (h, gp_var_name, fmt = "")
-
-  if (numel (h) == 1 && isfigure (h))
-    if (isempty (get (gcf, "__plot_stream__")))
-      ostream = __gnuplot_open_stream__ (2, h);
-    else
-      ostream = get (h, "__plot_stream__");
-    endif
-  else
-    ostream = h;
-  endif
-  if (numel (ostream) < 1)
-    error ("__gnuplot_get_var__: stream to gnuplot not open");
-  elseif (ispc ())
-    if (numel (ostream) == 1)
-      error ("__gnuplot_get_var__: Need mkfifo that is not implemented under Windows");
-    endif
-    use_mkfifo = false;
-    istream = ostream(2);
-    ostream = ostream(1);
-  else
-    use_mkfifo = true;
-    ostream = ostream(1);
-  endif
-
-  if (use_mkfifo)
-    gpin_name = tmpnam ();
-
-    ## Mode: 0600 == 6*8*8
-    [err, msg] = mkfifo (gpin_name, 6*8*8);
-
-    if (err)
-      error ("__gnuplot_get_var__: Can not make FIFO (%s)", msg);
-    endif
-  endif
-
-  gp_var_name = strtrim (gp_var_name);
-  n = min (strfind (gp_var_name, " "), strfind (gp_var_name, ",")) - 1;
-  if (isempty (n))
-    n = numel (gp_var_name);
-  endif
-
-  unwind_protect
-
-    ## Notes: Variables may be undefined if user closes gnuplot by "q"
-    ## or Alt-F4.  Further, this abrupt close also requires the leading
-    ## "\n" on the next line.
-    if (use_mkfifo)
-      fprintf (ostream, "\nset print \"%s\";\n", gpin_name);
-      fflush (ostream);
-      [gpin, err] = fopen (gpin_name, "r");
-      if (err)
-        ## Try a second time, and then give an error.
-        [gpin, err] = fopen (gpin_name, "r");
-      endif
-      if (err)
-        error ("__gnuplot_get_var__: can not open FIFO");
-      endif
-      gp_cmd = sprintf ("\nif (exists(\"%s\")) print %s; else print NaN\n",
-                        gp_var_name(1:n), gp_var_name);
-      fputs (ostream, gp_cmd);
-
-      ## Close output file, to force it to be flushed
-      fputs (ostream, "set print;\n");
-      fflush (ostream);
-
-      ## Now read from fifo.
-      reading = true;
-      str = {};
-      while (reading)
-        str{end+1} = fgets (gpin);
-        if (isnumeric (str{end}) && (str{end} == -1))
-          reading = false;
-          str = str(1:(end-1));
-        endif
-      endwhile
-      str = strcat (str{:});
-      fclose (gpin);
-    else
-      ## Direct gnuplot to print to <STDOUT>
-      fprintf (ostream, "set print \"-\";\n");
-      fflush (ostream);
-      gp_cmd = sprintf ("\nif (exists(\"%s\")) print \"OCTAVE: \", %s; else print NaN\n",
-                        gp_var_name(1:n), gp_var_name);
-      fputs (ostream, gp_cmd);
-      fflush (ostream);
-      ## Direct gnuplot to print to <STDERR>
-      fputs (ostream, "set print;\n");
-      fflush (ostream);
-
-      str = {};
-      while (isempty (str))
-        str = fread (istream, "*char")';
-        if (isempty (str))
-          sleep (0.05);
-        else
-          str = regexp (str, 'OCTAVE:.*', "match");
-          str = str{end}(8:end);
-        endif
-        fclear (istream);
-      endwhile
-    endif
-
-    ## Strip out EOLs and the continuation character "|"
-    str(str=="\n" | str=="\r") = "";
-    n_continue = strfind (str, " \\ ");
-    if (! isempty (n_continue))
-      str(n_continue+1) = "";
-    endif
-
-    if (isempty (fmt))
-      gp_var_value = strtrim (str);
-    else
-      gp_var_value = sscanf (str, fmt);
-    endif
-
-  unwind_protect_cleanup
-    if (use_mkfifo)
-      unlink (gpin_name);
-    endif
-  end_unwind_protect
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_ginput__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-## Copyright (C) 2004-2012 Petr Mikulik
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __gnuplot_ginput__ (@var{f}, @var{n})
-## Undocumented internal function.
-## @end deftypefn
-
-## This is ginput.m implementation for gnuplot and X11.
-## It requires gnuplot 4.1 and later.
-
-## This file initially bore the copyright statement
-## Petr Mikulik
-## History: June 2006; August 2005; June 2004; April 2004
-## License: public domain
-
-function [x, y, button] = __gnuplot_ginput__ (f, n)
-
-  if (compare_versions (__gnuplot_version__ (), "4.0", "<="))
-    error ("ginput: version %s of gnuplot not supported", gnuplot_version ());
-  endif
-
-  ostream = get (f, "__plot_stream__");
-  if (numel (ostream) < 1)
-    error ("ginput: stream to gnuplot not open");
-  elseif (ispc ())
-    if (numel (ostream) == 1)
-      error ("ginput: Need mkfifo that is not implemented under Windows");
-    endif
-    use_mkfifo = false;
-    istream = ostream(2);
-    ostream = ostream(1);
-  else
-    use_mkfifo = true;
-    ostream = ostream(1);
-  endif
-
-  if (nargin == 1)
-    x = zeros (100, 1);
-    y = zeros (100, 1);
-    button = zeros (100, 1);
-  else
-    x = zeros (n, 1);
-    y = zeros (n, 1);
-    button = zeros (n, 1);
-  endif
-
-  if (use_mkfifo)
-    gpin_name = tmpnam ();
-
-    ##Mode: 6*8*8 ==  0600
-    [err, msg] = mkfifo (gpin_name, 6*8*8);
-
-    if (err)
-      error ("ginput: Can not open fifo (%s)", msg);
-    endif
-  endif
-
-  unwind_protect
-
-    k = 0;
-    while (true)
-      k++;
-
-      ## Notes: MOUSE_* can be undefined if user closes gnuplot by "q"
-      ## or Alt-F4. Further, this abrupt close also requires the leading
-      ## "\n" on the next line.
-      if (use_mkfifo)
-        fprintf (ostream, "set print \"%s\";\n", gpin_name);
-        fflush (ostream);
-        [gpin, err] = fopen (gpin_name, "r");
-        if (err)
-          error ("ginput: Can not open FIFO (%s)", msg);
-        endif
-        fputs (ostream, "pause mouse any;\n\n");
-        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
-
-        ## Close output file, to force it to be flushed
-        fputs (ostream, "set print;\n");
-        fflush (ostream);
-
-        ## Now read from fifo.
-        [x(k), y(k), button(k), count] = fscanf (gpin, "%f %f %d", "C");
-        fclose (gpin);
-      else
-        fputs (ostream, "set print \"-\";\n");
-        fflush (ostream);
-        fputs (ostream, "pause mouse any;\n\n");
-        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print \"OCTAVE: \", MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
-
-        ## Close output file, to force it to be flushed
-        fputs (ostream, "set print;\n");
-        fflush (ostream);
-
-        str = {};
-        while (isempty (str))
-          str = fread (istream, "*char")';
-          if (isempty (str))
-            sleep (0.05);
-          else
-            str = regexp (str, 'OCTAVE:\s+[-+.\d]+\s+[-+.\d]+\s+\d*', 'match');
-          endif
-          fclear (istream);
-        endwhile
-        [x(k), y(k), button(k), count] = sscanf (str{end}(8:end), "%f %f %d", "C");
-      endif
-
-      if ([x(k), y(k), button(k)] == [0, 0, -1])
-        ## Mousing not active (no plot yet).
-        break;
-      endif
-
-      if (button(k) == 0x0D || button(k) == 0x0A)
-        ## Stop when hitting a RETURN or ENTER key.
-        x(k:end) = [];
-        y(k:end) = [];
-        button(k:end) = [];
-        break;
-      endif
-      if (nargin > 1 && k == n)
-        ## Input argument n was given, stop when k == n.
-        break;
-      endif
-
-    endwhile
-
-  unwind_protect_cleanup
-    if (use_mkfifo)
-      unlink (gpin_name);
-    endif
-  end_unwind_protect
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_has_feature__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{has_feature} =} __gnuplot_has_feature__ (@var{feature})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2009-01-27
-
-function res = __gnuplot_has_feature__ (feature)
-  persistent features = {"x11_figure_position",
-                         "wxt_figure_size",
-                         "transparent_patches",
-                         "transparent_surface",
-                         "epslatex_implies_eps_filesuffix",
-                         "epslatexstandalone_terminal",
-                         "screen_coordinates_for_{lrtb}margin",
-                         "variable_GPVAL_TERMINALS",
-                         "key_has_font_properties",
-                         "windows_figure_position",
-                         "has_termoption_dashed"};
-  persistent has_features;
-
-  if (isempty (has_features))
-    try
-      gnuplot_version = __gnuplot_version__ ();
-    catch
-      ## Don't throw an error if gnuplot isn't installed
-      gnuplot_version = "0.0.0";
-    end_try_catch
-    versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3"};
-    operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
-    have_features = false (size (features));
-    for n = 1 : numel (have_features)
-      has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});
-    endfor
-  endif
-
-  n = find (strcmpi (feature, features));
-  if (isempty (n))
-    res = NaN;
-  else
-    res = has_features(n);
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_has_terminal__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{has_terminal} =} __gnuplot_has_terminal__ (@var{terminal})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-09-13
-
-function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream)
-
-  term = strtrim (term);
-  term = lower (strtok (term, " "));
-
-  if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
-    if (nargin < 2)
-      plot_stream = __gnuplot_open_stream__ (2);
-    endif
-    available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
-    available_terminals = regexp (available_terminals, '\w+', "match");
-    if (nargin < 2 && ! isempty (plot_stream))
-      pclose (plot_stream(1));
-      if (numel (plot_stream) > 1)
-        pclose (plot_stream(2));
-      endif
-      if (numel (plot_stream) > 2)
-        waitpid (plot_stream(3));
-      endif
-    endif
-  else
-    ## Gnuplot 4.0 terminals. No new terminals were added until 4.4 which
-    ## allows the list of terminals to be obtained from GPVAL_TERMINALS.
-    available_terminals = {"aifm", "aqua", "canvas", "cgm", "corel", ...
-                           "dumb", "dxf", "eepic", "emf", "epslatex", ...
-                           "epson_180dpi", "fig", "gif", "gnugraph", ...
-                           "gpic", "hp2623A", "hp2648", "hp500c", ...
-                           "hpgl", "hpljii", "hppj", "imagen", "jpeg", ...
-                           "latex", "mf", "mif", "mp", "pbm", "pdf", ...
-                           "pm", "png", "postscript", "pslatex", ...
-                           "pstex", "pstricks", "qms", "regis", "rgip", ...
-                           "svg", "texdraw", "tgif", "tkcanvas", ...
-                           "tpic", "windows", "x11", "xlib", "xterm"};
-  endif
-
-  gnuplot_supports_term = any (strcmp (term, available_terminals));
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_open_stream__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{stream} =} __gnuplot_open_stream__ (@var{npipes}, @var{h})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2009-04-11
-
-function plot_stream = __gnuplot_open_stream__ (npipes, h)
-  [prog, args] = gnuplot_binary ();
-  if (npipes > 1)
-    [plot_stream(1), plot_stream(2), pid] = popen2 (prog, args{:});
-    if (pid < 0)
-      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
-    else
-      plot_stream(3) = pid;
-    endif
-  else
-    plot_stream = popen (sprintf ("%s ", prog, args{:}), "w");
-    if (plot_stream < 0)
-      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
-    endif
-  endif
-  if (nargin > 1)
-    set (h, "__plot_stream__", plot_stream);
-  endif
-endfunction
-
--- a/scripts/plot/private/__gnuplot_print__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,316 +0,0 @@
-## Copyright (C) 1999-2012 Daniel Heiserer
-## Copyright (C) 2001 Laurent Mazet
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __gnuplot_print__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
-## Adapted-By: jwe
-
-function opts = __gnuplot_print__ (opts)
-
-  dos_shell = (ispc () && ! isunix ());
-
-  if (isempty (opts.fontsize))
-    ## If no fontsize, determine the nominal axes fontsize.
-    defaultfontsize = get (0, "defaultaxesfontsize");
-    axesfontsize = get (findobj (opts.figure, "type", "axes"), "fontsize");
-    if (iscell (axesfontsize))
-      axesfontsize = round (median (cell2mat (axesfontsize)));
-    endif
-    if (isempty (axesfontsize))
-      opts.fontsize = defaultfontsize;
-    else
-      opts.fontsize = axesfontsize;
-    endif
-  endif
-  ## The axes-label and tick-label spacing is determined by
-  ## the font spec given in "set terminal ..."
-  gp_opts = font_spec (opts);
-
-  pipeline = "";
-
-  switch (lower (opts.devopt))
-    case {"eps", "eps2", "epsc", "epsc2"}
-      if (any (strcmp (opts.devopt, {"eps", "epsc"})))
-        gp_opts = [gp_opts " level1"];
-      endif
-      if (opts.tight_flag || ! isempty (opts.preview))
-        tmp_file = strcat (tmpnam (), ".eps");
-        eps_drawnow (opts, tmp_file, gp_opts);
-        if (dos_shell)
-          cleanup = [" & del " strrep(tmp_file, '/', '\')];
-        else
-          cleanup = [" ; rm " tmp_file];
-        endif
-        pipeline = {sprintf("%s %s",
-                            opts.epstool_cmd (opts, tmp_file, opts.name),
-                            cleanup)};
-      else
-        eps_drawnow (opts, opts.name, gp_opts);
-      endif
-    case {"epslatex", "pslatex", "pstex", "epslatexstandalone"}
-      dot = find (opts.name == ".", 1, "last");
-      n = find (opts.devopt == "l", 1);
-      suffix = opts.devopt(1:n-1);
-      if (! isempty (dot))
-        if (any (strcmpi (opts.name(dot:end), {["." suffix], ".tex", "."})))
-          name = opts.name(1:dot-1);
-        else
-          error ("print:invalid-suffix", 
-                 "invalid suffix '%s' for device '%s'.",
-                 opts.name(dot:end), lower (opts.devopt));
-        endif
-      endif
-      if (strfind (opts.devopt, "standalone"))
-        term = sprintf ("%s ",
-                        strrep (opts.devopt, "standalone", " standalone"));
-      else
-        term = sprintf ("%s ", opts.devopt);
-      endif
-      if (__gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
-        suffix = "tex";
-      else
-        ## Gnuplot 4.0 wants a ".eps" suffix.
-        suffix = "eps";
-      endif
-      local_drawnow ([term " " gp_opts],
-                     strcat (name, ".", suffix), opts);
-    case "tikz"
-      if (__gnuplot_has_terminal__ ("tikz"))
-        local_drawnow (["lua tikz " gp_opts], opts.name, opts);
-      else
-        error (sprintf ("print:no%soutput", opts.devopt),
-               "print.m: '%s' output is not available for gnuplot-%s",
-               upper (opts.devopt), __gnuplot_version__ ());
-      endif
-    case "svg"
-      local_drawnow (["svg dynamic " gp_opts], opts.name, opts);
-    case {"aifm", "corel", "eepic", "emf", "fig"}
-      local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
-    case {"pdfcairo", "pngcairo"}
-      if (__gnuplot_has_terminal__ (opts.devopt))
-        local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
-      else
-        error (sprintf ("print:no%soutput", opts.devopt),
-               "print.m: '%s' output is not available for gnuplot-%s",
-               upper (opts.devopt), __gnuplot_version__ ());
-      endif
-    case {"canvas", "dxf", "hpgl", "mf", "gif", "pstricks", "texdraw"}
-      local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
-    case opts.ghostscript.device
-      gp_opts = font_spec (opts, "devopt", "eps");
-      opts.ghostscript.output = opts.name;
-      opts.ghostscript.source = strcat (tmpnam (), ".eps");
-      eps_drawnow (opts, opts.ghostscript.source, gp_opts);
-      [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
-      if (opts.send_to_printer || isempty (opts.name))
-        cmd_lpr = opts.lpr_cmd (opts);
-        cmd = [cmd_gs " | " cmd_lpr];
-      else
-        cmd = cmd_gs;
-      endif
-      if (dos_shell)
-        cmd = sprintf ("%s & del %s", cmd,
-                       strrep (opts.ghostscript.source, '/', '\'));
-      else
-        cmd = sprintf ("%s ; rm %s", cmd, opts.ghostscript.source);
-      endif
-      if (! isempty (cmd_cleanup))
-        if (dos_shell)
-          pipeline = {[cmd " & " cmd_cleanup]};
-        else
-          pipeline = {[cmd " ; " cmd_cleanup]};
-        endif
-      else
-        pipeline = {cmd};
-      endif
-    otherwise
-      error (sprintf ("print:no%soutput", opts.devopt),
-             "print.m: %s output is not available for the Gnuplot graphics toolkit",
-             upper (opts.devopt));
-  endswitch
-
-
-  opts.pipeline = pipeline;
-
-  for n = 1:numel (pipeline)
-    if (opts.debug)
-      fprintf ("gnuplot-pipeline: '%s'\n", pipeline{n});
-    endif
-    [status, output] = system (pipeline{n});
-    if (status)
-      fprintf ("%s\n%s\n%s\n",
-               "---------- output begin ----------",
-               output,
-               "----------- output end -----------");
-      error ("gnuplot:failedpipe", "print: failed to print");
-    endif
-  endfor
-
-endfunction
-
-function eps_drawnow (opts, epsfile, gp_opts)
-  [h, fontsize] = get_figure_text_objs (opts);
-  unwind_protect
-    fontsize_2x = cellfun (@times, {2}, fontsize, "uniformoutput", false);
-    set (h, {"fontsize"}, fontsize_2x);
-    local_drawnow (["postscript eps " gp_opts], epsfile, opts);
-  unwind_protect_cleanup
-    set (h, {"fontsize"}, fontsize);
-  end_unwind_protect
-endfunction
-
-function local_drawnow (term, file, opts)
-  if (opts.use_color < 0)
-    mono = true;
-  else
-    mono = false;
-  endif
-  set (0, "currentfigure", opts.figure);
-  if (isempty (opts.debug_file) || ! opts.debug)
-    drawnow (term, file, mono);
-  else
-    drawnow (term, file, mono, opts.debug_file);
-  endif
-endfunction
-
-function f = font_spec (opts, varargin)
-  for n = 1:2:numel (varargin)
-    opts.(varargin{n}) = varargin{n+1};
-  endfor
-  f = "";
-  switch (opts.devopt)
-    case "cgm"
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ('font "%s"', opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ("%d", opts.fontsize);
-      endif
-    case {"eps", "eps2", "epsc", "epsc2"}
-      ## Gnuplot renders fonts as half their specification, which
-      ## results in a tight spacing for the axes-labels and tick-labels.
-      ## Compensate for the half scale. This will produce the proper
-      ## spacing for the requested fontsize.
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ('font "%s,%d"', opts.font, 2 * opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ('font "%s"', opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ("%d", 2 * opts.fontsize);
-      endif
-    case "svg"
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        fontsize = round (opts.fontsize * 0.75);
-        f = sprintf ('fname "%s" fsize %d', opts.font, fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ('fname "%s"', opts.font);
-      elseif (! isempty (opts.fontsize))
-        fontsize = round (opts.fontsize * 0.75);
-        f = sprintf ("%s fsize %d", f, fontsize);
-      endif
-    case "pdf"
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ('font "%s"', opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ("fsize %d", f, opts.fontsize);
-      endif
-    case {"pdfcairo", "pngcairo"}
-      if (! isempty (opts.font))
-        f = sprintf ('font "%s"', opts.font);
-      endif
-    case {"epslatex", "epslatexstandalone"}
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ('font "%s"', opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ("%d", opts.fontsize);
-      endif
-    case "pslatex"
-      if (! isempty (opts.fontsize))
-        f = sprintf ("%d", opts.fontsize);
-      endif
-    case {"gif", "jpeg", "png"}
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ('font "%s ,%d"', opts.font, opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ('font "%s"', opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ('font "%d"', opts.fontsize);
-      endif
-    case "emf"
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ('"%s" %d', opts.font, opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ('"%s"', opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ("%d", opts.fontsize);
-      endif
-    case "canvas"
-      if (! isempty (opts.fontsize))
-        f = sprintf ("fsize %d", opts.fontsize);
-      endif
-    case {"aifm", "corel"}
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ("%s %d", opts.font, opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ("%s", opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ("%d", opts.fontsize);
-      endif
-    case "fig"
-      if (! isempty (opts.font) && ! isempty (opts.fontsize))
-        f = sprintf ("font %s fontsize %d", opts.font, opts.fontsize);
-      elseif (! isempty (opts.font))
-        f = sprintf ("font %s", opts.font);
-      elseif (! isempty (opts.fontsize))
-        f = sprintf ("fontsize %d", opts.fontsize);
-      endif
-  endswitch
-endfunction
-
-function [h, fontsize] = get_figure_text_objs (opts)
-  h = findall (opts.figure, "-property", "fontsize");
-  hp = get (h, "parent");
-  if (iscell (hp))
-    hp = cell2mat (hp);
-  endif
-  ## Do not change the text objects fontsizes for the children of a
-  ## legend axes.  These will be handled by the fontsize listener.
-  is_legend_key_string = strcmp (get (hp, "tag"), "legend") ...
-                       & isprop (hp, "string") ...
-                       & isprop (hp, "location") ...
-                       & strcmp (get (hp, "type"), "axes");
-  h(is_legend_key_string) = [];
-  fontsize = get (h, "fontsize");
-  switch (numel (fontsize))
-    case 0
-      fontsize = {};
-    case 1
-      fontsize = {fontsize};
-  endswitch
-endfunction
-
--- a/scripts/plot/private/__gnuplot_version__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-## Copyright (C) 2006-2012 Daniel Sebald
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{version} =} __gnuplot_version__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Return the version of gnuplot we are using.  Note that we do not
-## attempt to handle the case of the user switching to different
-## versions of gnuplot during the same session.
-
-function version = __gnuplot_version__ ()
-
-  persistent __version__ = "";
-
-  if (isempty (__version__))
-    [status, output] = system (sprintf ('"%s" --version', gnuplot_binary ()));
-    if (status != 0)
-      ## This message ends in a newline so that the traceback messages
-      ## are skipped and people might actually see the message, read it,
-      ## comprehend it, take the advice it gives, and stop asking us
-      ## why plotting fails when gnuplot is not found.
-      error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n");
-    endif
-    output = strrep (output, "gnuplot", "");
-    output = strrep (output, "patchlevel", ".");
-    output = strrep (output, "\n", "");
-    output = strrep (output, "\r", "");
-    __version__ = strrep (output, " ", "");
-  endif
-
-  version = __version__;
-
-endfunction
-
--- a/scripts/plot/private/__go_draw_axes__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2662 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __go_draw_axes__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function __go_draw_axes__ (h, plot_stream, enhanced, mono,
-                           bg_is_set, fg_is_set, hlgnd)
-
-  showhiddenhandles = get (0, "showhiddenhandles");
-  unwind_protect
-    set (0, "showhiddenhandles", "on");
-    axis_obj = __get__ (h);
-  unwind_protect_cleanup
-    set (0, "showhiddenhandles", showhiddenhandles);
-  end_unwind_protect
-
-  parent_figure_obj = get (axis_obj.parent);
-  gnuplot_term = __gnuplot_get_var__ (axis_obj.parent, "GPVAL_TERM");
-
-  ## Set to false for plotyy axes.
-  ymirror = true;
-  if (isfield (axis_obj, "__plotyy_axes__"))
-    if (all (ishandle (axis_obj.__plotyy_axes__)))
-      ymirror = false;
-    else
-      h = axis_obj.__plotyy_axes__;
-      h = h(ishandle (h));
-      h = h(isprop (h, "__plotyy_axes__"));
-      rmappdata (h, "__plotyy_axes__");
-    endif
-  endif
-
-  nd = __calc_dimensions__ (h);
-
-  if (strcmp (axis_obj.dataaspectratiomode, "manual")
-      && strcmp (axis_obj.xlimmode, "manual")
-      && strcmp (axis_obj.ylimmode, "manual"))
-    ## All can't be "manual"
-    axis_obj.plotboxaspectratiomode = "auto";
-  endif
-
-  if (strcmp (axis_obj.dataaspectratiomode, "manual")
-      && strcmp (axis_obj.xlimmode, "manual")
-      && strcmp (axis_obj.ylimmode, "manual")
-      && (nd == 2 || all (mod (axis_obj.view, 90) == 0)))
-    ## FIXME - adjust plotboxaspectratio to respect other
-    fpos = get (axis_obj.parent, "position");
-    apos = axis_obj.position;
-  endif
-
-  pos = __actual_axis_position__ (h);
-
-  if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
-    dr = axis_obj.dataaspectratio;
-    if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
-      dr = dr(1) / dr(2);
-    else
-      ## FIXME - need to properly implement 3D
-      dr = mean (dr(1:2)) / dr(3);
-    endif
-  else
-    dr = 1;
-  endif
-
-  if (strcmp (axis_obj.activepositionproperty, "position"))
-    if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin"))
-      if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
-        x = [1, 1];
-      else
-        ## 3D plots need to be sized down to fit in the window.
-        x = 1.0 ./ sqrt ([2, 2.5]);
-      endif
-      fprintf (plot_stream, "set tmargin screen %.15g;\n",
-               pos(2)+pos(4)/2+x(2)*pos(4)/2);
-      fprintf (plot_stream, "set bmargin screen %.15g;\n",
-               pos(2)+pos(4)/2-x(2)*pos(4)/2);
-      fprintf (plot_stream, "set lmargin screen %.15g;\n",
-               pos(1)+pos(3)/2-x(1)*pos(3)/2);
-      fprintf (plot_stream, "set rmargin screen %.15g;\n",
-               pos(1)+pos(3)/2+x(1)*pos(3)/2);
-      sz_str = "";
-    else
-      fprintf (plot_stream, "set tmargin 0;\n");
-      fprintf (plot_stream, "set bmargin 0;\n");
-      fprintf (plot_stream, "set lmargin 0;\n");
-      fprintf (plot_stream, "set rmargin 0;\n");
-
-      if (nd == 3 && all (axis_obj.view == [0, 90]))
-        ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot
-        pos(3:4) = pos(3:4) * 1.4;
-        pos(1:2) = pos(1:2) - pos(3:4) * 0.125;
-      endif
-
-      fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2));
-
-      if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
-        sz_str = sprintf ("set size ratio %.15g", -dr);
-      else
-        sz_str = "set size noratio";
-      endif
-      sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4));
-    endif
-  else ## activepositionproperty == outerposition
-    fprintf (plot_stream, "unset tmargin;\n");
-    fprintf (plot_stream, "unset bmargin;\n");
-    fprintf (plot_stream, "unset lmargin;\n");
-    fprintf (plot_stream, "unset rmargin;\n");
-    fprintf (plot_stream, "set origin %g, %g;\n", pos(1:2));
-    sz_str = "";
-    if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
-      sz_str = sprintf ("ratio %g", -dr);
-    else
-      sz_str = "noratio";
-    endif
-    sz_str = sprintf ("set size %s %g, %g;\n", sz_str, pos(3:4));
-  endif
-  if (! isempty (sz_str))
-    fputs (plot_stream, sz_str);
-  endif
-
-  ## Reset all labels, axis-labels, tick-labels, and title
-  ## FIXME - We should have an function to initialize the axis.
-  ##         Presently, this is dispersed in this function.
-  fputs (plot_stream, "unset label;\n");
-  fputs (plot_stream, "unset xtics;\n");
-  fputs (plot_stream, "unset ytics;\n");
-  fputs (plot_stream, "unset ztics;\n");
-  fputs (plot_stream, "unset x2tics;\n");
-  fputs (plot_stream, "unset x2tics;\n");
-
-  if (! isempty (axis_obj.title))
-    t = get (axis_obj.title);
-    if (isempty (t.string))
-      fputs (plot_stream, "unset title;\n");
-    else
-      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-      fontspec = create_fontspec (f, s, gnuplot_term);
-      fprintf (plot_stream, "set title \"%s\" %s %s;\n",
-               undo_string_escapes (tt), fontspec,
-               __do_enhanced_option__ (enhanced, t));
-    endif
-  endif
-
-  if (! isempty (axis_obj.xlabel))
-    t = get (axis_obj.xlabel);
-    angle = t.rotation;
-    colorspec = get_text_colorspec (axis_obj.xcolor, mono);
-    if (isempty (t.string))
-      fprintf (plot_stream, "unset xlabel;\n");
-      fprintf (plot_stream, "unset x2label;\n");
-    else
-      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-      fontspec = create_fontspec (f, s, gnuplot_term);
-      if (strcmpi (axis_obj.xaxislocation, "top"))
-        fprintf (plot_stream, "set x2label \"%s\" %s %s %s",
-                 undo_string_escapes (tt), colorspec, fontspec,
-                 __do_enhanced_option__ (enhanced, t));
-      else
-        fprintf (plot_stream, "set xlabel \"%s\" %s %s %s",
-                 undo_string_escapes (tt), colorspec, fontspec,
-                 __do_enhanced_option__ (enhanced, t));
-      endif
-      fprintf (plot_stream, " rotate by %f;\n", angle);
-      if (strcmpi (axis_obj.xaxislocation, "top"))
-        fprintf (plot_stream, "unset xlabel;\n");
-      else
-        fprintf (plot_stream, "unset x2label;\n");
-      endif
-    endif
-  endif
-
-  if (! isempty (axis_obj.ylabel))
-    t = get (axis_obj.ylabel);
-    angle = t.rotation;
-    colorspec = get_text_colorspec (axis_obj.ycolor, mono);
-    if (isempty (t.string))
-      fprintf (plot_stream, "unset ylabel;\n");
-      fprintf (plot_stream, "unset y2label;\n");
-    else
-      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-      fontspec = create_fontspec (f, s, gnuplot_term);
-      if (strcmpi (axis_obj.yaxislocation, "right"))
-        fprintf (plot_stream, "set y2label \"%s\" %s %s %s",
-                 undo_string_escapes (tt), colorspec, fontspec,
-                 __do_enhanced_option__ (enhanced, t));
-      else
-        fprintf (plot_stream, "set ylabel \"%s\" %s %s %s",
-                 undo_string_escapes (tt), colorspec, fontspec,
-                 __do_enhanced_option__ (enhanced, t));
-      endif
-      fprintf (plot_stream, " rotate by %f;\n", angle);
-      if (strcmpi (axis_obj.yaxislocation, "right"))
-        fprintf (plot_stream, "unset ylabel;\n");
-      else
-        fprintf (plot_stream, "unset y2label;\n");
-      endif
-    endif
-  endif
-
-  if (! isempty (axis_obj.zlabel))
-    t = get (axis_obj.zlabel);
-    angle = t.rotation;
-    colorspec = get_text_colorspec (axis_obj.zcolor, mono);
-    if (isempty (t.string))
-      fputs (plot_stream, "unset zlabel;\n");
-    else
-      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-      fontspec = create_fontspec (f, s, gnuplot_term);
-      fprintf (plot_stream, "set zlabel \"%s\" %s %s %s",
-               undo_string_escapes (tt), colorspec, fontspec,
-               __do_enhanced_option__ (enhanced, t));
-      fprintf (plot_stream, " rotate by %f;\n", angle);
-    endif
-  endif
-
-  if (strcmpi (axis_obj.xaxislocation, "top"))
-    xaxisloc = "x2";
-    xaxisloc_using = "x2";
-  else
-    xaxisloc = "x";
-    xaxisloc_using = "x1";
-    if (strcmpi (axis_obj.xaxislocation, "zero"))
-      fputs (plot_stream, "set xzeroaxis;\n");
-    endif
-  endif
-  if (strcmpi (axis_obj.yaxislocation, "right"))
-    yaxisloc = "y2";
-    yaxisloc_using = "y2";
-  else
-    yaxisloc = "y";
-    yaxisloc_using = "y1";
-    if (strcmpi (axis_obj.yaxislocation, "zero"))
-      fputs (plot_stream, "set yzeroaxis;\n");
-    endif
-  endif
-
-  have_grid = false;
-
-  if (strcmpi (axis_obj.xgrid, "on"))
-    have_grid = true;
-    fprintf (plot_stream, "set grid %stics;\n", xaxisloc);
-  else
-    fprintf (plot_stream, "set grid no%stics;\n", xaxisloc);
-  endif
-
-  if (strcmpi (axis_obj.ygrid, "on"))
-    have_grid = true;
-    fprintf (plot_stream, "set grid %stics;\n", yaxisloc);
-  else
-    fprintf (plot_stream, "set grid no%stics;\n", yaxisloc);
-  endif
-
-  if (strcmpi (axis_obj.zgrid, "on"))
-    have_grid = true;
-    fputs (plot_stream, "set grid ztics;\n");
-  else
-    fputs (plot_stream, "set grid noztics;\n");
-  endif
-
-  if (strcmpi (axis_obj.xminorgrid, "on"))
-    have_grid = true;
-    if (strcmp (axis_obj.xscale, "log"))
-      m = 10;
-    else
-      m = 5;
-    endif
-    fprintf (plot_stream, "set m%stics %d;\n", xaxisloc, m);
-    fprintf (plot_stream, "set grid m%stics;\n", xaxisloc);
-  else
-    fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc);
-  endif
-
-  if (strcmpi (axis_obj.yminorgrid, "on"))
-    have_grid = true;
-    if (strcmp (axis_obj.yscale, "log"))
-      m = 10;
-    else
-      m = 5;
-    endif
-    fprintf (plot_stream, "set m%stics %d;\n", yaxisloc, m);
-    fprintf (plot_stream, "set grid m%stics;\n", yaxisloc);
-  else
-    fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc);
-  endif
-
-  if (strcmpi (axis_obj.zminorgrid, "on"))
-    have_grid = true;
-    if (strcmp (axis_obj.zscale, "log"))
-      m = 10;
-    else
-      m = 5;
-    endif
-    fprintf (plot_stream, "set mztics %d;\n", m);
-    fputs (plot_stream, "set grid mztics;\n");
-  else
-    fputs (plot_stream, "set grid nomztics;\n");
-  endif
-
-  ## The grid front/back/layerdefault option also controls the
-  ## appearance of tics, so it is used even if the grid is absent.
-  if (strcmpi (axis_obj.layer, "top"))
-    fputs (plot_stream, "set grid front;\n");
-    fputs (plot_stream, "set border front;\n");
-  else
-    fputs (plot_stream, "set grid layerdefault;\n");
-    ## FIXME -- the gnuplot help says that "layerdefault" should work
-    ## for set border too, but it fails for me with gnuplot 4.2.5.  So
-    ## use "back" instead.
-    fputs (plot_stream, "set border back;\n");
-  endif
-
-  fprintf (plot_stream, "set grid linewidth %f, linewidth %f;\n",
-           axis_obj.linewidth, axis_obj.linewidth);
-
-  if (! have_grid)
-    fputs (plot_stream, "unset grid;\n");
-  endif
-
-  xlogscale = strcmpi (axis_obj.xscale, "log");
-  ylogscale = strcmpi (axis_obj.yscale, "log");
-  zlogscale = strcmpi (axis_obj.zscale, "log");
-
-  ## Detect logscale and negative lims
-  if (xlogscale && all (axis_obj.xlim < 0))
-    axis_obj.xsgn = -1;
-    if (strcmp (axis_obj.xdir, "reverse"))
-      axis_obj.xdir = "normal";
-    elseif (strcmp (axis_obj.xdir, "normal"))
-      axis_obj.xdir = "reverse";
-    endif
-    axis_obj.xtick = -flip (axis_obj.xtick);
-    axis_obj.xticklabel = flip (axis_obj.xticklabel);
-    axis_obj.xlim = -flip (axis_obj.xlim);
-  else
-    axis_obj.xsgn = 1;
-  endif
-  if (ylogscale && all (axis_obj.ylim < 0))
-    axis_obj.ysgn = -1;
-    if (strcmp (axis_obj.ydir, "reverse"))
-      axis_obj.ydir = "normal";
-    elseif (strcmp (axis_obj.ydir, "normal"))
-      axis_obj.ydir = "reverse";
-    endif
-    axis_obj.ytick = -flip (axis_obj.ytick);
-    axis_obj.yticklabel = flip (axis_obj.yticklabel);
-    axis_obj.ylim = -flip (axis_obj.ylim);
-  else
-    axis_obj.ysgn = 1;
-  endif
-  if (zlogscale && all (axis_obj.zlim < 0))
-    axis_obj.zsgn = -1;
-    if (strcmp (axis_obj.zdir, "reverse"))
-      axis_obj.zdir = "normal";
-    elseif (strcmp (axis_obj.zdir, "normal"))
-      axis_obj.zdir = "reverse";
-    endif
-    axis_obj.ztick = -flip (axis_obj.ztick);
-    axis_obj.zticklabel = flip (axis_obj.zticklabel);
-    axis_obj.zlim = -flip (axis_obj.zlim);
-  else
-    axis_obj.zsgn = 1;
-  endif
-
-  xlim = axis_obj.xlim;
-  ylim = axis_obj.ylim;
-  zlim = axis_obj.zlim;
-  clim = axis_obj.clim;
-
-  do_tics (axis_obj, plot_stream, ymirror, mono, gnuplot_term);
-
-  fputs (plot_stream, "unset logscale;\n");
-  if (xlogscale)
-    fprintf (plot_stream, "set logscale %s;\n", xaxisloc);
-  endif
-  if (ylogscale)
-    fprintf (plot_stream, "set logscale %s;\n", yaxisloc);
-  endif
-  if (zlogscale)
-    fputs (plot_stream, "set logscale z;\n");
-  endif
-
-  xautoscale = strcmpi (axis_obj.xlimmode, "auto");
-  yautoscale = strcmpi (axis_obj.ylimmode, "auto");
-  zautoscale = strcmpi (axis_obj.zlimmode, "auto");
-  cautoscale = strcmpi (axis_obj.climmode, "auto");
-  cdatadirect = false;
-  truecolor = false;
-
-  fputs (plot_stream, "set clip two;\n");
-
-  kids = axis_obj.children;
-  ## Remove the axis labels and title from the children, and
-  ## preserved the original order.
-  [jnk, k] = setdiff (kids, [axis_obj.xlabel; axis_obj.ylabel; ...
-                             axis_obj.zlabel; axis_obj.title]);
-  kids = kids (sort (k));
-
-  if (nd == 3)
-    fputs (plot_stream, "set parametric;\n");
-    fputs (plot_stream, "set style data lines;\n");
-    fputs (plot_stream, "set surface;\n");
-    fputs (plot_stream, "unset contour;\n");
-  endif
-
-  data_idx = 0;
-  data = cell ();
-  is_image_data = [];
-  hidden_removal = NaN;
-  view_map = false;
-
-  if (! cautoscale && clim(1) == clim(2))
-    clim(2)++;
-  endif
-  addedcmap = [];
-
-  ximg_data = {};
-  ximg_data_idx = 0;
-
-  while (! isempty (kids))
-
-    obj = get (kids(end));
-
-    if (isfield (obj, "xdata"))
-      obj.xdata = double (obj.xdata);
-    endif
-    if (isfield (obj, "ydata"))
-      obj.ydata = double (obj.ydata);
-    endif
-    if (isfield (obj, "zdata"))
-      obj.zdata = double (obj.zdata);
-    endif
-
-    if (isfield (obj, "units"))
-      units = obj.units;
-      unwind_protect
-        set (kids(end), "units", "data");
-        obj = get (kids(end));
-      unwind_protect_cleanup
-        set (kids(end), "units", units);
-      end_unwind_protect
-    endif
-    kids = kids(1:(end-1));
-
-    if (strcmp (obj.visible, "off"))
-      continue;
-    endif
-
-    if (xlogscale && isfield (obj, "xdata"))
-      obj.xdata = axis_obj.xsgn * obj.xdata;
-      obj.xdata(obj.xdata<=0) = NaN;
-    endif
-    if (ylogscale && isfield (obj, "ydata"))
-      obj.ydata = axis_obj.ysgn * obj.ydata;
-      obj.ydata(obj.ydata<=0) = NaN;
-    endif
-    if (zlogscale && isfield (obj, "zdata"))
-      obj.zdata = axis_obj.zsgn * obj.zdata;
-      obj.zdata(obj.zdata<=0) = NaN;
-    endif
-
-    ## Check for facecolor interpolation for surfaces.
-    doing_interp_color = ...
-       isfield (obj, "facecolor") && strcmp (obj.facecolor, "interp");
-
-    switch (obj.type)
-      case "image"
-        img_data = obj.cdata;
-        img_xdata = obj.xdata;
-        img_ydata = obj.ydata;
-
-        if (ndims (img_data) == 3)
-          truecolor = true;
-        elseif (strcmpi (obj.cdatamapping, "direct"))
-          cdatadirect = true;
-        endif
-        data_idx++;
-        is_image_data(data_idx) = true;
-        parametric(data_idx) = false;
-        have_cdata(data_idx) = false;
-        have_3d_patch(data_idx) = false;
-
-        if (img_xdata(2) < img_xdata(1))
-          img_xdata = img_xdata(2:-1:1);
-          img_data = img_data(:,end:-1:1,:);
-        elseif (img_xdata(1) == img_xdata(2))
-          img_xdata = img_xdata(1) + [0, columns(img_data)-1];
-        endif
-        if (img_ydata(2) < img_ydata(1))
-          img_ydata = img_ydata(2:-1:1);
-          img_data = img_data(end:-1:1,:,:);
-        elseif (img_ydata(1) == img_ydata(2))
-          img_ydata = img_ydata(1) + [0, rows(img_data)-1];
-        endif
-
-        [y_dim, x_dim] = size (img_data(:,:,1));
-        if (x_dim > 1)
-          dx = abs (img_xdata(2)-img_xdata(1))/(x_dim-1);
-        else
-          x_dim = 2;
-          img_data = [img_data, img_data];
-          dx = abs (img_xdata(2)-img_xdata(1));
-        endif
-        if (y_dim > 1)
-          dy = abs (img_ydata(2)-img_ydata(1))/(y_dim-1);
-        else
-          y_dim = 2;
-          img_data = [img_data; img_data];
-          dy = abs (img_ydata(2)-img_ydata(1));
-        endif
-
-        x_origin = min (img_xdata);
-        y_origin = min (img_ydata);
-
-        if (ndims (img_data) == 3)
-          data{data_idx} = permute (img_data, [3, 1, 2])(:);
-          format = "1:2:3";
-          imagetype = "rgbimage";
-        else
-          data{data_idx} = img_data(:);
-          format = "1";
-          imagetype = "image";
-        endif
-
-        titlespec{data_idx} = "title \"\"";
-        usingclause{data_idx} = sprintf ("binary array=%dx%d scan=yx origin=(%.15g,%.15g) dx=%.15g dy=%.15g using %s",
-            x_dim, y_dim, x_origin, y_origin, dx, dy, format);
-        withclause{data_idx} = sprintf ("with %s;", imagetype);
-
-      case "line"
-        if (strcmp (obj.linestyle, "none")
-            && (! isfield (obj, "marker")
-                || (isfield (obj, "marker")
-                    && strcmp (obj.marker, "none"))))
-          continue;
-        endif
-        data_idx++;
-        is_image_data(data_idx) = false;
-        parametric(data_idx) = true;
-        have_cdata(data_idx) = false;
-        have_3d_patch(data_idx) = false;
-        if (isempty (obj.displayname))
-          titlespec{data_idx} = "title \"\"";
-        else
-          tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
-          titlespec{data_idx} = ['title "' tmp '"'];
-        endif
-        usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
-        errbars = "";
-        if (nd == 3)
-          xdat = obj.xdata(:);
-          ydat = obj.ydata(:);
-          if (! isempty (obj.zdata))
-            zdat = obj.zdata(:);
-          else
-            zdat = zeros (size (xdat));
-          endif
-          data{data_idx} = [xdat, ydat, zdat]';
-          usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", numel (xdat));
-          ## fputs (plot_stream, "set parametric;\n");
-        else
-          xdat = obj.xdata(:);
-          ydat = obj.ydata(:);
-          data{data_idx} = [xdat, ydat]';
-          usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s",
-                                          rows (xdat), xaxisloc_using, yaxisloc_using);
-        endif
-
-        style = do_linestyle_command (obj, obj.color, data_idx, mono,
-                                      plot_stream, errbars);
-
-        withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                        style{1}, data_idx);
-
-        if (length (style) > 1)
-          data_idx++;
-          is_image_data(data_idx) = is_image_data(data_idx - 1);
-          parametric(data_idx) = parametric(data_idx - 1);
-          have_cdata(data_idx) = have_cdata(data_idx - 1);
-          have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-          titlespec{data_idx} = "title \"\"";
-          usingclause{data_idx} = usingclause{data_idx - 1};
-          data{data_idx} = data{data_idx - 1};
-          withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                        style{2}, data_idx);
-        endif
-        if (length (style) > 2)
-          data_idx++;
-          is_image_data(data_idx) = is_image_data(data_idx - 1);
-          parametric(data_idx) = parametric(data_idx - 1);
-          have_cdata(data_idx) = have_cdata(data_idx - 1);
-          have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-          titlespec{data_idx} = "title \"\"";
-          usingclause{data_idx} = usingclause{data_idx - 1};
-          data{data_idx} = data{data_idx - 1};
-          withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                        style{3}, data_idx);
-        endif
-
-     case "patch"
-       cmap = parent_figure_obj.colormap;
-       [nr, nc] = size (obj.xdata);
-
-       if (! isempty (obj.cdata))
-         cdat = obj.cdata;
-         if (strcmpi (obj.cdatamapping, "direct"))
-           cdatadirect = true;
-         endif
-       else
-         cdat = [];
-       endif
-
-       data_3d_idx = NaN;
-       for i = 1:nc
-         xcol = obj.xdata(:,i);
-         ycol = obj.ydata(:,i);
-         if (nd == 3)
-           if (! isempty (obj.zdata))
-             zcol = obj.zdata(:,i);
-           else
-             zcol = zeros (size (xcol));
-           endif
-         endif
-
-         if (! isnan (xcol) && ! isnan (ycol))
-           ## Is the patch closed or not
-           if (strcmp (obj.facecolor, "none"))
-             hidden_removal = false;
-           else
-
-             if (isnan (hidden_removal))
-               hidden_removal = true;
-             endif
-             if (nd == 3)
-               if (numel (xcol) > 3)
-                 error ("__go_draw_axes__: gnuplot (as of v4.2) only supports 3-D filled triangular patches");
-               else
-                 if (isnan (data_3d_idx))
-                   data_idx++;
-                   data_3d_idx = data_idx;
-                   is_image_data(data_idx) = false;
-                   parametric(data_idx) = false;
-                   have_cdata(data_idx) = true;
-                   have_3d_patch(data_idx) = true;
-                   withclause{data_3d_idx} = sprintf ("with pm3d");
-                   usingclause{data_3d_idx} =  "using 1:2:3:4";
-                   data{data_3d_idx} = [];
-                 endif
-                 local_idx = data_3d_idx;
-                 ccdat = NaN;
-               endif
-             else
-               data_idx++;
-               local_idx = data_idx;
-               is_image_data(data_idx) = false;
-               parametric(data_idx) = false;
-               have_cdata(data_idx) = false;
-               have_3d_patch(data_idx) = false;
-             endif
-
-             if (i > 1 || isempty (obj.displayname))
-               titlespec{local_idx} = "title \"\"";
-             else
-               tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
-               titlespec{local_idx} = ['title "' tmp '"'];
-             endif
-             if (isfield (obj, "facecolor"))
-               if ((strcmp (obj.facecolor, "flat")
-                   || strcmp (obj.facecolor, "interp"))
-                   && isfield (obj, "cdata"))
-                 if (ndims (obj.cdata) == 2
-                     && (columns (obj.cdata) == nc
-                         && (rows (obj.cdata) == 1
-                             || rows (obj.cdata) == 3)))
-                   ccol = cdat (:, i);
-                 elseif (ndims (obj.cdata) == 2
-                     && (rows (obj.cdata) == nc
-                         && (columns (obj.cdata) == 1
-                             || columns (obj.cdata) == 3)))
-                   ccol = cdat (i, :);
-                 elseif (ndims (obj.cdata) == 3)
-                   ccol = permute (cdat (:, i, :), [1, 3, 2]);
-                 else
-                   ccol = cdat;
-                 endif
-                 if (strcmp (obj.facecolor, "flat"))
-                   if (isequal (size (ccol), [1, 3]))
-                     ## RGB Triplet
-                     color = ccol;
-                   elseif (nd == 3 && numel (xcol) == 3)
-                     ccdat = ccol;
-                   else
-                     if (cdatadirect)
-                       r = round (ccol);
-                     else
-                       r = 1 + round ((rows (cmap) - 1)
-                                      * (ccol - clim(1))/(clim(2) - clim(1)));
-                     endif
-                     r = max (1, min (r, rows (cmap)));
-                     color = cmap(r, :);
-                   endif
-                 elseif (strcmp (obj.facecolor, "interp"))
-                   if (nd == 3 && numel (xcol) == 3)
-                     ccdat = ccol;
-                     if (! isvector (ccdat))
-                       tmp = rows (cmap) + rows (addedcmap) + ...
-                            [1 : rows(ccdat)];
-                       addedcmap = [addedcmap; ccdat];
-                       ccdat = tmp(:);
-                     else
-                       ccdat = ccdat(:);
-                     endif
-                   else
-                     if (sum (diff (ccol)))
-                       warning ("\"interp\" not supported, using 1st entry of cdata");
-                     endif
-                     if (cdatadirect)
-                       r = round (ccol);
-                     else
-                       r = 1 + round ((rows (cmap) - 1)
-                                      * (ccol - clim(1))/(clim(2) - clim(1)));
-                     endif
-                     r = max (1, min (r, rows (cmap)));
-                     color = cmap(r(1),:);
-                   endif
-                 endif
-               elseif (isnumeric (obj.facecolor))
-                 color = obj.facecolor;
-               else
-                 color = [0, 1, 0];
-               endif
-             else
-               color = [0, 1, 0];
-             endif
-
-             if (nd == 3 && numel (xcol) == 3)
-               if (isnan (ccdat))
-                 ccdat = (rows (cmap) + rows (addedcmap) + 1) * ones(3, 1);
-                 addedcmap = [addedcmap; reshape(color, 1, 3)];
-               endif
-               data{data_3d_idx} = [data{data_3d_idx}, ...
-                                    [[xcol; xcol(end)], [ycol; ycol(end)], ...
-                                    [zcol; zcol(end)], [ccdat; ccdat(end)]]'];
-             else
-               if (mono)
-                 colorspec = "";
-               elseif (__gnuplot_has_feature__ ("transparent_patches")
-                       && isscalar (obj.facealpha))
-                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\" fillstyle transparent solid %f",
-                                    round (255*color), obj.facealpha);
-               else
-                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                      round (255*color));
-               endif
-
-               withclause{data_idx} = sprintf ("with filledcurve %s",
-                                             colorspec);
-               data{data_idx} = [xcol, ycol]';
-               usingclause{data_idx} = sprintf ("record=%d using ($1):($2)",
-                                                numel (xcol));
-             endif
-           endif
-         endif
-
-         ## patch outline
-         if (!(strcmp (obj.edgecolor, "none")
-                && (strcmp (obj.marker, "none")
-                    || (strcmp (obj.markeredgecolor, "none")
-                        && strcmp (obj.markerfacecolor, "none")))))
-
-           data_idx++;
-           is_image_data(data_idx) = false;
-           parametric(data_idx) = false;
-           have_cdata(data_idx) = false;
-           have_3d_patch(data_idx) = false;
-           titlespec{data_idx} = "title \"\"";
-           usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
-
-           if (isfield (obj, "markersize"))
-             mdat = obj.markersize / 3;
-           endif
-
-           if (isfield (obj, "edgecolor"))
-             ## FIXME
-             ## This is the wrong thing to do as edgecolor, markeredgecolor
-             ## and markerfacecolor can have different values and we should
-             ## treat them seperately. However, the below allow the scatter
-             ## functions to work as expected, where only one of these values
-             ## is set
-             if (strcmp (obj.edgecolor, "none"))
-               if (strcmp (obj.markeredgecolor, "none"))
-                 ec = obj.markerfacecolor;
-               else
-                 ec = obj.markeredgecolor;
-               endif
-             else
-               ec = obj.edgecolor;
-             endif
-
-             if ((strcmp (ec, "flat")
-                  || strcmp (ec, "interp"))
-                 && isfield (obj, "cdata"))
-               if (ndims (obj.cdata) == 2
-                   && (columns (obj.cdata) == nc
-                       && (rows (obj.cdata) == 1
-                           || rows (obj.cdata) == 3)))
-                 ccol = cdat (:, i);
-               elseif (ndims (obj.cdata) == 2
-                       && (rows (obj.cdata) == nc
-                           && (columns (obj.cdata) == 1
-                               || columns (obj.cdata) == 3)))
-                 ccol = cdat (i, :);
-               elseif (ndims (obj.cdata) == 3)
-                 ccol = permute (cdat (:, i, :), [1, 3, 2]);
-               else
-                 ccol = cdat;
-               endif
-               if (strcmp (ec, "flat"))
-                 if (numel (ccol) == 3)
-                   color = ccol;
-                 else
-                   if (isscalar (ccol))
-                     ccol = repmat (ccol, numel (xcol), 1);
-                   endif
-                   color = "flat";
-                   have_cdata(data_idx) = true;
-                 endif
-               elseif (strcmp (ec, "interp"))
-                 if (numel (ccol) == 3)
-                   warning ("\"interp\" not supported, using 1st entry of cdata");
-                   color = ccol(1,:);
-                 else
-                   if (isscalar (ccol))
-                     ccol = repmat (ccol, numel (xcol), 1);
-                   endif
-                   color = "interp";
-                   have_cdata(data_idx) = true;
-                 endif
-               endif
-             elseif (isnumeric (ec))
-               color = ec;
-             else
-               color = [0, 0, 0];
-             endif
-           else
-             color = [0, 0, 0];
-           endif
-
-           if (isfield (obj, "linestyle"))
-             switch (obj.linestyle)
-               case "-"
-                 lt = "lt 1";
-               case "--"
-                 lt = "lt 2";
-               case ":"
-                 lt = "lt 3";
-               case "-."
-                 lt = "lt 6";
-               case "none"
-                 lt = "";
-               otherwise
-                 lt = "";
-             endswitch
-           else
-             lt = "";
-           endif
-
-           if (isfield (obj, "linewidth"))
-             lw = sprintf ("linewidth %f", obj.linewidth);
-           else
-             lw  = "";
-           endif
-
-           [pt, pt2, obj] = gnuplot_pointtype (obj);
-           if (! isempty (pt))
-             pt = sprintf ("pointtype %s", pt);
-           endif
-           if (! isempty (pt2))
-             pt2 = sprintf ("pointtype %s", pt2);
-           endif
-
-           if (mono)
-             colorspec = "";
-           else
-             if (ischar (color))
-               colorspec = "palette";
-             else
-               colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                    round (255*color));
-             endif
-           endif
-
-           sidx = 1;
-           if (isempty (lt))
-             style = "";
-           else
-             style = "lines";
-           endif
-           tmpwith = {};
-
-           facesame = true;
-           if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
-               && !strcmp (obj.markerfacecolor, "none"))
-             if (strcmp (obj.markerfacecolor, "auto")
-                 || ! isnumeric (obj.markerfacecolor)
-                 || (isnumeric (obj.markerfacecolor)
-                     && isequal (color, obj.markerfacecolor)))
-               style = strcat (style, "points");
-               if (isfield (obj, "markersize"))
-                 if (length (mdat) == nc)
-                   m = mdat(i);
-                 else
-                   m = mdat;
-                 endif
-                 ps = sprintf ("pointsize %f", m / 3);
-               else
-                 ps = "";
-               endif
-
-               tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                        style, lw, pt2, lt, ps,
-                                        colorspec);
-             else
-               facesame = false;
-               if (! isempty (style))
-                 tmpwith{sidx} = sprintf ("with %s %s %s %s",
-                                          style, lw, lt,
-                                          colorspec);
-                 sidx ++;
-               endif
-               if (isnumeric (obj.markerfacecolor) && ! mono)
-                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                      round (255*obj.markerfacecolor));
-               endif
-               style = "points";
-               if (isfield (obj, "markersize"))
-                 if (length (mdat) == nc)
-                   m = mdat(i);
-                 else
-                   m = mdat;
-                 endif
-                 ps = sprintf ("pointsize %f", m / 3);
-               else
-                 ps = "";
-               endif
-               tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                        style, lw, pt2, lt, ps,
-                                        colorspec);
-             endif
-           endif
-
-           if (isfield (obj, "markeredgecolor")
-               && !strcmp (obj.markeredgecolor, "none"))
-             if (facesame && !isempty (pt)
-                 && (strcmp (obj.markeredgecolor, "auto")
-                     || ! isnumeric (obj.markeredgecolor)
-                     || (isnumeric (obj.markeredgecolor)
-                         && isequal (color, obj.markeredgecolor))))
-               if (sidx == 1 && ((length (style) == 5
-                        && strncmp (style, "lines", 5))
-                       || isempty (style)))
-                 style = strcat (style, "points");
-                 if (isfield (obj, "markersize"))
-                   if (length (mdat) == nc)
-                     m = mdat(i);
-                   else
-                     m = mdat;
-                   endif
-                   ps = sprintf ("pointsize %f", m / 3);
-                 else
-                   ps = "";
-                 endif
-                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                          style, lw, pt, lt, ps,
-                                          colorspec);
-               endif
-             else
-               if (!isempty (style))
-                 if (length (tmpwith) < sidx || isempty (tmpwith{sidx}))
-                   tmpwith{sidx} = sprintf ("with %s %s %s %s",
-                                            style, lw, lt,
-                                            colorspec);
-                 endif
-                 sidx ++;
-               endif
-
-               if (!isempty (pt))
-                 if (! mono)
-                   if (strcmp (obj.markeredgecolor, "auto"))
-                     colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                          round (255*color));
-                   elseif (isnumeric (obj.markeredgecolor) && ! mono)
-                     colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                          round (255*obj.markeredgecolor));
-                   endif
-                 endif
-                 style = "points";
-                 if (isfield (obj, "markersize"))
-                   if (length (mdat) == nc)
-                     m = mdat(i);
-                   else
-                     m = mdat;
-                   endif
-                   ps = sprintf ("pointsize %f", m / 3);
-                 else
-                   ps = "";
-                 endif
-                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                          style, lw, pt, lt, ps,
-                                          colorspec);
-               endif
-             endif
-           endif
-
-           if (isempty (tmpwith))
-             withclause{data_idx} = sprintf ("with %s %s %s %s %s",
-                                             style, lw, pt, lt,
-                                             colorspec);
-           else
-             withclause{data_idx} = tmpwith{1};
-           endif
-           if (nd == 3)
-             if (ischar (color))
-               if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
-                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
-                                   [zcol; zcol(1)], [ccol; ccol(1)]]';
-               else
-                 data{data_idx} = [xcol, ycol, zcol, ccol]';
-               endif
-               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4)", columns (data{data_idx}));
-             else
-               if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
-                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
-                                   [zcol; zcol(1)]]';
-               else
-                 data{data_idx} = [xcol, ycol, zcol]';
-               endif
-               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
-             endif
-           else
-             if (ischar (color))
-               if (! isnan (xcol) && ! isnan (ycol))
-                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
-                                   [ccol; ccol(1)]]';
-               else
-                 data{data_idx} = [xcol, ycol, ccol]';
-               endif
-               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
-             else
-               if (! isnan (xcol) && ! isnan (ycol))
-                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]';
-               else
-                 data{data_idx} = [xcol, ycol]';
-               endif
-               usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", columns (data{data_idx}));
-             endif
-           endif
-
-           if (length (tmpwith) > 1)
-             data_idx++;
-             is_image_data(data_idx) = is_image_data(data_idx - 1);
-             parametric(data_idx) = parametric(data_idx - 1);
-             have_cdata(data_idx) = have_cdata(data_idx - 1);
-             have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-             titlespec{data_idx} = "title \"\"";
-             usingclause{data_idx} = usingclause{data_idx - 1};
-             data{data_idx} = data{data_idx - 1};
-             withclause{data_idx} = tmpwith{2};
-           endif
-           if (length (tmpwith) > 2)
-             data_idx++;
-             is_image_data(data_idx) = is_image_data(data_idx - 1);
-             parametric(data_idx) = parametric(data_idx - 1);
-             have_cdata(data_idx) = have_cdata(data_idx - 1);
-             have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-             titlespec{data_idx} = "title \"\"";
-             usingclause{data_idx} = usingclause{data_idx - 1};
-             data{data_idx} = data{data_idx - 1};
-             withclause{data_idx} = tmpwith{3};
-           endif
-         endif
-       endfor
-
-      case "surface"
-        view_map = true;
-        if (! (strcmp (obj.edgecolor, "none")
-               && strcmp (obj.facecolor, "none")))
-          data_idx++;
-          is_image_data(data_idx) = false;
-          parametric(data_idx) = false;
-          have_cdata(data_idx) = true;
-          have_3d_patch(data_idx) = false;
-          style = do_linestyle_command (obj, obj.edgecolor,
-                                        data_idx, mono,
-                                        plot_stream);
-
-          if (isempty (obj.displayname))
-            titlespec{data_idx} = "title \"\"";
-          else
-            tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
-            titlespec{data_idx} = ['title "' tmp '"'];
-          endif
-          withclause{data_idx} = sprintf ("with pm3d linestyle %d",
-                                          data_idx);
-          withpm3d = true;
-          pm3didx = data_idx;
-
-          xdat = obj.xdata;
-          ydat = obj.ydata;
-          zdat = obj.zdata;
-          cdat = obj.cdata;
-
-          err = false;
-          if (! size_equal (zdat, cdat))
-            err = true;
-          endif
-          if (isvector (xdat) && isvector (ydat) && ismatrix (zdat))
-            if (rows (zdat) == length (ydat)
-                && columns (zdat) == length (xdat))
-              [xdat, ydat] = meshgrid (xdat, ydat);
-            else
-              err = true;
-            endif
-          elseif (ismatrix (xdat) && ismatrix (ydat) && ismatrix (zdat))
-            if (! size_equal (xdat, ydat, zdat))
-              err = true;
-            endif
-          else
-            err = true;
-          endif
-          if (err)
-            error ("__go_draw_axes__: invalid grid data");
-          endif
-          xlen = columns (zdat);
-          ylen = rows (zdat);
-          if (xlen == columns (xdat) && xlen == columns (ydat)
-              && ylen == rows (xdat) && ylen == rows (ydat))
-            len = 4 * xlen;
-            zz = zeros (ylen, len);
-            k = 1;
-            for kk = 1:4:len
-              zz(:,kk)   = xdat(:,k);
-              zz(:,kk+1) = ydat(:,k);
-              zz(:,kk+2) = zdat(:,k);
-              zz(:,kk+3) = cdat(:,k);
-              k++;
-            endfor
-            data{data_idx} = zz.';
-          endif
-
-          if (doing_interp_color)
-            interp_str = "interpolate 0, 0";
-          else
-            ## No interpolation of facecolors.
-            interp_str = "";
-          endif
-          usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3):($4)", ylen, xlen);
-
-          flat_interp_face = (strcmp (obj.facecolor, "flat")
-                              || strcmp (obj.facecolor, "interp"));
-          flat_interp_edge = (strcmp (obj.edgecolor, "flat")
-                              || strcmp (obj.edgecolor, "interp"));
-
-          facecolor_none_or_white = (strcmp (obj.facecolor, "none")
-                                     || (isnumeric (obj.facecolor)
-                                         && all (obj.facecolor == 1)));
-          hidden_removal = false;
-          fputs (plot_stream, "set style increment default;\n");
-          if (flat_interp_edge && facecolor_none_or_white)
-            withpm3d = false;
-            withclause{data_idx} = sprintf ("with %s palette", style {1});
-            fputs (plot_stream, "unset pm3d\n");
-            if (all (obj.facecolor == 1))
-              hidden_removal = true;
-            endif
-          elseif (facecolor_none_or_white)
-            if (all (obj.facecolor == 1))
-              hidden_removal = true;
-            endif
-            fputs (plot_stream,"unset pm3d;\n");
-            fputs (plot_stream,"set style increment user;\n");
-            withpm3d = false;
-            withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                            style{1}, data_idx);
-            fputs (plot_stream, "unset pm3d\n");
-          endif
-
-          if (doing_interp_color)
-            ## "depthorder" interferes with interpolation of colors.
-            dord = "scansautomatic";
-          else
-            dord = "depthorder";
-          endif
-
-          if (flat_interp_face && strcmp (obj.edgecolor, "flat"))
-            fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n",
-                     interp_str, dord);
-          elseif (!facecolor_none_or_white)
-            if (strcmp (obj.edgecolor, "none"))
-              if (__gnuplot_has_feature__ ("transparent_surface")
-                  && isscalar (obj.facealpha))
-                fprintf (plot_stream,
-                         "set style fill transparent solid %f;\n",
-                         obj.facealpha);
-              endif
-              fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n",
-                       interp_str, dord);
-            else
-              fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n",
-                       data_idx, interp_str, dord);
-
-              if (__gnuplot_has_feature__ ("transparent_surface")
-                  && isscalar (obj.facealpha))
-                fprintf (plot_stream,
-                         "set style fill transparent solid %f;\n",
-                         obj.facealpha);
-              endif
-            endif
-          endif
-
-          zz = [];
-          if (length (style) > 1)
-            len = 3 * xlen;
-            zz = zeros (ylen, len);
-            k = 1;
-            for kk = 1:3:len
-              zz(:,kk)   = xdat(:,k);
-              zz(:,kk+1) = ydat(:,k);
-              zz(:,kk+2) = zdat(:,k);
-              k++;
-            endfor
-            zz = zz.';
-
-            data_idx++;
-            is_image_data(data_idx) = is_image_data(data_idx - 1);
-            parametric(data_idx) = parametric(data_idx - 1);
-            have_cdata(data_idx) = false;
-            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-            titlespec{data_idx} = "title \"\"";
-            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
-            data{data_idx} = zz;
-            withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                            style{2}, data_idx);
-
-          endif
-          if (length (style) > 2)
-            data_idx++;
-            is_image_data(data_idx) = is_image_data(data_idx - 1);
-            parametric(data_idx) = parametric(data_idx - 1);
-            have_cdata(data_idx) = false;
-            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-            titlespec{data_idx} = "title \"\"";
-            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
-            data{data_idx} = zz;
-            withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                            style{3}, data_idx);
-          endif
-          if (withpm3d && strcmp (style{1}, "linespoints"))
-            if (isempty (zz))
-              len = 3 * xlen;
-              zz = zeros (ylen, len);
-              k = 1;
-              for kk = 1:3:len
-                zz(:,kk)   = xdat(:,k);
-                zz(:,kk+1) = ydat(:,k);
-                zz(:,kk+2) = zdat(:,k);
-                k++;
-              endfor
-              zz = zz.';
-            endif
-            data_idx++;
-            is_image_data(data_idx) = is_image_data(data_idx - 1);
-            parametric(data_idx) = parametric(data_idx - 1);
-            have_cdata(data_idx) = false;
-            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-            titlespec{data_idx} = "title \"\"";
-            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
-            data{data_idx} = zz;
-            withclause{data_idx} = sprintf ("with points linestyle %d",
-                                            pm3didx);
-          endif
-        endif
-
-      case "text"
-        [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string");
-        fontspec = create_fontspec (f, s, gnuplot_term);
-        lpos = obj.position;
-        halign = obj.horizontalalignment;
-        valign = obj.verticalalignment;
-        angle = obj.rotation;
-        units = obj.units;
-        color = obj.color;
-        if (strcmpi (units, "normalized"))
-          units = "graph";
-        elseif (strcmp (axis_obj.yaxislocation, "right")
-                && strcmp (units, "data"))
-          units = "second";
-        else
-          units = "";
-        endif
-
-        if (isnumeric (color))
-          colorspec = get_text_colorspec (color, mono);
-        endif
-
-        if (ischar (obj.string))
-          num_lines = rows (obj.string);
-        else
-          num_lines = numel (obj.string);
-        endif
-        switch (valign)
-          ## Text offset in characters. Relies on gnuplot for font metrics.
-          case "top"
-            dy = -0.5;
-          case "cap"
-            dy = -0.5;
-          case "middle"
-            dy = 0.5 * (num_lines - 1);
-          case "baseline"
-            dy = 0.5 + (num_lines - 1);
-          case "bottom"
-            dy = 0.5 + (num_lines - 1);
-        endswitch
-        ## Gnuplot's Character units are different for x/y and vary with
-        ## fontsize. The aspect ratio of 1:1.7 was determined by experiment
-        ## to work for eps/ps/etc. For the MacOS aqua terminal a value of 2.5
-        ## is needed. However, the difference is barely noticable.
-        dx_and_dy = [(-dy * sind (angle)), (dy * cosd (angle))] .* [1.7 1];
-
-        ## FIXME: Multiline text produced the gnuplot
-        ##        "warning: ft_render: skipping glyph"
-        if (nd == 3)
-          ## This produces the desired vertical alignment in 3D.
-          fprintf (plot_stream,
-                   "set label \"%s\" at %s %.15e,%.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
-                   undo_string_escapes (label), units, lpos(1),
-                   lpos(2), lpos(3), halign, angle, dx_and_dy, fontspec,
-                   __do_enhanced_option__ (enhanced, obj), colorspec);
-        else
-          fprintf (plot_stream,
-                   "set label \"%s\" at %s %.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
-                   undo_string_escapes (label), units,
-                   lpos(1), lpos(2), halign, angle, dx_and_dy, fontspec,
-                   __do_enhanced_option__ (enhanced, obj), colorspec);
-        endif
-
-      case "hggroup"
-        ## Push group children into the kid list.
-        if (isempty (kids))
-          kids = obj.children;
-        elseif (! isempty (obj.children))
-          kids = [kids; obj.children];
-        endif
-
-      otherwise
-        error ("__go_draw_axes__: unknown object class, %s",
-               obj.type);
-    endswitch
-
-  endwhile
-
-  ## This is need to prevent warnings for rotations in 3D plots, while
-  ## allowing colorbars with contours.
-  if (nd == 2 || (data_idx > 1 && !view_map))
-    fputs (plot_stream, "set pm3d implicit;\n");
-  else
-    fputs (plot_stream, "set pm3d explicit;\n");
-  endif
-
-  if (isnan (hidden_removal) || hidden_removal)
-    fputs (plot_stream, "set hidden3d;\n");
-  else
-    fputs (plot_stream, "unset hidden3d;\n");
-  endif
-
-  have_data = (! (isempty (data) || all (cellfun ("isempty", data))));
-
-  ## Note we don't use the [xy]2range of gnuplot as we don't use the
-  ## dual axis plotting features of gnuplot.
-  if (isempty (xlim))
-    return;
-  endif
-  if (strcmpi (axis_obj.xdir, "reverse"))
-    xdir = "reverse";
-  else
-    xdir = "noreverse";
-  endif
-  fprintf (plot_stream, "set xrange [%.15e:%.15e] %s;\n", xlim, xdir);
-  if (strcmpi (axis_obj.xaxislocation, "top"))
-    fprintf (plot_stream, "set x2range [%.15e:%.15e] %s;\n", xlim, xdir);
-  endif
-
-  if (isempty (ylim))
-    return;
-  endif
-  if (strcmpi (axis_obj.ydir, "reverse"))
-    ydir = "reverse";
-  else
-    ydir = "noreverse";
-  endif
-  fprintf (plot_stream, "set yrange [%.15e:%.15e] %s;\n", ylim, ydir);
-  if (strcmpi (axis_obj.yaxislocation, "right"))
-    fprintf (plot_stream, "set y2range [%.15e:%.15e] %s;\n", ylim, ydir);
-  endif
-
-  if (nd == 3)
-    if (isempty (zlim))
-      return;
-    endif
-    if (strcmpi (axis_obj.zdir, "reverse"))
-      zdir = "reverse";
-    else
-      zdir = "noreverse";
-    endif
-    fprintf (plot_stream, "set zrange [%.15e:%.15e] %s;\n", zlim, zdir);
-  endif
-
-  cmap = parent_figure_obj.colormap;
-  cmap_sz = rows (cmap);
-  if (! any (isinf (clim)))
-    if (truecolor || ! cdatadirect)
-      if (rows (addedcmap) > 0)
-        for i = 1:data_idx
-          if (have_3d_patch(i))
-            data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz;
-           endif
-        endfor
-        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim(1), clim(2) *
-                 (cmap_sz + rows (addedcmap)) / cmap_sz);
-      else
-        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim);
-      endif
-    else
-      fprintf (plot_stream, "set cbrange [1:%d];\n", cmap_sz +
-               rows (addedcmap));
-    endif
-  endif
-
-  if (strcmpi (axis_obj.box, "on"))
-    if (nd == 3)
-      fputs (plot_stream, "set border 4095;\n");
-    else
-      fputs (plot_stream, "set border 431;\n");
-    endif
-  else
-    if (nd == 3)
-      fputs (plot_stream, "set border 895;\n");
-    elseif (! isempty (axis_obj.ytick))
-      if (strcmpi (axis_obj.yaxislocation, "right"))
-        fprintf (plot_stream, "unset ytics; set y2tics %s nomirror\n",
-                 axis_obj.tickdir);
-        if (strcmpi (axis_obj.xaxislocation, "top"))
-          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 12;\n");
-        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
-          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 9;\n");
-        else # xaxislocation == zero
-          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 8;\n");
-          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
-                   axis_obj.linewidth);
-        endif
-      elseif (strcmpi (axis_obj.yaxislocation, "left"))
-        fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
-                 axis_obj.tickdir);
-        if (strcmpi (axis_obj.xaxislocation, "top"))
-          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 6;\n");
-        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
-          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 3;\n");
-        else # xaxislocation == zero
-          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 2;\n");
-          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
-                   axis_obj.linewidth);
-        endif
-      else # yaxislocation == zero
-        fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
-                 axis_obj.tickdir);
-        if (strcmpi (axis_obj.xaxislocation, "top"))
-          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 4;\n");
-        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
-          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "set border 1;\n");
-        else # xaxislocation == zero
-          fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
-                   axis_obj.tickdir);
-          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                   axis_obj.tickdir);
-          fputs (plot_stream, "unset border;\n");
-          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
-                   axis_obj.linewidth);
-        endif
-        fprintf (plot_stream, "set yzeroaxis lt -1 lw %f;\n",
-                 axis_obj.linewidth);
-      endif
-    endif
-  endif
-
-  if (strcmpi (axis_obj.visible, "off"))
-    fputs (plot_stream, "unset border; unset tics\n");
-  else
-    fprintf (plot_stream, "set border lw %f;\n", axis_obj.linewidth);
-  endif
-
-  if (! isempty (hlgnd) && ! isempty (hlgnd.children)
-      && any (strcmpi (get (hlgnd.children, "visible"), "on")))
-    if (strcmpi (hlgnd.box, "on"))
-      box = "box";
-    else
-      box = "nobox";
-    endif
-    if (strcmpi (hlgnd.orientation, "vertical"))
-      horzvert = "vertical";
-    else
-      horzvert = "horizontal";
-    endif
-    if (strcmpi (hlgnd.textposition, "right"))
-      reverse = "reverse";
-    else
-      reverse = "noreverse";
-    endif
-    inout = "inside";
-    keypos = hlgnd.location;
-    if (ischar (keypos))
-      keypos = lower (keypos);
-      keyout = strfind (keypos, "outside");
-      if (! isempty (keyout))
-        inout = "outside";
-        keypos = keypos(1:keyout-1);
-      endif
-    endif
-    switch (keypos)
-      case "north"
-        pos = "center top";
-      case "south"
-        pos = "center bottom";
-      case "east"
-        pos = "right center";
-      case "west"
-        pos = "left center";
-      case "northeast"
-        pos = "right top";
-      case "northwest"
-        pos = "left top";
-      case "southeast"
-        pos = "right bottom";
-      case "southwest"
-        pos = "left bottom";
-      case "best"
-        pos = "";
-        warning ("legend: 'Best' not yet implemented for location specifier.\n");
-        ## Least conflict with data in plot.
-        ## Least unused space outside plot.
-      otherwise
-        pos = "";
-    endswitch
-    if (__gnuplot_has_feature__ ("key_has_font_properties"))
-      [fontname, fontsize] = get_fontname_and_size (hlgnd);
-      fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
-    else
-      fontspec = "";
-    endif
-    textcolors = get (findobj (hlgnd.children, "type", "text"), "color");
-    if (iscell (textcolors))
-      textcolors = cell2mat (textcolors);
-      textcolors = unique (textcolors, "rows");
-    endif
-    if (rows (textcolors) > 1)
-      ## Gnuplot is unable to assign arbitrary colors to each text entry
-      ## for the key/legend.  But, the text color can be set to match the
-      ## color of the plot object.
-      colorspec = "textcolor variable";
-    else
-      colorspec = get_text_colorspec (textcolors, mono);
-    endif
-    fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s;\n",
-             inout, pos, box, reverse, horzvert, fontspec, colorspec);
-  else
-    fputs (plot_stream, "unset key;\n");
-  endif
-  fputs (plot_stream, "set style data lines;\n");
-
-  cmap = [cmap; addedcmap];
-  cmap_sz = cmap_sz + rows (addedcmap);
-  if (length (cmap) > 0)
-    fprintf (plot_stream,
-             "set palette positive color model RGB maxcolors %i;\n",
-             cmap_sz);
-    fprintf (plot_stream,
-             "set palette file \"-\" binary record=%d using 1:2:3:4;\n",
-             cmap_sz);
-    fwrite (plot_stream, [1:cmap_sz; cmap.'], "float32");
-    fwrite (plot_stream, "\n");
-  endif
-
-  fputs (plot_stream, "unset colorbox;\n");
-
-  if (have_data)
-    if (nd == 2)
-      plot_cmd = "plot";
-    else
-      plot_cmd = "splot";
-      rot_x = 90 - axis_obj.view(2);
-      rot_z = axis_obj.view(1);
-      while (rot_z < 0)
-        rot_z += 360;
-      endwhile
-      fputs (plot_stream, "set ticslevel 0;\n");
-      if (view_map && rot_x == 0 && rot_z == 0)
-        fputs (plot_stream, "set view map;\n");
-      else
-        fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z);
-      endif
-    endif
-    if (have_3d_patch (1))
-      fputs (plot_stream, "set pm3d depthorder\n");
-      fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
-               usingclause{1}, titlespec{1}, withclause{1});
-    elseif (is_image_data (1))
-      if (numel (is_image_data) > 1 && is_image_data(2))
-        ## Remove terminating semicolon
-        n = max (strfind (withclause{1}, ";"));
-        if (! isempty (n))
-          withclause{1} = withclause{1}(1:n-1);
-        endif
-      endif
-      fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
-               usingclause{1}, titlespec{1}, withclause{1});
-    else
-      fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
-               usingclause{1}, titlespec{1}, withclause{1});
-    endif
-    for i = 2:data_idx
-      if (have_3d_patch (i))
-        fprintf (plot_stream, ", \"-\" %s %s %s \\\n",
-                 usingclause{i}, titlespec{i}, withclause{i});
-      elseif (is_image_data (i))
-        if (! is_image_data (i-1))
-          fputs (plot_stream, "; ");
-          if (bg_is_set)
-            fputs (plot_stream, "unset obj 1; \\\n");
-            bg_is_set = false;
-          endif
-          if (fg_is_set)
-            fputs (plot_stream, "unset obj 2; \\\n");
-            fg_is_set = false;
-          endif
-          if (numel (is_image_data) > i && is_image_data(i+1))
-            ## Remove terminating semicolon
-            n = max (strfind (withclause{i}, ";"));
-            if (! isempty (n))
-              withclause{i} = withclause{i}(1:n-1);
-            endif
-          endif
-          fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
-                   usingclause{i}, titlespec{i}, withclause{i});
-        else
-          ## For consecutive images continue with the same plot command
-          fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", ",",
-                   usingclause{i}, titlespec{i}, withclause{i});
-        endif
-      elseif (is_image_data (i-1))
-        if (bg_is_set)
-          fputs (plot_stream, "unset obj 1; \\\n");
-          bg_is_set = false;
-        endif
-        if (fg_is_set)
-          fputs (plot_stream, "unset obj 2; \\\n");
-          fg_is_set = false;
-        endif
-        fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
-                 usingclause{i}, titlespec{i}, withclause{i});
-      else
-        fprintf (plot_stream, ", \"-\" binary format='%%float64' %s %s %s \\\n",
-                 usingclause{i}, titlespec{i}, withclause{i});
-      endif
-    endfor
-    fputs (plot_stream, ";\n");
-    for i = 1:data_idx
-      if (have_3d_patch (i))
-        ## Can't write 3d patch data as binary as can't plot more than
-        ## a single patch at a time and have to plot all patches together
-        ## so that the gnuplot depth ordering is done correctly
-        for j = 1 : 4 : columns (data{i})
-          if (j != 1)
-            fputs (plot_stream, "\n\n");
-          endif
-          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j).');
-          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n", data{i}(:,j+1).');
-          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+2).');
-          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+3).');
-        endfor
-        fputs (plot_stream, "e\n");
-      elseif (is_image_data(i))
-        fwrite (plot_stream, data{i}, "float32");
-      else
-        __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i),
-                                have_cdata(i));
-      endif
-    endfor
-  else
-    fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n");
-  endif
-
-  ## Needed to allow mouse rotation with pcolor.
-  if (view_map)
-    fputs (plot_stream, "unset view;\n");
-  endif
-
-  if (bg_is_set)
-    fputs (plot_stream, "unset obj 1;\n");
-    bg_is_set = false;
-  endif
-
-  fflush (plot_stream);
-
-endfunction
-
-function x = flip (x)
-  if (rows (x) == 1)
-    x = fliplr (x);
-  elseif (columns (x) == 1 || ischar (x))
-    x = flipud (x);
-  else
-    x = flipud (fliplr (x));
-  endif
-endfunction
-
-function fontspec = create_fontspec (f, s, gp_term)
-  if (strcmp (f, "*") || strcmp (gp_term, "tikz"))
-    fontspec = sprintf ("font \",%d\"", s);
-  else
-    fontspec = sprintf ("font \"%s,%d\"", f, s);
-  endif
-endfunction
-
-function style = do_linestyle_command (obj, linecolor, idx, mono,
-                                       plot_stream, errbars = "")
-  style = {};
-
-  fprintf (plot_stream, "set style line %d default;\n", idx);
-  fprintf (plot_stream, "set style line %d", idx);
-
-  found_style = false;
-  if (isnumeric (linecolor))
-    color = linecolor;
-    if (! mono)
-      fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-               round (255*color));
-    endif
-  else
-    color = [0, 0, 0];
-  endif
-
-  if (isfield (obj, "linestyle"))
-    switch (obj.linestyle)
-      case "-"
-        lt = "1";
-      case "--"
-        lt = "2";
-      case ":"
-        lt = "3";
-      case "-."
-        lt = "6";
-      case "none"
-        lt = "";
-      otherwise
-        lt = "";
-    endswitch
-
-    if (! isempty (lt))
-      fprintf (plot_stream, " linetype %s", lt);
-    endif
-
-  else
-    lt = "";
-  endif
-  if (! isempty (errbars))
-    found_style = true;
-  endif
-
-  if (isfield (obj, "linewidth"))
-    fprintf (plot_stream, " linewidth %f", obj.linewidth);
-    found_style = true;
-  endif
-
-  [pt, pt2, obj] = gnuplot_pointtype (obj);
-
-  if (! isempty (pt))
-    found_style = true;
-  endif
-
-  sidx = 1;
-  if (isempty (errbars))
-    if (isempty (lt))
-      style {sidx} = "";
-    else
-      style {sidx} = "lines";
-    endif
-
-    facesame = true;
-    if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
-        && !strcmp (obj.markerfacecolor, "none"))
-      if (strcmp (obj.markerfacecolor, "auto")
-          || ! isnumeric (obj.markerfacecolor)
-          || (isnumeric (obj.markerfacecolor)
-              && isequal (color, obj.markerfacecolor)))
-        if (! isempty (pt2))
-          fprintf (plot_stream, " pointtype %s", pt2);
-          style {sidx} = strcat (style{sidx}, "points");
-        endif
-        if (isfield (obj, "markersize"))
-          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-        endif
-      else
-        facesame = false;
-        if (! found_style)
-          fputs (plot_stream, " default");
-        endif
-        fputs (plot_stream, ";\n");
-        if (! isempty (style {sidx}))
-          sidx ++;
-          idx ++;
-        else
-          fputs (plot_stream, ";\n");
-        endif
-        fprintf (plot_stream, "set style line %d default;\n", idx);
-        fprintf (plot_stream, "set style line %d", idx);
-        if (isnumeric (obj.markerfacecolor) && ! mono)
-          fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-                   round (255*obj.markerfacecolor));
-        endif
-        if (! isempty (pt2))
-          style {sidx} = "points";
-          fprintf (plot_stream, " pointtype %s", pt2);
-        endif
-        if (isfield (obj, "markersize"))
-          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-        endif
-      endif
-    endif
-    if (isfield (obj, "markeredgecolor")
-        && !strcmp (obj.markeredgecolor, "none"))
-      if (facesame && !isempty (pt)
-          && (strcmp (obj.markeredgecolor, "auto")
-              || ! isnumeric (obj.markeredgecolor)
-              || (isnumeric (obj.markeredgecolor)
-                  && isequal (color, obj.markeredgecolor))))
-        if (sidx == 1 && ((length (style {sidx}) == 5
-            && strncmp (style{sidx}, "lines", 5)) || isempty (style {sidx})))
-          if (! isempty (pt))
-            style {sidx} = strcat (style{sidx}, "points");
-            fprintf (plot_stream, " pointtype %s", pt);
-          endif
-          if (isfield (obj, "markersize"))
-            fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-          endif
-        endif
-      else
-        if (! found_style)
-          fputs (plot_stream, " default");
-        endif
-        fputs (plot_stream, ";\n");
-        if (!isempty (style {sidx}))
-          sidx ++;
-          idx ++;
-        else
-          fputs (plot_stream, ";\n");
-        endif
-        fprintf (plot_stream, "set style line %d default;\n", idx);
-        fprintf (plot_stream, "set style line %d", idx);
-        if (! mono)
-          if (strcmp (obj.markeredgecolor, "auto"))
-            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-                     round (255*color));
-          elseif (isnumeric (obj.markeredgecolor) && ! mono)
-            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-                     round (255*obj.markeredgecolor));
-          endif
-        endif
-        if (! isempty (pt))
-          style {sidx} = "points";
-          fprintf (plot_stream, " pointtype %s", pt);
-        endif
-        if (isfield (obj, "markersize"))
-          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-        endif
-      endif
-    endif
-  else
-    style{1} = errbars;
-    fputs (plot_stream, " pointtype 0");
-  endif
-
-  if (! found_style && isempty (style {1}))
-    fputs (plot_stream, " default");
-  endif
-
-  fputs (plot_stream, ";\n");
-
-endfunction
-
-function [pt, pt2, obj] = gnuplot_pointtype (obj)
-  if (isfield (obj, "marker"))
-    switch (obj.marker)
-      case "+"
-        pt = pt2 = "1";
-      case "o"
-        pt = "6";
-        pt2 = "7";
-      case "*"
-        pt = pt2 = "3";
-      case "."
-        pt = "6";
-        pt2 = "7";
-        if (isfield (obj, "markerfacecolor")
-            || strcmp (obj.markerfacecolor, "none"))
-          obj.markerfacecolor = "auto";
-        endif
-        if (isfield (obj, "markersize"))
-          obj.markersize /= 3;
-        else
-          obj.markersize = 5;
-        endif
-      case "x"
-        pt = pt2 = "2";
-      case {"square", "s"}
-        pt = "4";
-        pt2 = "5";
-      case {"diamond", "d"}
-        pt = "12";
-        pt2 = "13";
-      case "^"
-        pt = "8";
-        pt2 = "9";
-      case "v"
-        pt = "10";
-        pt2 = "11";
-      case ">"
-        ## FIXME: should be triangle pointing right, use triangle pointing up
-        pt = "8";
-        pt2 = "9";
-      case "<"
-        ## FIXME: should be triangle pointing left, use triangle pointing down
-        pt = "10";
-        pt2 = "11";
-      case {"pentagram", "p"}
-        ## FIXME: should be pentagram, using pentagon
-        pt = "14";
-        pt2 = "15";
-      case {"hexagram", "h"}
-        ## FIXME: should be 6 pt start, using "*" instead
-        pt = pt2 = "3";
-      case "none"
-        pt = pt2 = "";
-      otherwise
-        pt = pt2 = "";
-    endswitch
-  else
-    pt = pt2 = "";
-  endif
-endfunction
-
-function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata)
-
-  ## DATA is already transposed.
-
-  ## FIXME -- this may need to be converted to C++ for speed.
-
-  ## Convert NA elements to normal NaN values because fprintf writes
-  ## "NA" and that confuses gnuplot.
-  idx = find (isna (data));
-  if (any (idx))
-    data(idx) = NaN;
-  endif
-
-  if (nd == 2)
-    fwrite (plot_stream, data, "float64");
-  elseif (nd == 3)
-    if (parametric)
-      fwrite (plot_stream, data, "float64");
-    else
-      nr = rows (data);
-      if (cdata)
-        for j = 1:4:nr
-          fwrite (plot_stream, data(j:j+3,:), "float64");
-        endfor
-      else
-        for j = 1:3:nr
-          fwrite (plot_stream, data(j:j+2,:), "float64");
-        endfor
-      endif
-    endif
-  endif
-
-endfunction
-
-function do_tics (obj, plot_stream, ymirror, mono, gnuplot_term)
-
-  obj.xticklabel = ticklabel_to_cell (obj.xticklabel);
-  obj.yticklabel = ticklabel_to_cell (obj.yticklabel);
-  obj.zticklabel = ticklabel_to_cell (obj.zticklabel);
-
-  if (strcmp (obj.xminorgrid, "on"))
-    obj.xminortick = "on";
-  endif
-  if (strcmp (obj.yminorgrid, "on"))
-    obj.yminortick = "on";
-  endif
-  if (strcmp (obj.zminorgrid, "on"))
-    obj.zminortick = "on";
-  endif
-
-  [fontname, fontsize] = get_fontname_and_size (obj);
-  fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
-
-  ## A Gnuplot tic scale of 69 is equivalent to Octave's 0.5.
-  ticklength = sprintf ("scale %4.1f", (69/0.5)*obj.ticklength(1));
-
-  if (strcmpi (obj.xaxislocation, "top"))
-    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
-               obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
-               obj.xcolor, "x", plot_stream, true, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
-               obj.xsgn, gnuplot_term);
-  elseif (strcmpi (obj.xaxislocation, "zero"))
-    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
-               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
-               "axis", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
-               obj.xcolor, "x2", plot_stream, true, mono, "axis",
-               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
-               obj.xsgn, gnuplot_term);
-  else
-    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
-               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
-               obj.xcolor, "x2", plot_stream, true, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
-               obj.xsgn, gnuplot_term);
-  endif
-  if (strcmpi (obj.yaxislocation, "right"))
-    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
-               obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
-               obj.ycolor, "y", plot_stream, ymirror, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
-               obj.ysgn, gnuplot_term);
-  elseif (strcmpi (obj.yaxislocation, "zero"))
-    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
-               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
-               "axis", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
-               obj.ycolor, "y2", plot_stream, ymirror, mono, "axis",
-               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
-               obj.ysgn, gnuplot_term);
-  else
-    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
-               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
-               obj.ycolor, "y2", plot_stream, ymirror, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
-               obj.ysgn, gnuplot_term);
-  endif
-  do_tics_1 (obj.ztickmode, obj.ztick, obj.zminortick, obj.zticklabelmode,
-             obj.zticklabel, obj.zcolor, "z", plot_stream, true, mono,
-             "border", obj.tickdir, ticklength, fontname, fontspec,
-             obj.interpreter, obj.zscale, obj.zsgn, gnuplot_term);
-endfunction
-
-function do_tics_1 (ticmode, tics, mtics, labelmode, labels, color, ax,
-                    plot_stream, mirror, mono, axispos, tickdir, ticklength,
-                    fontname, fontspec, interpreter, scale, sgn, gnuplot_term)
-  persistent warned_latex = false;
-  if (strcmpi (interpreter, "tex"))
-    for n = 1 : numel (labels)
-      labels{n} = __tex2enhanced__ (labels{n}, fontname, false, false);
-    endfor
-  elseif (strcmpi (interpreter, "latex"))
-    if (! warned_latex)
-      warning ("latex markup not supported for tick marks");
-      warned_latex = true;
-    endif
-  endif
-  if (strcmp (scale, "log"))
-    num_mtics = 10;
-    if (any (strcmp (gnuplot_term, {"tikz", "pstex", "pslatex", "epslatex"})))
-      fmt = "$10^{%T}$";
-    else
-      fmt = "10^{%T}";
-    endif
-    if (sgn < 0)
-      fmt = strcat ("-", fmt);
-    endif
-  else
-    fmt = "%g";
-    num_mtics = 5;
-  endif
-  colorspec = get_text_colorspec (color, mono);
-  if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual"))
-    if (isempty (tics))
-      fprintf (plot_stream, "unset %stics;\nunset m%stics;\n", ax, ax);
-    elseif (strcmpi (labelmode, "manual"))
-      if (ischar (labels))
-        labels = cellstr (labels);
-      endif
-      if (isnumeric (labels))
-        labels = num2str (real (labels(:)));
-      endif
-      if (ischar (labels))
-        labels = permute (cellstr (labels), [2, 1]);
-      endif
-      if (iscellstr (labels))
-        k = 1;
-        ntics = numel (tics);
-        nlabels = numel (labels);
-        fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
-        if (mirror)
-          fprintf (plot_stream, "set %stics add %s %s %s mirror (", ax,
-                   tickdir, ticklength, axispos);
-        else
-          fprintf (plot_stream, "set %stics add %s %s %s nomirror (", ax,
-                   tickdir, ticklength, axispos);
-        endif
-
-        labels = regexprep (labels, '%', "%%");
-        for i = 1:ntics
-          fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i));
-          if (i < ntics)
-            fputs (plot_stream, ", ");
-          endif
-          if (k > nlabels)
-            k = 1;
-          endif
-        endfor
-        fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec);
-        if (strcmp (mtics, "on"))
-          fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
-        else
-          fprintf (plot_stream, "unset m%stics;\n", ax);
-        endif
-      else
-        error ("__go_draw_axes__: unsupported type of ticklabel");
-      endif
-    else
-      fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
-      if (mirror)
-        fprintf (plot_stream, "set %stics %s %s %s mirror (", ax, tickdir,
-                 ticklength, axispos);
-      else
-        fprintf (plot_stream, "set %stics %s %s %s nomirror (", ax, tickdir,
-                 ticklength, axispos);
-      endif
-      fprintf (plot_stream, " %.15g,", tics(1:end-1));
-      fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec);
-      if (strcmp (mtics, "on"))
-        fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
-      else
-        fprintf (plot_stream, "unset m%stics;\n", ax);
-      endif
-    endif
-  else
-    fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
-    if (mirror)
-      fprintf (plot_stream, "set %stics %s %s %s mirror %s %s;\n", ax,
-               axispos, tickdir, ticklength, colorspec, fontspec);
-    else
-      fprintf (plot_stream, "set %stics %s %s %s nomirror %s %s;\n", ax,
-               tickdir, ticklength, axispos, colorspec, fontspec);
-    endif
-    if (strcmp (mtics, "on"))
-      fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
-    else
-      fprintf (plot_stream, "unset m%stics;\n", ax);
-    endif
-  endif
-endfunction
-
-function ticklabel = ticklabel_to_cell (ticklabel)
-  if (isnumeric (ticklabel))
-    ## Use upto 5 significant digits
-    ticklabel = num2str (ticklabel(:), 5);
-  endif
-  if (ischar (ticklabel))
-    if (rows (ticklabel) == 1 && any (ticklabel == "|"))
-      ticklabel = ostrsplit (ticklabel, "|");
-    else
-      ticklabel = cellstr (ticklabel);
-    endif
-  elseif (isempty (ticklabel))
-    ticklabel = {""};
-  else
-    ticklabel = ticklabel;
-  endif
-endfunction
-
-function colorspec = get_text_colorspec (color, mono)
-  if (mono)
-    colorspec = "";
-  else
-    colorspec = sprintf ("textcolor rgb \"#%02x%02x%02x\"",
-                         round (255*color));
-  endif
-endfunction
-
-function [f, s, fnt, it, bld] = get_fontname_and_size (t)
-  if (isempty (t.fontname) || strcmp (t.fontname, "*"))
-    fnt = "{}";
-  else
-    fnt = t.fontname;
-  endif
-  f = fnt;
-  it = false;
-  bld = false;
-  if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold"))
-    if (! isempty (t.fontangle)
-        && (strcmpi (t.fontangle, "italic")
-            || strcmpi (t.fontangle, "oblique")))
-      f = [f "-bolditalic"];
-      it = true;
-      bld = true;
-    else
-      f = [f "-bold"];
-      bld = true;
-    endif
-  elseif (! isempty (t.fontangle)
-          && (strcmpi (t.fontangle, "italic")
-              || strcmpi (t.fontangle, "oblique")))
-    f = [f "-italic"];
-    it = true;
-  endif
-  if (isempty (t.fontsize))
-    s = 10;
-  else
-    s = t.fontsize;
-  endif
-endfunction
-
-function [str, f, s] = __maybe_munge_text__ (enhanced, obj, fld)
-
-  persistent warned_latex = false;
-
-  if (strcmp (fld, "string"))
-    [f, s, fnt, it, bld] = get_fontname_and_size (obj);
-  else
-    f = "Helvetica";
-    s = 10;
-    fnt = f;
-    it = false;
-    bld = false;
-  endif
-
-  ## The text object maybe multiline, and may be of any class
-  str = getfield (obj, fld);
-  if (ischar (str) && rows (str) > 1)
-    str = cellstr (str);
-  elseif (isnumeric (str))
-    str = cellstr (num2str (str(:)));
-  endif
-  if (iscellstr (str))
-    for n = 1:numel (str)
-      if (isnumeric (str{n}))
-        str{n} = num2str (str{n});
-      endif
-    endfor
-    str = sprintf ("%s\n", str{:})(1:end-1);
-  endif
-
-  if (enhanced)
-    if (strcmpi (obj.interpreter, "tex"))
-      if (iscellstr (str))
-        for n = 1:numel (str)
-          str{n} = __tex2enhanced__ (str{n}, fnt, it, bld);
-        endfor
-      else
-        str = __tex2enhanced__ (str, fnt, it, bld);
-      endif
-    elseif (strcmpi (obj.interpreter, "latex"))
-      if (! warned_latex)
-        warning ("latex markup not supported for text objects");
-        warned_latex = true;
-      endif
-    elseif (enhanced)
-      str = no_super_sub_scripts (str);
-    endif
-  endif
-endfunction
-
-function str = no_super_sub_scripts (str)
-  if (iscellstr (str))
-    labels = str;
-  else
-    labels = cellstr (str);
-  endif
-  for marker = "_^" 
-    for m = 1 : numel (labels)
-      n1 = strfind (labels{m}, sprintf ("\\%s", marker));
-      n2 = strfind (labels{m}, marker);
-      if (! isempty (n1))
-        n1 = n1 + 1;
-        n2 = setdiff (n2, n1);
-      endif
-      for n = numel (n2):-1:1
-        labels{m} = [labels{m}(1:n2(n)-1), "\\", labels{m}(n2(n):end)];
-      endfor
-    endfor
-  endfor
-  if (iscellstr (str))
-    str = labels;
-  else
-    str = char (labels);
-  endif
-endfunction
-
-function str = __tex2enhanced__ (str, fnt, it, bld)
-  persistent sym = __setup_sym_table__ ();
-  persistent flds = fieldnames (sym);
-
-  [s, e, m] = regexp (str, "\\\\([a-zA-Z]+|0)", "start", "end", "matches");
-
-  for i = length (s) : -1 : 1
-    ## special case for "\0"  and replace with "{/Symbol \306}'
-    if (strncmp (m{i}, '\0', 2))
-      str = [str(1:s(i) - 1) '{/Symbol \306}' str(s(i) + 2:end)];
-    else
-      f = m{i}(2:end);
-      if (isfield (sym, f))
-        g = getfield (sym, f);
-        ## FIXME The symbol font doesn't seem to support bold or italic
-        ##if (bld)
-        ##  if (it)
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
-        ##  else
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
-        ##  endif
-        ##elseif (it)
-        ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
-        ##endif
-        str = [str(1:s(i) - 1) g str(e(i) + 1:end)];
-      elseif (strncmp (f, "rm", 2))
-        bld = false;
-        it = false;
-        str = [str(1:s(i) - 1) '/' fnt ' ' str(s(i) + 3:end)];
-      elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2))
-        it = true;
-        if (bld)
-          str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)];
-        else
-          str = [str(1:s(i) - 1) '/' fnt '-italic ' str(s(i) + 3:end)];
-        endif
-      elseif (strncmp (f, "bf", 2))
-        bld = true;
-        if (it)
-          str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)];
-        else
-          str = [str(1:s(i) - 1) '/' fnt '-bold ' str(s(i) + 3:end)];
-        endif
-      elseif (strcmpi (f, "color"))
-        ## FIXME Ignore \color but remove trailing {} block as well
-        d = strfind (str(e(i) + 1:end),'}');
-        if (isempty (d))
-          warning ('syntax error in \color argument');
-        else
-          str = [str(1:s(i) - 1) str(e(i) + d + 1:end)];
-        endif
-      elseif (strcmpi (f, "fontname"))
-        b1 = strfind (str(e(i) + 1:end),'{');
-        b2 = strfind (str(e(i) + 1:end),'}');
-        if (isempty (b1) || isempty (b2))
-          warning ('syntax error in \fontname argument');
-        else
-          str = [str(1:s(i) - 1), '/', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
-                 '{}', str(e(i) + b2(1) + 1:end)];
-        endif
-      elseif (strcmpi (f, "fontsize"))
-        b1 = strfind (str(e(i) + 1:end),'{');
-        b2 = strfind (str(e(i) + 1:end),'}');
-        if (isempty (b1) || isempty (b2))
-          warning ('syntax error in \fontname argument');
-        else
-          str = [str(1:s(i) - 1), '/=', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
-                 '{}', str(e(i) + b2(1) + 1:end)];
-        endif
-      else
-        ## Last desperate attempt to treat the symbol. Look for things
-        ## like \pix, that should be translated to the symbol Pi and x
-        for j = 1 : length (flds)
-          if (strncmp (flds{j}, f, length (flds{j})))
-            g = getfield (sym, flds{j});
-            ## FIXME The symbol font doesn't seem to support bold or italic
-            ##if (bld)
-            ##  if (it)
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
-            ##  else
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
-            ##  endif
-            ##elseif (it)
-            ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
-            ##endif
-            str = [str(1:s(i) - 1) g str(s(i) + length (flds{j}) + 1:end)];
-            break;
-          endif
-        endfor
-      endif
-    endif
-  endfor
-
-  ## Prepend @ to things  things like _0^x or _{-100}^{100} for
-  ## alignment But need to put the shorter of the two arguments first.
-  ## Carful of nested {} and unprinted characters when defining
-  ## shortest.. Don't have to worry about things like ^\theta as they
-  ## are already converted to ^{/Symbol q}.
-
-  ## FIXME -- This is a mess... Is it worth it just for a "@" character?
-
-  [s, m] = regexp (str,'[_\^]','start','matches');
-  i = 1;
-  p = 0;
-  while (i < length (s))
-    if (i < length (s))
-      if (str(s(i) + p + 1) == "{")
-        s1 = strfind (str(s(i) + p + 2:end),'{');
-        si = 1;
-        l1 = strfind (str(s(i) + p + 1:end),'}');
-        li = 1;
-        while (li <= length (l1) && si <= length (s1))
-          if (l1(li) < s1(si))
-            if (li == si)
-              break;
-            endif
-            li++;
-          else
-            si++;
-          endif
-        endwhile
-        l1 = l1 (min (length (l1), si));
-        if (s(i) + l1 + 1 == s(i+1))
-          if (str(s(i + 1) + p + 1) == "{")
-            s2 = strfind (str(s(i + 1) + p + 2:end),'{');
-            si = 1;
-            l2 = strfind (str(s(i + 1) + p + 1:end),'}');
-            li = 1;
-            while (li <= length (l2) && si <= length (s2))
-              if (l2(li) < s2(si))
-                if (li == si)
-                  break;
-                endif
-                li++;
-              else
-                si++;
-              endif
-            endwhile
-            l2 = l2 (min (length (l2), si));
-            if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <=
-                length_string (str(s(i+1)+p+2:s(i+1)+p+l2-1)))
-              ## Shortest already first!
-              str = [str(1:s(i)+p-1) "@" str(s(i)+p:end)];
-            else
-              ## Have to swap sub/super-script to get shortest first.
-              str = [str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2), ...
-                     str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)];
-            endif
-          else
-            ## Have to swap sub/super-script to get shortest first.
-            str = [str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1), ...
-                   str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)];
-          endif
-          i += 2;
-          p ++;
-        else
-          i++;
-        endif
-      else
-        if (s(i+1) == s(i) + 2)
-          ## Shortest already first!
-          str = [str(1:s(i)+p-1) "@" str(s(i)+p:end)];
-          p ++;
-          i += 2;
-        else
-          i ++;
-        endif
-      endif
-    else
-      i ++;
-    endif
-  endwhile
-
-endfunction
-
-function l = length_string (s)
-  l = length (s) - length (strfind (s,'{')) - length (strfind (s,'}'));
-  m = regexp (s, '/([\w-]+|[\w-]+=\d+)', 'matches');
-  if (!isempty (m))
-    l = l - sum (cellfun ("length", m));
-  endif
-endfunction
-
-function sym = __setup_sym_table__ ()
-  ## Setup the translation table for TeX to gnuplot enhanced mode.
-  sym.forall = '{/Symbol \042}';
-  sym.exists = '{/Symbol \044}';
-  sym.ni = '{/Symbol \047}';
-  sym.cong = '{/Symbol \100}';
-  sym.Delta = '{/Symbol D}';
-  sym.Phi = '{/Symbol F}';
-  sym.Gamma = '{/Symbol G}';
-  sym.vartheta = '{/Symbol J}';
-  sym.Lambda = '{/Symbol L}';
-  sym.Pi = '{/Symbol P}';
-  sym.Theta = '{/Symbol Q}';
-  sym.Sigma = '{/Symbol S}';
-  sym.varsigma = '{/Symbol V}';
-  sym.Omega = '{/Symbol W}';
-  sym.Xi = '{/Symbol X}';
-  sym.Psi = '{/Symbol Y}';
-  sym.perp = '{/Symbol \136}';
-  sym.alpha = '{/Symbol a}';
-  sym.beta = '{/Symbol b}';
-  sym.chi = '{/Symbol c}';
-  sym.delta = '{/Symbol d}';
-  sym.epsilon = '{/Symbol e}';
-  sym.phi = '{/Symbol f}';
-  sym.gamma = '{/Symbol g}';
-  sym.eta = '{/Symbol h}';
-  sym.iota = '{/Symbol i}';
-  sym.varphi = '{/Symbol j}';
-  sym.kappa = '{/Symbol k}';
-  sym.lambda = '{/Symbol l}';
-  sym.mu = '{/Symbol m}';
-  sym.nu = '{/Symbol n}';
-  sym.o =  '{/Symbol o}';
-  sym.pi = '{/Symbol p}';
-  sym.theta = '{/Symbol q}';
-  sym.rho = '{/Symbol r}';
-  sym.sigma = '{/Symbol s}';
-  sym.tau = '{/Symbol t}';
-  sym.upsilon = '{/Symbol u}';
-  sym.varpi = '{/Symbol v}';
-  sym.omega = '{/Symbol w}';
-  sym.xi = '{/Symbol x}';
-  sym.psi = '{/Symbol y}';
-  sym.zeta = '{/Symbol z}';
-  sym.sim = '{/Symbol \176}';
-  sym.Upsilon = '{/Symbol \241}';
-  sym.prime = '{/Symbol \242}';
-  sym.leq = '{/Symbol \243}';
-  sym.infty = '{/Symbol \245}';
-  sym.clubsuit = '{/Symbol \247}';
-  sym.diamondsuit = '{/Symbol \250}';
-  sym.heartsuit = '{/Symbol \251}';
-  sym.spadesuit = '{/Symbol \252}';
-  sym.leftrightarrow = '{/Symbol \253}';
-  sym.leftarrow = '{/Symbol \254}';
-  sym.uparrow = '{/Symbol \255}';
-  sym.rightarrow = '{/Symbol \256}';
-  sym.downarrow = '{/Symbol \257}';
-  sym.circ = '{/Symbol \260}';
-  sym.pm = '{/Symbol \261}';
-  sym.geq = '{/Symbol \263}';
-  sym.times = '{/Symbol \264}';
-  sym.propto = '{/Symbol \265}';
-  sym.partial = '{/Symbol \266}';
-  sym.bullet = '{/Symbol \267}';
-  sym.div = '{/Symbol \270}';
-  sym.neq = '{/Symbol \271}';
-  sym.equiv = '{/Symbol \272}';
-  sym.approx = '{/Symbol \273}';
-  sym.ldots = '{/Symbol \274}';
-  sym.mid = '{/Symbol \275}';
-  sym.aleph = '{/Symbol \300}';
-  sym.Im = '{/Symbol \301}';
-  sym.Re = '{/Symbol \302}';
-  sym.wp = '{/Symbol \303}';
-  sym.otimes = '{/Symbol \304}';
-  sym.oplus = '{/Symbol \305}';
-  sym.oslash = '{/Symbol \306}';
-  sym.cap = '{/Symbol \307}';
-  sym.cup = '{/Symbol \310}';
-  sym.supset = '{/Symbol \311}';
-  sym.supseteq = '{/Symbol \312}';
-  sym.subset = '{/Symbol \314}';
-  sym.subseteq = '{/Symbol \315}';
-  sym.in = '{/Symbol \316}';
-  sym.notin = '{/Symbol \317}';
-  sym.angle = '{/Symbol \320}';
-  sym.bigtriangledown = '{/Symbol \321}';
-  sym.langle = '{/Symbol \341}';
-  sym.rangle = '{/Symbol \361}';
-  sym.nabla = '{/Symbol \321}';
-  sym.prod = '{/Symbol \325}';
-  sym.surd = '{/Symbol \326}';
-  sym.cdot = '{/Symbol \327}';
-  sym.neg = '{/Symbol \330}';
-  sym.wedge = '{/Symbol \331}';
-  sym.vee = '{/Symbol \332}';
-  sym.Leftrightarrow = '{/Symbol \333}';
-  sym.Leftarrow = '{/Symbol \334}';
-  sym.Uparrow = '{/Symbol \335}';
-  sym.Rightarrow = '{/Symbol \336}';
-  sym.Downarrow = '{/Symbol \337}';
-  sym.diamond = '{/Symbol \340}';
-  sym.copyright = '{/Symbol \343}';
-  sym.lfloor = '{/Symbol \353}';
-  sym.lceil  = '{/Symbol \351}';
-  sym.rfloor = '{/Symbol \373}';
-  sym.rceil  = '{/Symbol \371}';
-  sym.int = '{/Symbol \362}';
-endfunction
-
-function retval = __do_enhanced_option__ (enhanced, obj)
-  retval = "";
-  if (enhanced)
-    if (strcmpi (obj.interpreter, "none"))
-      retval = "noenhanced";
-    else
-      retval = "enhanced";
-    endif
-  endif
-endfunction
-
--- a/scripts/plot/private/__go_draw_figure__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __go_draw_figure__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function __go_draw_figure__ (h, plot_stream, enhanced, mono)
-
-  htype = get (h, "type");
-  if (strcmp (htype, "figure"))
-    ## Get complete list of children.
-    kids = allchild (h);
-    nkids = length (kids);
-
-    if (nkids > 0)
-      fputs (plot_stream, "\nreset;\n");
-      fputs (plot_stream, "set autoscale keepfix;\n");
-      fputs (plot_stream, "set origin 0, 0\n");
-      fputs (plot_stream, "set size 1, 1\n");
-      bg = get (h, "color");
-      if (isnumeric (bg))
-        fprintf (plot_stream, "set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * bg);
-        bg_is_set = true;
-      else
-        bg_is_set = false;
-      endif
-      fg_was_set = false;
-
-      for i = nkids:-1:1
-        type = get (kids(i), "type");
-        switch (type)
-          case "axes"
-            if (strcmpi (get (kids (i), "tag"), "legend"))
-              ## This is so ugly. If there was a way of getting
-              ## gnuplot to give us the text extents of strings
-              ## then we could get rid of this mess.
-              lh = getfield (get (kids(i), "userdata"), "handle");
-              if (isscalar (lh))
-                ## We have a legend with a single parent. It'll be handled
-                ## below as a gnuplot key to the axis it corresponds to
-                continue;
-              else
-                ca = lh(1);
-                ## Rely upon listener to convert axes position
-                ## to "normalized" units.
-                legend_axes_units = get (kids(i), "units");
-                legend_axes_position = get (kids(i), "position");
-                legend_axes_outerposition = get (kids(i), "outerposition");
-                legend_axes_box = get (kids(i), "box");
-                legend_axes_ylim = get (kids(i), "ylim");
-                orig_axes_units = get (ca, "units");
-                hlgnd = get (kids(i));
-
-                unwind_protect
-                  set (ca, "units", "normalized");
-                  set (kids(i), "units", "normalized", "box", "off",
-                       "ylim", [-2, -1], "position", get (ca(1), "position"),
-                       "outerposition", get (ca(1), "outerposition"));
-
-                  ## Create a new set of lines with the appropriate
-                  ## displaynames, etc
-                  toberm = [];
-                  hobj = get (kids(i), "children");
-                  for j = numel (hobj) : -1 : 1
-                    if (! strcmp (get (hobj(j), "type"), "text"))
-                      continue;
-                    endif
-                    displayname = get (hobj(j), "string");
-                    ll = [];
-                    lm = [];
-                    for k = numel (hobj) : -1 : 1
-                      if (! strcmp (get (hobj(k), "type"), "line"))
-                        continue;
-                      endif
-                      if (get (hobj(j), "userdata")
-                          != get (hobj(k), "userdata"))
-                        continue;
-                      endif
-                      if (! strcmp (get (hobj(k), "linestyle"), "none"))
-                        ll = hobj(k);
-                      endif
-                      if (! strcmp (get (hobj(k), "marker"), "none"))
-                        lm = hobj(k);
-                      endif
-                    endfor
-
-                    if (! isempty (ll))
-                      if (!isempty (lm))
-                        toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", get(ll,"linestyle"), "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
-                      else
-                        toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(ll,"color"), "linestyle", get(ll,"linestyle"), "marker", "none", "displayname", displayname, "parent", kids(i))];
-                      endif
-                    elseif (! isempty (lm))
-                      toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", "none", "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
-                    endif
-                  endfor
-                  if (bg_is_set)
-                    fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
-                  endif
-                  __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
-                                    bg_is_set, false, hlgnd);
-                unwind_protect_cleanup
-                  ## Return axes "units" and "position" back to
-                  ## their original values.
-                  set (ca, "units", orig_axes_units);
-                  set (kids(i), "units", legend_axes_units,
-                       "box", legend_axes_box,
-                       "ylim", legend_axes_ylim,
-                       "position", legend_axes_position,
-                       "outerposition", legend_axes_outerposition);
-                  delete (toberm);
-                  bg_is_set = false;
-                end_unwind_protect
-              endif
-            else
-              ## Rely upon listener to convert axes position
-              ## to "normalized" units.
-              orig_axes_units = get (kids(i), "units");
-              orig_axes_position = get (kids(i), "position");
-              unwind_protect
-                set (kids(i), "units", "normalized");
-                fg = get (kids(i), "color");
-                if (isnumeric (fg) && strcmp (get (kids(i), "visible"), "on"))
-                  fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * fg);
-                  fg_is_set = true;
-                  fg_was_set = true;
-                elseif (fg_was_set)
-                  fprintf (plot_stream, "unset obj 2\n");
-                  fg_is_set = false;
-                  fg_was_set = false;
-                else
-                  fg_is_set = false;
-                endif
-                if (bg_is_set)
-                  fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
-                endif
-                ## Find if this axes has an associated legend axes and pass it
-                ## to __go_draw_axes__
-                hlegend = [];
-                fkids = get (h, "children");
-                for j = 1 : numel (fkids)
-                  if (ishandle (fkids (j))
-                      && strcmp (get (fkids (j), "type"), "axes")
-                      && (strcmp (get (fkids (j), "tag"), "legend")))
-                    udata = get (fkids (j), "userdata");
-                    if (isscalar (udata.handle)
-                        && ! isempty (intersect (udata.handle, kids (i))))
-                      hlegend = get (fkids (j));
-                      break;
-                    endif
-                  endif
-                endfor
-                __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
-                                  bg_is_set, fg_is_set, hlegend);
-              unwind_protect_cleanup
-                ## Return axes "units" and "position" back to
-                ## their original values.
-                set (kids(i), "units", orig_axes_units);
-                set (kids(i), "position", orig_axes_position);
-                bg_is_set = false;
-                fg_is_set = false;
-              end_unwind_protect
-            endif
-          case "uimenu"
-            ## ignore uimenu objects
-            kids(i) = [];
-          otherwise
-            error ("__go_draw_figure__: unknown object class, %s", type);
-        endswitch
-      endfor
-      if (isempty (kids))
-        fputs (plot_stream, "\nreset; clear;\n");
-        fflush (plot_stream);
-      else
-        fputs (plot_stream, "\nunset multiplot;\n");
-      endif
-    else
-      fputs (plot_stream, "\nreset; clear;\n");
-      fflush (plot_stream);
-    endif
-  else
-    error ("__go_draw_figure__: expecting figure object, found '%s'",
-           htype);
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__interp_cube__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-##
-## Author: Martin Helm <martin@mhelm.de>
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{vxyz}, @var{idx}, @var{frac}] =} __interp_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
-## Undocumented internal function.
-## @end deftypefn
-
-function [Vxyz, idx, frac] = __interp_cube__ (x, y, z, val, v, req = "values" )
-  if (ismatrix (x) && ndims (x) == 3 && ismatrix (y) && ndims (y) == 3
-       && ismatrix (z) && ndims (z) == 3 && size_equal (x, y, z, val))
-    x = squeeze (x(1,:,1))(:);
-    y = squeeze (y(:,1,1))(:);
-    z = squeeze (z(1,1,:))(:);
-  elseif (isvector (x) && isvector (y) && isvector (z))
-    x = x(:);
-    y = y(:);
-    z = z(:);
-  else
-    error ("__interp_cube__: X, Y, Z have wrong dimensions");
-  endif
-  if (size (val) != [length(x), length(y), length(z)])
-    error ("__interp_cube__: VAL has wrong dimensions");
-  endif
-  if (columns (v) != 3)
-    error ( "V has to be Nx3 matrix");
-  endif
-  ##if (!ischar (req))
-  ## error ('__interp_cube__: Invalid request parameter use "values", "normals" or "normals8"');
-  ##endif
-  if (isempty (v))
-    Vxyz = idx = frac = [];
-    return;
-  endif
-
-  switch (req)
-    case "normals"
-      [idx, frac] = cube_idx (x, y, z, v);
-
-      dx = x(2:end) - x(1:end-1);
-      dy = y(2:end) - y(1:end-1);
-      dz = z(2:end) - z(1:end-1);
-      dx = 0.5 .* [dx;dx(end)](idx(:,2));
-      dy = 0.5 .* [dy;dy(end)](idx(:,1));
-      dz = 0.5 .* [dz;dz(end)](idx(:,3));
-
-      p000 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) - dz];
-      p100 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) - dz];
-      p010 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) - dz];
-      p001 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) + dz];
-      p011 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) + dz];
-      p101 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) + dz];
-      p110 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) - dz];
-      p111 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) + dz];
-
-      v000 = interp_cube_trilin (x, y, z, val, p000);
-      v100 = interp_cube_trilin (x, y, z, val, p100);
-      v010 = interp_cube_trilin (x, y, z, val, p010);
-      v001 = interp_cube_trilin (x, y, z, val, p001);
-      v011 = interp_cube_trilin (x, y, z, val, p011);
-      v101 = interp_cube_trilin (x, y, z, val, p101);
-      v110 = interp_cube_trilin (x, y, z, val, p110);
-      v111 = interp_cube_trilin (x, y, z, val, p111);
-
-      Dx = -v000 .+ v100 .- v010 .- v001 .- v011 .+ v101 .+ v110 .+ v111;
-      Dy = -v000 .- v100 .+ v010 .- v001 .+ v011 .- v101 .+ v110 .+ v111;
-      Dz = -v000 .- v100 .- v010 .+ v001 .+ v011 .+ v101 .- v110 .+ v111;
-      Vxyz = 0.5 .* [Dx./dx, Dy./dy, Dz./dz];
-    case "normals8"
-      [idx, frac] = cube_idx (x, y, z, v);
-
-      dx = x(2:end) - x(1:end-1);
-      dy = y(2:end) - y(1:end-1);
-      dz = z(2:end) - z(1:end-1);
-      dx = [dx;dx(end)](idx(:,2));
-      dy = [dy;dy(end)](idx(:,1));
-      dz = [dz;dz(end)](idx(:,3));
-      [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v);
-      Vxyz = [Dx./dx, Dy./dy, Dz./dz];
-    case "values"
-      [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v);
-   otherwise
-     error ('__interp_cube__: Invalid request type "%s", use "values", "normals" or "normals8"', req);
-  endswitch
-endfunction
-
-function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v)
-  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
-  sval = size (val);
-  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
-  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
-  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
-  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
-  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
-  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
-  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
-  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
-  Bx = frac(:, 1);
-  By = frac(:, 2);
-  Bz = frac(:, 3);
-  Vxyz = ...
-    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i100 ) .* Bx .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i010 ) .* (1 .- Bx) .* By .* (1 .- Bz) .+ ...
-    val( i001 ) .* (1 .- Bx) .* (1 .- By) .* Bz .+ ...
-    val( i011 ) .* (1 .- Bx) .* By .* Bz .+ ...
-    val( i101 ) .* Bx .* (1 .- By) .* Bz .+ ...
-    val( i110 ) .* Bx .* By .* (1 .- Bz) .+ ...
-    val( i111 ) .* Bx .* By .* Bz;
-endfunction
-
-function [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v)
-  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
-  sval = size (val);
-  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
-  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
-  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
-  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
-  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
-  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
-  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
-  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
-  Bx = frac(:, 1);
-  By = frac(:, 2);
-  Bz = frac(:, 3);
-  Dx = ...
-    val( i000 ) .* -1 .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i100 ) .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i010 ) .* -1 .* By .* (1 .- Bz) .+ ...
-    val( i001 ) .* -1 .* (1 .- By) .* Bz .+ ...
-    val( i011 ) .* -1 .* By .* Bz .+ ...
-    val( i101 ) .* (1 .- By) .* Bz .+ ...
-    val( i110 ) .* By .* (1 .- Bz) .+ ...
-    val( i111 ) .* By .* Bz;
-  Dy = ...
-    val( i000 ) .* (1 .- Bx) .* -1 .* (1 .- Bz) .+ ...
-    val( i100 ) .* Bx .* -1 .* (1 .- Bz) .+ ...
-    val( i010 ) .* (1 .- Bx) .* (1 .- Bz) .+ ...
-    val( i001 ) .* (1 .- Bx) .* -1 .* Bz .+ ...
-    val( i011 ) .* (1 .- Bx) .* Bz .+ ...
-    val( i101 ) .* Bx .* -1 .* Bz .+ ...
-    val( i110 ) .* Bx .* (1 .- Bz) .+ ...
-    val( i111 ) .* Bx .* Bz;
-  Dz = ...
-    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* -1 .+ ...
-    val( i100 ) .* Bx .* (1 .- By) .* -1 .+ ...
-    val( i010 ) .* (1 .- Bx) .* By .* -1 .+ ...
-    val( i001 ) .* (1 .- Bx) .* (1 .- By) .+ ...
-    val( i011 ) .* (1 .- Bx) .* By + ...
-    val( i101 ) .* Bx .* (1 .- By) .+ ...
-    val( i110 ) .* Bx .* By .* -1 .+ ...
-    val( i111 ) .* Bx .* By;
-endfunction
-
-function [idx, frac] = cube_idx (x, y, z, v)
-  idx = zeros (size (v));
-  frac = zeros (size (v));
-  idx(:, 2) = lookup (x(2:end-1), v(:, 1)) + 1;
-  frac(:, 2) = (v(:, 1) - x(idx(:, 2)) )...
-      ./ (x(idx(:, 2)+1) - x(idx(:, 2)));
-  idx(:, 1) = lookup (y(2:end-1), v(:, 2)) + 1;
-  frac(:, 1) = (v(:, 2) - y(idx(:, 1))) ...
-      ./ (y(idx(:, 1)+1) - y(idx(:, 1)));
-  idx(:, 3) = lookup (z(2:end-1), v(:, 3)) + 1;
-  frac(:, 3) = (v(:, 3) - z(idx(:, 3))) ...
-      ./ (z(idx(:, 3)+1) - z(idx(:, 3)));
-endfunction
-
--- a/scripts/plot/private/__is_function__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{result} =} __is_function__ (@var{func})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function result = __is_function__ (func)
-
-  existval = exist (func);
-  result = (existval == 2 || existval == 3 || existval == 5 || existval == 6);
-
-endfunction
-
--- a/scripts/plot/private/__line__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __line__ (@var{p}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## __line__ (p, x, y, z)
-## Create line object from x, y, and z with parent p.
-## Return handle to line object.
-
-## Author: jwe
-
-function h = __line__ (p, varargin)
-
-  nvargs = numel (varargin);
-
-  if (nvargs > 1 && ! ischar (varargin{1}) && ! ischar (varargin{2}))
-    if (nvargs > 2 && ! ischar (varargin{3}))
-      num_data_args = 3;
-    else
-      num_data_args = 2;
-    endif
-  else
-    num_data_args = 0;
-  endif
-
-  if (num_data_args > 0 && ! size_equal (varargin{1:num_data_args}))
-    n = 1:num_data_args;
-    m = cellfun (@numel, varargin(1:num_data_args));
-    [~, m] = max (m);
-    b = ones (size (varargin{m(1)}));
-    try
-      varargin(n) = cellfun (@(x) bsxfun (@times, b, x), varargin(n), "uniformoutput", false);
-    catch
-      error ("line: number of X, Y, and Z points must be equal");
-    end_try_catch
-  endif
-
-  if (rem (nvargs - num_data_args, 2) != 0)
-    error ("line: invalid number of PROPERTY / VALUE pairs");
-  endif
-
-  other_args = {};
-  if (nvargs > num_data_args)
-    other_args = varargin(num_data_args+1:end);
-  endif
-
-  nlines = 0;
-  nvecpts = 0;
-  ismat = false (1, 3);
-  for i = 1:num_data_args
-    tmp = varargin{i}(:,:);
-    if (isvector (tmp))
-      nlines = max (1, nlines);
-      if (! isscalar (tmp))
-        if (nvecpts == 0)
-          nvecpts = numel (tmp);
-        elseif (nvecpts != numel (tmp))
-          error ("line: data size mismatch");
-        endif
-      endif
-    else
-      ismat(i) = true;
-      nlines = max (columns (tmp), nlines);
-    endif
-    varargin{i} = tmp;
-  endfor
-
-  if (num_data_args == 0)
-    varargin = {[0, 1], [0, 1]};
-    num_data_args = 2;
-    nlines = 1;
-  endif
-
-  handles = zeros (nlines, 1);
-
-  data = cell (1, 3);
-
-  if (num_data_args > 1)
-    data(1:num_data_args) = varargin(1:num_data_args);
-    for i = 1:num_data_args
-      if (islogical (data{i}))
-        data(i) = double (data{i});
-      elseif (iscomplex (data{i}))
-        data(i) = real (data{i});
-      endif
-    endfor
-  endif
-
-  data_args = reshape ({"xdata", "ydata", "zdata"; data{:}}, [1, 6]);
-  mask = reshape ([false(1,3); ismat], [1, 6]);
-
-  for i = 1:nlines
-    tmp = data(ismat);
-    if (! size_equal (tmp)
-        || (nvecpts != 0 && any (nvecpts != cellfun ("size", tmp, 1))))
-      error ("line: data size_mismatch");
-    endif
-    data_args(mask) = cellfun (@(x) x(:,i), data(ismat),
-                               "uniformoutput", false);
-
-    handles(i) = __go_line__ (p, data_args{:}, other_args{:});
-
-  endfor
-
-  if (nargout > 0)
-    h = handles;
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__marching_cube__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,531 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
-## Undocumented internal function.
-## @end deftypefn
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
-##
-## Return the triangulation information @var{t} at points @var{p} for
-## the isosurface values resp. the volume data @var{val} and the iso
-## level @var{iso}.  It is considered that the volume data @var{val} is
-## given at the points @var{x}, @var{y} and @var{z} which are of type
-## three--dimensional numeric arrays.  The orientation of the triangles
-## is choosen such that the normals point from the higher values to the
-## lower values.
-##
-## Optionally the color data @var{col} can be passed to this function
-## whereas computed vertices color data @var{c} is returned as third
-## argument.
-##
-## The marching cube algorithm is well known and described, for example, at
-## Wikipedia.  The triangulation lookup table and the edge table used
-## here are based on Cory Gene Bloyd's implementation and can be found
-## beyond other surface and geometry stuff at Paul Bourke's website
-## @uref{http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise}.
-##
-## For example:
-##
-## @example
-## @group
-## N = 20;
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-##
-## c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
-## [t, p] = __marching_cube__ (x, y, z, c, .5);
-##
-## figure ();
-## trimesh (t, p(:,1), p(:,2), p(:,3));
-## @end group
-## @end example
-##
-## Instead of the @command{trimesh} function the @command{patch}
-## function can be used to visualize the geometry.  For example:
-##
-## @example
-## @group
-## figure (); view (-38, 20);
-## pa = patch ("Faces", t, "Vertices", p, "FaceVertexCData", p, ...
-##             "FaceColor", "interp", "EdgeColor", "none");
-##
-## ## Revert normals
-## set (pa, "VertexNormals", -get (pa, "VertexNormals"));
-##
-## ## Set lightning (available with the JHandles package)
-## # set (pa, "FaceLighting", "gouraud");
-## # light ( "Position", [1 1 5]);
-## @end group
-## @end example
-##
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function [T, p, col] = __marching_cube__ (xx, yy, zz, c, iso, colors)
-
-  persistent edge_table=[];
-  persistent tri_table=[];
-
-  calc_cols = false;
-  lindex = 4;
-
-  if (isempty (tri_table) || isempty (edge_table))
-    [edge_table, tri_table] = init_mc ();
-  endif
-
-  if ((nargin != 5 && nargin != 6) || (nargout != 2 && nargout != 3))
-    print_usage ();
-  endif
-
-  if (!ismatrix (xx) || !ismatrix (yy) || !ismatrix (zz) || !ismatrix (c) || ...
-    ndims (xx) != 3 || ndims (yy) != 3 || ndims (zz) != 3 || ndims (c) != 3)
-    error ("__marching_cube__: XX, YY, ZZ, C must be matrices of dim 3");
-  endif
-
-  if (!size_equal (xx, yy, zz, c))
-    error ("__marching_cube__: XX, YY, ZZ, C must be of equal size");
-  endif
-
-  if (any (size (xx) < [2 2 2]))
-    error ("__marching_cube__: grid size must be at least 2x2x2");
-  endif
-
-  if (!isscalar (iso))
-    error ("__marching_cube__: ISO must be scalar value");
-  endif
-
-  if (nargin == 6)
-    if ( !ismatrix (colors) || ndims (colors) != 3 || size (colors) != size (c) )
-      error ( "COLORS must be a matrix of dim 3 and of same size as C" );
-    endif
-    calc_cols = true;
-    lindex = 5;
-  endif
-
-  n = size (c) - 1;
-
-  ## phase I: assign information to each voxel which edges are intersected by
-  ## the isosurface
-  cc = zeros (n(1), n(2), n(3), "uint16");
-  cedge = zeros (size (cc), "uint16");
-
-  vertex_idx = {1:n(1), 1:n(2), 1:n(3); ...
-    2:n(1)+1, 1:n(2), 1:n(3); ...
-    2:n(1)+1, 2:n(2)+1, 1:n(3); ...
-    1:n(1), 2:n(2)+1, 1:n(3); ...
-    1:n(1), 1:n(2), 2:n(3)+1; ...
-    2:n(1)+1, 1:n(2), 2:n(3)+1; ...
-    2:n(1)+1, 2:n(2)+1, 2:n(3)+1; ...
-    1:n(1), 2:n(2)+1, 2:n(3)+1 };
-
-  ## calculate which vertices have values higher than iso
-  for ii=1:8
-    idx = c(vertex_idx{ii, :}) > iso;
-    cc(idx) = bitset (cc(idx), ii);
-  endfor
-
-  cedge = edge_table(cc+1); # assign the info about intersected edges
-  id =  find (cedge); # select only voxels which are intersected
-  if (isempty (id))
-    T = p = col = [];
-    return;
-  endif
-
-  ## phase II: calculate the list of intersection points
-  xyz_off = [1, 1, 1; 2, 1, 1; 2, 2, 1; 1, 2, 1; 1, 1, 2;  2, 1, 2; 2, 2, 2; 1, 2, 2];
-  edges = [1 2; 2 3; 3 4; 4 1; 5 6; 6 7; 7 8; 8 5; 1 5; 2 6; 3 7; 4 8];
-  offset = sub2ind (size (c), xyz_off(:, 1), xyz_off(:, 2), xyz_off(:, 3)) -1;
-  pp = zeros (length (id), lindex, 12);
-  ccedge = [vec(cedge(id)), id];
-  ix_offset=0;
-  for jj=1:12
-    id__ = bitget (ccedge(:, 1), jj);
-    id_ = ccedge(id__, 2);
-    [ix iy iz] = ind2sub (size (cc), id_);
-    id_c = sub2ind (size (c), ix, iy, iz);
-    id1 = id_c + offset(edges(jj, 1));
-    id2 = id_c + offset(edges(jj, 2));
-    if (calc_cols)
-      pp(id__, 1:5, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
-        xx(id2), yy(id2), zz(id2), c(id1), c(id2), colors(id1), colors(id2)), ...
-        (1:rows (id_))' + ix_offset ];
-    else
-      pp(id__, 1:4, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
-        xx(id2), yy(id2), zz(id2), c(id1), c(id2)), ...
-        (1:rows (id_))' + ix_offset ];
-    endif
-    ix_offset += rows (id_);
-  endfor
-
-  ## phase III: calculate the triangulation from the point list
-  T = [];
-  tri = tri_table(cc(id)+1, :);
-  for jj=1:3:15
-    id_ = find (tri(:, jj)>0);
-    p = [id_, lindex*ones(rows (id_), 1),tri(id_, jj:jj+2)];
-    if (!isempty (p))
-      p1 = sub2ind (size (pp), p(:,1), p(:,2), p(:,3));
-      p2 = sub2ind (size (pp), p(:,1), p(:,2), p(:,4));
-      p3 = sub2ind (size (pp), p(:,1), p(:,2), p(:,5));
-      T = [T; pp(p1), pp(p2), pp(p3)];
-    endif
-  endfor
-
-  p = [];
-  col = [];
-  for jj = 1:12
-    idp = pp(:, lindex, jj) > 0;
-    if (any (idp))
-      p(pp(idp, lindex, jj), 1:3) = pp(idp, 1:3, jj);
-      if (calc_cols)
-        col(pp(idp, lindex, jj),1) = pp(idp, 4, jj);
-      endif
-    endif
-  endfor
-endfunction
-
-function p = vertex_interp (isolevel,p1x, p1y, p1z,...
-  p2x, p2y, p2z,valp1,valp2, col1, col2)
-
-  if (nargin == 9)
-    p = zeros (length (p1x), 3);
-  elseif (nargin == 11)
-    p = zeros (length (p1x), 4);
-  else
-    error ("__marching_cube__: wrong number of arguments");
-  endif
-  mu = zeros (length (p1x), 1);
-  id = abs (valp1-valp2) < (10*eps) .* (abs (valp1) .+ abs (valp2));
-  if (any (id))
-    p(id, 1:3) = [ p1x(id), p1y(id), p1z(id) ];
-    if (nargin == 11)
-      p(id, 4) = col1(id);
-    endif
-  endif
-  nid = !id;
-  if (any (nid))
-    mu(nid) = (isolevel - valp1(nid)) ./ (valp2(nid) - valp1(nid));
-    p(nid, 1:3) = [p1x(nid) + mu(nid) .* (p2x(nid) - p1x(nid)), ...
-      p1y(nid) + mu(nid) .* (p2y(nid) - p1y(nid)), ...
-      p1z(nid) + mu(nid) .* (p2z(nid) - p1z(nid))];
-    if (nargin == 11)
-      p(nid, 4) = col1(nid) + mu(nid) .* (col2(nid) - col1(nid));
-    endif
-  endif
-endfunction
-
-function [edge_table, tri_table] = init_mc ()
-  edge_table = [
-  0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, ...
-  0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, ...
-  0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, ...
-  0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, ...
-  0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c, ...
-  0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, ...
-  0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac, ...
-  0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, ...
-  0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c, ...
-  0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, ...
-  0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc, ...
-  0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, ...
-  0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c, ...
-  0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, ...
-  0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc , ...
-  0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, ...
-  0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, ...
-  0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, ...
-  0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, ...
-  0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, ...
-  0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, ...
-  0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, ...
-  0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, ...
-  0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460, ...
-  0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, ...
-  0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0, ...
-  0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, ...
-  0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230, ...
-  0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, ...
-  0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, ...
-  0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, ...
-  0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0   ];
-
-  tri_table =[
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1;
-  3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1;
-  3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1;
-  3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1;
-  9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1;
-  9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
-  2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1;
-  8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1;
-  9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
-  4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1;
-  3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1;
-  1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1;
-  4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1;
-  4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
-  5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1;
-  2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1;
-  9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
-  0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
-  2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1;
-  10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1;
-  5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1;
-  5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1;
-  9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1;
-  0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1;
-  1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1;
-  10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1;
-  8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1;
-  2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1;
-  7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1;
-  2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1;
-  11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1;
-  5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1;
-  11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1;
-  11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
-  1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1;
-  9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1;
-  5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1;
-  2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
-  5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1;
-  6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1;
-  3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1;
-  6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1;
-  5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1;
-  1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
-  10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1;
-  6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1;
-  8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1;
-  7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1;
-  3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
-  5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1;
-  0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1;
-  9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1;
-  8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1;
-  5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1;
-  0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1;
-  6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1;
-  10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1;
-  10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1;
-  8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1;
-  1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1;
-  0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1;
-  10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1;
-  3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1;
-  6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1;
-  9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1;
-  8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1;
-  3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1;
-  6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1;
-  0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1;
-  10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1;
-  10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1;
-  2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1;
-  7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1;
-  7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1;
-  2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1;
-  1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1;
-  11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1;
-  8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1;
-  0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1;
-  7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
-  10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
-  2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
-  6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1;
-  7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1;
-  2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1;
-  1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1;
-  10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1;
-  10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1;
-  0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1;
-  7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1;
-  6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1;
-  8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1;
-  9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1;
-  6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1;
-  4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1;
-  10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1;
-  8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1;
-  0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1;
-  1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1;
-  8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1;
-  10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1;
-  4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1;
-  10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
-  5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
-  11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1;
-  9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
-  6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1;
-  7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1;
-  3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1;
-  7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1;
-  3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1;
-  6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1;
-  9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1;
-  1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1;
-  4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1;
-  7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1;
-  6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1;
-  3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1;
-  0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1;
-  6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1;
-  0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1;
-  11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1;
-  6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1;
-  5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1;
-  9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1;
-  1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1;
-  1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1;
-  10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1;
-  0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1;
-  5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1;
-  10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1;
-  11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1;
-  9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1;
-  7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1;
-  2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1;
-  8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1;
-  9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1;
-  9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1;
-  1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1;
-  9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1;
-  9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1;
-  5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1;
-  0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1;
-  10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1;
-  2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1;
-  0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1;
-  0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1;
-  9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1;
-  5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1;
-  3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1;
-  5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1;
-  8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1;
-  0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1;
-  9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1;
-  1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1;
-  3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1;
-  4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1;
-  9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1;
-  11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1;
-  11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1;
-  2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1;
-  9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1;
-  3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1;
-  1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1;
-  4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1;
-  3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1;
-  0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1;
-  9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1;
-  1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ] + 1;
-endfunction
-
--- a/scripts/plot/private/__next_line_color__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-## Copyright (C) 2013 Carl Osterwisch
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{rgb} =} __next_line_color__ (@var{reset})
-## Undocumented internal function.
-## @end deftypefn
-
-## Return the next line color in the rotation.
-
-## Author: Carl Osterwisch
-## Author: jwe
-
-function rgb = __next_line_color__ (reset)
-
-  persistent reset_colors = true;
-
-  if (nargin == 1)
-    ## Indicates whether the next call will increment or not
-    reset_colors = reset;
-  else
-    ## Find and return the next line color
-    ca = gca ();
-    colororder = get (ca, "colororder");
-    if (reset_colors)
-      color_index = 1;
-      reset_colors = false;
-    else
-      ## Executed when "hold all" is active
-      n_kids = length (get (ca, "children"));
-      n_colors = rows (colororder);
-      color_index = mod (n_kids, n_colors) + 1;
-    endif
-    rgb = colororder(color_index,:);
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__next_line_style__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{style} =} __next_line_style__ (@var{reset})
-## Undocumented internal function.
-## @end deftypefn
-
-## Return the next line style in the rotation.
-
-
-function [linestyle, marker] = __next_line_style__ (reset)
-
-  persistent reset_style = true;
-
-  if (nargin == 1)
-    ## Indicates whether the next call will increment or not
-    reset_style = reset;
-  else
-    ## Find and return the next line style
-    ca = gca ();
-    style_rotation = get (ca, "linestyleorder");
-    if (ischar (style_rotation))
-      style_rotation = strsplit (style_rotation, "|");
-    endif
-    nStyles = length (style_rotation);
-    if (reset_style || (nStyles < 2))
-      style_index = 1;
-      reset_style = false;
-    else
-      ## Executed when "hold all" is active
-      nChildren = length (get (ca, "Children"));
-      nColors = rows (get (ca, "ColorOrder"));
-      style_index = mod (floor (nChildren/nColors), nStyles) + 1;
-    endif
-    options = __pltopt__ ("__next_line_style__",
-                          style_rotation(style_index));
-    linestyle = options.linestyle;
-    marker = options.marker;
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__patch__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,370 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton, Shai Ayal, Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{h}, @var{fail}] =} __patch__ (@var{p}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## __patch__ (p, x, y, c)
-## Create patch object from x and y with color c and parent p.
-## Return handle to patch object.
-
-## Author: Kai Habel
-
-function [h, failed] = __patch__ (p, varargin)
-
-  h = NaN;
-  failed = false;
-
-  is_numeric_arg = cellfun (@isnumeric, varargin);
-
-  if (isempty (varargin))
-    args = {"xdata", [0; 1; 0], "ydata", [1; 1; 0], "facecolor", [0, 0, 0]};
-    args = setvertexdata (args);
-  elseif (isstruct (varargin{1}))
-    if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces"))
-      args{1} = "faces";
-      args{2} = getfield (varargin{1}, "faces");
-      args{3} = "vertices";
-      args{4} = getfield (varargin{1}, "vertices");
-      args{5} = "facevertexcdata";
-      if (isfield (varargin{1}, "facevertexcdata"))
-        args{6} = getfield (varargin{1}, "facevertexcdata");
-      else
-        args{6} = [];
-      endif
-      args = [args; varargin(2:end)];
-      args = setdata (args);
-    else
-      failed = true;
-    endif
-  elseif (is_numeric_arg(1))
-    if (nargin < 3 || ! is_numeric_arg(2))
-      failed = true;
-    else
-
-      if (nargin > 4 && all (is_numeric_arg(1:4)))
-        x = varargin{1};
-        y = varargin{2};
-        z = varargin{3};
-        c = varargin{4};
-        iarg = 5;
-      elseif (nargin > 3 && all (is_numeric_arg(1:3)))
-        x = varargin{1};
-        y = varargin{2};
-        iarg = 4;
-        if (rem (nargin - iarg, 2) == 1)
-          c = varargin {iarg};
-          z = varargin{3};
-          iarg = 5;
-        else
-          z = [];
-          c = varargin{3};
-        endif
-      elseif (nargin > 2 && all (is_numeric_arg(1:2)))
-        x = varargin{1};
-        y = varargin{2};
-        z = [];
-        iarg = 3;
-        if (rem (nargin - iarg, 2) == 1)
-          c = varargin {iarg};
-          iarg++; 
-        else
-          c = [];
-        endif
-      endif
-
-      if (isvector (x))
-        x = x(:);
-        y = y(:);
-        z = z(:);
-        if (isnumeric (c))
-          if (isvector (c) && numel (c) == numel (x))
-            c = c(:);
-          elseif (rows (c) != numel (x) && columns (c) == numel (x))
-            c = c.';
-          endif
-        endif
-      endif
-      args{1} = "xdata";
-      args{2} = x;
-      args{3} = "ydata";
-      args{4} = y;
-      args{5} = "zdata";
-      args{6} = z;
-
-      if (isnumeric (c))
-
-        if (ndims (c) == 3 && columns (c) == 1)
-          c = permute (c, [1, 3, 2]);
-        endif
-
-        if (isvector (c) && numel (c) == columns (x))
-          if (isnan (c))
-            args{7} = "facecolor";
-            args{8} = [1, 1, 1];
-            args{9} = "cdata";
-            args{10} = c;
-          elseif (isnumeric (c))
-            args{7} = "facecolor";
-            args{8} = "flat";
-            args{9} = "cdata";
-            args{10} = c;
-          else
-            error ("patch: color value not valid");
-          endif
-        elseif (isvector (c) && numel (c) == 3)
-          args{7} = "facecolor";
-          args{8} = c;
-          args{9} = "cdata";
-          args{10} = [];
-        elseif (ndims (c) == 3 && size (c, 3) == 3)
-          ## CDATA is specified as RGB data
-          if ((rows (c) == 1 && columns (c) == 1) ...
-              || (rows (c) == 1 && columns (c) == columns (x)))
-            ## Single patch color or per-face color
-            args{7} = "facecolor";
-            args{8} = "flat";
-            args{9} = "cdata";
-            args{10} = c;
-          elseif (rows (c) == rows (x) && columns (c) == columns (x))
-            ## Per-vertex color
-            args{7} = "facecolor";
-            args{8} = "interp";
-            args{9} = "cdata";
-            args{10} = c;
-          else
-            error ("patch: color value not valid");
-          endif
-        else
-          ## Color Vectors
-          if (isempty (c))
-            args{7} = "facecolor";
-            args{8} = "interp";
-            args{9} = "cdata";
-            args{10} = [];
-          elseif (isequal (size (c), size (x)) && isequal (size (c), size (y)))
-            args{7} = "facecolor";
-            args{8} = "interp";
-            args{9} = "cdata";
-            args{10} = c;
-          else
-            error ("patch: size of x, y, and c must be equal");
-          endif
-        endif
-      elseif (ischar (c) && rem (nargin - iarg, 2) == 0)
-        ## Assume that any additional argument over an even number is
-        ## color string.
-        args{7} = "facecolor";
-        args{8} =  tolower (c);
-        args{9} = "cdata";
-        args{10} = [];
-      else
-        args{7} = "facecolor";
-        args{8} = [0, 1, 0];
-        args{9} = "cdata";
-        args{10} = [];
-      endif
-
-      args = [args, varargin(iarg:end)];
-      args = setvertexdata (args);
-    endif
-  else
-    args = varargin;
-    if (any (strcmpi (args, "faces") | strcmpi (args, "vertices")))
-      args = setdata (args);
-    else
-      args = setvertexdata (args);
-    endif
-  endif
-
-  if (!failed)
-    h = __go_patch__ (p, args {:});
-
-    ## Setup listener functions
-    addlistener (h, "xdata", @update_data);
-    addlistener (h, "ydata", @update_data);
-    addlistener (h, "zdata", @update_data);
-    addlistener (h, "cdata", @update_data);
-
-    addlistener (h, "faces", @update_fvc);
-    addlistener (h, "vertices", @update_fvc);
-    addlistener (h, "facevertexcdata", @update_fvc);
-  endif
-endfunction
-
-function args = delfields (args, flds)
-  idx = cellfun ("isclass", args, "char");
-  idx(idx) = ismember (args(idx), flds);
-  if (rows (idx) == 1)
-    idx |= [false, idx(1:end-1)];
-  else
-    idx |= [false; idx(1:end-1)];
-  endif
-  args(idx) = [];
-endfunction
-
-function args = setdata (args)
-  args = delfields (args, {"xdata", "ydata", "zdata", "cdata"});
-  ## Remove the readonly fields as well
-  args = delfields (args, {"type", "uicontextmenu"});
-  nargs = length (args);
-  idx = find (strcmpi (args, "faces"), 1, "last") + 1;
-  if (idx > nargs)
-    faces = [];
-  else
-    faces = args {idx};
-  endif
-  idx = find (strcmpi (args, "vertices"), 1, "last") + 1;
-  if (idx > nargs)
-    vert = [];
-  else
-    vert = args {idx};
-  endif
-  idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    fvc = [];
-  else
-    fvc = args {idx};
-  endif
-  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    if (!isempty (fvc))
-      fc = "flat";
-    else
-      fc = [0, 1, 0];
-    endif
-    args = {"facecolor", fc, args{:}};
-  endif
-
-  nc = rows (faces);
-  idx = faces .';
-  t1 = isnan (idx);
-  for i = find (any (t1))
-    first_idx_in_column = find (t1(:,i), 1);
-    idx(first_idx_in_column:end,i) = idx(first_idx_in_column-1,i);
-  endfor
-  x = reshape (vert(:,1)(idx), size (idx));
-  y = reshape (vert(:,2)(idx), size (idx));
-  if (columns (vert) > 2)
-    z = reshape (vert(:,3)(idx), size (idx));
-  else
-    z = [];
-  endif
-
-  if (rows (fvc) == nc || rows (fvc) == 1)
-    c = reshape (fvc, [1, size(fvc)]);
-  else
-    if (columns (fvc) == 3)
-      c = cat (3, reshape (fvc(idx, 1), size (idx)),
-               reshape (fvc(idx, 2), size (idx)),
-               reshape (fvc(idx, 3), size (idx)));
-    elseif (isempty (fvc))
-      c = [];
-    else ## if (columnns (fvc) == 1)
-      c = permute (fvc(faces), [2, 1]);
-    endif
-  endif
-  args = {"xdata", x, "ydata", y, "zdata", z, "cdata", c, args{:}};
-endfunction
-
-function args = setvertexdata (args)
-  args = delfields (args, {"vertices", "faces", "facevertexcdata"});
-  ## Remove the readonly fields as well
-  args = delfields (args, {"type", "uicontextmenu"});
-  nargs = length (args);
-  idx = find (strcmpi (args, "xdata"), 1, "last") + 1;
-  if (idx > nargs)
-    x = [];
-  else
-    x = args {idx};
-  endif
-  idx = find (strcmpi (args, "ydata"), 1, "last") + 1;
-  if (idx > nargs)
-    y = [];
-  else
-    y = args {idx};
-  endif
-  idx = find (strcmpi (args, "zdata"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    z = [];
-  else
-    z = args {idx};
-  endif
-  idx = find (strcmpi (args, "cdata"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    c = [];
-  else
-    c = args {idx};
-  endif
-  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    if (!isempty (c))
-      fc = "flat";
-    else
-      fc = [0, 1, 0];
-    endif
-    args = {"facecolor", fc, args{:}};
-  endif
-
-  [nr, nc] = size (x);
-  if (nr == 1 && nc > 1)
-    nr = nc;
-    nc = 1;
-  endif
-  if (!isempty (z))
-    vert = [x(:), y(:), z(:)];
-  else
-    vert = [x(:), y(:)];
-  endif
-  faces = reshape (1:numel (x), nr, nc);
-  faces = faces';
-
-  if (ndims (c) == 3)
-    fvc = reshape (c, rows (c) * columns (c), size (c, 3));
-  else
-    fvc = c(:);
-  endif
-
-  args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}};
-endfunction
-
-function update_data (h, d)
-  update_handle (h, false);
-endfunction
-
-function update_fvc (h, d)
-  update_handle (h, true);
-endfunction
-
-function update_handle (h, isfv)
-  persistent recursive = false;
-
-  if (! recursive)
-    recursive = true;
-    f = get (h);
-    if (isfv)
-      set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:});
-    else
-      set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:});
-    endif
-    recursive = false;
-  endif
-endfunction
-
--- a/scripts/plot/private/__pie__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-## Copyright (C) 2010 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{hlist} =} __pie__ (caller, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function hlist = __pie__ (caller, varargin)
-
-  h = varargin{1};
-  x = abs (varargin{2});
-  iarg = 3;
-
-  if (! isvector (x))
-    error ("%s: expecting vector argument", caller);
-  endif
-
-  len = length (x);
-
-  have_explode = false;
-  have_labels = false;
-
-  while (iarg <= nargin - 1)
-    arg = varargin{iarg++};
-    if (iscell (arg))
-      labels = arg;
-      have_labels = true;
-      if (numel (x) != numel (labels))
-        error ("%s: mismatch in number of labels and data", caller);
-      endif
-    elseif (isnumeric (arg) || islogical (arg))
-      explode = arg;
-      have_explode = true;
-      if (! size_equal (x, explode))
-        error ("%s: mismatch in number of elements in explode and data",
-               caller);
-      endif
-    else
-      error ("%s: %s is invalid as an optional argument", caller, class (arg));
-    endif
-  endwhile
-
-  if (! have_explode)
-    explode = zeros (size (x));
-  endif
-
-  normalize = true;
-  if (sum (x(:)) < 1)
-    normalize = false;
-  endif
-
-  if (! have_labels)
-    if (normalize)
-      xp = round (100 * x ./ sum (x));
-    else
-      xp = round (100 * x);
-    endif
-    for i = 1:len
-      labels{i} = sprintf ("%d%%", xp(i));
-    endfor
-  endif
-
-  hlist = [];
-  refinement = 90;
-  phi = 0:refinement:360;
-  if (normalize)
-    xphi = cumsum (x / sum (x) * 360);
-  else
-    xphi = cumsum (x * 360);
-  endif
-
-  for i = 1:len
-    if (i == 1)
-      xn = 0 : 360 / refinement : xphi(i);
-    else
-      xn = xphi(i-1) : 360 / refinement : xphi(i);
-    endif
-
-    if (xn(end) != xphi(i))
-      xn = [xn, xphi(i)];
-    endif
-
-    xn2 = (xn(1) + xn(end)) / 2;
-    if (explode (i))
-      xoff = - 0.1 * sind (xn2);
-      yoff = 0.1 * cosd (xn2);
-    else
-      xoff = 0;
-      yoff = 0;
-    endif
-    xt = - 1.2 * sind (xn2);
-    yt = 1.2 * cosd (xn2);
-
-    if (len == 1)
-      set (h, "clim", [1, 2]);
-    else
-      set (h, "clim", [1, len]);
-    endif
-
-    if (strcmp (caller, "pie3"))
-      ln = length (xn);
-      zlvl = 0.35;
-      sx = repmat (xoff + [0, -sind(xn), 0], [2, 1]);
-      sy = repmat (yoff + [0, cosd(xn), 0], [2, 1]);
-      sz = [zeros(1, ln + 2); zlvl * ones(1, ln + 2)];
-      sc = i * ones (size (sz));
-
-      hlist = [hlist;
-        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i);
-        surface(sx, sy, sz, sc);
-        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zlvl * ones (1, ln + 1), i);
-        text(xt, yt, zlvl, labels{i})];
-
-    elseif (strcmp (caller, "pie"))
-      if (xt > 0)
-        align = "left";
-      else
-        align = "right";
-      endif
-
-      hlist = [hlist; patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], i);
-               text(xt, yt, labels{i}, "horizontalalignment", align)];
-
-    else
-      error ("__pie__: unknown caller '%s'", caller);
-    endif
-  endfor
-
-  addlistener (gca, "view", {@update_text_pos, hlist});
-
-  if (strcmp (caller, "pie3"))
-    axis ([-1.25, 1.25, -1.25, 1.25, -0.05, 0.4], "equal", "off");
-    view (-37.5, 30);
-  elseif (strcmp (caller, "pie"))
-    axis ([-1.5, 1.5, -1.5, 1.5], "square", "off");
-  endif
-endfunction
-
-function update_text_pos (all_handles)
-  ## Text objects in the foreground should be at the base level.
-  ## Text objects in the background should be at the top level.
-  ## Text objects on the right side should be aligned to the right
-  ## and on the left side to the left.
-  tobj = findobj (all_handles, "type", "text");
-
-  ## check if we are called from pie3
-  s = findobj (all_handles, "type", "surface");
-  is_pie3 = false;
-  if (length (s) > 0)
-    is_pie3 = true;
-  endif
-
-  if (length (tobj) > 0)
-    ax = get (tobj(1), "parent");
-    azel = get (ax, "view");
-    pos = get (tobj, "position");
-    if (iscell (pos))
-      pos = cell2mat (pos);
-    endif
-    phi = atand (pos(:,1) ./ pos(:,2));
-    [theta, r] = cart2pol (pos(:,1), pos(:,2));
-    theta *= 180/pi;
-    theta -= azel(1);
-    theta = mod (theta, 360);
-    ud_mask = (theta > 180);
-    lr_mask = (theta > 90) & (theta < 270);
-    for i = 1 : length (tobj)
-      if (is_pie3)
-        if (ud_mask(i))
-          set (tobj(i), "position", [pos(i,1), pos(i,2), -0.05]);
-        else
-          set (tobj(i), "position", [pos(i,1), pos(i,2), 0.40]);
-        endif
-      endif
-
-      if (lr_mask(i))
-        set (tobj(i), "horizontalalignment", "right");
-      else
-        set (tobj(i), "horizontalalignment", "left");
-      endif
-    endfor
-  endif
-endfunction
-
--- a/scripts/plot/private/__plt__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,502 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __plt__ (@var{caller}, @var{h}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function retval = __plt__ (caller, h, varargin)
-
-  persistent warned_callers = {};
-  nargs = nargin - 2;
-
-  if (nargs > 0)
-
-    k = 1;
-
-    x_set = false;
-    y_set = false;
-    property_set = false;
-    properties = {};
-
-    hlegend = [];
-    fkids = get (gcf (), "children");
-    for i = 1 : numel (fkids)
-      if (   strcmp (get (fkids(i), "type"), "axes")
-          && strcmp (get (fkids(i), "tag"), "legend"))
-        udata = get (fkids(i), "userdata");
-        if (! isempty (intersect (udata.handle, gca ())))
-          hlegend = fkids(i);
-          break;
-        endif
-      endif
-    endfor
-
-    setlgnd = false;
-    if (isempty (hlegend))
-      hlgnd = [];
-      tlgnd = {};
-    else
-      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
-    endif
-
-    ## Gather arguments, decode format, gather plot strings, and plot lines.
-
-    retval = [];
-
-    while (nargs > 0 || x_set)
-
-      if (nargs == 0)
-        ## Force the last plot when input variables run out.
-        next_cell = {};
-        next_arg = {""};
-      else
-        next_cell = varargin(k);
-        next_arg = varargin{k++};
-      endif
-
-      if (isnumeric (next_arg) && ndims (next_arg) > 2
-          && any (size (next_arg) == 1))
-        next_arg = squeeze (next_arg);
-        if (! any (strcmp (caller, warned_callers)) && ndims (next_arg) < 3)
-          warning (["%s: N-d inputs have been squeezed to less than " ...
-                    "three dimensions"], caller)
-          warned_callers(end+1) = caller;
-        endif
-      endif
-      if (isnumeric (next_arg) && ndims (next_arg) > 2)
-        error ("%s: plot arrays must have less than 2 dimensions", caller)
-      endif
-
-      nargs--;
-
-      if (ischar (next_arg) || iscellstr (next_arg))
-        if (x_set)
-          [options, valid] = __pltopt__ (caller, next_arg, false);
-          if (! valid)
-            if (nargs == 0)
-              error ("%s: properties must appear followed by a value", caller);
-            endif
-            properties = [properties, [next_cell, varargin(k++)]];
-            nargs--;
-            continue;
-          else
-            while (nargs > 0 && ischar (varargin{k}))
-              if (nargs < 2)
-                error ("%s: properties must appear followed by a value",
-                       caller);
-              endif
-              properties = [properties, varargin(k:k+1)];
-              k += 2;
-              nargs -= 2;
-            endwhile
-          endif
-          if (y_set)
-            tmp = __plt2__ (h, x, y, options, properties);
-            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
-            properties = {};
-            retval = [retval; tmp];
-          else
-            tmp = __plt1__ (h, x, options, properties);
-            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
-            properties = {};
-            retval = [retval; tmp];
-          endif
-          x_set = false;
-          y_set = false;
-        else
-          error ("plot: no data to plot");
-        endif
-      elseif (x_set)
-        if (y_set)
-          options = __pltopt__ (caller, {""});
-          tmp = __plt2__ (h, x, y, options, properties);
-          [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
-          retval = [retval; tmp];
-          x = next_arg;
-          y_set = false;
-          properties = {};
-        else
-          y = next_arg;
-          y_set = true;
-        endif
-      else
-        x = next_arg;
-        x_set = true;
-      endif
-
-    endwhile
-
-    if (setlgnd)
-      legend (gca (), hlgnd, tlgnd);
-    endif
-  else
-    error ("__plt__: invalid number of arguments");
-  endif
-
-endfunction
-
-function [hlgnd, tlgnd, setlgnd] = __plt_key__ (h, options, hlgnd, tlgnd, setlgnd)
-  n = numel (h);
-  if (numel (options) == 1)
-    options = repmat (options(:), n, 1);
-  endif
-
-  for i = 1 : n
-    key = options(i).key;
-    if (! isempty (key))
-      hlgnd = [hlgnd(:); h(i)];
-      tlgnd = {tlgnd{:}, key};
-      setlgnd = true;
-    endif
-  endfor
-endfunction
-
-function retval = __plt1__ (h, x1, options, properties = {})
-
-  if (nargin < 3 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (! isstruct (options))
-    error ("__plt1__: options must be a struct array");
-  endif
-
-  [nr, nc] = size (x1);
-  if (nr == 1)
-    x1 = x1.';
-    [nr, nc] = deal (nc, nr);   # Swap rows and columns
-  endif
-  if (iscomplex (x1))
-    x1_i = imag (x1);
-    if (any ((x1_i(:))))
-      x2 = x1_i;
-      x1 = real (x1);
-    else
-      x2 = x1;
-      x1 = (1:nr)';
-    endif
-  else
-    x2 = x1;
-    x1 = (1:nr)';
-  endif
-
-  retval = __plt2__ (h, x1, x2, options, properties);
-
-endfunction
-
-function retval = __plt2__ (h, x1, x2, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (! isstruct (options))
-    error ("__plt2__: options must be a struct array");
-  endif
-
-  if (islogical (x1))
-    x1 = int8 (x1);
-  elseif (iscomplex ((x1)))
-    x1 = real (x1);
-  endif
-
-  if (islogical (x2))
-    x2 = int8 (x2);
-  elseif (iscomplex (x2))
-    x2 = real (x2);
-  endif
-
-  h_set = false;
-  if (isempty (x1) && isempty (x2))
-    retval = zeros (0, 1);
-  elseif (isscalar (x1))
-    if (isscalar (x2))
-      retval = __plt2ss__ (h, x1, x2, options, properties);
-    elseif (isvector (x2))
-      retval = __plt2sv__ (h, x1, x2, options, properties);
-    else
-      error ("__plt2__: invalid data for plotting");
-    endif
-  elseif (isvector (x1))
-    if (isscalar (x2))
-      retval = __plt2vs__ (h, x1, x2, options, properties);
-    elseif (isvector (x2))
-      retval = __plt2vv__ (h, x1, x2, options, properties);
-    elseif (ismatrix (x2))
-      retval = __plt2vm__ (h, x1, x2, options, properties);
-    else
-      error ("__plt2__: invalid data for plotting");
-    endif
-  elseif (ismatrix (x1))
-    if (isvector (x2))
-      retval = __plt2mv__ (h, x1, x2, options, properties);
-    elseif (ismatrix (x2))
-      retval = __plt2mm__ (h, x1, x2, options, properties);
-    else
-      error ("__plt2__: invalid data for plotting");
-    endif
-  else
-    error ("__plt2__: invalid data for plotting");
-  endif
-
-endfunction
-
-function retval = __plt2mm__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  [x_nr, x_nc] = size (x);
-  [y_nr, y_nc] = size (y);
-
-  if (x_nr != y_nr && x_nc != y_nc)
-    error ("__plt2mm__: matrix dimensions must match");
-  endif
-
-  if (numel (options) == 1)
-    options = repmat (options(:), x_nc, 1);
-  endif
-  retval = zeros (x_nc, 1);
-  for i = 1:x_nc
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      [linestyle, marker] = __next_line_style__ ();
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x(:,i), y(:,i), "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2mv__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  y = y(:);
-  [y_nr, y_nc] = size (y);
-  [x_nr, x_nc] = size (x);
-
-  if (x_nr == y_nr)
-    ## Correctly oriented.  Do nothing.
-  elseif (x_nc == y_nr)
-    x = x.';
-    [x_nr, x_nc] = deal (x_nc, x_nr);
-  else
-    error ("__plt2mv__: matrix dimensions must match");
-  endif
-
-  if (numel (options) == 1)
-    options = repmat (options(:), x_nc, 1);
-  endif
-  retval = zeros (x_nc, 1);
-  for i = 1:x_nc
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      [linestyle, marker] = __next_line_style__ ();
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x(:,i), y, "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2ss__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (numel (options) > 1)
-    options = options(1);
-  endif
-
-  linestyle = options.linestyle;
-  marker = options.marker;
-  if (isempty (marker) && isempty (linestyle))
-    ## If unspecified, marker for a single point is always "."
-    linestyle = "-";
-    marker = ".";
-  endif
-  color = options.color;
-  if (isempty (color))
-    color = __next_line_color__ ();
-  endif
-
-  retval = line (x, y, "color", color,
-                 "linestyle", linestyle,
-                 "marker", marker, properties{:});
-
-endfunction
-
-function retval = __plt2sv__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  len = numel (y);
-  if (numel (options) == 1)
-    options = repmat (options(:), len, 1);
-  endif
-  retval = zeros (len, 1);
-  for i = 1:len
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      ## If unspecified, marker for a point is always "."
-      linestyle = "-";
-      marker = ".";
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x, y(i), "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2vm__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  x = x(:);
-  [x_nr, x_nc] = size (x);
-  [y_nr, y_nc] = size (y);
-
-  if (x_nr == y_nr)
-    ## Correctly oriented.  Do nothing.
-  elseif (x_nr == y_nc)
-    y = y.';
-    [y_nr, y_nc] = deal (y_nc, y_nr);
-  else
-    error ("__plt2vm__: matrix dimensions must match");
-  endif
-
-  if (numel (options) == 1)
-    options = repmat (options(:), y_nc, 1);
-  endif
-  retval = zeros (y_nc, 1);
-  for i = 1:y_nc
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      [linestyle, marker] = __next_line_style__ ();
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x, y(:,i), "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2vs__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  len = numel (x);
-  if (numel (options) == 1)
-    options = repmat (options(:), len, 1);
-  endif
-  retval = zeros (len, 1);
-  for i = 1:len
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      ## If unspecified, marker for a point is always "."
-      linestyle = "-";
-      marker = ".";
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x(i), y, "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2vv__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (numel (options) > 1)
-    options = options(1);
-  endif
-
-  x = x(:);
-  y = y(:);
-
-  if (length (x) != length (y))
-    error ("__plt2vv__: vector lengths must match");
-  endif
-
-  linestyle = options.linestyle;
-  marker = options.marker;
-  if (isempty (marker) && isempty (linestyle))
-    [linestyle, marker] = __next_line_style__ ();
-  endif
-  color = options.color;
-  if (isempty (color))
-    color = __next_line_color__ ();
-  endif
-
-  retval = line (x, y, "color", color,
-                 "linestyle", linestyle,
-                 "marker", marker, properties{:});
-
-endfunction
-
--- a/scripts/plot/private/__pltopt__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
-## Undocumented internal function.
-## @end deftypefn
-
-## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
-##
-## Decode plot option strings.
-##
-## @var{opt} can currently be some combination of the following:
-##
-## @table @code
-## @item "-"
-## For solid linestyle (default).
-##
-## @item "--"
-## For dashed line style.
-##
-## @item "-."
-## For linespoints plot style.
-##
-## @item ":"
-## For dots plot style.
-##
-## @item "r"
-## Red line color.
-##
-## @item "g"
-## Green line color.
-##
-## @item "b"
-## Blue line color.
-##
-## @item "c"
-## Cyan line color.
-##
-## @item "m"
-## Magenta line color.
-##
-## @item "y"
-## Yellow line color.
-##
-## @item "k"
-## Black line color.
-##
-## @item "w"
-## White line color.
-##
-## @item ";title;"
-## Here @code{"title"} is the label for the key.
-##
-## @item "+"
-## @itemx "o"
-## @itemx "*"
-## @itemx "."
-## @itemx "x"
-## @itemx "s"
-## @itemx "d"
-## @itemx "^"
-## @itemx "v"
-## @itemx ">"
-## @itemx "<"
-## @itemx "p"
-## @itemx "h"
-## Used in combination with the points or linespoints styles, set the point
-## style.
-## @end table
-##
-## The legend may be fixed to include the name of the variable
-## plotted in some future version of Octave.
-
-## Author: jwe
-
-function [options, valid] = __pltopt__ (caller, opt, err_on_invalid = true)
-
-  options = __default_plot_options__ ();
-  valid = true;
-
-  if (ischar (opt))
-    opt = cellstr (opt);
-  elseif (! iscellstr (opt))
-    error ("__pltopt__: argument must be a character string or cell array of character strings");
-  endif
-
-  nel = numel (opt);
-
-  for i = nel:-1:1
-    [options(i), valid] = __pltopt1__ (caller, opt{i}, err_on_invalid);
-    if (! err_on_invalid && ! valid)
-      return;
-    endif
-  endfor
-
-endfunction
-
-## Really decode plot option strings.
-
-## Author: Rick Niles <niles@axp745.gsfc.nasa.gov>
-## Adapted-By: jwe
-## Maintainer: jwe
-
-function [options, valid] = __pltopt1__ (caller, opt, err_on_invalid)
-
-  options = __default_plot_options__ ();
-  valid = true;
-
-  have_linestyle = false;
-  have_marker = false;
-
-  ## If called by __errplot__, extract the linestyle before proceeding.
-  if (strcmp (caller, "__errplot__"))
-    if (strncmp (opt, "#~>", 3))
-      n = 3;
-    elseif (strncmp (opt, "#~", 2) || strncmp (opt, "~>", 2))
-      n = 2;
-    elseif (strncmp (opt, "~", 1) || strncmp (opt, ">", 1)
-            || strncmp (opt, "#", 1))
-      n = 1;
-    else
-      n = 0;
-    endif
-    options.errorstyle = opt(1:n);
-    opt(1:n) = [];
-  else
-    options.errorstyle = "~";
-  endif
-
-  while (! isempty (opt))
-    if (strncmp (opt, "--", 2) || strncmp (opt, "-.", 2))
-      options.linestyle = opt(1:2);
-      have_linestyle = true;
-      n = 2;
-    else
-      topt = opt(1);
-      n = 1;
-      if (topt == "-" || topt == ":")
-        have_linestyle = true;
-        options.linestyle = topt;
-      elseif (topt == "+" || topt == "o" || topt == "*"
-              || topt == "." || topt == "x" || topt == "s"
-              || topt == "d" || topt == "^" || topt == "v"
-              || topt == ">" || topt == "<" || topt == "p"
-              || topt == "h" || topt == "@")
-        have_marker = true;
-        ## Check for long form marker styles
-        if (any (topt == "sdhp"))
-          if (strncmp (opt, "square", 6))
-            n = 6;
-          elseif (strncmp (opt, "diamond", 7))
-            n = 7;
-          elseif (strncmp (opt, "hexagram", 8))
-            n = 8;
-          elseif (strncmp (opt, "pentagram", 9))
-            n = 9;
-          endif
-        endif
-        ## Backward compatibility.  Leave undocumented.
-        if (topt == "@")
-          topt = "+";
-        endif
-        options.marker = topt;
-      ## Numeric color specs are for backward compatibility.  Don't document.
-      elseif (topt == "k" || topt == "0")
-        options.color = [0, 0, 0];
-      elseif (topt == "r" || topt == "1")
-        options.color = [1, 0, 0];
-      elseif (topt == "g" || topt == "2")
-        options.color = [0, 1, 0];
-      elseif (topt == "b" || topt == "3")
-        options.color = [0, 0, 1];
-      elseif (topt == "y")
-        options.color = [1, 1, 0];
-      elseif (topt == "m" || topt == "4")
-        options.color = [1, 0, 1];
-      elseif (topt == "c" || topt == "5")
-        options.color = [0, 1, 1];
-      elseif (topt == "w" || topt == "6")
-        options.color = [1, 1, 1];
-      elseif (isspace (topt))
-        ## Do nothing.
-      elseif (topt == ";")
-        t = index (opt(2:end), ";");
-        if (t)
-          options.key = opt(2:t);
-          n = t+1;
-        else
-          if (err_on_invalid)
-            error ("%s: unfinished key label", caller);
-          else
-            valid = false;
-            options = __default_plot_options__ ();
-            return;
-          endif
-        endif
-      else
-        if (err_on_invalid)
-          error ("%s: unrecognized format character: '%s'", caller, topt);
-        else
-          valid = false;
-          options = __default_plot_options__ ();
-          return;
-        endif
-      endif
-    endif
-    opt(1:n) = [];
-  endwhile
-
-  if (! have_linestyle && have_marker)
-    options.linestyle = "none";
-  endif
-
-  if (have_linestyle && ! have_marker)
-    options.marker = "none";
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__print_parse_opts__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,654 +0,0 @@
-## Copyright (C) 2010-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{args} =} __print_parse_opts__ (@var{propname}, @var{propvalue})
-## @deftypefnx {Function File} {@var{args} =} __print_parse_opts__ (@var{struct})
-## Undocumented internal function.
-## @end deftypefn
-
-function arg_st = __print_parse_opts__ (varargin)
-
-  persistent warn_on_missing_binary = true
-
-  arg_st.append_to_file = false;
-  arg_st.canvas_size = [];
-  arg_st.debug = false;
-  arg_st.debug_file = "octave-print-commands.log";
-  arg_st.devopt = "";
-  arg_st.epstool_binary = __quote_path__ (__find_binary__ ("epstool"));
-  arg_st.figure = get (0, "currentfigure");
-  arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev"));
-  arg_st.fontsize = "";
-  arg_st.font = "";
-  arg_st.scalefontsize = 1;
-  arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid
-  arg_st.formatted_for_printing = false;
-  arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ());
-  arg_st.ghostscript.debug = false;
-  arg_st.ghostscript.device = "";
-  arg_st.ghostscript.epscrop = true;
-  arg_st.ghostscript.level = [];
-  arg_st.ghostscript.output = "";
-  arg_st.ghostscript.papersize = "";
-  arg_st.ghostscript.pageoffset = [];
-  arg_st.ghostscript.resolution = 150;
-  arg_st.ghostscript.antialiasing = false;
-  arg_st.ghostscript.antialiasing_textalphabits = 4;
-  arg_st.ghostscript.antialiasing_graphicsalphabits = 4;
-  arg_st.loose = false;
-  arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr"));
-  arg_st.name = "";
-  arg_st.orientation = "";
-  arg_st.pstoedit_binary = __quote_path__ (__find_binary__ ("pstoedit"));
-  arg_st.preview = "";
-  arg_st.printer = "";
-  arg_st.send_to_printer = false;
-  arg_st.special_flag = "textnormal";
-  arg_st.tight_flag = false;
-  arg_st.use_color = 0; # 0=default, -1=mono, +1=color
-
-  if (isunix ())
-    arg_st.lpr_options = "-l";
-  elseif (ispc ())
-    arg_st.lpr_options = "-o l";
-  else
-    arg_st.lpr_options = "";
-  endif
-  arg_st.unlink = {};
-
-  if (nargin > 0 && isfigure (varargin{1}))
-    arg_st.figure = varargin{1};
-    varargin(1) = [];
-  endif
-
-  for i = 1:numel (varargin)
-    arg = strtrim (varargin{i});
-    if (ischar (arg))
-      if (strcmp (arg, "-color"))
-        arg_st.use_color = 1;
-      elseif (strcmp (arg, "-append"))
-        arg_st.append_to_file = true;
-      elseif (strcmp (arg, "-mono"))
-        arg_st.use_color = -1;
-      elseif (strcmp (arg, "-solid"))
-        arg_st.force_solid = 1;
-      elseif (strcmp (arg, "-dashed"))
-        arg_st.force_solid = -1;
-      elseif (strncmp (arg, "-portrait", length (arg)))
-        arg_st.orientation = "portrait";
-      elseif (strncmp (arg, "-landscape", length (arg)))
-        arg_st.orientation = "landscape";
-      elseif (strcmp (arg, "-loose"))
-        arg_st.loose = true;
-        arg_st.tight_flag = false;
-      elseif (strcmp (arg, "-tight"))
-        arg_st.loose = false;
-        arg_st.tight_flag = true;
-      elseif (strcmp (arg, "-textspecial"))
-        arg_st.special_flag = "textspecial";
-      elseif (any (strcmp (arg, {"-interchange", "-metafile", "-pict", "-tiff"})))
-        arg_st.preview = arg(2:end);
-      elseif (strncmp (arg, "-debug", 6))
-        arg_st.debug = true;
-        arg_st.ghostscript.debug = true;
-        if (length (arg) > 7)
-          arg_st.debug_file = arg(8:end);
-        endif
-      elseif (length (arg) > 2 && arg(1:2) == "-d")
-        arg_st.devopt = tolower (arg(3:end));
-      elseif (length (arg) > 2 && arg(1:2) == "-P")
-        arg_st.printer = arg;
-      elseif (strncmp (arg, "-EPSTOOL:", 9))
-        arg_st.epstool_binary = arg{10:end};
-      elseif (strncmp (arg, "-FIG2DEV:", 9))
-        arg_st.fig2dev_binary = arg{10:end};
-      elseif (strncmp (arg, "-PSTOEDIT:", 9))
-        arg_st.pstoedit_binary = arg{10:end};
-      elseif (strncmpi (arg, "-textalphabits=", 15))
-        n = find (arg == "=");
-        if (! isempty (n) && n == numel (arg) - 1 && any (arg(end) == "124"))
-          arg_st.ghostscript.antialiasing_textalphabits = str2num (arg(end));
-        else
-          error ("print: improper syntax, or value, for TextAlphaBits");
-        endif
-      elseif (strncmpi (arg, "-graphicsalphabits=", 19))
-        n = find (arg == "=");
-        if (! isempty (n) && n == numel (arg) - 1 && any (arg(end) == "124"))
-          arg_st.ghostscript.antialiasing_graphicsalphabits = str2num (arg(end));
-        else
-          error ("print: improper syntax, or value, for GraphicsAlphaBits");
-        endif
-      elseif ((length (arg) > 2) && arg(1:2) == "-G")
-        arg_st.ghostscript.binary = file_in_path (getenv ("PATH"), arg(3:end));
-        if (isempty (arg_st.ghostscript.binary))
-          error ("print: Ghostscript binary ""%s"" could not be located",
-                 arg(3:end));
-        else
-          arg_st.ghostscript.binary = __quote_path__ (arg_st.ghostscript.binary);
-        endif
-      elseif (length (arg) > 2 && arg(1:2) == "-F")
-        idx = rindex (arg, ":");
-        if (idx)
-          arg_st.font = arg(3:idx-1);
-          arg_st.fontsize = str2num (arg(idx+1:end));
-        else
-          arg_st.font = arg(3:end);
-        endif
-      elseif (length (arg) > 2 && arg(1:2) == "-S")
-        arg_st.canvas_size = str2num (arg(3:end));
-      elseif (length (arg) > 2 && arg(1:2) == "-r")
-        arg_st.ghostscript.resolution = str2double (arg(3:end));
-      elseif (length (arg) > 2 && arg(1:2) == "-f")
-        arg_st.figure = str2num (arg(3:end));
-      elseif (length (arg) >= 1 && arg(1) == "-")
-        error ("print: unknown option '%s'", arg);
-      elseif (length (arg) > 0)
-        arg_st.name = tilde_expand (arg);
-      endif
-    elseif (isfigure (arg))
-      arg_st.figure = arg;
-    else
-      error ("print: expecting inputs to be character string options or a figure handle");
-    endif
-  endfor
-
-  if (arg_st.ghostscript.resolution == 0)
-    ## Do as Matlab does.
-    arg_st.ghostscript.resolution = get (0, "screenpixelsperinch");
-  endif
-
-  if (isempty (arg_st.orientation))
-    if (isfigure (arg_st.figure))
-      arg_st.orientation = get (arg_st.figure, "paperorientation");
-    else
-      ## Allows tests to be run without error.
-      arg_st.orientation = "portrait";
-    endif
-  endif
-
-  if (isempty (arg_st.ghostscript.binary))
-    arg_st.ghostscript.binary = __ghostscript_binary__ ();
-  endif
-
-  dot = rindex (arg_st.name, ".");
-  if (isempty (arg_st.devopt))
-    if (dot == 0)
-      arg_st.devopt = "psc";
-    else
-      arg_st.devopt = tolower (arg_st.name(dot+1:end));
-    endif
-  endif
-
-  if (arg_st.use_color == 0)
-    if (any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt)))
-      arg_st.use_color = -1;
-    else
-      arg_st.use_color = 1;
-    endif
-  endif
-
-  if (strcmp (arg_st.devopt, "tex"))
-    arg_st.devopt = "epslatex";
-  elseif (strcmp (arg_st.devopt, "ill"))
-    arg_st.devopt = "aifm";
-  elseif (strcmp (arg_st.devopt, "cdr"))
-    arg_st.devopt = "corel";
-  elseif (strcmp (arg_st.devopt, "meta"))
-    arg_st.devopt = "emf";
-  elseif (strcmp (arg_st.devopt, "jpg"))
-    arg_st.devopt = "jpeg";
-  endif
-
-  dev_list = {"aifm", "corel", "fig", "png", "jpeg", ...
-              "gif", "pbm", "pbmraw", "dxf", "mf", ...
-              "svg", "hpgl", "ps", "ps2", "psc", ...
-              "psc2", "eps", "eps2", "epsc", "epsc2", ...
-              "emf", "pdf", "pslatex", "epslatex", "epslatexstandalone", ...
-              "pslatexstandalone", "pdflatexstandalone", ...
-              "pstex", "tiff", "tiffn" "tikz", "pcxmono", ...
-              "pcx24b", "pcx256", "pcx16", "pgm", "pgmraw", ...
-              "ppm", "ppmraw", "pdflatex", "texdraw", ...
-              "pdfcairo", "pngcairo", "pstricks", ...
-              "epswrite", "pswrite", "ps2write", "pdfwrite"};
-
-  suffixes = {"ai", "cdr", "fig", "png", "jpg", ...
-              "gif", "pbm", "pbm", "dxf", "mf", ...
-              "svg", "hpgl", "ps", "ps", "ps", ...
-              "ps", "eps", "eps", "eps", "eps", ...
-              "emf", "pdf", "tex", "tex", "tex", ...
-              "tex", "tex", ...
-              "ps", "tiff", "tiff", "tikz", "pcx", ...
-              "pcx", "pcx", "pcx", "pgm", "pgm", ...
-              "ppm", "ppm", "tex", "tex", ...
-              "pdf", "png", "tex", ...
-              "eps", "ps", "ps", "pdf"};
-
-  if (isfigure (arg_st.figure))
-    __graphics_toolkit__ = get (arg_st.figure, "__graphics_toolkit__");
-  else
-    ## Allow tests when no figures are present.
-    __graphics_toolkit__ = get (0, "defaultfigure__graphics_toolkit__");
-  endif
-
-  if (strcmp (__graphics_toolkit__, "gnuplot")
-      && __gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
-    suffixes(strncmp (dev_list, "epslatex", 8)) = {"eps"};
-  endif
-
-  match = strcmpi (dev_list, arg_st.devopt);
-  if (any (match))
-    default_suffix = suffixes {match};
-  else
-    default_suffix = arg_st.devopt;
-  endif
-
-  if (dot == 0 && ! isempty (arg_st.name))
-    arg_st.name = strcat (arg_st.name, ".", default_suffix);
-  endif
-
-  if (arg_st.append_to_file)
-    if (isempty (arg_st.name))
-      arg_st.append_to_file = false;
-    elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ...
-                                          "ps", "ps2", "psc", "psc2", "pdf"})))
-      have_ghostscript = ! isempty (__ghostscript_binary__ ());
-      if (have_ghostscript)
-        file_exists = ((numel (dir (arg_st.name)) == 1)
-                       && (! isdir (arg_st.name)));
-        if (! file_exists)
-          arg_st.append_to_file = false;
-        endif
-      else
-        arg_st.append_to_file = false;
-        warning ("print.m: appended output requires ghostscript to be installed");
-      endif
-    else
-      warning ("print.m: appended output is not supported for device '%s'",
-               arg_st.devopt);
-      arg_st.append_to_file = false;
-    endif
-  endif
-
-  if (! isempty (arg_st.printer) || isempty (arg_st.name))
-    arg_st.send_to_printer = true;
-  endif
-
-  if (any (strcmp (arg_st.devopt, {"ps", "ps2", "psc", "psc2", "pdf"})))
-    arg_st.formatted_for_printing = true;
-  endif
-
-  aliases = gs_aliases ();
-  if (any (strcmp (arg_st.devopt, fieldnames (aliases))))
-    arg_st.devopt = aliases.(arg_st.devopt);
-  endif
-
-  ## FIXME - eps2 & epsc2 needs to be handled
-  if (strcmp (arg_st.devopt, "pswrite"))
-    arg_st.ghostscript.level = 1;
-  elseif (strcmp (arg_st.devopt, "ps2write"))
-    arg_st.ghostscript.level = 2;
-  endif
-
-  if ((any (strcmp (arg_st.devopt, gs_device_list))
-       && ! arg_st.formatted_for_printing)
-      || any (strcmp (arg_st.devopt, {"pswrite", "ps2write", "pdfwrite"})))
-    ## Use ghostscript for graphic formats
-    arg_st.ghostscript.device = arg_st.devopt;
-    arg_st.ghostscript.output = arg_st.name;
-    arg_st.ghostscript.antialiasing = true;
-    if (arg_st.formatted_for_printing)
-      arg_st.ghostscript.epscrop = ! arg_st.loose;
-    else
-      ## pstoedit throws errors if the EPS file isn't cropped
-      arg_st.ghostscript.epscrop = true;
-    endif
-  elseif (all (! strcmp (arg_st.devopt, dev_list)))
-    ## Assume we are formating output for a printer
-    arg_st.formatted_for_printing = true;
-    arg_st.ghostscript.device = arg_st.devopt;
-    arg_st.ghostscript.output = arg_st.name;
-    arg_st.ghostscript.antialiasing = false;
-    arg_st.ghostscript.epscrop = ! arg_st.loose;
-  endif
-
-  if (arg_st.send_to_printer)
-    if (isempty (arg_st.name))
-      ## Pipe the ghostscript output 
-      arg_st.name = "-";
-    else
-      error ("print: a file name may not specified when spooling to a printer")
-    endif
-    if (! any (strcmp (arg_st.devopt, gs_device_list))
-      || ! any (strcmp (arg_st.devopt, {"pswrite", "ps2write"})))
-      ## Only postscript and supported ghostscript devices
-      error ("print: invalid format for spooling to a printer")
-    endif
-  elseif (isempty (arg_st.name))
-    error ("print: an output file name must be specified")
-  endif
-
-  if (isempty (arg_st.canvas_size))
-    if (isfigure (arg_st.figure))
-      [arg_st.ghostscript.papersize, paperposition] = ...
-                           gs_papersize (arg_st.figure, arg_st.orientation);
-    else
-      ## allows tests to be run
-      arg_st.ghostscript.papersize = "letter";
-      paperposition = [0.25, 2.50, 8.00, 6.00] * 72;
-    endif
-    arg_st.canvas_size = paperposition(3:4);
-    if (strcmp (__graphics_toolkit__, "gnuplot") && ! arg_st.ghostscript.epscrop)
-      arg_st.ghostscript.pageoffset = paperposition(1:2) - 50;
-    else
-      arg_st.ghostscript.pageoffset = paperposition(1:2);
-    endif
-  else
-    ## Convert canvas size to points from pixels.
-    if (! isempty (arg_st.fontsize))
-      ## Work around the eps bbox having whole numbers (both gnuplot & gl2ps).
-      arg_st.scalefontsize = arg_st.ghostscript.resolution / 72;
-    endif
-    arg_st.ghostscript.resolution = 72;
-    arg_st.ghostscript.papersize = arg_st.canvas_size;
-    arg_st.ghostscript.epscrop = true;
-    arg_st.ghostscript.pageoffset = [0, 0];
-  endif
-
-  if (arg_st.formatted_for_printing)
-    arg_st.ghostscript.resolution = [];
-  else
-    arg_st.ghostscript.papersize = "";
-    arg_st.ghostscript.pageoffset = [0, 0];
-  endif
-
-  if (warn_on_missing_binary)
-    if (isempty (arg_st.ghostscript.binary))
-      warning ("print:missing_gs", "print.m: Ghostscript binary is not available.\nOnly eps output is available.");
-    else
-      if (isempty (arg_st.epstool_binary))
-        warning ("print:missing_epstool", "print.m: epstool binary is not available.\nSome output formats are not available.");
-      endif
-      if (isempty (arg_st.fig2dev_binary))
-        warning ("print:missing_fig2dev", "print.m: fig2dev binary is not available.\nSome output formats are not available.");
-      endif
-      if (isempty (arg_st.pstoedit_binary))
-        warning ("print:missing_pstoedit", "print.m: pstoedit binary is not available.\nSome output formats are not available.");
-      endif
-    endif
-    warn_on_missing_binary = false;
-  endif
-
-endfunction
-
-## Test blocks are not allowed (and not needed) for private functions
-#%!test
-%! opts = __print_parse_opts__ ();
-%! assert (opts.devopt, "pswrite");
-%! assert (opts.use_color, 1);
-%! assert (opts.send_to_printer, true);
-%! assert (opts.canvas_size, [576, 432]);
-%! assert (opts.ghostscript.device, "pswrite");
-
-#%!test
-%! opts = __print_parse_opts__ ("test.pdf", "-S640,480");
-%! assert (opts.canvas_size, [307.2, 230.4], 0.1);
-
-#%!test
-%! opts = __print_parse_opts__ ("-dpsc", "-append", "-loose");
-%! assert (opts.devopt, "pswrite");
-%! assert (opts.send_to_printer, true);
-%! assert (opts.use_color, 1);
-%! assert (opts.append_to_file, false);
-%! assert (opts.ghostscript.device, "pswrite");
-%! assert (opts.ghostscript.epscrop, false);
-
-#%!test
-%! opts = __print_parse_opts__ ("-deps", "-tight");
-%! assert (opts.tight_flag, true);
-%! assert (opts.send_to_printer, true);
-%! assert (opts.use_color, -1);
-%! assert (opts.ghostscript.device, "");
-
-#%!test
-%! opts = __print_parse_opts__ ("-djpg", "foobar", "-mono", "-loose");
-%! assert (opts.devopt, "jpeg");
-%! assert (opts.name, "foobar.jpg");
-%! assert (opts.ghostscript.device, "jpeg");
-%! assert (opts.ghostscript.epscrop, true);
-%! assert (opts.ghostscript.papersize, "");
-%! assert (opts.ghostscript.pageoffset, [0, 0]);
-%! assert (opts.send_to_printer, false);
-%! assert (opts.printer, "");
-%! assert (opts.use_color, -1);
-
-#%!test
-%! opts = __print_parse_opts__ ("-ddeskjet", "foobar", "-mono", "-Pmyprinter");
-%! assert (opts.ghostscript.output, "foobar.deskjet");
-%! assert (opts.ghostscript.device, "deskjet");
-%! assert (opts.devopt, "deskjet");
-%! assert (opts.send_to_printer, true);
-%! assert (opts.printer, "-Pmyprinter");
-%! assert (opts.use_color, -1);
-
-#%!test
-%! opts = __print_parse_opts__ ("-f5", "-dljet3");
-%! assert (opts.ghostscript.device, "ljet3");
-%! assert (strfind (opts.ghostscript.output, ".ljet3"));
-%! assert (opts.devopt, "ljet3");
-%! assert (opts.send_to_printer, true);
-%! assert (opts.figure, 5);
-
-function cmd = __quote_path__ (cmd)
-  if (! isempty (cmd))
-    is_quoted = all (cmd([1, end]) == "'");
-    if (! is_quoted)
-      dos_shell = ! isunix () && ispc ();
-      if (dos_shell && any (cmd == "/"))
-        cmd = strrep (cmd, "/", "\\");
-      endif
-      if (any (cmd == " "))
-        cmd = strcat ('"', strrep (cmd, '"', '""') ,'"');
-      endif
-    endif
-  endif
-endfunction
-
-function gs = __ghostscript_binary__ ()
-
-  persistent ghostscript_binary = ""
-  persistent warn_on_no_ghostscript = true
-  persistent warn_on_bad_gsc = true
-
-  if (isempty (ghostscript_binary))
-    GSC = getenv ("GSC");
-    if (exist (GSC, "file")
-        || (! isempty (GSC) && file_in_path (getenv ("PATH"), GSC)))
-      gs_binaries = {GSC};
-    elseif (! isempty (GSC) && warn_on_bad_gsc)
-      warning ("print:badgscenv",
-               "print.m: GSC environment variable not set properly");
-      warn_on_bad_gsc = false;
-      gs_binaries = {};
-    else
-      gs_binaries = {};
-    endif
-    if (isunix ())
-      ## Unix - Includes Mac OSX and Cygwin.
-      gs_binaries = horzcat (gs_binaries, {"gs", "gs.exe"});
-    else
-      ## pc - Includes Win32 and mingw.
-      gs_binaries = horzcat (gs_binaries, {"gs.exe", "gswin32c.exe", "gswin64c.exe", "mgs.exe"});
-    endif
-    n = 0;
-    while (n < numel (gs_binaries) && isempty (ghostscript_binary))
-      n = n + 1;
-      ghostscript_binary = file_in_path (getenv ("PATH"), gs_binaries{n});
-    endwhile
-    if (warn_on_no_ghostscript && isempty (ghostscript_binary))
-      warning ("print:noghostscript",
-               "print.m: ghostscript not found in PATH");
-      warn_on_no_ghostscript = false;
-    endif
-  endif
-
-  gs = ghostscript_binary;
-
-endfunction
-
-function bin = __find_binary__ (binary)
-
-  persistent data = struct ()
-
-  if (! isfield (data, binary))
-    ## Reinitialize when 'user_binaries' is present.
-    data.(binary).bin = "";
-    data.(binary).warn_on_absence = false;
-  endif
-
-  if (isempty (data.(binary).bin))
-    if (isunix ())
-      ## Unix - Includes Mac OSX and Cygwin.
-      binaries = strcat (binary, {"", ".exe"});
-    else
-      ## pc - Includes Win32 and mingw.
-      binaries = strcat (binary, {".exe"});
-    endif
-    n = 0;
-    while (n < numel (binaries) && isempty (data.(binary).bin))
-      n = n + 1;
-      data.(binary).bin = file_in_path (getenv ("PATH"), binaries{n});
-    endwhile
-    if (isempty (data.(binary).bin) && data.(binary).warn_on_absence)
-      warning (sprintf ("print:no%s", binary),
-               "print.m: '%s' not found in PATH", binary);
-      data.(binary).warn_on_absence = false;
-    endif
-  endif
-
-  bin = data.(binary).bin;
-
-endfunction
-
-function [papersize, paperposition] = gs_papersize (hfig, paperorientation)
-  persistent papertypes papersizes
-
-  if (isempty (papertypes))
-    papertypes = {"usletter", "uslegal",     "a0",     "a1", ...
-                        "a2",      "a3",     "a4",     "a5", ...
-                        "b0",      "b1",     "b2",     "b3", ...
-                        "b4",      "b5", "arch-a", "arch-b", ...
-                    "arch-c",  "arch-d", "arch-e",      "a", ...
-                         "b",       "c",      "d",      "e", ...
-                   "tabloid"};
-    papersizes = [ 8.5, 11.0;  8.5, 14.0; 33.1, 46.8; 23.4, 33.1;
-                  16.5, 23.4; 11.7, 16.5;  8.3, 11.7;  5.8,  8.3;
-                  39.4, 55.7; 27.8, 39.4; 19.7, 27.8; 13.9, 19.7;
-                   9.8, 13.9;  6.9,  9.8;  9.0, 12.0; 12.0, 18.0;
-                  18.0, 24.0; 24.0, 36.0; 36.0, 48.0;  8.5, 11.0;
-                  11.0, 17.0; 18.0, 24.0; 24.0, 36.0; 36.0, 48.0;
-                  11.0, 17.0] * 72;
-  endif
-
-  papertype = get (hfig, "papertype");
-  paperunits = get (hfig, "paperunits");
-  paperposition = get (hfig, "paperposition");
-  if (strcmp (papertype, "<custom>"))
-    papersize = get (hfig, "papersize");
-    papersize = convert2points (papersize , paperunits);
-  else
-    papersize = papersizes (strcmp (papertypes, papertype), :);
-  endif
-
-  if (strcmp (paperunits, "normalized"))
-    paperposition = paperposition .* papersize([1,2,1,2]);
-  else
-    paperposition = convert2points (paperposition, paperunits);
-  endif
-
-  ## FIXME - This will be obsoleted by listeners for paper properties.
-  ##         Papersize is tall when portrait,and wide when landscape.
-  if ((papersize(1) > papersize(2) && strcmpi (paperorientation, "portrait"))
-      || (papersize(1) < papersize(2) && strcmpi (paperorientation, "landscape")))
-    papersize = papersize([2,1]);
-    paperposition = paperposition([2,1,4,3]);
-  endif
-
-  if ((! strcmp (papertype, "<custom>")) && (strcmp (paperorientation, "portrait")))
-    ## For portrait use the ghostscript name
-    papersize = papertype;
-    papersize(papersize=="-") = "";
-    papersize = strrep (papersize, "us", "");
-    switch (papersize)
-      case "a"
-        papersize = "letter";
-      case {"b", "tabloid"}
-        papersize = "11x17";
-      case {"c", "d", "e"}
-        papersize = strcat ("arch", papersize);
-    endswitch
-    if (strncmp (papersize, "arch", 4))
-      papersize(end) = upper (papersize(end));
-    endif
-  endif
-
-endfunction
-
-function value = convert2points (value, units)
-  switch (units)
-    case "inches"
-      value = value * 72;
-    case "centimeters"
-      value = value * 72 / 2.54;
-    case "normalized"
-      error ("print:customnormalized",
-             "print.m: papersize=='<custom>' and paperunits='normalized' may not be combined");
-  endswitch
-endfunction
-
-function device_list = gs_device_list ();
-  ## Graphics formats/languages, not priners.
-  device_list = {"bmp16"; "bmp16m"; "bmp256"; "bmp32b"; "bmpgray"; ...
-                 "epswrite"; "jpeg"; "jpegcymk"; "jpeggray"; "pbm"; ...
-                 "pbmraw"; "pcx16"; "pcx24b"; "pcx256"; "pcx2up"; ...
-                 "pcxcmyk"; "pcxgray"; "pcxmono"; "pdfwrite"; "pgm"; ...
-                 "pgmraw"; "pgnm"; "pgnmraw"; "png16"; "png16m"; ...
-                 "png256"; "png48"; "pngalpha"; "pnggray"; "pngmono"; ...
-                 "pnm"; "pnmraw"; "ppm"; "ppmraw"; "ps2write"; ...
-                 "pswrite"; "tiff12nc"; "tiff24nc"; "tiff32nc"; ...
-                 "tiffcrle"; "tiffg3"; "tiffg32d"; "tiffg4"; ...
-                 "tiffgray"; "tifflzw"; "tiffpack"; "tiffsep"};
-endfunction
-
-function aliases = gs_aliases ();
-  ## Aliases for other devices: "bmp", "png", "tiff", "tiffn", "pdf",
-  ##                            "ps", "ps2", "psc", "psc2"
-  ##
-  ## eps, epsc, eps2, epsc2 are not included here because those are
-  ## are generated by the graphics toolkit.
-  aliases.bmp = "bmp32b";
-  aliases.pdf = "pdfwrite";
-  aliases.png = "png16m";
-  aliases.ps = "pswrite";
-  aliases.ps2 = "ps2write";
-  aliases.psc = "pswrite";
-  aliases.psc2 = "ps2write";
-  aliases.tiff = "tiff24nc";
-  aliases.tiffn = "tiff24nc";
-endfunction
-
--- a/scripts/plot/private/__quiver__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,448 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{hg} =} __quiver__ (@dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function hg = __quiver__ (varargin)
-
-  h = varargin{1};
-  is3d = varargin{2};
-
-  autoscale = 0.9;
-  arrowsize = 0.2;
-
-  firstnonnumeric = Inf;
-  for i = 3:nargin
-    if (! isnumeric (varargin{i}))
-      firstnonnumeric = i;
-      break;
-    endif
-  endfor
-
-  ioff = 3;
-  if (nargin < (6 + is3d) || firstnonnumeric < (6 + is3d))
-    u = varargin{ioff++};
-    v = varargin{ioff++};
-    if (is3d)
-      w = varargin{ioff++};
-      [x, y, z] = meshgrid (1:columns (u), 1:rows (u), 1:max (size (w)));
-    else
-      [x, y] = meshgrid (1:columns (u), 1:rows (u));
-    endif
-    if (nargin >= ioff && isnumeric (varargin{ioff})
-        && isscalar (varargin{ioff}))
-      autoscale = varargin{ioff++};
-    endif
-  else
-    x = varargin{ioff++};
-    y = varargin{ioff++};
-    if (is3d)
-      z = varargin{ioff++};
-    endif
-    u = varargin{ioff++};
-    v = varargin{ioff++};
-    if (is3d)
-      w = varargin{ioff++};
-      if (isvector (x) && isvector (y) && isvector (z)
-          && (! isvector (u) || ! isvector (v) || ! isvector (w)))
-        [x, y, z] = meshgrid (x, y, z);
-      endif
-    else
-      if (isvector (x) && isvector (y) && (! isvector (u) || ! isvector (v)))
-        [x, y] = meshgrid (x, y);
-      endif
-    endif
-    if (nargin >= ioff && isnumeric (varargin{ioff})
-        && isscalar (varargin{ioff}))
-      autoscale = varargin{ioff++};
-    endif
-  endif
-
-  have_filled = false;
-  have_line_spec = false;
-  args = {};
-  while (ioff <= nargin)
-    arg = varargin{ioff++};
-    if (ischar (arg) && strcmpi (arg, "filled"))
-      have_filled = true;
-    elseif ((ischar (arg) || iscellstr (arg))
-            && ! have_line_spec)
-      [linespec, valid] = __pltopt__ ("quiver", arg, false);
-      if (valid)
-        have_line_spec = true;
-        if (strcmp (linespec.linestyle, "none"))
-          linespec.linestyle = "-";
-        endif
-      else
-        args {end + 1} = arg;
-        if (ioff <= nargin)
-          args {end + 1} = varargin{ioff++};
-        endif
-      endif
-    else
-      args {end + 1} = arg;
-      if (ioff <= nargin)
-        args {end + 1} = varargin{ioff++};
-      endif
-    endif
-  endwhile
-
-  if (autoscale && numel (u) > 1)
-    ## Scale the arrows to fit in the grid
-    if (isvector (x))
-      ny = nx = length (x);
-    else
-      [nx, ny] = size (x);
-    endif
-    dx = (max (x(:)) - min (x(:))) ./ nx;
-    dy = (max (y(:)) - min (y(:))) ./ ny;
-    if (is3d)
-      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
-      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
-    else
-      dz = 0;
-      len = max (sqrt (u(:).^2 + v(:).^2));
-    endif
-    if (len > 0)
-      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
-      if (sd != 0)
-        s = sqrt (2) * autoscale * sd;
-      else # special case of identical points with multiple vectors
-        s = autoscale;
-      endif
-      uu = s * u;
-      vv = s * v;
-      if (is3d)
-        ww = s*w;
-      endif
-    endif
-  else
-    uu = u;
-    vv = v;
-    if (is3d)
-      ww = w;
-    endif
-  endif
-
-  hstate = get (h, "nextplot");
-  unwind_protect
-    hg = hggroup ();
-    if (is3d)
-      args = __add_datasource__ ("quiver3", hg,
-                                 {"x", "y", "z", "u", "v", "w"}, args{:});
-    else
-      args = __add_datasource__ ("quiver", hg,
-                                 {"x", "y", "z", "u", "v", "w"}, args{:});
-    endif
-    hold on;
-
-    addproperty ("xdata", hg, "data", x);
-    addproperty ("ydata", hg, "data", y);
-
-    addproperty ("udata", hg, "data", u);
-    addproperty ("vdata", hg, "data", v);
-    if (is3d)
-      addproperty ("zdata", hg, "data", z);
-      addproperty ("wdata", hg, "data", w);
-    else
-      addproperty ("zdata", hg, "data", []);
-      addproperty ("wdata", hg, "data", []);
-    endif
-
-    addlistener (hg, "xdata", @update_data);
-    addlistener (hg, "ydata", @update_data);
-    addlistener (hg, "zdata", @update_data);
-    addlistener (hg, "udata", @update_data);
-    addlistener (hg, "vdata", @update_data);
-    addlistener (hg, "wdata", @update_data);
-
-    x = x(:);
-    y = y(:);
-    xend = x + uu(:);
-    yend = y + vv(:);
-    if (is3d)
-      z = z(:);
-      zend = z + ww(:);
-    endif
-
-    if (have_line_spec)
-      if (is3d)
-        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
-                    [y.'; yend.'; NaN(1, length (y))](:),
-                    [z.'; zend.'; NaN(1, length (z))](:),
-                    "linestyle", linespec.linestyle,
-                    "color", linespec.color, "parent", hg);
-      else
-        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
-                   [y.'; yend.'; NaN(1, length (y))](:),
-                   "linestyle", linespec.linestyle,
-                    "color", linespec.color, "parent", hg);
-      endif
-    else
-      if (is3d)
-        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
-                    [y.'; yend.'; NaN(1, length (y))](:),
-                    [z.'; zend.'; NaN(1, length (z))](:),
-                    "color", "black", "parent", hg);
-      else
-        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
-                   [y.'; yend.'; NaN(1, length (y))](:),
-                   "parent", hg);
-      endif
-    endif
-
-    xtmp = x + uu(:) .* (1 - arrowsize);
-    ytmp = y + vv(:) .* (1 - arrowsize);
-
-    if (is3d)
-      xarrw1 = xtmp + sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
-      xarrw2 = xtmp - sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
-      yarrw1 = ytmp - sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
-      yarrw2 = ytmp + sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
-
-      zarrw1 = zarrw2 = zend - ww(:) * arrowsize;
-    else
-      xarrw1 = xtmp + (y - yend) * arrowsize / 3;
-      xarrw2 = xtmp - (y - yend) * arrowsize / 3;
-      yarrw1 = ytmp - (x - xend) * arrowsize / 3;
-      yarrw2 = ytmp + (x - xend) * arrowsize / 3;
-    endif
-
-    if (have_line_spec)
-      if (isfield (linespec, "marker")
-          && ! strcmp (linespec.marker, "none"))
-        if (is3d)
-          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
-                      "linestyle", "none", "parent", hg);
-        else
-          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                     "linestyle", "none", "parent", hg);
-        endif
-      else
-        if (is3d)
-          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
-                      "linestyle", linespec.linestyle,
-                      "color", linespec.color, "parent", hg);
-        else
-          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                     "linestyle", linespec.linestyle,
-                      "color", linespec.color, "parent", hg);
-        endif
-      endif
-    elseif (is3d)
-      h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                  [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                  [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
-                  "color", "black", "parent", hg);
-    else
-      h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                 [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                 "parent", hg);
-    endif
-
-    if (! have_line_spec
-        || (isfield (linespec, "marker")
-            && strcmp (linespec.marker, "none")))
-      if (is3d)
-        h3 = plot3 (x, y, z, "linestyle", "none", "marker", "none",
-                    "parent", hg);
-      else
-        h3 = plot (x, y, "linestyle", "none", "marker", "none", "parent", hg);
-      endif
-    else
-      if (is3d)
-        h3 = plot3 (x, y, z, "linestyle", "none", "marker", linespec.marker,
-                    "parent", hg);
-      else
-
-        h3 = plot (x, y, "linestyle", "none", "marker", linespec.marker,
-                   "parent", hg);
-      endif
-    endif
-    if (have_filled)
-      ## FIXME: gnuplot doesn't respect the markerfacecolor field
-      set (h3, "markerfacecolor", get (h1, "color"));
-    endif
-
-    ## Set up the hggroup properties and listeners
-    if (autoscale)
-      addproperty ("autoscale", hg, "radio", "{on}|off", "on");
-      addproperty ("autoscalefactor", hg, "data", autoscale);
-    else
-      addproperty ("autoscale", hg, "radio", "{on}|off", "off");
-      addproperty ("autoscalefactor", hg, "data", 1.0);
-    endif
-    addlistener (hg, "autoscale", @update_data);
-    addlistener (hg, "autoscalefactor", @update_data);
-
-    addproperty ("maxheadsize", hg, "data", arrowsize);
-    addlistener (hg, "maxheadsize", @update_data);
-
-    addproperty ("showarrowhead", hg, "radio", "{on}|off", "on");
-    addlistener (hg, "showarrowhead", @update_props);
-
-    addproperty ("color", hg, "linecolor", get (h1, "color"));
-    addproperty ("linewidth", hg, "linelinewidth", get (h1, "linewidth"));
-    addproperty ("linestyle", hg, "linelinestyle", get (h1, "linestyle"));
-    addproperty ("marker", hg, "linemarker", get (h3, "marker"));
-    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
-                 get (h3, "markerfacecolor"));
-    addproperty ("markersize", hg, "linemarkersize", get (h3, "markersize"));
-
-    addlistener (hg, "color", @update_props);
-    addlistener (hg, "linewidth", @update_props);
-    addlistener (hg, "linestyle", @update_props);
-    addlistener (hg, "marker", @update_props);
-    addlistener (hg, "markerfacecolor", @update_props);
-    addlistener (hg, "markersize", @update_props);
-
-    ## Matlab property, although Octave does not implement it.
-    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-    if (! isempty (args))
-      set (hg, args{:});
-    endif
-  unwind_protect_cleanup
-    set (h, "nextplot", hstate);
-  end_unwind_protect
-
-endfunction
-
-function update_data (h, d)
-  x = get (h, "xdata");
-  y = get (h, "ydata");
-  z = get (h, "zdata");
-
-  u = get (h, "udata");
-  v = get (h, "vdata");
-  w = get (h, "wdata");
-
-  s = get (h, "autoscalefactor");
-  arrowsize = get (h, "maxheadsize");
-
-  kids = get (h, "children");
-
-  if (isempty (z) || isempty (w))
-    is3d = false;
-  else
-    is3d = true;
-  endif
-
-  if (strcmpi (get (h, "autoscale"), "on") && s != 0)
-    ## Scale the arrows to fit in the grid
-    if (isvector (x))
-      ny = nx = length (x);
-    else
-      [nx, ny] = size (x);
-    endif
-    dx = (max (x(:)) - min (x(:))) ./ nx;
-    dy = (max (y(:)) - min (y(:))) ./ ny;
-    if (is3d)
-      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
-      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
-    else
-      dz = 0;
-      len = max (sqrt (u(:).^2 + v(:).^2));
-    endif
-    if (len > 0)
-      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
-      if (sd != 0)
-        s *= sqrt (2) * sd;
-      endif
-      u = s * u;
-      v = s * v;
-      if (is3d)
-        w = s*w;
-      endif
-    endif
-  endif
-
-  x = x(:);
-  y = y(:);
-  xend = x + u(:);
-  yend = y + v(:);
-  if (is3d)
-    z = z(:);
-    zend = z + w(:);
-  endif
-
-  set (kids (3), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
-  set (kids (3), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
-  if (is3d)
-    set (kids (3), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
-  endif
-
-  xtmp = x + u(:) .* (1 - arrowsize);
-  ytmp = y + v(:) .* (1 - arrowsize);
-  xarrw1 = xtmp + (y - yend) * arrowsize / 3;
-  xarrw2 = xtmp - (y - yend) * arrowsize / 3;
-  yarrw1 = ytmp - (x - xend) * arrowsize / 3;
-  yarrw2 = ytmp + (x - xend) * arrowsize / 3;
-  if (is3d)
-    zarrw1 = zarrw2 = zend - w(:) * arrowsize;
-  endif
-
-  set (kids (2), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
-  set (kids (2), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
-  if (is3d)
-    set (kids (2), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
-  endif
-
-  set (kids (2), "xdata", [xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:));
-  set (kids (2), "ydata", [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:));
-  if (is3d)
-    set (kids (2), "zdata", [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:));
-  endif
-
-  set (kids (1), "xdata", x);
-  set (kids (1), "ydata", y);
-  if (is3d)
-    set (kids (1), "zdata", z);
-  endif
-
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-
-  set (kids(3), "color", get (h, "color"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"));
-  set (kids(2), "color", get (h, "color"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"));
-  if (strcmpi (get (h, "showarrowhead"), "on"))
-    set (kids (2), "visible", "on");
-  else
-    set (kids (2), "visible", "off");
-  endif
-  set (kids(1), "color", get (h, "color"),
-       "marker", get (h, "marker"),
-       "markerfacecolor", get (h, "markerfacecolor"),
-       "markersize", get (h, "markersize"));
-endfunction
-
--- a/scripts/plot/private/__scatter__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,374 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{hg} =} __scatter__ (@dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function hg = __scatter__ (varargin)
-
-  hax = varargin{1};  # We don't do anything with this.  Could remove it.
-  nd  = varargin{2};
-  fcn = varargin{3};
-  x   = varargin{4}(:);
-  y   = varargin{5}(:);
-
-  if (nd == 2)
-    istart = 6;
-  else
-    z = varargin{6}(:);
-    istart = 7;
-  endif
-
-  if (istart <= nargin)
-    s = varargin{istart}(:);
-    if (isempty (s) || ischar (s))
-      s = 6;
-    endif
-    if (! ischar (varargin{istart}))
-      istart++;
-    endif
-  else
-    s = 6;
-  endif
-
-  ## Remove NaNs
-  idx = isnan (x) | isnan (y) | isnan (s);
-  if (nd == 3)
-    idx |= isnan (z);
-    z(idx) = [];
-  endif
-  x(idx) = [];
-  y(idx) = [];
-  if (nd == 2)
-    z = zeros (length (x), 0);
-  endif
-  if (numel (s) > 1)
-    s(idx) = [];
-  endif
-
-  firstnonnumeric = find (! cellfun ("isnumeric", varargin(istart:nargin)), 1);
-  if (isempty (firstnonnumeric))
-    firstnonnumeric = Inf;
-  else
-    firstnonnumeric += istart - 1;
-  endif
-
-  if (istart <= nargin && firstnonnumeric > istart)
-    c = varargin{istart};
-    if (isvector (c) && columns (c) != 3)
-      c = c(:);
-    endif
-  elseif (firstnonnumeric == istart && ischar (varargin{istart})
-          && ! (   strcmpi (varargin{istart}, "filled")
-                || strcmpi (varargin{istart}, "fill")))
-    c = varargin{istart};
-    firstnonnumeric++;
-  else
-    c = [];
-  endif
-
-  newargs = {};
-  filled = false;
-  have_marker = false;
-  marker = "o";
-  iarg = firstnonnumeric;
-  while (iarg <= nargin)
-    arg = varargin{iarg++};
-    if (ischar (arg) && (strcmpi (arg, "filled") || strcmpi (arg, "fill")))
-      filled = true;
-    elseif ((ischar (arg) || iscellstr (arg)) && ! have_marker)
-      [linespec, valid] = __pltopt__ (fcn, arg, false);
-      if (valid)
-        have_marker = true;
-        marker = linespec.marker;
-        if (strcmp (marker, "none"))
-          marker = "o";
-        elseif (isempty (marker))
-          have_marker = false;
-          [~, marker] = __next_line_style__ ();
-        endif
-      else
-        error ("%s: invalid linespec", fcn);
-      endif
-    else
-      newargs{end+1} = arg;
-      if (iarg <= nargin)
-        newargs{end+1} = varargin{iarg++};
-      endif
-    endif
-  endwhile
-
-  if (isempty (c))
-    c = __next_line_color__ ();
-  endif
-
-  ## Must occur after __next_line_color__ in order to work correctly.
-  hg = hggroup ();
-  newargs = __add_datasource__ (fcn, hg, {"x", "y", "z", "c", "size"},
-                                newargs{:});
-
-  addproperty ("xdata", hg, "data", x);
-  addproperty ("ydata", hg, "data", y);
-  addproperty ("zdata", hg, "data", z);
-  if (ischar (c))
-    ## For single explicit color, cdata is unused
-    addproperty ("cdata", hg, "data", []);
-  else
-    addproperty ("cdata", hg, "data", c);
-  endif
-  addproperty ("sizedata", hg, "data", s);
-  addlistener (hg, "xdata", @update_data);
-  addlistener (hg, "ydata", @update_data);
-  addlistener (hg, "zdata", @update_data);
-  addlistener (hg, "cdata", @update_data);
-  addlistener (hg, "sizedata", @update_data);
-
-  one_explicit_color = ischar (c) || isequal (size (c), [1, 3]);
-
-  if (numel (x) <= 100)
-
-    ## For small number of points, we'll construct an object for each point.
-
-    if (numel (s) == 1)
-      s = repmat (s, numel (x), 1);
-    endif
-
-    if (one_explicit_color)
-      for i = 1 : numel (x)
-        if (filled)
-          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                        "facecolor", "none", "edgecolor", "none",
-                        "marker", marker,  "markersize", s(i),
-                        "markeredgecolor", c, "markerfacecolor", c,
-                        "linestyle", "none");
-        else
-          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                        "facecolor", "none", "edgecolor", "none",
-                        "marker", marker,  "markersize", s(i),
-                        "markeredgecolor", c, "markerfacecolor", "none",
-                        "linestyle", "none");
-        endif
-      endfor
-    else
-      if (rows (c) == 1)
-        c = repmat (c, rows (x), 1);
-      endif
-      for i = 1 : numel (x)
-        if (filled)
-          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                        "facecolor", "none", "edgecolor", "none",
-                        "marker", marker, "markersize", s(i),
-                        "markeredgecolor", "none",
-                        "markerfacecolor", "flat",
-                        "cdata", c(i,:), "facevertexcdata", c(i,:),
-                        "linestyle", "none");
-        else
-          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                        "facecolor", "none", "edgecolor", "none",
-                        "marker", marker, "markersize", s(i),
-                        "markeredgecolor", "flat",
-                        "markerfacecolor", "none",
-                        "cdata", c(i,:), "facevertexcdata", c(i,:),
-                        "linestyle", "none");
-        endif
-      endfor
-    endif
-
-  else
-
-    ## For larger numbers of points, we split the points by common color.
-
-    vert = [x, y, z];
-    if (one_explicit_color)
-      render_size_color (hg, vert, s, c, marker, filled, true);
-    else
-      if (rows (c) == 1)
-        c = repmat (c, rows (x), 1);
-      endif
-      ## We want to group points by color.  So first get all the unique colors
-      [cc, ~, c_to_cc] = unique (c, "rows");
-
-      for i = 1 : rows (cc)
-        ## Now for each possible unique color, get the logical index of
-        ## points that correspond to that color
-        idx = (i == c_to_cc);
-        if (isscalar (s))
-          render_size_color (hg, vert(idx, :), s, c(idx,:),
-                                 marker, filled, true);
-        else
-          render_size_color (hg, vert(idx, :), s(idx), c(idx,:),
-                                 marker, filled, true);
-        endif
-      endfor
-
-    endif
-  endif
-
-  if (! ischar (c) && rows (c) > 1)
-    ax = get (hg, "parent");
-    clim = get (ax, "clim");
-    if (min (c(:)) < clim(1))
-      clim(1) = min (c(:));
-      set (ax, "clim", clim);
-    endif
-    if (max (c(:)) > clim(2))
-      set (ax, "clim", [clim(1), max(c(:))]);
-    endif
-  endif
-
-  addproperty ("linewidth", hg, "patchlinewidth", 0.5);
-  addproperty ("marker", hg, "patchmarker", marker);
-  if (filled)
-    addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "none");
-    if (one_explicit_color)
-      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", c);
-    else
-      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "flat");
-    endif
-  else
-    addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "none");
-    if (one_explicit_color)
-      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", c);
-    else
-      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "flat");
-    endif
-  endif
-  addlistener (hg, "linewidth", @update_props);
-  addlistener (hg, "marker", @update_props);
-  addlistener (hg, "markerfacecolor", @update_props);
-  addlistener (hg, "markeredgecolor", @update_props);
-
-  ## Matlab property, although Octave does not implement it.
-  addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-  if (! isempty (newargs))
-    set (hg, newargs{:});
-  endif
-
-endfunction
-
-function render_size_color (hg, vert, s, c, marker, filled, isflat)
-  if (isscalar (s))
-    x = vert(:,1);
-    y = vert(:,2);
-    z = vert(:,3:end);
-    toolkit = get (ancestor (hg, "figure"), "__graphics_toolkit__");
-    ## Does gnuplot only support triangles with different vertex colors ?
-    ## TODO: Verify gnuplot can only support one color.  If RGB triplets
-    ##       can be assigned to each vertex, then fix __go_draw_axes__.m
-    gnuplot_hack = (numel (x) > 1 && columns (c) == 3
-                    && strcmp (toolkit, "gnuplot"));
-    if (ischar (c) || ! isflat || gnuplot_hack)
-      if (filled)
-        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker,
-                          "markeredgecolor", "none",
-                          "markerfacecolor", c(1,:),
-                          "markersize", s, "linestyle", "none");
-      else
-        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker,
-                          "markeredgecolor", c(1,:),
-                          "markerfacecolor", "none",
-                          "markersize", s, "linestyle", "none");
-      endif
-    else
-      if (filled)
-        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker, "markersize", s,
-                          "markeredgecolor", "none",
-                          "markerfacecolor", "flat",
-                          "cdata", c, "facevertexcdata", c,
-                          "linestyle", "none");
-      else
-        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker, "markersize", s,
-                          "markeredgecolor", "flat",
-                          "markerfacecolor", "none",
-                          "cdata", c, "facevertexcdata", c,
-                          "linestyle", "none");
-      endif
-    endif
-  else
-    ## Round size to one decimal place.
-    [ss, ~, s_to_ss] = unique (ceil (s*10) / 10);
-    for i = 1:rows (ss)
-      idx = (i == s_to_ss);
-      render_size_color (hg, vert(idx,:), ss(i), c,
-                             marker, filled, isflat);
-    endfor
-  endif
-endfunction
-
-function update_props (h, d)
-  lw = get (h, "linewidth");
-  m  = get (h, "marker");
-  fc = get (h, "markerfacecolor");
-  ec = get (h, "markeredgecolor");
-  kids = get (h, "children");
-
-  set (kids, "linewidth", lw, "marker", m,
-             "markerfacecolor", fc, "markeredgecolor", ec);
-endfunction
-
-function update_data (h, d)
-  x = get (h, "xdata");
-  y = get (h, "ydata");
-  z = get (h, "zdata");
-  c = get (h, "cdata");
-  if (rows (c) == 1)
-    c = repmat (c, numel (x), 1);
-  endif
-  s = get (h, "sizedata");
-  if (numel (s) == 1)
-    s = repmat (s, numel (x), 1);
-  endif
-  hlist = get (h, "children");
-
-  if (isempty (z))
-    for i = 1 : length (hlist)
-      set (hlist(i), "vertices", [x(i), y(i)],
-                     "cdata", reshape (c(i,:),[1, size(c)(2:end)]),
-                     "facevertexcdata", c(i,:),
-                     "markersize", s(i));
-    endfor
-  else
-    for i = 1 : length (hlist)
-      set (hlist(i), "vertices", [x(i), y(i), z(i)],
-                     "cdata", reshape (cd(i,:),[1, size(cd)(2:end)]),
-                     "facevertexcdata", cd(i,:),
-                     "markersize", s(i));
-    endfor
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__stem__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,430 +0,0 @@
-## Copyright (C) 2006-2012 Michel D. Schmid
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __stem__ (@var{have_z}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
-## Adapted-by: jwe
-
-function h = __stem__ (have_z, varargin)
-
-  if (have_z)
-    caller = "stem3";
-  else
-    caller = "stem";
-  endif
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ (caller, varargin{:});
-
-  [x, y, z, dofill, llc, ls, mmc, ms, varargin] = ...
-                                           check_stem_arg (have_z, varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    hold_state = get (hax, "nextplot");
-    set (hax, "nextplot", "add");
-
-    h = [];
-    nx = rows (x);
-    for i = 1 : columns (x)
-      if (have_z)
-        xt = x(:)';
-        xt = [xt; xt; NaN(1, nx)](:);
-        yt = y(:)';
-        yt = [yt; yt; NaN(1, nx)](:);
-        zt = z(:)';
-        zt = [zeros(1, nx); zt; NaN(1, nx)](:);
-      else
-        xt = x(:, i)';
-        xt = [xt; xt; NaN(1, nx)](:);
-        yt = y(:, i)';
-        yt = [zeros(1, nx); yt; NaN(1, nx)](:);
-      endif
-
-      if (isempty (llc))
-        lc = __next_line_color__ ();
-      else
-        lc = llc;
-      endif
-
-      if (isempty (mmc))
-        mc = lc;
-      else
-        mc = mmc;
-      endif
-
-      if (dofill)
-        fc = mc;
-      else
-        fc = "none";
-      endif
-
-      ## Must occur after __next_line_color__ in order to work correctly.
-      hg = hggroup ();
-      h = [h; hg];
-      args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:});
-
-      if (have_z)
-        __line__ (hax, xt, yt, zt, "color", lc, "linestyle", ls, "parent", hg);
-        __line__ (hax, x, y, z, "color", mc, "linestyle", "none",
-                       "marker", ms, "markerfacecolor", fc, "parent", hg);
-        h_baseline = [];
-      else
-        __line__ (hax, xt, yt, "color", lc, "linestyle", ls, "parent", hg);
-        __line__ (hax, x(:,i), y(:, i), "color", mc, "linestyle", "none",
-                       "marker", ms, "markerfacecolor", fc, "parent", hg);
-        x_axis_range = get (hax, "xlim");
-        h_baseline = line (hax, x_axis_range, [0, 0], "color", [0, 0, 0]);
-        set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
-        addlistener (hax, "xlim", @update_xlim);
-        addproperty ("basevalue", h_baseline, "data", 0);
-        addlistener (h_baseline, "basevalue", {@update_baseline, 0});
-        addlistener (h_baseline, "ydata", {@update_baseline, 1});
-        addlistener (h_baseline, "visible", {@update_baseline, 2});
-      endif
-
-      ## Setup the hggroup and listeners.
-      addproperty ("showbaseline", hg, "radio", "{on}|off");
-      addproperty ("baseline", hg, "data", h_baseline);
-      addproperty ("basevalue", hg, "data", 0);
-
-      if (! have_z)
-        addlistener (hg, "showbaseline", @show_baseline);
-        addlistener (hg, "basevalue", @move_baseline);
-      endif
-
-      addproperty ("color", hg, "linecolor", lc);
-      addproperty ("linestyle", hg, "linelinestyle", ls);
-      addproperty ("linewidth", hg, "linelinewidth", 0.5);
-      addproperty ("marker", hg, "linemarker", ms);
-      addproperty ("markeredgecolor", hg, "linemarkerfacecolor", mc);
-      addproperty ("markerfacecolor", hg, "linemarkerfacecolor", fc);
-      addproperty ("markersize", hg, "linemarkersize", 6);
-
-      addlistener (hg, "color", @update_props);
-      addlistener (hg, "linestyle", @update_props);
-      addlistener (hg, "linewidth", @update_props);
-      addlistener (hg, "marker", @update_props);
-      addlistener (hg, "markeredgecolor", @update_props);
-      addlistener (hg, "markerfacecolor", @update_props);
-      addlistener (hg, "markersize", @update_props);
-
-      addproperty ("xdata", hg, "data", x(:, i));
-      addproperty ("ydata", hg, "data", y(:, i));
-      if (have_z)
-        addproperty ("zdata", hg, "data", z(:, i));
-      else
-        addproperty ("zdata", hg, "data", []);
-      endif
-
-      addlistener (hg, "xdata", @update_data);
-      addlistener (hg, "ydata", @update_data);
-      addlistener (hg, "zdata", @update_data);
-
-      ## Matlab property, although Octave does not implement it.
-      addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-      if (! isempty (args))
-        set (hg, args{:});
-      endif
-      if (i == 1 && ! isempty (h_baseline))
-        set (h_baseline, "parent", get (hg, "parent"));
-      endif
-    endfor
-
-    if (! strcmp (hold_state, "add") && have_z)
-      set (hax, "view", [-37.5 30],
-                "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-    set (hax, "nextplot", hold_state);
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-endfunction
-
-function [x, y, z, dofill, lc, ls, mc, ms, args] = check_stem_arg (have_z, varargin)
-
-  if (have_z)
-    caller = "stem3";
-  else
-    caller = "stem";
-  endif
-  nargin = nargin - 1;  # account for have_z argument 
-
-  num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
-  if (isempty (num_numeric))
-    num_numeric = nargin;     
-  endif
-
-  if (num_numeric < 1 || num_numeric > 3)
-    print_usage (caller);
-  endif
-
-  x = y = z = [];
-  if (num_numeric == 1)
-    if (have_z)
-      z = varargin{1};
-    else
-      y = varargin{1};
-    endif
-  elseif (num_numeric == 2)
-    if (have_z)
-      error ("stem3: must define X, Y, and Z");
-    else
-      x = varargin{1};
-      y = varargin{2};
-    endif
-  else  # nun_numeric == 3
-    if (have_z)
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-    else
-      error ("stem: can not define Z for 2-D stem plot");
-    endif
-  endif
-
-  ## Validate numeric data
-  if (have_z)
-    if (isempty (x))
-      [nr, nc] = size (z);
-      if (nr >= nc)
-        x = repmat ([1:nc], nr, 1);
-        y = repmat ([1:nr]', 1, nc);
-      else
-        x = repmat ([1:nc], nr, 1);
-        y = repmat ([1:nr]', 1, nc);
-      endif
-    endif
-    if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
-      error ("stem3: X, Y, and Z must be numeric");
-    endif
-  else
-    if (isempty (x))
-      if (isvector (y))
-        x = 1:length (y);
-      elseif (ismatrix (y))
-        x = 1:rows (y);
-      endif
-    endif
-    if (! (ismatrix (x) && ismatrix (y)))
-      error ("stem: X and Y must be numeric");
-    endif
-  endif
-
-  ## Check sizes of x, y and z.
-  if (have_z)
-    if (! size_equal (x, y, z))
-      error ("stem3: inconsistent sizes for X, Y, and Z");
-    endif
-    x = x(:);
-    y = y(:);
-    z = z(:);
-  else
-    if (isvector (x))
-      x = x(:);
-      if (isvector (y))
-        if (length (x) != length (y))
-          error ("stem: inconsistent sizes for X and Y");
-        endif
-        y = y(:);
-      else
-        if (length (x) == rows (y))
-          x = repmat (x(:), 1, columns (y));
-        else
-          error ("stem: inconsistent sizes for X and Y");
-        endif
-      endif
-    elseif (! size_equal (x, y))
-      error ("stem: inconsistent sizes for X and Y");
-    endif
-  endif
-
-  dofill = false;
-  have_line_spec = false;
-  ## set specifiers to default values.
-  [lc, ls, mc, ms] = set_default_values ();
-
-  args = {};
-  ioff = num_numeric + 1;
-  while (ioff <= nargin)
-    arg = varargin{ioff++};
-    if (ischar (arg) && any (strcmpi (arg, {"fill", "filled"})))
-      dofill = true;
-    elseif ((ischar (arg) || iscellstr (arg)) && ! have_line_spec)
-      [linespec, valid] = __pltopt__ (caller, arg, false);
-      if (valid)
-        have_line_spec = true;
-        [lc, ls, mc, ms] = stem_line_spec (linespec);
-      else
-        args{end+1} = arg;
-        if (ioff <= nargin)
-          args{end+1} = varargin{ioff++};
-        else
-          error ('%s: No value specified for property "%s"', caller, arg);
-        endif
-      endif
-    else
-      args{end+1} = arg;
-      if (ioff <= nargin)
-        args{end+1} = varargin{ioff++};
-      else
-        error ('%s: No value specified for property "%s"', caller, arg);
-      endif
-    endif
-  endwhile
-
-endfunction
-
-function [lc, ls, mc, ms] = stem_line_spec (lspec)
-
-  [lc, ls, mc, ms] = set_default_values ();
-
-  if (! isempty (lspec.color))
-    lc = mc = lspec.color;
-  endif
-
-  if (! isempty (lspec.linestyle) && ! strcmp (lspec.linestyle, "none"))
-    ls = lspec.linestyle;
-  endif
-
-  if (! isempty (lspec.marker) && ! strcmp (lspec.marker, "none"))
-    ms = lspec.marker;
-  endif
-
-endfunction
-
-function [lc, ls, mc, ms] = set_default_values ()
-  mc = [];
-  lc = [];
-  ls = "-";
-  ms = "o";
-endfunction
-
-function update_xlim (h, ~)
-  kids = get (h, "children");
-  xlim = get (h, "xlim");
-
-  for i = 1 : length (kids)
-    obj = get (kids(i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
-      if (any (get (obj.baseline, "xdata") != xlim))
-        set (obj.baseline, "xdata", xlim);
-      endif
-    endif
-  endfor
-endfunction
-
-function update_baseline (h, ~, src)
-  visible = get (h, "visible");
-  if (src == 0)
-    basevalue = get (h, "basevalue");
-  else
-    basevalue = get (h, "ydata")(1);
-  endif
-
-  kids = get (get (h, "parent"), "children");
-  for i = 1 : length (kids)
-    obj = get (kids(i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
-        && obj.baseline == h)
-      ## Avoid lots of unnecessary listener updates
-      if (! strcmp (get (kids(i), "showbaseline"), visible))
-        set (kids(i), "showbaseline", visible);
-      endif
-      if (get (kids(i), "basevalue") != basevalue)
-        set (kids(i), "basevalue", basevalue);
-      endif
-    endif
-  endfor
-endfunction
-
-function show_baseline (h, ~)
-  set (get (h, "baseline"), "visible", get (h, "showbaseline"));
-endfunction
-
-function move_baseline (h, ~)
-  b0 = get (h, "basevalue");
-  bl = get (h, "baseline");
-
-  set (bl, "ydata", [b0, b0]);
-
-  kids = get (h, "children");
-  yt = get (h, "ydata")(:)';
-  ny = length (yt);
-  yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:);
-  set (kids(2), "ydata", yt);
-endfunction
-
-function update_props (h, ~)
-  kids = get (h, "children");
-  set (kids(2), "color", get (h, "color"),
-                "linestyle", get (h, "linestyle"),
-                "linewidth", get (h, "linewidth"));
-  set (kids(1), "color", get (h, "markeredgecolor"),
-                "marker", get (h, "marker"),
-                "markerfacecolor", get (h, "markerfacecolor"),
-                "markersize", get (h, "markersize"));
-endfunction
-
-function update_data (h, ~)
-  x = get (h, "xdata");
-  y = get (h, "ydata");
-  z = get (h, "zdata");
-
-  if (!isempty (z) && size_equal (x, y, z))
-    sz = min ([size(x); size(y); size(z)]);
-    x = x(1:sz(1),1:sz(2));
-    y = y(1:sz(1),1:sz(2));
-    z = z(1:sz(1),1:sz(2));
-  elseif (numel (x) != numel (y));
-    sz = min ([size(x); size(y)]);
-    x = x(1:sz(1),1:sz(2));
-    y = y(1:sz(1),1:sz(2));
-  endif
-  bl = get (h, "basevalue");
-  nx = numel (x);
-  x = x(:)';
-  xt = [x; x; NaN(1, nx)](:);
-  if (! isempty (z))
-    y = y(:)';
-    yt = [y; y; NaN(1, nx)](:);
-    z = z(:)';
-    zt = [bl * ones(1, nx); z; NaN(1, nx)](:);
-  else
-    y = y(:)';
-    yt = [bl * ones(1, nx); y; NaN(1, nx)](:);
-    zt = [];
-  endif
-
-  kids = get (h, "children");
-  set (kids(2), "xdata", xt, "ydata", yt, "zdata", zt);
-  set (kids(1), "xdata", x, "ydata", y, "zdata", z);
-endfunction
-
--- a/scripts/plot/private/__tight_eps_bbox__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{bbox} =} __tight_eps_bbox__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-07-26
-
-function bb = __tight_eps_bbox__ (opts, eps_file_name)
-
-  box_string = "%%BoundingBox:";
-
-  cmd = sprintf ("\"%s\" \"%s\" 2>&1", "head", eps_file_name);
-  [status, output] = system (cmd);
-
-  if (status == 0)
-    orig_bbox_line = get_bbox (output);
-  else
-    error ("print:noboundingbox",
-           "print.m: no bounding box found in '%s'", eps_file_name);
-  endif
-
-  ghostscript_options = "-q -dBATCH -dSAFER -dNOPAUSE -dTextAlphaBits=4 -sDEVICE=bbox";
-  cmd = sprintf ("\"%s\" %s \"%s\" 2>&1", opts.ghostscript.binary,
-                 ghostscript_options, eps_file_name);
-  [status, output] = system (cmd);
-
-  if (status == 0)
-    tight_bbox_line = get_bbox (output);
-  else
-    warning ("print:nogsboundingbox",
-             "print.m: ghostscript failed to determine the bounding for '%s'",
-             eps_file_name);
-  endif
-
-  ## Attempt to fix the bbox in place.
-  fid = fopen (eps_file_name, "r+");
-  unwind_protect
-    bbox_replaced = false;
-    looking_for_bbox = true;
-    while (looking_for_bbox)
-      current_line = fgetl (fid);
-      if (strncmpi (current_line, box_string, length (box_string)))
-        line_length = numel (current_line);
-        num_spaces = line_length - numel (tight_bbox_line);
-        if (numel (current_line) >= numel (tight_bbox_line))
-          new_line = tight_bbox_line;
-          new_line(end+1:numel (current_line)) = " ";
-          bbox_replaced = true;
-          ## Back up to the beginning of the line (include EOL characters).
-          if (ispc ())
-            fseek (fid, -line_length-2, "cof");
-          else
-            fseek (fid, -line_length-1, "cof");
-          endif
-          count = fprintf (fid, "%s", new_line);
-        endif
-        looking_for_bbox = false;
-      elseif (! ischar (current_line))
-        looking_for_bbox = false;
-      endif
-    endwhile
-  unwind_protect_cleanup
-    fclose (fid);
-  end_unwind_protect
-
-  ## If necessary load the eps-file and replace the bbox (can be slow).
-  if (! bbox_replaced)
-    fid = fopen (eps_file_name, "r");
-    unwind_protect
-      data = char (fread (fid, Inf)).';
-    unwind_protect_cleanup
-      fclose (fid);
-    end_unwind_protect
-    n = strfind (data, box_string);
-    if (numel (n) > 1)
-      ## Only replace one instance.
-      n = n(1);
-    elseif (isempty (n))
-      error ("print:noboundingbox", ...
-             "print.m: no bounding box found in '%s'.", eps_file_name);
-    endif
-    m = numel (orig_bbox_line);
-    data = horzcat (data(1:(n-1)), tight_bbox_line, data((n+m):end));
-    fid = fopen (eps_file_name, "w");
-    unwind_protect
-      fprintf (fid, "%s", data);
-    unwind_protect_cleanup
-      fclose (fid);
-    end_unwind_protect
-  endif
-
-endfunction
-
-function bbox_line = get_bbox (lines)
-  box_string = "%%BoundingBox:";
-  pattern = strcat (box_string, "[^%]*");
-  pattern = pattern(1:find (double (pattern) > 32, 1, "last"));
-  bbox_line = regexp (lines, pattern, "match");
-  if (iscell (bbox_line))
-    bbox_line = bbox_line{1};
-  endif
-  ## Remove the EOL characters.
-  bbox_line(double (bbox_line) < 32) = "";
-endfunction
-
--- a/scripts/plot/private/__uigetdir_fltk__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{dirname} =} __uigetdir_fltk__ (@var{start_path}, @var{dialog_title})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function dirname = __uigetdir_fltk__ (start_path, dialog_title)
-
-  if (exist ("__fltk_uigetfile__") != 3)
-    error ("uigetdir: fltk graphics toolkit required");
-  endif
-
-  dirname = __fltk_uigetfile__ ("", dialog_title, start_path, [240, 120], "dir");
-
-endfunction
-
--- a/scripts/plot/private/__uigetfile_fltk__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uigetfile_fltk__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function [retval, retpath, retindex] = __uigetfile_fltk__ (filters, title, defval, position, multiselect, defdir)
-
-  if (exist ("__fltk_uigetfile__") != 3)
-    error ("uigetfile: fltk graphics toolkit required");
-  endif
-
-  filters = __fltk_file_filter__ (filters);
-  if (length (defdir) > 0)
-    defval = fullfile (defdir, defval);
-  endif
-  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, multiselect);
-
-endfunction
-
--- a/scripts/plot/private/__uiobject_split_args__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{args}, @var{parent_type}, @var{use_gcf})
-## @end deftypefn
-
-## Author: goffioul
-
-function [parent, args] = __uiobject_split_args__ (who, in_args, parent_type = {}, use_gcf = 1)
-
-  parent = [];
-  args = {};
-  offset = 1;
-
-  if (! isempty (in_args))
-    if (ishandle (in_args{1}))
-      parent = in_args{1};
-      offset = 2;
-    elseif (! ischar (in_args{1}))
-      error ("%s: invalid parent handle.", who);
-    endif
-
-    args = in_args(offset:end);
-  endif
-
-  if (rem (length (args), 2))
-    error ("%s: expecting PROPERTY/VALUE pairs", who);
-  endif
-
-  if (! isempty (args))
-    i = find (strcmpi (args(1:2:end), "parent"), 1, "first");
-    if (! isempty (i) && length (args) >= 2*i)
-      parent = args{2*i};
-      if (! ishandle (parent))
-        error ("%s: invalid parent handle.", who);
-      endif
-      args([2*i-1, 2*i]) = [];
-    endif
-  endif
-
-  if (! isempty (parent))
-    if (! isempty (parent_type) && isempty (find (strcmpi (get (parent, "type"), parent_type))))
-      error ("%s: invalid parent, the parent type must be: %s", ...
-             who, sprintf ("%s, ", parent_type{:})(1:end-2));
-    endif
-  elseif (use_gcf)
-    parent = gcf ();
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__uiputfile_fltk__.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uiputfile_fltk__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function [retval, retpath, retindex] = __uiputfile_fltk__ (filters, title, defval, position, tag, defdir)
-
-  if (exist ("__fltk_uigetfile__") != 3)
-    error ("uiputfile: fltk graphics toolkit required");
-  endif
-
-  filters = __fltk_file_filter__ (filters);
-  if (length (defdir) > 0)
-    defval = fullfile (defdir, defval);
-  endif
-  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, tag);
-
-endfunction
-
--- a/scripts/plot/quiver.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} quiver (@var{u}, @var{v})
-## @deftypefnx {Function File} {} quiver (@var{x}, @var{y}, @var{u}, @var{v})
-## @deftypefnx {Function File} {} quiver (@dots{}, @var{s})
-## @deftypefnx {Function File} {} quiver (@dots{}, @var{style})
-## @deftypefnx {Function File} {} quiver (@dots{}, "filled")
-## @deftypefnx {Function File} {} quiver (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} quiver (@dots{})
-##
-## Plot the (@var{u}, @var{v}) components of a vector field in
-## an (@var{x}, @var{y}) meshgrid.  If the grid is uniform, you can
-## specify @var{x} and @var{y} as vectors.
-##
-## If @var{x} and @var{y} are undefined they are assumed to be
-## @code{(1:@var{m}, 1:@var{n})} where
-## @code{[@var{m}, @var{n}] = size (@var{u})}.
-##
-## The variable @var{s} is a scalar defining a scaling factor to use for
-## the arrows of the field relative to the mesh spacing.  A value of 0
-## disables all scaling.  The default value is 1.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## of the same format as the @code{plot} command.
-## If a marker is specified then markers at the grid points of the vectors are
-## drawn rather than arrows.  If the argument @qcode{"filled"} is given then the
-## markers are filled.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to a quiver object.
-## A quiver object regroups the components of the quiver plot (body, arrow,
-## and marker), and allows them to be changed together.
-##
-## @example
-## @group
-## [x, y] = meshgrid (1:2:20);
-## h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10));
-## set (h, "maxheadsize", 0.33);
-## @end group
-## @end example
-##
-## @seealso{quiver3, compass, feather, plot}
-## @end deftypefn
-
-function retval = quiver (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  else
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-    unwind_protect
-      hax = newplot (hax);
-      htmp = __quiver__ (hax, false, varargin{:});
-    unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-    end_unwind_protect
-  endif
-
-  if (nargout > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [x,y] = meshgrid (1:2:20);
-%! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10));
-%! set (h, 'maxheadsize', 0.33);
-
-%!demo
-%! clf;
-%! axis ('equal');
-%! x = linspace (0, 3, 80);
-%! y = sin (2*pi*x);
-%! theta = 2*pi*x + pi/2;
-%! quiver (x, y, sin (theta)/10, cos (theta)/10);
-%! hold on; plot (x,y,'r'); hold off;
-
--- a/scripts/plot/quiver3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} quiver3 (@var{u}, @var{v}, @var{w})
-## @deftypefnx {Function File} {} quiver3 (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w})
-## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{s})
-## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{style})
-## @deftypefnx {Function File} {} quiver3 (@dots{}, "filled")
-## @deftypefnx {Function File} {} quiver3 (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} quiver3 (@dots{})
-##
-## Plot the (@var{u}, @var{v}, @var{w}) components of a vector field in
-## an (@var{x}, @var{y}, @var{z}) meshgrid.  If the grid is uniform, you
-## can specify @var{x}, @var{y}, and @var{z} as vectors.
-##
-## If @var{x}, @var{y}, and @var{z} are undefined they are assumed to be
-## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] =
-## size (@var{u})} and @code{@var{p} = max (size (@var{w}))}.
-##
-## The variable @var{s} is a scalar defining a scaling factor to use for
-## the arrows of the field relative to the mesh spacing.  A value of 0
-## disables all scaling.  The default value is 1.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## of the same format as the @code{plot} command.
-## If a marker is specified then markers at the grid points of the vectors are
-## drawn rather than arrows.  If the argument @qcode{"filled"} is given then the
-## markers are filled.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to a quiver object.
-## A quiver object regroups the components of the quiver plot (body, arrow,
-## and marker), and allows them to be changed together.
-##
-## @example
-## @group
-## [x, y, z] = peaks (25);
-## surf (x, y, z);
-## hold on;
-## [u, v, w] = surfnorm (x, y, z / 10);
-## h = quiver3 (x, y, z, u, v, w);
-## set (h, "maxheadsize", 0.33);
-## @end group
-## @end example
-##
-## @seealso{quiver, compass, feather, plot}
-## @end deftypefn
-
-function retval = quiver3 (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  else
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-    unwind_protect
-      hax = newplot (hax);
-      htmp = __quiver__ (hax, true, varargin{:});
-
-      if (! ishold (hax))
-        set (hax, "view", [-37.5, 30]);  # 3D view
-      endif
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-  endif
-
-  if (nargout > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x,y] = meshgrid (-1:0.1:1);
-%! z = sin (2*pi * sqrt (x.^2 + y.^2));
-%! theta = 2*pi * sqrt (x.^2 + y.^2) + pi/2;
-%! mesh (x, y, z);
-%! hold on;
-%! quiver3 (x, y, z, sin (theta), cos (theta), ones (size (z)));
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (25);
-%! surf (x, y, z);
-%! hold on;
-%! [u, v, w] = surfnorm (x, y, z / 10);
-%! h = quiver3 (x, y, z, u, v, w);
-%! set (h, 'maxheadsize', 0.33);
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (25);
-%! surf (x, y, z);
-%! hold on;
-%! [u, v, w] = surfnorm (x, y, z / 10);
-%! h = quiver3 (x, y, z, u, v, w);
-%! set (h, 'maxheadsize', 0.33);
-%! hold off;
-%! shading interp;
-
--- a/scripts/plot/rectangle.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-## Copyright (C) 2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} rectangle ()
-## @deftypefnx {Function File} {} rectangle (@dots{}, "Position", @var{pos})
-## @deftypefnx {Function File} {} rectangle (@dots{}, "Curvature", @var{curv})
-## @deftypefnx {Function File} {} rectangle (@dots{}, "EdgeColor", @var{ec})
-## @deftypefnx {Function File} {} rectangle (@dots{}, "FaceColor", @var{fc})
-## @deftypefnx {Function File} {} rectangle (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} rectangle (@dots{})
-##
-## Draw a rectangular patch defined by @var{pos} and @var{curv}.
-## 
-## The variable @code{@var{pos}(1:2)} defines the lower left-hand corner of
-## the patch and @code{@var{pos}(3:4)} defines its width and height.  By
-## default, the value of @var{pos} is @code{[0, 0, 1, 1]}.
-##
-## The variable @var{curv} defines the curvature of the sides of the rectangle
-## and may be a scalar or two-element vector with values between 0 and 1.
-## A value of 0 represents no curvature of the side, whereas a value of 1
-## means that the side is entirely curved into the arc of a circle.
-## If @var{curv} is a two-element vector, then the first element is the
-## curvature along the x-axis of the patch and the second along y-axis.
-##
-## If @var{curv} is a scalar, it represents the curvature of the shorter of the
-## two sides of the rectangle and the curvature of the other side is defined
-## by
-##
-## @example
-## min (pos (1:2)) / max (pos (1:2)) * curv
-## @end example
-##
-## Additional property/value pairs are passed to the underlying patch command. 
-## 
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## rectangle object.
-## @end deftypefn
-## @seealso{patch, line, cylinder, ellipsoid, sphere}
-
-function h = rectangle (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("rectangle", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    htmp = __rectangle__ (hax, varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-endfunction
-
-function hg = __rectangle__ (hax, varargin)
-
-  iarg = 1;
-  pos = [0, 0, 1, 1];
-  curv2 = [0, 0];
-  ec = [0, 0, 0];
-  fc = "none";
-
-  while (iarg < length (varargin))
-    arg = varargin{iarg};
-    if (ischar (arg))
-      if (strcmpi (arg, "position"))
-        pos = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-        if (!isvector (pos) || numel (pos) != 4)
-          error ("rectangle: position must be a 4 element vector");
-        endif
-      elseif (strcmpi (arg, "curvature"))
-        curv2 = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-        if (!isnumeric (curv2) || (numel (curv2) != 1 && numel (curv2) != 2))
-          error ("rectangle: curvature must be a 2 element vector or a scalar");
-        endif
-        if (any (curv2 < 0) || any (curv2 > 1))
-          error ("rectangle: curvature values must be between 0 and 1");
-        endif
-      elseif (strcmpi (arg, "edgecolor"))
-        ec = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-      elseif (strcmpi (arg, "facecolor"))
-        fc = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-      else
-        iarg ++;
-      endif
-    else
-      iarg ++;
-    endif
-  endwhile
-
-  if (numel (curv2) == 1)
-    [a, ai] = min (pos (3 : 4));
-    [b, bi] = max (pos (3 : 4));
-    if (ai < bi)
-      curv = [curv2, curv2 .* a ./ b];
-    else
-      curv = [curv2 .* a ./ b, curv2];
-    endif
-  else
-    curv = curv2;
-  endif
-
-  if (all (curv) < 0.01)
-    ## Special case : no curvature
-    x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
-    y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
-  else
-    p = pi / 2 * [0 : 15] / 15;
-    c = curv .* pos(3 : 4) / 2;
-    cx = c(1) * sin (p) - c(1);
-    cy = c(2) * cos (p) - c(2);
-    x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
-         pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
-    y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
-         pos(2) + pos(4) + cy, pos(2) + c(2)];
-  endif
-
-  hg = hggroup ();
-
-  h = patch ("xdata", x(:), "ydata", y(:), "facecolor", fc, "edgecolor", ec, ...
-             "parent", hg, varargin{:});
-
-  addproperty ("curvature", hg, "data", curv2);
-  addproperty ("position",  hg, "data", pos);
-  addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
-  addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
-  addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
-  addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
-
-  addlistener (hg, "curvature", @update_data);
-  addlistener (hg, "position",  @update_data);
-  addlistener (hg, "edgecolor", @update_props);
-  addlistener (hg, "linewidth", @update_props);
-  addlistener (hg, "linestyle", @update_props);
-  addlistener (hg, "facecolor", @update_props);
-endfunction
-
-function update_data (h, d)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (!recursion)
-    unwind_protect
-      recursion = true;
-
-      kids = get (h, "children");
-      pos = get (h, "position");
-      curv2 = get (h, "curvature");
-
-      if (numel (curv2) == 1)
-        [a, ai] = min (pos (3 : 4));
-        [b, bi] = max (pos (3 : 4));
-        if (ai < bi)
-          curv = [curv2, curv2 .* a ./ b];
-        else
-          curv = [curv2 .* a ./ b, curv2];
-        endif
-      else
-        curv = curv2;
-      endif
-
-      if (all (curv) < 0.01)
-        ## Special case : no curvature
-        x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
-        y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
-      else
-        p = pi / 2 * [0 : 15] / 15;
-        c = curv .* pos(3 : 4) / 2;
-        cx = c(1) * sin (p) - c(1);
-        cy = c(2) * cos (p) - c(2);
-        x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
-             pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
-        y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
-             pos(2) + pos(4) + cy, pos(2) + c(2)];
-      endif
-
-      set (kids, "xdata", x, "ydata", y);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-  set (kids, "edgecolor", get (h, "edgecolor"),
-             "linewidth", get (h, "linewidth"),
-             "linestyle", get (h, "linestyle"),
-             "facecolor", get (h, "facecolor"));
-endfunction
-
-
-%!demo
-%! clf;
-%! axis equal;
-%! rectangle ('Position', [0.05, 0.05, 0.9, 0.9], 'Curvature', [0.5, 0.5]);
-%! title ('rectangle() with corners curved');
-
-%!demo
-%! clf;
-%! axis equal;
-%! rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
-%! title ('rectangle() with sides as complete arcs');
-
-%!demo
-%! clf;
-%! axis equal;
-%! h = rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
-%! set (h, 'FaceColor', [0, 1, 0]);
-%! title ('rectangle() with FaceColor = green');
-
--- a/scripts/plot/refresh.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} refresh ()
-## @deftypefnx {Function File} {} refresh (@var{h})
-## Refresh a figure, forcing it to be redrawn.
-##
-## When called without an argument the current figure is redrawn.  Otherwise,
-## the figure with graphic handle @var{h} is redrawn.
-## @seealso{drawnow}
-## @end deftypefn
-
-function refresh (h)
-
-  if (nargin > 1)
-    print_usage ();
-  elseif (nargin == 1)
-    if (! isfigure (h))
-      error ("refresh: H must be a valid figure handle");
-    endif
-  else
-    h = gcf ();
-  endif
-
-  set (h, "__modified__", "on");
-  drawnow ();
-
-endfunction
-
--- a/scripts/plot/refreshdata.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} refreshdata ()
-## @deftypefnx {Function File} {} refreshdata (@var{h})
-## @deftypefnx {Function File} {} refreshdata (@var{h}, @var{workspace})
-## Evaluate any @samp{datasource} properties of the current figure and update
-## the plot if the corresponding data has changed.
-##
-## If the first argument @var{h} is a list of graphic handles, then operate
-## on these objects rather than the current figure returned by @code{gcf}.
-##
-## The optional second argument @var{workspace} can take the following values:
-##
-## @table @asis
-## @item @qcode{"base"}
-## Evaluate the datasource properties in the base workspace.  (default).
-##
-## @item @qcode{"caller"}
-## Evaluate the datasource properties in the workspace of the function
-## that called @code{refreshdata}.
-## @end table
-##
-## An example of the use of @code{refreshdata} is:
-##
-## @example
-## @group
-## x = 0:0.1:10;
-## y = sin (x);
-## plot (x, y, "ydatasource", "y");
-## for i = 1 : 100
-##   pause (0.1);
-##   y = sin (x + 0.1*i);
-##   refreshdata ();
-## endfor
-## @end group
-## @end example
-## @end deftypefn
-
-function refreshdata (h, workspace)
-
-  if (nargin == 0)
-    h = gcf ();
-    workspace = "base";
-  else
-    if (iscell (h))
-      h = [h{:}];
-    endif
-    if (! all (isfigure (h)))
-      error ("refreshdata: H must be a list of figure handles");
-    endif
-    if (nargin == 1)
-      workspace = "base";
-    elseif (nargin == 2)
-      if (! ischar (workspace)
-          || ! any (strcmpi (workspace, {"base", "caller"})))
-        error ('refreshdata: WORKSPACE must be "base" or "caller"');
-      endif
-      workspace = tolower (workspace);
-    else
-      print_usage ();
-    endif
-  endif
-
-  h = findall (h);
-  objs = [];
-  props = {};
-
-  for i = 1 : numel (h)
-    obj = get (h(i));
-    flds = fieldnames (obj);
-    ## regexp() is proper way to do searching, but is 3X slower.
-    ## Pretty unlikely that people are going to be adding datasource
-    ## properties that are not, in fact, datasources.
-    ## m = regexp (flds, '^.+datasource$');
-    m = strfind (flds, "datasource");
-    m = flds(!cellfun (@isempty, m));
-    for j = 1 : numel (m)
-      if (isempty (obj.(m{j})))
-        continue;  # datasource field doesn't point to anything
-      endif
-      expr = obj.(m{j});       # datasource field
-      val = evalin (workspace, expr);
-      pdname = m{j}(1:end-6);  # property data name without "source"
-      set (h(i), pdname, val); 
-    endfor
-  endfor
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! y = sin (x);
-%! plot (x, y, 'ydatasource', 'y');
-%! title ('refreshdata() showing moving sine curve');
-%! axis manual;
-%! for i = 1 : 100
-%!   pause (0);
-%!   y = sin (x + 0.1 * i);
-%!   refreshdata (gcf, 'caller');
-%! end
-
--- a/scripts/plot/ribbon.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ribbon (@var{y})
-## @deftypefnx {Function File} {} ribbon (@var{x}, @var{y})
-## @deftypefnx {Function File} {} ribbon (@var{x}, @var{y}, @var{width})
-## @deftypefnx {Function File} {} ribbon (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ribbon (@dots{})
-## Plot a ribbon plot for the columns of @var{y} vs. @var{x}.
-##
-## The optional parameter @var{width} specifies the width of a single ribbon
-## (default is 0.75).  If @var{x} is omitted, a vector containing the
-## row numbers is assumed (@code{1:rows (Y)}).
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of graphics handles to
-## the surface objects representing each ribbon.
-## @seealso{surface, waterfall}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel at gmx.de>
-
-function h = ribbon (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ribbon", varargin{:});
-
-  if (nargin < 1 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
-    y = varargin{1};
-    if (isvector (y))
-      y = y(:);
-    endif
-    [nr, nc] = size (y);
-    x = repmat ((1:nr)', 1, nc);
-    width = 0.75;
-  elseif (nargin == 2)
-    x = varargin{1};
-    y = varargin{2};
-    width = 0.75;
-  else
-    x = varargin{1};
-    y = varargin{2};
-    width = varargin{3};
-  endif
-
-  if (isvector (x) && isvector (y))
-    if (length (x) != length (y))
-      error ("ribbon: vectors X and Y must have the same length");
-    else
-      [x, y] = meshgrid (x, y);
-    endif
-  else
-    if (! size_equal (x, y))
-      error ("ribbon: matrices X and Y must have the same size");
-    endif
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    [nr, nc] = size (y);
-    htmp = zeros (nc, 1);
-
-    for c = nc:-1:1
-      zz = [y(:,c), y(:,c)];
-      yy = x(:,c);
-      xx = [c - width / 2, c + width / 2];
-      [xx, yy] = meshgrid (xx, yy);
-      cc = repmat (c, size (zz));
-      htmp(c) = surface (xx, yy, zz, cc);
-    endfor
-
-    if (! ishold ())
-      set (hax, "view", [-37.5, 30], "box", "off", 
-                "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = sombrero ();
-%! ribbon (y, z);
-%! title ('ribbon() plot of sombrero()');
-
-%!FIXME: Could have some input validation tests here
-
--- a/scripts/plot/rose.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} rose (@var{th})
-## @deftypefnx {Function File} {} rose (@var{th}, @var{nbins})
-## @deftypefnx {Function File} {} rose (@var{th}, @var{bins})
-## @deftypefnx {Function File} {} rose (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} rose (@dots{})
-## @deftypefnx {Function File} {[@var{thout} @var{rout}] =} rose (@dots{})
-## Plot an angular histogram.
-##
-## With one vector argument, @var{th}, plot the histogram with 20 angular bins.
-## If @var{th} is a matrix then each column of @var{th} produces a separate
-## histogram.
-##
-## If @var{nbins} is given and is a scalar, then the histogram is produced with
-## @var{nbin} bins.  If @var{bins} is a vector, then the center of each bin is
-## defined by the values of @var{bins} and the number of bins is
-## given by the number of elements in @var{bins}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a vector of graphics handles to the
-## line objects representing each histogram.
-##
-## If two output arguments are requested then no plot is made and 
-## the polar vectors necessary to plot the histogram are returned instead.
-##
-## @example
-## @group
-## [th, r] = rose ([2*randn(1e5,1), pi + 2*randn(1e5,1)]);
-## polar (th, r);
-## @end group
-## @end example
-##
-## @seealso{hist, polar}
-## @end deftypefn
-
-function [thout, rout] = rose (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("rose", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  ## Force theta to [0,2*pi] range
-  th = varargin{1};
-  th = atan2 (sin (th), cos (th)) + pi;
-
-  if (nargin > 1)
-    x = varargin{2};
-    if (isscalar (x))
-      x = [0.5/x : 1/x : 1] * 2*pi;
-    else
-      ## Force theta to [0,2*pi] range
-      x = atan2 (sin (x), cos (x)) + pi;
-    endif
-  else
-    x = [1/40 : 1/20 : 1] * 2*pi;
-  endif
-
-  [nn, xx] = hist (th, x);
-  xx = xx(:).';
-  if (isvector (nn))
-    nn = nn(:);
-  endif
-  x1 = xx(1:end-1) + diff (xx, 1) / 2;
-  x1 = [x1 ; x1; x1; x1](:);
-  th = [0; 0; x1; 2*pi ; 2*pi];
-  r = zeros (4 * rows (nn), columns (nn));
-  r(2:4:end, :) = nn;
-  r(3:4:end, :) = nn;
-
-  if (nargout < 2)
-    oldfig = [];
-    if (! isempty (hax))
-      oldfig = get (0, "currentfigure");
-    endif
-    unwind_protect
-      hax = newplot (hax);
-      htmp = polar (th, r);
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-
-    if (nargout > 0)
-      thout = htmp;
-    endif
-  else
-    thout = th;
-    rout = r;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! rose ([2*randn(1e5, 1), pi + 2*randn(1e5, 1)]);
-%! title ('rose() angular histogram plot');
-
--- a/scripts/plot/saveas.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} saveas (@var{h}, @var{filename})
-## @deftypefnx {Function File} {} saveas (@var{h}, @var{filename}, @var{fmt})
-## Save graphic object @var{h} to the file @var{filename} in graphic
-## format @var{fmt}.
-##
-## @var{fmt} should be one of the following formats:
-##
-## @table @code
-##   @item ps
-##     PostScript
-##
-##   @item eps
-##     Encapsulated PostScript
-##
-##   @item jpg
-##     JPEG Image
-##
-##   @item png
-##     PNG Image
-##
-##   @item emf
-##     Enhanced Meta File
-##
-##   @item pdf
-##     Portable Document Format
-## @end table
-##
-## All device formats specified in @code{print} may also be used.  If
-## @var{fmt} is omitted it is extracted from the extension of @var{filename}.
-## The default format is @qcode{"pdf"}.
-##
-## @example
-## @group
-## clf ();
-## surf (peaks);
-## saveas (1, "figure1.png");
-## @end group
-## @end example
-##
-## @seealso{print, orient}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function  saveas (h, filename, fmt = "pdf")
-
-  if ((nargin != 2) && (nargin != 3))
-    print_usage ();
-  endif
-
-  if (ishandle (h))
-    if (isfigure (h))
-      fig = h;
-    else
-      fig = ancestor (h, "figure");
-    endif
-  else
-    error ("saveas: first argument H must be a graphics handle");
-  endif
-
-  if (!ischar (filename))
-    error ("saveas: FILENAME must be a string");
-  endif
-
-  if (nargin == 2)
-    [~, ~, ext] = fileparts (filename);
-    if (!isempty (ext))
-      fmt = ext(2:end);
-    endif
-  endif
-
-  if (nargin == 3)
-    if (!ischar (filename))
-      error ("saveas: EXT must be a string");
-    endif
-
-    [~, ~, ext] = fileparts (filename);
-
-    if (isempty (ext))
-      filename = strcat (filename, ".", fmt);
-    endif
-  endif
-
-  prt_opt = strcat ("-d", tolower (fmt));
-
-  print (fig, filename, prt_opt);
-
-endfunction
-
--- a/scripts/plot/scatter.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} scatter (@var{x}, @var{y})
-## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s})
-## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c})
-## @deftypefnx {Function File} {} scatter (@dots{}, @var{style})
-## @deftypefnx {Function File} {} scatter (@dots{}, "filled")
-## @deftypefnx {Function File} {} scatter (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} scatter (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} scatter (@dots{})
-## Draw a 2-D scatter plot.
-##
-## A marker is plotted at each point defined by the coordinates in the vectors
-## @var{x} and @var{y}.
-##
-## The size of the markers is determined by @var{s}, which can be a scalar
-## or a vector of the same length as @var{x} and @var{y}.  If @var{s}
-## is not given, or is an empty matrix, then a default value of 8 points is
-## used.
-##
-## The color of the markers is determined by @var{c}, which can be a string
-## defining a fixed color; a 3-element vector giving the red, green, and blue
-## components of the color; a vector of the same length as @var{x} that gives
-## a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
-## the RGB color of each marker individually.
-##
-## The marker to use can be changed with the @var{style} argument, that is a
-## string defining a marker in the same manner as the @code{plot} command.
-## If no marker is specified it defaults to @qcode{"o"} or circles.
-## If the argument @qcode{"filled"} is given then the markers are filled.
-##
-## Additional property/value pairs are passed directly to the underlying
-## patch object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created patch
-## object.
-## 
-## Example:
-##
-## @example
-## @group
-## x = randn (100, 1);
-## y = randn (100, 1);
-## scatter (x, y, [], sqrt (x.^2 + y.^2));
-## @end group
-## @end example
-##
-## @seealso{scatter3, patch, plot}
-## @end deftypefn
-
-function retval = scatter (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("scatter", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    
-    htmp = __scatter__ (hax, 2, "scatter", varargin{:});
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = randn (100, 1);
-%! y = randn (100, 1);
-%! scatter (x, y, 'r');
-%! title ('scatter() plot with red bubbles');
-
-%!demo
-%! clf;
-%! x = randn (100, 1);
-%! y = randn (100, 1);
-%! c = x .* y;
-%! scatter (x, y, 20, c, 'filled');
-%! title ('scatter() with colored filled bubbles');
-
-%!demo
-%! clf;
-%! x = randn (100, 1);
-%! y = randn (100, 1);
-%! scatter (x, y, [], sqrt (x.^2 + y.^2));
-%! title ({'scatter() plot'; ...
-%!         'bubble color determined by distance from origin'});
-
-%!demo
-%! clf;
-%! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949];
-%! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273];
-%! x = rand_10x1_data5;
-%! y = rand_10x1_data6;
-%! s = 10 - 10*log (x.^2 + y.^2);
-%! h = scatter (x, y, [], 'r', 's');
-%! title ({'scatter() plot'; ...
-%!         'marker is square, color is red'});
-
-%!demo
-%! clf;
-%! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726];
-%! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356];
-%! x = rand_10x1_data3;
-%! y = rand_10x1_data4;
-%! s = 10 - 10*log (x.^2 + y.^2);
-%! h = scatter (x, y, [], 'r', 's', 'filled');
-%! title ({'scatter() plot'; ...
-%!         'marker is square, marker is filled, color is red'});
-
-%!demo
-%! clf;
-%! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940];
-%! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143];
-%! x = rand_10x1_data1;
-%! y = rand_10x1_data2;
-%! s = 10 - 10*log (x.^2 + y.^2);
-%! h = scatter (x, y, s, s, 's', 'filled');
-%! title ({'scatter() plot with filled square markers', ...
-%!         'size and color of markers determined by algorithm'});
-
-%!demo
-%! clf;
-%! k = 1;
-%! for m = [1, 3]
-%!   for n = [101, 50, 1]
-%!     x = rand (n, 1);
-%!     y = rand (n, 1);
-%!     if (m > 1)
-%!       str = 'Three Colors';
-%!       idx = ceil (rand (n, 1) * 3);
-%!       colors = eye (3);
-%!       colors = colors(idx, :);
-%!     else
-%!       str = 'Random Colors';
-%!       colors = rand (n, m);
-%!     end
-%!     if (n == 1)
-%!       str = sprintf ('%s: 1 point', str);
-%!     elseif (n < 100)
-%!       str = sprintf ('%s: < 100 points', str);
-%!     else
-%!       str = sprintf ('%s: > 100 points', str);
-%!     end
-%!     subplot (2,3,k);
-%!     k = k + 1;
-%!     scatter (x, y, 15, colors, 'filled');
-%!     axis ([0 1 0 1]);
-%!     title (str);
-%!   end
-%! end
-
-%!demo
-%! clf;
-%! k = 1;
-%! for m = [1, 3]
-%!   for n = [101, 50, 1]
-%!     x = rand (n, 1);
-%!     y = rand (n, 1);
-%!     if (m > 1)
-%!       str = 'Three Colors';
-%!       idx = ceil (rand (n, 1) * 3);
-%!       colors = eye (3);
-%!       colors = colors(idx, :);
-%!     else
-%!       str = 'Random Colors';
-%!       colors = rand (n, m);
-%!     end
-%!     if (n == 1)
-%!       str = sprintf ('%s: 1 point', str);
-%!     elseif (n < 100)
-%!       str = sprintf ('%s: < 100 points', str);
-%!     else
-%!       str = sprintf ('%s: > 100 points', str);
-%!     end
-%!     subplot (2,3,k);
-%!     k = k + 1;
-%!     scatter (x, y, 15, colors);
-%!     axis ([0 1 0 1]);
-%!     title (str);
-%!   end
-%! end
-
--- a/scripts/plot/scatter3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} scatter3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s})
-## @deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c})
-## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{style})
-## @deftypefnx {Function File} {} scatter3 (@dots{}, "filled")
-## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} scatter3 (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} scatter3 (@dots{})
-## Draw a 3-D scatter plot.
-##
-## A marker is plotted at each point defined by the coordinates in the vectors
-## @var{x}, @var{y}, and @var{z}.
-##
-## The size of the markers is determined by @var{s}, which can be a scalar
-## or a vector of the same length as @var{x}, @var{y}, and @var{z}.  If @var{s}
-## is not given, or is an empty matrix, then a default value of 8 points is
-## used.
-##
-## The color of the markers is determined by @var{c}, which can be a string
-## defining a fixed color; a 3-element vector giving the red, green, and blue
-## components of the color; a vector of the same length as @var{x} that gives
-## a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
-## the RGB color of each marker individually.
-##
-## The marker to use can be changed with the @var{style} argument, that is a
-## string defining a marker in the same manner as the @code{plot} command.
-## If no marker is specified it defaults to @qcode{"o"} or circles.
-## If the argument @qcode{"filled"} is given then the markers are filled.
-##
-## Additional property/value pairs are passed directly to the underlying
-## patch object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the hggroup
-## object representing the points.
-##
-## @example
-## @group
-## [x, y, z] = peaks (20);
-## scatter3 (x(:), y(:), z(:), [], z(:));
-## @end group
-## @end example
-##
-## @seealso{scatter, patch, plot}
-## @end deftypefn
-
-function retval = scatter3 (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("scatter3", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    
-    htmp = __scatter__ (hax, 3, "scatter3", varargin{:});
-
-    if (! ishold (hax))
-      set (hax, "view", [-37.5, 30], "box", "off",
-                "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [x, y, z] = peaks (20);
-%! scatter3 (x(:), y(:), z(:), [], z(:));
-%! title ({'Default scatter3() plot', ...
-%!         'constant size bubbles and color determined by Z'});
-
-%!demo
-%! clf;
-%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
-%! scatter3 (x(:), y(:), z(:), 10, z(:), 's');
-%! title ({'scatter3() plot', ...
-%!         'marker is square, size is 10, color determined by Z'});
-
-%!demo
-%! clf;
-%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
-%! scatter3 (x(:), y(:), z(:), 20*z(:), [], 's');
-%! title ({'scatter3() plot', ...
-%!         'marker is square, size is determined by Z'});
-
-%!demo
-%! clf;
-%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
-%! scatter3 (x(:), y(:), z(:), 20*z(:), z(:), 's');
-%! title ({'scatter3() plot', ...
-%!         'marker is square, size and color determined by Z'});
-
--- a/scripts/plot/semilogx.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogx (@var{y})
-## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y})
-## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} semilogx (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} semilogx (@dots{})
-## Produce a 2-D plot using a logarithmic scale for the x-axis.
-##
-## See the documentation of @code{plot} for a description of the
-## arguments that @code{semilogx} will accept.
-## 
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{plot, semilogy, loglog}
-## @end deftypefn
-
-## Author: jwe
-
-function h = semilogx (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    set (hax, "xscale", "log");
-    if (! ishold (hax))
-      set (hax, "xminortick", "on");
-    endif
-
-    htmp = __plt__ ("semilogx", hax, varargin{:});
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 1:0.01:10;
-%! y = (x .* (1 + rand (size (x)))) .^ 2;
-%! semilogx (y, x);
-%! title ({'semilogx() plot', 'X-axis is logarithmic'});
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (1,2,1);
-%!  semilogx (x, y);
-%!  xlabel ('semilogx (x, y)');
-%!
-%! subplot (1,2,2);
-%!  semilogx (-x, y);
-%!  xlabel ('semilogx (-x, y)');
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (1,2,1);
-%!  semilogx (x, y);
-%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  xlabel ({'semilogx (x, y)', 'xdir = reversed'});
-%!
-%! subplot (1,2,2);
-%!  semilogx (-x, y);
-%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  xlabel ({'semilogx (-x, y)', 'xdir = reversed'});
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   semilogx (a, b);
-%!   assert (get (gca, "xscale"), "log");
-%!   assert (get (gca, "yscale"), "linear");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a =-logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   semilogx (a, b);
-%!   axis tight;
-%!   assert (all (get (gca, "xtick") < 0));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/semilogxerr.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogxerr (@var{args})
-## @deftypefnx {Function File} {} semilogxerr (@var{hax}, @var{args})
-## @deftypefnx {Function File} {@var{h} =} semilogxerr (@var{args})
-## Produce 2-D plots using a logarithmic scale for the x-axis and
-## errorbars at each data point.
-##
-## Many different combinations of arguments are possible.  The most common
-## form is
-##
-## @example
-## semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
-## @end example
-##
-## @noindent
-## which produces a semi-logarithmic plot of @var{y} versus @var{x}
-## with errors in the @var{y}-scale defined by @var{ey} and the plot
-## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
-## formats and additional information.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## @seealso{errorbar, semilogyerr, loglogerr}
-## @end deftypefn
-
-## Created: 20.2.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function h = semilogxerr (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    set (hax, "xscale", "log");
-    if (! ishold (hax))
-      set (hax, "xminortick", "on");
-    endif
-
-    htmp = __errcomm__ ("semilogxerr", hax, varargin{:});
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = exp (log (0.01):0.2:log (10));
-%! y = wblpdf (x, 2, 2);
-%! ey = 0.5*rand (size (y)) .* y;
-%! semilogxerr (x, y, ey, '#~x-');
-%! xlim (x([1, end]));
-%! title ({'semilogxerr(): semilogx() plot with errorbars', ...
-%!         'X-axis is logarithmic'});
-
--- a/scripts/plot/semilogy.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogy (@var{y})
-## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y})
-## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} semilogy (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} semilogy (@dots{})
-## Produce a 2-D plot using a logarithmic scale for the y-axis.
-##
-## See the documentation of @code{plot} for a description of the
-## arguments that @code{semilogy} will accept.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{plot, semilogx, loglog}
-## @end deftypefn
-
-## Author: jwe
-
-function h = semilogy (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    set (hax, "yscale", "log");
-    if (! ishold (hax))
-      set (hax, "yminortick", "on");
-    endif
-
-    htmp = __plt__ ("semilogy", hax, varargin{:});
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 1:0.01:10;
-%! y = (x .* (1 + rand (size (x)))) .^ 2;
-%! semilogy (x, y);
-%! title ({'semilogx() plot', 'Y-axis is logarithmic'});
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (2,1,1);
-%!  semilogy (x, y);
-%!  ylabel ('semilogy (x, y)');
-%!
-%! subplot (2,1,2);
-%!  semilogy (x, -y);
-%!  ylabel ('semilogy (x, -y)');
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (2,1,1);
-%!  semilogy (x, y);
-%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  ylabel ({'semilogy (x, y)', 'ydir = reversed'});
-%!
-%! subplot (2,1,2);
-%!  semilogy (x, -y);
-%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  ylabel ({'semilogy (x, -y)', 'ydir = reversed'});
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   semilogy (a, b);
-%!   assert (get (gca, "yscale"), "log");
-%!   assert (get (gca, "xscale"), "linear");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b =-logspace (-5, 1, 10);
-%!   semilogy (a, b);
-%!   axis tight;
-%!   assert (all (get (gca, "ytick") < 0));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/semilogyerr.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogyerr (@var{args})
-## @deftypefnx {Function File} {} semilogyerr (@var{hax}, @var{args})
-## @deftypefnx {Function File} {@var{h} =} semilogyerr (@var{args})
-## Produce 2-D plots using a logarithmic scale for the y-axis and
-## errorbars at each data point.
-##
-## Many different combinations of arguments are possible.  The most common
-## form is
-##
-## @example
-## semilogyerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
-## @end example
-##
-## @noindent
-## which produces a semi-logarithmic plot of @var{y} versus @var{x}
-## with errors in the @var{y}-scale defined by @var{ey} and the plot
-## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
-## formats and additional information.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## @seealso{errorbar, semilogxerr, loglogerr}
-## @end deftypefn
-
-## Created: 20.2.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function h = semilogyerr (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("semilogyerr", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    set (hax, "yscale", "log");
-    if (! ishold (hax))
-      set (hax, "yminortick", "on");
-    endif
-
-    htmp = __errcomm__ ("semilogyerr", hax, varargin{:});
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0.25:0.25:10;
-%! y = wblpdf (x, 4, 2);
-%! eyu = rand (size (y));
-%! eyl = 1.0 - 1./(1+eyu);
-%! semilogyerr (x, y, eyl.*y, eyu.*y, '~-d');
-%! xlim ([0 10]);
-%! title ({'semilogyerr(): semilogy() plot with errorbars', ...
-%!         'Y-axis is logarithmic'});
-
--- a/scripts/plot/shading.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-## Copyright (C) 2006-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} shading (@var{type})
-## @deftypefnx {Function File} {} shading (@var{hax}, @var{type})
-## Set the shading of patch or surface graphic objects.
-##
-## Valid arguments for @var{type} are
-##
-## @table @asis
-## @item @qcode{"flat"}
-## Single colored patches with invisible edges.
-##
-## @item @qcode{"faceted"}
-## Single colored patches with visible edges.
-##
-## @item @qcode{"interp"}
-## Color between patch vertices are interpolated and the patch edges are
-## invisible.
-## @end table
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-## @seealso{fill, mesh, patch, pcolor, surf, surface, hidden}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function shading (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("shading", varargin{:});
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  mode = varargin{1};
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-
-  ## Find all patch and surface objects that are descendants of hax
-  ## and  which are not part of a contour plot hggroup.
-  hlist = [];
-  kids = get (hax, "children");
-  while (! isempty (kids))
-    types = get (kids, "type");
-    hlist = [hlist; kids(strcmp(types, "patch"))];
-    hlist = [hlist; kids(strcmp(types, "surface"))];
-    parents = kids(strcmp (types, "axes"));
-    hglist = kids(strcmp (types, "hggroup"));
-    for i = 1 : numel (hglist)
-      props = get (hglist(i));
-      if (! isfield (props, "levelstep"))
-        parents(end+1) = hglist(i); 
-      endif
-    endfor
-    kids = get (parents, "children");
-  endwhile
-
-  ## FIXME: This is the old, simple code.
-  ##        Unfortunately, it also shades contour plots which is not desirable.
-  ##hp = findobj (hax, "type", "patch");
-  ##hs = findobj (hax, "type", "surface");
-  ##hlist = [hp(:); hs(:)];
-
-  switch (lower (mode))
-    case "flat"
-      set (hlist, "facecolor", "flat");
-      set (hlist, "edgecolor", "none");
-    case "interp"
-      set (hlist, "facecolor", "interp");
-      set (hlist, "edgecolor", "none");
-    case "faceted"
-      set (hlist, "facecolor", "flat");
-      set (hlist, "edgecolor", [0 0 0]);
-    otherwise
-      error ('shading: Invalid MODE "%s"', mode);
-  endswitch
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-%! shading faceted;
-%! title ('shading ''faceted''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-%! shading flat;
-%! title ('shading ''flat''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-%! shading interp;
-%! title ('shading ''interp''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks ());
-%! shading faceted;
-%! title ('shading ''faceted''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks ());
-%! shading flat;
-%! title ('shading ''flat''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks ());
-%! shading interp;
-%! title ('shading ''interp''');
-
--- a/scripts/plot/shg.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Command} {} shg
-## Show the graph window.
-##
-## Currently, this is the same as executing @code{drawnow}.
-## @seealso{drawnow, figure}
-## @end deftypefn
-
-## Author: jwe
-
-function shg ()
-
-  if (nargin != 0)
-    warning ("shg: ignoring extra arguments");
-  endif
-
-  drawnow ();
-
-endfunction
-
--- a/scripts/plot/shrinkfaces.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-## Copyright (C) 2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} shrinkfaces (@var{p}, @var{sf})
-## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{p}, @var{sf})
-## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{fv}, @var{sf})
-## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{f}, @var{v}, @var{sf})
-## @deftypefnx {Function File} {[@var{nf}, @var{nv}] =} shrinkfaces (@dots{})
-##
-## Reduce the faces area for a given patch, structure or explicit faces
-## and points matrices by a scale factor @var{sf}.  The structure
-## @var{fv} must contain the fields @qcode{"faces"} and @qcode{"vertices"}. 
-## If the factor @var{sf} is omitted then a default of 0.3 is used.
-##
-## Given a patch handle as the first input argument and no output
-## parameters, perform the shrinking of the patch faces in place and
-## redraw the patch.
-##
-## If called with one output argument, return a structure with fields
-## @qcode{"faces"}, @qcode{"vertices"}, and @qcode{"facevertexcdata"}
-## containing the data after shrinking which can then directly be used as an
-## input argument for the @code{patch} function.
-##
-## Performing the shrinking on faces which are not convex can lead to
-## undesired results.
-##
-## For example,
-##
-## @example
-## @group
-## [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
-## tri = delaunay (phi(:), r(:));
-## v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
-## clf ()
-## p = patch ("Faces", tri, "Vertices", v, "FaceColor", "none");
-## fv = shrinkfaces (p);
-## patch (fv)
-## axis equal
-## grid on
-## @end group
-## @end example
-##
-## @noindent
-## draws a triangulated 3/4 circle and the corresponding shrunken
-## version.
-## @seealso{patch}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function [nf, nv] = shrinkfaces (varargin)
-
-  if (nargin < 1 || nargin > 3 || nargout > 2)
-    print_usage ();
-  endif
-  
-  sf = 0.3;
-  p = varargin{1};
-  colors = [];
-
-  if (ishandle (p) && nargin < 3)
-    faces = get (p, "Faces");
-    vertices = get (p, "Vertices");
-    colors = get (p, "FaceVertexCData");
-    if (nargin == 2)
-      sf = varargin{2};
-    endif
-  elseif (isstruct (p) && nargin < 3)
-    faces = p.faces;
-    vertices = p.vertices;
-    if (isfield (p, "facevertexcdata"))
-      colors = p.facevertexcdata;
-    endif
-    if (nargin == 2)
-      sf = varargin{2};
-    endif
-  elseif (ismatrix (p) && nargin >= 2 && ismatrix (varargin{2}))
-    faces = p;
-    vertices = varargin{2};
-    if (nargin == 3)
-      sf = varargin{3};
-    endif
-  else
-    print_usage ();
-  endif
-  
-  if (! isscalar (sf) || sf <= 0)
-    error ("shrinkfaces: scale factor must be a positive scalar");
-  endif
-
-  n = columns (vertices);
-  if (n < 2 || n > 3)
-    error ("shrinkfaces: only 2-D and 3-D patches are supported");
-  endif
-
-  m = columns (faces);
-  if (m < 3)
-    error ("shrinkfaces: faces must consist of at least 3 vertices");
-  endif
-
-  v = vertices(faces'(:), :);
-  if (isempty (colors) || rows (colors) == rows (faces))
-    c = colors;
-  elseif (rows (colors) == rows (vertices))
-    c = colors(faces'(:), :);
-  else
-    ## Discard inconsistent color data.
-    c = [];
-  endif
-  sv = rows (v);
-  ## we have to deal with a probably very large number of vertices, so
-  ## use sparse we use as midpoint (1/m, ..., 1/m) in generalized
-  ## barycentric coordinates.
-  midpoints = full (kron ( speye (sv / m), ones (m, m) / m) * sparse (v));
-  v = sqrt (sf) * (v - midpoints) + midpoints;
-  f = reshape (1:sv, m, sv / m)';
-  
-  switch (nargout)
-    case 0
-      if (ishandle (p))
-        ## avoid exceptions
-        set (p, "FaceVertexCData", [], "CData", []);
-        set (p, "Vertices", v, "Faces", f, "FaceVertexCData", c);
-      else
-        nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
-      endif
-    case 1
-      nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
-    case 2
-      nf = f;
-      nv = v;
-  endswitch
-
-endfunction
-
-
-%!demo
-%! clf;
-%! faces = [1 2 3; 1 3 4];
-%! vertices = [0 0; 1 0; 1 1; 0 1];
-%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
-%! fv = shrinkfaces (faces, vertices, 0.25);
-%! patch (fv);
-%! axis equal;
-
-%!demo
-%! clf;
-%! faces = [1 2 3 4; 5 6 7 8];
-%! vertices = [0 0; 1 0; 2 1; 1 1; 2 0; 3 0; 4 1; 3.5 1];
-%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
-%! fv = shrinkfaces (faces, vertices, 0.25);
-%! patch (fv);
-%! axis equal;
-%! grid on;
-
-%!demo
-%! clf;
-%! faces = [1 2 3 4];
-%! vertices = [-1 2; 0 0; 1 2; 0 1];
-%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
-%! fv = shrinkfaces (faces, vertices, 0.25);
-%! patch (fv);
-%! axis equal;
-%! grid on;
-%! title 'faces which are not convex are clearly not allowed'
-
-%!demo
-%! clf;
-%! [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
-%! tri = delaunay (phi(:), r(:));
-%! v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
-%! p = patch ('Faces', tri, 'Vertices', v, 'FaceColor', 'none');
-%! fv = shrinkfaces (p);
-%! patch (fv);
-%! axis equal;
-%! grid on;
-
-%!demo
-%! clf;
-%! N = 10;  % N intervals per axis
-%! [x, y, z] = meshgrid (linspace (-4,4,N+1));
-%! val = x.^3 + y.^3 + z.^3;
-%! fv = isosurface (x, y, z, val, 3, z);
-%!
-%! p = patch ('Faces', fv.faces, 'Vertices', fv.vertices, 'FaceVertexCData', ...
-%!            fv.facevertexcdata, 'FaceColor', 'interp', 'EdgeColor', 'black');
-%! axis equal;
-%! view (115, 30);
-%! drawnow;
-%! shrinkfaces (p, 0.6);
-
-%!shared faces, vertices, nfv, nfv2
-%! faces = [1 2 3];
-%! vertices = [0 0 0; 1 0 0; 1 1 0];
-%! nfv = shrinkfaces (faces, vertices, 0.7);
-%! nfv2 = shrinkfaces (nfv, 1/0.7);
-%!assert (isfield (nfv, "faces"))
-%!assert (isfield (nfv, "vertices"))
-%!assert (size (nfv.faces), [1 3])
-%!assert (size (nfv.vertices), [3 3])
-%!assert (norm (nfv2.vertices - vertices), 0, 2*eps)
-
--- a/scripts/plot/slice.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel, David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{sx}, @var{sy}, @var{sz})
-## @deftypefnx {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi})
-## @deftypefnx {Function File} {} slice (@var{v}, @var{sx}, @var{sy}, @var{sz})
-## @deftypefnx {Function File} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi})
-## @deftypefnx {Function File} {} slice (@dots{}, @var{method})
-## @deftypefnx {Function File} {} slice (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} slice (@dots{})
-## Plot slices of 3-D data/scalar fields.
-##
-## Each element of the 3-dimensional array @var{v} represents a scalar value at
-## a location given by the parameters @var{x}, @var{y}, and @var{z}.  The
-## parameters @var{x}, @var{x}, and @var{z} are either 3-dimensional arrays of
-## the same size as the array @var{v} in the @qcode{"meshgrid"} format or
-## vectors.  The parameters @var{xi}, etc. respect a similar format to
-## @var{x}, etc., and they represent the points at which the array @var{vi}
-## is interpolated using interp3.  The vectors @var{sx}, @var{sy}, and
-## @var{sz} contain points of orthogonal slices of the respective axes.
-##
-## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be
-## @code{x = 1:size (@var{v}, 2)}, @code{y = 1:size (@var{v}, 1)} and
-## @code{z = 1:size (@var{v}, 3)}.
-##
-## @var{method} is one of:
-##
-## @table @asis
-## @item @qcode{"nearest"}
-## Return the nearest neighbor.
-##
-## @item @qcode{"linear"}
-## Linear interpolation from nearest neighbors.
-##
-## @item @qcode{"cubic"}
-## Cubic interpolation from four nearest neighbors (not implemented yet).
-##
-## @item @qcode{"spline"}
-## Cubic spline interpolation---smooth first and second derivatives
-## throughout the curve.
-## @end table
-##
-## The default method is @qcode{"linear"}.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## Examples:
-##
-## @example
-## @group
-## [x, y, z] = meshgrid (linspace (-8, 8, 32));
-## v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
-## slice (x, y, z, v, [], 0, []);
-##
-## [xi, yi] = meshgrid (linspace (-7, 7));
-## zi = xi + yi;
-## slice (x, y, z, v, xi, yi, zi);
-## @end group
-## @end example
-## @seealso{interp3, surface, pcolor}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function h = slice (varargin)
-
-  [hax, varargin, nargs] = __plt_get_axis_arg__ ("slice", varargin{:});
-
-  method = "linear";
-
-  if (ischar (varargin{end}))
-    method = varargin{end};
-    nargs -= 1;
-  endif
-
-  if (nargs == 4)
-    v = varargin{1};
-    if (ndims (v) != 3)
-      error ("slice: V must be a 3-dimensional array of values");
-    endif
-    [nx, ny, nz] = size (v);
-    [x, y, z] = meshgrid (1:nx, 1:ny, 1:nz);
-    sx = varargin{2};
-    sy = varargin{3};
-    sz = varargin{4};
-  elseif (nargs == 7)
-    v = varargin{4};
-    if (ndims (v) != 3)
-      error ("slice: V must be a 3-dimensional array of values");
-    endif
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    if (isvector (x) && isvector (y) && isvector (z))
-      [x, y, z] = meshgrid (x, y, z);
-    elseif (ndims (x) == 3 && size_equal (x, y, z))
-      ## Do nothing.
-    else
-      error ("slice: X, Y, Z size mismatch");
-    endif
-    sx = varargin{5};
-    sy = varargin{6};
-    sz = varargin{7};
-  else
-    print_usage ();
-  endif
-
-  if (any ([isvector(sx), isvector(sy), isvector(sz)]))
-    have_sval = true;
-  elseif (ndims (sx) == 2 && size_equal (sx, sy, sz))
-    have_sval = false;
-  else
-    error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)");
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    sidx = 1;
-    minv = min (v(:));
-    maxv = max (v(:));
-    set (hax, "clim", [minv, maxv]);
-
-    if (have_sval)
-      ns = length (sx) + length (sy) + length (sz);
-      hs = zeros (ns,1);
-      [ny, nx, nz] = size (v);
-      if (length (sz) > 0)
-        for i = 1:length (sz)
-          [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)),
-                                   squeeze (y(:,1,1)), sz(i));
-          vz = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
-          htmp(sidx++) = surface (xi, yi, sz(i) * ones (size (yi)), vz);
-        endfor
-      endif
-
-      if (length (sy) > 0)
-        for i = length (sy):-1:1
-          [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)), sy(i), squeeze (z(1,1,:)));
-          vy = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
-          htmp(sidx++) = surface (squeeze (xi),
-                                  squeeze (sy(i) * ones (size (zi))),
-                                  squeeze (zi), vy);
-        endfor
-      endif
-
-      if (length (sx) > 0)
-        for i = length (sx):-1:1
-          [xi, yi, zi] = meshgrid (sx(i), squeeze (y(:,1,1)), squeeze (z(1,1,:)));
-          vx = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
-          htmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))),
-                                  squeeze (yi), squeeze(zi), vx);
-        endfor
-      endif
-    else
-      vi = interp3 (x, y, z, v, sx, sy, sz);
-      htmp = surface (sx, sy, sz, vi);
-    endif
-
-    if (! ishold ())
-      set (hax, "view", [-37.5, 30.0], "box", "off",
-                "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
-%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
-%! slice (x, y, z, v, [], 0, []);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
-%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
-%! [xi, yi] = meshgrid (linspace (-7, 7));
-%! zi = xi + yi;
-%! slice (x, y, z, v, xi, yi, zi);
-
--- a/scripts/plot/sombrero.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} sombrero ()
-## @deftypefnx {Function File} {} sombrero (@var{n})
-## @deftypefnx {Function File} {@var{z} =} sombrero (@dots{})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sombrero (@dots{})
-## Plot the familiar 3-D sombrero function.
-##
-## The function plotted is
-## @tex
-## $$z = { \rm{sin} (\sqrt {(x^2 + y^2)}) \over \sqrt {(x^2 + y^2)} }$$
-## @end tex
-## @ifnottex
-##
-## @example
-## z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
-## @end example
-##
-## @end ifnottex
-## Called without a return argument, @code{sombrero} plots the surface of the
-## above function over the meshgrid [-8,8] using @code{surf}.
-## 
-## If @var{n} is a scalar the plot is made with @var{n} grid lines.
-## The default value for @var{n} is 41.
-##
-## When called with output arguments, return the data for the function
-## evaluated over the meshgrid.  This can subsequently be plotted with
-## @code{surf (@var{x}, @var{y}, @var{z})}.
-##
-## @seealso{peaks, meshgrid, mesh, surf}
-## @end deftypefn
-
-## Author: jwe
-
-function [x, y, z] = sombrero (n = 41)
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (n <= 1)
-    error ("sombrero: number of grid lines N must be greater than 1");
-  endif
-
-  [xx, yy] = meshgrid (linspace (-8, 8, n));
-  r = sqrt (xx.^2 + yy.^2) + eps;  # eps prevents div/0 errors
-  zz = sin (r) ./ r;
-
-  if (nargout == 0)
-    surf (xx, yy, zz);
-  elseif (nargout == 1)
-    x = zz;
-  else
-    x = xx;
-    y = yy;
-    z = zz;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-%! title ('sombrero() function');
-
-## Test input validation
-%!error sombrero (1,2,3)
-%!error <N must be greater than 1> sombrero (1)
-
--- a/scripts/plot/specular.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-## Copyright (C) 2009-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv})
-## @deftypefnx {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se})
-## Calculate specular reflection strength of a surface defined by the normal
-## vector elements @var{sx}, @var{sy}, @var{sz} using Phong's approximation.
-##
-## The light source location and viewer location vectors can be specified using
-## parameter @var{lv} and @var{vv} respectively.  The location vectors can
-## given as 2-element vectors [azimuth, elevation] in degrees or as 3-element
-## vectors [x, y, z].
-##
-## An optional sixth argument describes the specular exponent (spread) @var{se}.
-## @seealso{diffuse, surfl}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function retval = specular (sx, sy, sz, lv, vv, se)
-
-  if (nargin < 5 || nargin > 6)
-    print_usage ();
-  endif
-
-  ## Checks for specular exponent (se).
-  if (nargin < 6)
-    se = 10;
-  else
-    if (!isnumeric (se) || numel (se) != 1 || se <= 0)
-      error ("specular: exponent must be positive scalar");
-    endif
-  endif
-
-  ## Checks for normal vector.
-  if (!size_equal (sx, sy, sz))
-    error ("specular: SX, SY, and SZ must have same size");
-  endif
-
-  ## Check for light vector (lv) argument.
-  if (length (lv) < 2 || length (lv) > 3)
-    error ("specular: light vector LV must be a 2- or 3-element vector");
-  elseif (length (lv) == 2)
-    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
-  endif
-
-  ## Check for view vector (vv) argument.
-  if (length (vv) < 2 || length (lv) > 3)
-    error ("specular: view vector VV must be a 2- or 3-element vector");
-  elseif (length (vv) == 2)
-    [vv(1), vv(2), vv(3)] = sph2cart (vv(1) * pi / 180, vv(2) * pi / 180, 1.0);
-  endif
-
-  ## Normalize view and light vector.
-  if (sum (abs (lv)) > 0)
-    lv  /= norm (lv);
-  endif
-  if (sum (abs (vv)) > 0)
-    vv  /= norm (vv);
-  endif
-
-  ## Calculate normal vector lengths and dot-products.
-  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
-  l_dot_n = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
-  v_dot_n = (sx * vv(1) + sy * vv(2) + sz * vv(3)) ./ ns;
-
-  ## Calculate specular reflection using Phong's approximation.
-  retval = 2 * l_dot_n .* v_dot_n - dot (lv, vv);
-
-  ## Set zero if light is on the other side.
-  retval(l_dot_n < 0) = 0;
-
-  ## Allow postive values only.
-  retval(retval < 0) = 0;
-  retval = retval .^ se;
-
-endfunction
-
--- a/scripts/plot/sphere.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} sphere ()
-## @deftypefnx {Function File} {} sphere (@var{n})
-## @deftypefnx {Function File} {} sphere (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sphere (@dots{})
-## Plot a 3-D unit sphere.
-##
-## The optional input @var{n} determines the number of faces around the
-## the circumference of the sphere.  The default value is 20.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## If outputs are requested @code{sphere} returns three matrices in
-## @code{meshgrid} format such that @code{surf (@var{x}, @var{y}, @var{z})}
-## generates a unit sphere.
-##
-## Example:
-##
-## @example
-## @group
-## [x, y, z] = sphere (40);
-## surf (3*x, 3*y, 3*z);
-## axis equal;
-## title ("sphere of radius 3");
-## @end group
-## @end example
-## @seealso{cylinder, ellipsoid, rectangle}
-## @end deftypefn
-
-function [xx, yy, zz] = sphere (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("sphere", varargin{:});
-
-  if (nargin > 1)
-    print_usage ();
-  elseif (nargin == 1)
-    n = varargin{1};
-  else
-    n = 20;
-  endif
-
-  theta = linspace (0, 2*pi, n+1);
-  phi = linspace (-pi/2, pi/2, n+1);
-  [theta,phi] = meshgrid (theta, phi);
-
-  x = cos (phi) .* cos (theta);
-  y = cos (phi) .* sin (theta);
-  z = sin (phi);
-
-  if (nargout > 0)
-    xx = x;
-    yy = y;
-    zz = z;
-  else
-    oldfig = [];
-    if (! isempty (hax))
-      oldfig = get (0, "currentfigure");
-    endif
-    unwind_protect
-      hax = newplot (hax);
-    
-      surf (x, y, z);
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-  endif
-
-endfunction
-
--- a/scripts/plot/stairs.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stairs (@var{y})
-## @deftypefnx {Function File} {} stairs (@var{x}, @var{y})
-## @deftypefnx {Function File} {} stairs (@dots{}, @var{style})
-## @deftypefnx {Function File} {} stairs (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} stairs (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} stairs (@dots{})
-## @deftypefnx {Function File} {[@var{xstep}, @var{ystep}] =} stairs (@dots{})
-## Produce a stairstep plot.
-##
-## The arguments @var{x} and @var{y} may be vectors or matrices.
-## If only one argument is given, it is taken as a vector of Y values
-## and the X coordinates are taken to be the indices of the elements.
-## 
-## The style to use for the plot can be defined with a line style @var{style}
-## of the same format as the @code{plot} command.
-##
-## Multiple property/value pairs may be specified, but they must appear in
-## pairs.
-##
-## If the first argument @var{hax} is an axis handle, then plot into this axis,
-## rather than the current axis handle returned by @code{gca}.
-##
-## If one output argument is requested, return a graphics handle to the
-## created plot.  If two output arguments are specified, the data are generated
-## but not plotted.  For example,
-##
-## @example
-## stairs (x, y);
-## @end example
-##
-## @noindent
-## and
-##
-## @example
-## @group
-## [xs, ys] = stairs (x, y);
-## plot (xs, ys);
-## @end group
-## @end example
-##
-## @noindent
-## are equivalent.
-## @seealso{bar, hist, plot, stem}
-## @end deftypefn
-
-## Author: jwe
-
-function [xs, ys] = stairs (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("stairs", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  if (nargout < 2)
-    oldfig = [];
-    if (! isempty (hax))
-      oldfig = get (0, "currentfigure");
-    endif
-    unwind_protect
-      hax = newplot (hax);
-      [htmp, xxs, yys] = __stairs__ (true, varargin{:});
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-    if (nargout == 1)
-      xs = htmp;
-    endif
-  else
-    [~, xs, ys] = __stairs__ (false, varargin{:});
-  endif
-
-endfunction
-
-function [h, xs, ys] = __stairs__ (doplot, varargin)
-
-  if (nargin == 2 || ischar (varargin{2}))
-    y = varargin{1};
-    varargin(1) = [];
-    if (! ismatrix (y) || ndims (y) > 2)
-      error ("stairs: Y must be a numeric 2-D vector or matrix");
-    endif
-    if (isvector (y))
-      y = y(:);
-    endif
-    x = 1:rows (y);
-  else
-    x = varargin{1};
-    y = varargin{2};
-    varargin(1:2) = [];
-    if (! ismatrix (x) || ! ismatrix (y) || ndims (x) > 2 || ndims (y) > 2)
-      error ("stairs: X and Y must be numeric 2-D vectors or matrices");
-    endif
-  endif
-
-  vec_x = isvector (x);
-  if (vec_x)
-    x = x(:);
-  endif
-
-  if (isvector (y))
-    y = y(:);
-  elseif (ismatrix (y) && vec_x)
-    x = repmat (x, [1, columns(y)]);
-  endif
-
-  if (! size_equal (x, y))
-    error ("stairs: X and Y sizes must match");
-  endif
-
-  [nr, nc] = size (y);
-
-  len = 2*nr - 1;
-
-  xs = ys = zeros (len, nc);
-
-  xs(1,:) = x(1,:);
-  ys(1,:) = y(1,:);
-
-  xtmp = x(2:nr,:);
-  ridx = 2:2:len-1;
-  xs(ridx,:) = xtmp;
-  ys(ridx,:) = y(1:nr-1,:);
-
-  ridx = 3:2:len;
-  xs(ridx,:) = xtmp;
-  ys(ridx,:) = y(2:nr,:);
-
-  have_line_spec = false;
-  for i = 1:2:numel (varargin)
-    arg = varargin{i};
-    if (ischar (arg) || iscellstr (arg))
-      [linespec, valid] = __pltopt__ ("stairs", arg, false);
-      if (valid)
-        have_line_spec = true;
-        varargin(i) = [];
-        break;
-      endif
-    endif
-  endfor
-
-  if (doplot)
-    h = [];
-    hold_state = get (gca (), "nextplot");
-    unwind_protect
-      for i = 1 : columns (y)
-
-        if (have_line_spec)
-          lc = linespec.color;
-          if (isempty (lc))
-            lc = __next_line_color__ ();
-          endif
-          ls = linespec.linestyle;
-          if (isempty (ls))
-            ls = "-";
-          endif
-          mk = linespec.marker;
-          if (isempty (mk))
-            mk = "none";
-          endif
-        else
-          lc = __next_line_color__ ();
-          ls = "-";
-          mk = "none";
-        endif
-
-        ## Must occur after __next_line_color__ in order to work correctly.
-        hg = hggroup ();
-        h = [h; hg];
-        args = __add_datasource__ ("stairs", hg, {"x", "y"}, varargin{:});
-
-        addproperty ("xdata", hg, "data", x(:,i).');
-        addproperty ("ydata", hg, "data", y(:,i).');
-
-        addlistener (hg, "xdata", @update_data);
-        addlistener (hg, "ydata", @update_data);
-
-        htmp = line (xs(:,i).', ys(:,i).', "color", lc, "linestyle", ls,
-                                           "marker", mk, "parent", hg);
-
-        addproperty ("color", hg, "linecolor", get (htmp, "color"));
-        addproperty ("linestyle", hg, "linelinestyle", get (htmp, "linestyle"));
-        addproperty ("linewidth", hg, "linelinewidth", get (htmp, "linewidth"));
-
-        addproperty ("marker", hg, "linemarker", get (htmp, "marker"));
-        addproperty ("markeredgecolor", hg, "linemarkeredgecolor",
-                     get (htmp, "markeredgecolor"));
-        addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
-                     get (htmp, "markerfacecolor"));
-        addproperty ("markersize", hg, "linemarkersize",
-                     get (htmp, "markersize"));
-
-        addlistener (hg, "color", @update_props);
-        addlistener (hg, "linestyle", @update_props);
-        addlistener (hg, "linewidth", @update_props);
-        addlistener (hg, "marker", @update_props);
-        addlistener (hg, "markeredgecolor", @update_props);
-        addlistener (hg, "markerfacecolor", @update_props);
-        addlistener (hg, "markersize", @update_props);
-
-        ## Matlab property, although Octave does not implement it.
-        addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
-
-        if (! isempty (args))
-          set (hg, args{:});
-        endif
-      endfor
-    unwind_protect_cleanup
-      set (gca (), "nextplot", hold_state);
-    end_unwind_protect
-  else
-    h = 0;
-  endif
-
-endfunction
-
-function update_props (h, ~)
-  set (get (h, "children"),
-       {"color", "linestyle", "linewidth", "marker", "markeredgecolor",
-        "markerfacecolor", "markersize", "markersize"},
-       get (h, {"color", "linestyle", "linewidth", "marker", "markeredgecolor",
-                "markerfacecolor", "markersize", "markersize"}));
-endfunction
-
-function update_data (h, ~)
-  x = get (h, "xdata");
-  y = get (h, "ydata");
-
-  sz = min ([size(x); size(y)]);
-  x = x(1:sz(1), 1:sz(2));
-  y = y(1:sz(1), 1:sz(2));
-
-  nr = length (x);
-  len = 2 * nr - 1;
-  xs = ys = zeros (1, len);
-
-  xs(1) = x(1);
-  ys(1) = y(1);
-
-  xtmp = x(2:nr);
-  ridx = 2:2:len-1;
-  xs(ridx) = xtmp;
-  ys(ridx) = y(1:nr-1);
-
-  ridx = 3:2:len;
-  xs(ridx) = xtmp;
-  ys(ridx) = y(2:nr);
-
-  set (get (h, "children"), "xdata", xs, "ydata", ys);
-endfunction
-
-
-%!demo
-%! clf;
-%! rand_1x10_data1 = [0.073, 0.455, 0.837, 0.124, 0.426, 0.781, 0.004, 0.024, 0.519, 0.698];
-%! y = rand_1x10_data1;
-%! stairs (y);
-%! title ('stairs() plot of y-data');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! rand_1x10_data2 = [0.014, 0.460, 0.622, 0.394, 0.531, 0.378, 0.466, 0.788, 0.342, 0.893];
-%! y = rand_1x10_data2;
-%! [xs, ys] = stairs (x, y);
-%! plot (xs, ys);
-%! title ('plot() of stairs() generated data');
-
-%!demo
-%! clf;
-%! stairs (1:9, '-o');
-%! title ('stairs() plot with linespec to modify marker');
-
-%!demo
-%! clf;
-%! stairs (9:-1:1, 'marker', 's', 'markersize', 10, 'markerfacecolor', 'm');
-%! title ('stairs() plot with prop/val pairs to modify appearance');
-
-%!demo
-%! clf;
-%! N = 11;
-%! x = 0:(N-1);
-%! y = rand (1, N);
-%! hs = stairs (x(1), y(1));
-%! axis ([1, N-1 0, 1]);
-%! title ('stairs plot data modified through handle');
-%! for k = 2:N
-%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k));
-%!   drawnow ();
-%!   pause (0.2);
-%! end
-
-## Invisible figure used for tests
-%!shared hf, hax
-%! hf = figure ("visible", "off");
-%! hax = axes;
-
-%!error stairs ()
-%!error <Y must be a numeric 2-D vector> stairs (hax, {1})
-%!error <Y must be a numeric 2-D vector> stairs (ones (2,2,2))
-%!error <X and Y must be numeric 2-D vector> stairs ({1}, 1)
-%!error <X and Y must be numeric 2-D vector> stairs (1, {1})
-%!error <X and Y must be numeric 2-D vector> stairs (ones (2,2,2), 1)
-%!error <X and Y must be numeric 2-D vector> stairs (1, ones (2,2,2))
-%!error <X and Y sizes must match> stairs (1:2, 1:3)
-
-## Close figure used for testing
-%!test
-%! close (hf);
-
--- a/scripts/plot/stem.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-## Copyright (C) 2006-2012 Michel D. Schmid
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stem (@var{y})
-## @deftypefnx {Function File} {} stem (@var{x}, @var{y})
-## @deftypefnx {Function File} {} stem (@dots{}, @var{linespec})
-## @deftypefnx {Function File} {} stem (@dots{}, "filled")
-## @deftypefnx {Function File} {} stem (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} stem (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} stem (@dots{})
-## Plot a 2-D stem graph.
-##
-## If only one argument is given, it is taken as the y-values and the
-## x-coordinates are taken from the indices of the elements.
-##
-## If @var{y} is a matrix, then each column of the matrix is plotted as
-## a separate stem graph.  In this case @var{x} can either be a vector,
-## the same length as the number of rows in @var{y}, or it can be a
-## matrix of the same size as @var{y}.
-##
-## The default color is @qcode{"b"} (blue), the default line style is
-## @qcode{"-"}, and the default marker is @qcode{"o"}.  The line style can
-## be altered by the @code{linespec} argument in the same manner as the
-## @code{plot} command.  If the @qcode{"filled"} argument is present the
-## markers at the top of the stems will be filled in.  For example,
-##
-## @example
-## @group
-## x = 1:10;
-## y = 2*x;
-## stem (x, y, "r");
-## @end group
-## @end example
-##
-## @noindent
-## plots 10 stems with heights from 2 to 20 in red;
-##
-## Optional property/value pairs may be specified to control the appearance
-## of the plot.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a handle to a @nospell{"stem series"}
-## hggroup.  The single hggroup handle has all of the graphical elements
-## comprising the plot as its children; This allows the properties of
-## multiple graphics objects to be changed by modifying just a single
-## property of the @nospell{"stem series"} hggroup.
-##
-## For example,
-##
-## @example
-## @group
-## x = [0:10]';
-## y = [sin(x), cos(x)]
-## h = stem (x, y);
-## set (h(2), "color", "g");
-## set (h(1), "basevalue", -1)
-## @end group
-## @end example
-##
-## @noindent
-## changes the color of the second @nospell{"stem series"} and moves the base
-## line of the first.
-##
-## Stem Series Properties
-##
-## @table @asis
-## @item linestyle
-## The linestyle of the stem.  (Default: @qcode{"-"})
-##
-## @item linewidth
-## The width of the stem.  (Default: 0.5)
-##
-## @item color
-## The color of the stem, and if not separately specified, the marker.
-## (Default: @qcode{"b"} [blue])
-##
-## @item marker
-## The marker symbol to use at the top of each stem.  (Default: @qcode{"o"})
-##
-## @item markeredgecolor
-## The edge color of the marker.  (Default: @qcode{"color"} property)
-##
-## @item markerfacecolor
-## The color to use for @nospell{"filling"} the marker.  
-## (Default: @qcode{"none"} [unfilled])
-##
-## @item markersize
-## The size of the marker.  (Default: 6)
-##
-## @item baseline
-## The handle of the line object which implements the baseline.  Use @code{set}
-## with the returned handle to change graphic properties of the baseline.
-##
-## @item basevalue
-## The y-value where the baseline is drawn.  (Default: 0)
-## @end table
-## @seealso{stem3, bar, hist, plot, stairs}
-## @end deftypefn
-
-## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
-## Adapted-by: jwe
-
-function h = stem (varargin)
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  htmp = __stem__ (false, varargin{:});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! y = 1:10;
-%! stem (y);
-%! title ('stem plot of y-values only');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! stem (x, y);
-%! title ('stem plot of x and y-values');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, 'r');
-%! title ('stem plot with modified color');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, '-.k');
-%! title ('stem plot with modified line style and color');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, '-.ks');
-%! title ('stem plot with modified line style, color, and marker');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, 'filled');
-%! title ('stem plot with "filled" markers');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, 'markerfacecolor', [1 0 1]);
-%! title ('stem plot modified with property/value pair');
-
-%!demo
-%! clf;
-%! x = (0 : 10)';
-%! y = [sin(x), cos(x)];
-%! h = stem (x, y);
-%! set (h(2), 'color', 'g');
-%! set (h(1), 'basevalue', -1);
-%! title ('stem plots modified through hggroup handle');
-
-%!demo
-%! clf;
-%! N = 11;
-%! x = 0:(N-1);
-%! y = rand (1, N);
-%! hs = stem (x(1), y(1));
-%! set (gca (), 'xlim', [1, N-1], 'ylim', [0, 1]);
-%! title ('stem plot data modified through hggroup handle');
-%! for k=2:N
-%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k))
-%!   drawnow ();
-%!   pause (0.2);
-%! end
-
-%!error stem ()
-%!error <can not define Z for 2-D stem plot> stem (1,2,3)
-%!error <X and Y must be numeric> stem ({1})
-%!error <X and Y must be numeric> stem (1, {1})
-%!error <inconsistent sizes for X and Y> stem (1:2, 1:3)
-%!error <inconsistent sizes for X and Y> stem (1:2, ones (3,3))
-%!error <inconsistent sizes for X and Y> stem (ones (2,2), ones (3,3))
-%!error <No value specified for property "FOO"> stem (1, "FOO")
-
--- a/scripts/plot/stem3.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stem3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} stem3 (@dots{}, @var{linespec})
-## @deftypefnx {Function File} {} stem3 (@dots{}, "filled")
-## @deftypefnx {Function File} {} stem3 (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} stem3 (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} stem3 (@dots{})
-## Plot a 3-D stem graph.
-##
-## Stems are drawn from the height @var{z} to the location in the x-y plane
-## determined by @var{x} and @var{y}.  The default color is @qcode{"b"} (blue),
-## the default line style is @qcode{"-"}, and the default marker is @qcode{"o"}.
-##
-## The line style can be altered by the @code{linespec} argument in the same
-## manner as the @code{plot} command.  If the @qcode{"filled"} argument is
-## present the markers at the top of the stems will be filled in.
-##
-## Optional property/value pairs may be specified to control the appearance
-## of the plot.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a handle to the @nospell{"stem series"}
-## hggroup containing the line and marker objects used for the plot.
-## @xref{XREFstem,,stem}, for a description of the @nospell{"stem series"}
-## object.
-##
-## Example:
-##
-## @example
-## @group
-## theta = 0:0.2:6;
-## stem3 (cos (theta), sin (theta), theta);
-## @end group
-## @end example
-##
-## @noindent
-## plots 31 stems with heights from 0 to 6 lying on a circle.
-##
-## Implementation Note: Color definitions with RGB-triples are not valid.
-## @seealso{stem, bar, hist, plot}
-## @end deftypefn
-
-function h = stem3 (varargin)
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  htmp = __stem__ (true, varargin{:});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! theta = 0:0.2:6;
-%! stem3 (cos (theta), sin (theta), theta);
-%! title ('stem3() plot');
-
-%!error stem3 ()
-%!error <must define X, Y, and Z> stem3 (1,2)
-%!error <X, Y, and Z must be numeric> stem3 ({1}, 1, 1)
-%!error <X, Y, and Z must be numeric> stem3 (1, {1}, 1)
-%!error <X, Y, and Z must be numeric> stem3 (1, 1, {1})
-%!error <inconsistent sizes for X, Y, and Z> stem3 (ones (2,2), 1, 1);
-%!error <inconsistent sizes for X, Y, and Z> stem3 (1, ones (2,2), 1);
-%!error <inconsistent sizes for X, Y, and Z> stem3 (1, 1, ones (2,2));
-%!error <No value specified for property "FOO"> stem3 (1, "FOO")
--- a/scripts/plot/stemleaf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,596 +0,0 @@
-## Copyright (C) 2013 Michael D. Godfrey
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public
-## License as published by the Free Software Foundation;
-## either version 3 of the License, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied
-## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-## PURPOSE. See the GNU General Public License for more
-## details.
-##
-## You should have received a copy of the GNU General Public
-## License along with Octave; see the file COPYING. If not,
-## see <http://www.gnu.org/licenses/>.
-
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stemleaf (@var{x}, @var{caption})
-## @deftypefnx {Function File} {} stemleaf (@var{x}, @var{caption}, @var{stem_sz})
-## @deftypefnx {Function File} {@var{plotstr} =} stemleaf (@dots{})
-## Compute and display a stem and leaf plot of the vector @var{x}.
-##
-## The input @var{x} should be a vector of integers.  Any non-integer values
-## will be converted to integer by @code{@var{x} = fix (@var{x})}.  By default
-## each element of @var{x} will be plotted with the last digit of the element
-## as a leaf value and the remaining digits as the stem.  For example, 123
-## will be plotted with the stem @samp{12} and the leaf @samp{3}.  The second
-## argument, @var{caption}, should be a character array which provides a
-## description of the data.  It is included as a heading for the output.
-##
-## The optional input @var{stem_sz} sets the width of each stem.
-## The stem width is determined by @code{10^(@var{stem_sz} + 1)}.
-## The default stem width is 10.
-##
-## The output of @code{stemleaf} is composed of two parts: a
-## "Fenced Letter Display," followed by the stem-and-leaf plot itself.
-## The Fenced Letter Display is described in @cite{Exploratory Data Analysis}.
-## Briefly, the entries are as shown:
-##
-## @example
-## @group
-##
-##         Fenced Letter Display
-## #% nx|___________________     nx = numel (x)
-## M% mi|       md         |     mi median index, md median
-## H% hi|hl              hu| hs  hi lower hinge index, hl,hu hinges,
-## 1    |x(1)         x(nx)|     hs h_spreadx(1), x(nx) first 
-##            _______            and last data value.
-##      ______|step |_______     step 1.5*h_spread
-##     f|ifl            ifh|     inner fence, lower and higher
-##      |nfl            nfh|     no.\ of data points within fences
-##     F|ofl            ofh|     outer fence, lower and higher
-##      |nFl            nFh|     no.\ of data points outside outer
-##                               fences
-## @end group
-## @end example
-##
-## The stem-and-leaf plot shows on each line the stem value followed by the
-## string made up of the leaf digits.  If the @var{stem_sz} is not 1 the
-## successive leaf values are separated by ",".
-##
-## With no return argument, the plot is immediately displayed.  If an output
-## argument is provided, the plot is returned as an array of strings. 
-##
-## The leaf digits are not sorted.  If sorted leaf values are desired, use
-## @code{@var{xs} = sort (@var{x})} before calling @code{stemleaf (@var{xs})}.
-##
-## The stem and leaf plot and associated displays are described in: 
-## Ch. 3, @cite{Exploratory Data Analysis} by J. W. Tukey, Addison-Wesley, 1977.
-## @seealso{hist, printd}
-## @end deftypefn
-
-## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
-## Description: Compute stem and leaf plot
-
-function plotstr = stemleaf (x, caption, stem_sz)
-  ## Compute and display a stem and leaf plot of the vector x.  The x
-  ## vector is converted to integer by x = fix(x).  If an output argument
-  ## is provided, the plot is returned as an array of strings.  The
-  ## first element is the heading followed by an element for each stem.
-  ##
-  ## The default stem step is 10.  If stem_sz is provided the stem
-  ## step is set to: 10^(stem_sz+1).  The x vector should be integers.
-  ## It will be treated so that the last digit is the leaf value and the
-  ## other digits are the stems.
-  ##
-  ## When we first implemented stem and leaf plots in the early 1960's
-  ## there was some discussion about sorting vs. leaving the leaf
-  ## entries in the original order in the data.  We decided in favor of
-  ## sorting the leaves for most purposes.  This is the choice
-  ## implemented in the SNAP/IEDA system that was written at that time.
-  ##
-  ## SNAP/IEDA, and particularly its stem and leaf plotting, were further
-  ## developed by Hale Trotter, David Hoagland (at Princeton and MIT),
-  ## and others.
-  ##
-  ## Tukey, in EDA, generally uses unsorted leaves.  In addition, he
-  ## described a wide range of additional display formats.  This
-  ## implementation does not sort the leaves, but if the x vector is
-  ## sorted then the leaves come out sorted.  A simple display format is
-  ## used.
-  ##
-  ## I doubt if providing other options is worthwhile.  The code can
-  ## quite easily be modified to provide specific display results.  Or,
-  ## the returned output string can be edited.  The returned output is an
-  ## array of strings with each row containing a line of the plot
-  ## preceded by the lines of header text as the first row.  This
-  ## facilitates annotation.
-  ##
-  ## Note that the code has some added complexity due to the need to
-  ## distinguish both + and - 0 stems.  The +- stem values are essential
-  ## for all plots which span 0. After dealing with +-0 stems, the added
-  ## complexity of putting +- data values in the correct stem is minor,
-  ## but the sign of 0 leaves must be checked.  And, the cases where the
-  ## stems start or end at +- 0 must also be considered.
-  ##
-  ## The fact that IEEE floating point defines +- 0 helps make this
-  ## easier.
-  ##
-  ## Michael D. Godfrey   January 2013
-
-  ## More could be implemented for better data scaling.  And, of course,
-  ## other options for the kinds of plots described by Tukey could be
-  ## provided.  This may best be left to users.
-
-  if (nargin < 2 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (! isvector (x))
-    error ("stemleaf: X must be a vector");
-  endif
-
-  if (isinteger (x))
-    ## Avoid use of integers because rounding rules do not use fix():
-    ## Example: floor (int32 (-44)/10) == -4, floor (int32 (-46)/10) = -5 !!!
-    x = single (x);
-  elseif (isfloat (x))
-    xint = fix (x);
-    if (any (x != xint))
-      warning ("stemleaf: X truncated to integer values");
-      x = xint;
-    endif
-  else
-    error ("stemleaf: X must be a numeric vector");
-  endif
-
-  if (! ischar (caption))
-    error ("stemleaf: CAPTION must be a character array");
-  endif
-
-  if (nargin == 2)
-    stem_step = 10;
-  else
-    if (isscalar (stem_sz) && stem_sz >= 0 && isreal (stem_sz))
-      stem_sz = fix (stem_sz);
-      stem_step = 10^(stem_sz+1);
-    else
-      error ("stemleaf: STEM_SZ must be a real integer >= 0");
-    endif
-  endif
-
-  ## Note that IEEE 754 states that -+ 0 should compare equal. This has
-  ## led to C sort (and therefore Octave) treating them as equal.  Thus,
-  ## sort([-1 0 -0 1]) yields [-1 0 -0 1], and sort([-1 -0 0 1])
-  ## yields: [-1 -0 0 1].  This means that stem-and-leaf plotting cannot
-  ## rely on sort to order the data as needed for display.
-  ## This also applies to min()/max() so these routines can't be relied
-  ## upon if the max or min is -+ 0.
-
-  ## Compute hinges and fences based on ref: EDA pgs. 33 and 44.
-  ## Note that these outlier estimates are meant to be "distribution free".
-
-  nx = numel (x);
-  xs = sort (x);                # Note that sort preserves -0
-  mdidx = fix ((nx + 1)/2);     # median index
-  hlidx = fix ((mdidx + 1)/2);  # lower hinge index
-  huidx = fix (nx + 1 - hlidx); # upper hinge index
-  md = xs(mdidx);               # median
-  hl = xs(hlidx);               # lower hinge
-  hu = xs(huidx);               # upper hinge
-  h_spread = hu - hl;           # h_spread: difference between hinges
-  step = 1.5*h_spread;          # step: 1.5 * h_spread
-  i_fence_l = hl - step;        # inner fences: outside hinges + step
-  o_fence_l = hl - 2*step;      # outer fences: outside hinges + 2*step
-  i_fence_h = hu + step;
-  o_fence_h = hu + 2*step;
-  n_out_l   = sum (x<i_fence_l) - sum (x<o_fence_l);
-  n_out_h   = sum (x>i_fence_h) - sum (x>o_fence_h);
-  n_far_l   = sum (x<o_fence_l);
-  n_far_h   = sum (x>o_fence_h);
-
-  ## display table similar to that on pg. 33
-  plot_out = sprintf ("       Data: %s", caption);
-  plot_out = [plot_out; sprintf(" ")];
-  plot_out = [plot_out; sprintf("         Fenced Letter Display")];
-  plot_out = [plot_out; sprintf(" ")];
-  plot_out = [plot_out; sprintf("     #%3d|___________________", nx)];
-  plot_out = [plot_out; sprintf("     M%3d|       %5d      |", mdidx, md)];
-  plot_out = [plot_out; sprintf("     H%3d|%5d        %5d|   %d", hlidx, hl, hu, h_spread)];
-  plot_out = [plot_out; sprintf("     1   |%5d        %5d|", xs(1), xs(nx))];
-  plot_out = [plot_out; sprintf("               _______")];   
-  plot_out = [plot_out; sprintf("         ______|%5d|_______",step)];
-  plot_out = [plot_out; sprintf("        f|%5d        %5d|", i_fence_l, i_fence_h)];
-  plot_out = [plot_out; sprintf("         |%5d        %5d|  out", n_out_l, n_out_h)];
-  plot_out = [plot_out; sprintf("        F|%5d        %5g|", o_fence_l, o_fence_h)];
-  plot_out = [plot_out; sprintf("         |%5d        %5d|  far",n_far_l,n_far_h)];
-  plot_out = [plot_out; " "];
-
-  ## Determine stem values
-  min_x = min (x);
-  max_x = max (x);
-  if (min_x > 0)      # all stems > 0
-    stems = [fix(min(x)/stem_step) : (fix(max(x)/stem_step)+1)];
-  elseif (max_x < 0)  # all stems < 0
-    stems = [(fix(min_x/stem_step)-1) : fix(max_x/stem_step)];
-  elseif (min_x < 0 && max_x > 0)  # range crosses 0
-    stems = [(fix(min_x/stem_step)-1) : -0, 0 : fix(max_x/stem_step)+1 ];
-  else   # one endpoint is a zero which may be +0 or -0
-    if (min_x == 0)
-      if (any (x == 0 & signbit (x)))
-        min_x = -0;
-      else
-        min_x = +0;
-      endif
-    endif
-    if (max_x == 0)
-      if (any (x == 0 & ! signbit (x)))
-        max_x = +0;
-      else
-        max_x = -0;
-      endif
-    endif
-    stems = [];
-    if (signbit (min_x))
-      stems = [(fix(min_x/stem_step)-1) : -0];
-    endif
-    if (! signbit (max_x))
-      stems = [stems, 0 : fix(max_x/stem_step)+1 ];
-    endif
-  endif
-
-  ## Vectorized version provided by Rik Wehbring (rik@octave.org)
-  ## Determine leaves for each stem:
-  new_line  = 1;
-  for kx = 2: numel (stems)
-
-    stem_sign = signbit (stems(kx));
-    if (stems(kx) <= 0)
-      idx = ((x <= stems(kx)*stem_step) & (x > (stems(kx-1)*stem_step))
-              & (signbit (x) == stem_sign));
-      xlf = abs (x(idx) - stems(kx)*stem_step);
-    else
-      idx = ((x < stems(kx)*stem_step) & (x >= (stems(kx-1)*stem_step))
-              & (signbit (x) == stem_sign));
-      xlf = abs (x(idx) - stems(kx-1)*stem_step);
-    endif
-    ## Convert leaves to a string
-    if (stem_step == 10)
-      lf_str = sprintf ("%d", xlf);
-    else
-      lf_str = "";
-      if (! isempty (xlf))
-        lf_str = sprintf ("%d", xlf(1));
-        if (numel (xlf) > 1)
-          lf_str = [lf_str sprintf(",%d", xlf(2:end))];
-        endif
-      endif
-    endif
-
-    ## Set correct -0
-    if (stems(kx) == 0 && signbit (stems(kx)))
-      line = sprintf ("  -0 | %s",  lf_str);  # -0 stem.
-    elseif (stems(kx) < 0)
-      line = sprintf ("%4d | %s", stems(kx), lf_str);
-    elseif (stems(kx) > 0)
-      line = sprintf ("%4d | %s", stems(kx-1), lf_str);
-    else
-      line = "";
-    endif
-
-    if (! isempty (lf_str) || stems(kx) == 0 || stems(kx-1) == 0)
-      plot_out = [plot_out; line];
-      new_line = 1;
-    else
-      if (new_line == 1) 
-        plot_out = [plot_out; "     :"];  # just print one : if no leaves
-        new_line = 0;
-      endif
-    endif
-
-  endfor    # kx = 2: numel (stems)
-
-  if (nargout == 0)
-    disp (plot_out);
-  else
-    plotstr = plot_out;
-  endif
-
-endfunction
-
-
-%!demo
-%! %% Unsorted plot:
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
-%! stemleaf (x, 'Unsorted plot');
-
-%!demo
-%! %% Sorted leaves:
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
-%! y = sort (x);
-%! stemleaf (y, 'Sorted leaves');
-
-%!demo
-%! %% Sorted leaves (large dataset):
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48     ...
-%!      127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119   ...
-%!      58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 ...
-%!      121 58 114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7   ...
-%!      68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40    ...
-%!      119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114   ...
-%!      34 133 45 120 30 127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20  ...
-%!      0];
-%! y = sort (x);
-%! stemleaf (y, 'Sorted leaves (large dataset)');
-
-%!demo
-%! %% Gaussian leaves:
-%! x = fix (30 * randn (300,1));
-%! stemleaf (x, 'Gaussian leaves');
-
-%!test
-%! ## test minus to plus
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48 127   ...
-%!      36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109  ...
-%!      23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58   ...
-%!      114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7 68 40 31   ...
-%!      115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57 ...
-%!      122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30  ...
-%!      127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20 0];
-%! x = sort (x);
-%! rexp = char (
-%! "       Data: test minus to plus"    ,
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     #138|___________________"      ,     
-%! "     M 69|          52      |"      ,     
-%! "     H 35|   30          116|   86" ,
-%! "     1   |  -28          146|"      ,
-%! "               _______"             ,
-%! "         ______|  129|_______"      ,
-%! "        f|  -99          245|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F| -228          374|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "  -2 | 82"                          ,
-%! "  -1 | 3"                           ,
-%! "  -0 | 2"                           ,
-%! "   0 | 00177"                       ,
-%! "   1 | 00112288"                    ,
-%! "   2 | 001133577777899"             ,
-%! "   3 | 000111123456777889"          ,
-%! "   4 | 00122233344456788"           ,
-%! "   5 | 223788"                      ,
-%! "   6 | 138"                         ,
-%! "   7 | 11"                          ,
-%! "     : "                            ,
-%! "   9 | 69"                          ,
-%! "  10 | 04555567999"                 ,
-%! "  11 | 0133344455566667777899"      ,
-%! "  12 | 0011223444555677788"         ,
-%! "  13 | 1239"                        ,
-%! "  14 | 16"                          );
-%! r = stemleaf (x, "test minus to plus", 0);
-%! assert (r, rexp);
-
-%!test
-%! ## positive values above 0
-%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
-%! rexp = char (
-%! "       Data: positive values above 0",
-%! " "                                   ,
-%! "         Fenced Letter Display"      ,
-%! " "                                   ,
-%! "     # 14|___________________"       ,     
-%! "     M  7|          22      |"       ,     
-%! "     H  4|   12           42|   30"  ,
-%! "     1   |    5           52|"       ,
-%! "               _______"              ,
-%! "         ______|   45|_______"       ,
-%! "        f|  -33           87|"       ,     
-%! "         |    0            0|  out"  ,
-%! "        F|  -78          132|"       ,
-%! "         |    0            0|  far"  ,
-%! " "                                   ,
-%! "   0 | 5"                            ,
-%! "   1 | 22118"                        ,
-%! "   2 | 28"                           ,
-%! "   3 | 98"                           ,
-%! "   4 | 244"                          ,
-%! "   5 | 2"                            );
-%! r = stemleaf (x, "positive values above 0");
-%! assert (r, rexp);
-
-%!test
-%! ## negative values below 0
-%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
-%! x = -x;
-%! rexp = char (
-%! "       Data: negative values below 0",
-%! " "                                   ,
-%! "         Fenced Letter Display"      ,
-%! " "                                   ,
-%! "     # 14|___________________"       ,     
-%! "     M  7|         -28      |"       ,     
-%! "     H  4|  -42          -12|   30"  ,
-%! "     1   |  -52           -5|"       ,
-%! "               _______"              ,
-%! "         ______|   45|_______"       ,
-%! "        f|  -87           33|"       ,     
-%! "         |    0            0|  out"  ,
-%! "        F| -132           78|"       ,
-%! "         |    0            0|  far"  ,
-%! " "                                   ,
-%! "  -5 | 2"                            ,
-%! "  -4 | 244"                          ,
-%! "  -3 | 98"                           ,
-%! "  -2 | 28"                           ,
-%! "  -1 | 22118"                        ,
-%! "  -0 | 5"                            );
-%! r = stemleaf (x, "negative values below 0");
-%! assert (r, rexp);
-
-%!test
-%! ## positive values from 0
-%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
-%! rexp = char (
-%! "       Data: positive values from 0",
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     # 15|___________________"      ,     
-%! "     M  8|          22      |"      ,     
-%! "     H  4|   11           42|   31" ,
-%! "     1   |    0           52|"      ,
-%! "               _______"             ,
-%! "         ______|   46|_______"      ,
-%! "        f|  -35           88|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F|  -82          135|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "   0 | 20"                          ,
-%! "   1 | 22118"                       ,
-%! "   2 | 28"                          ,
-%! "   3 | 98"                          ,
-%! "   4 | 244"                         ,
-%! "   5 | 2"                           );
-%! r = stemleaf (x, "positive values from 0");
-%! assert (r, rexp);
-
-%!test
-%! ## negative values from 0
-%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
-%! x = -x;
-%! rexp = char (
-%! "       Data: negative values from 0",
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     # 15|___________________"      ,     
-%! "     M  8|         -22      |"      ,     
-%! "     H  4|  -42          -11|   31" ,
-%! "     1   |  -52            0|"      ,
-%! "               _______"             ,
-%! "         ______|   46|_______"      ,
-%! "        f|  -88           35|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F| -135           82|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "  -5 | 2"                           ,
-%! "  -4 | 244"                         ,
-%! "  -3 | 98"                          ,
-%! "  -2 | 28"                          ,
-%! "  -1 | 22118"                       ,
-%! "  -0 | 20"                          );
-%! r = stemleaf (x, "negative values from 0");
-%! assert (r, rexp);
-
-%!test
-%! ## both +0 and -0 present
-%! x = [-9 -7 -0 0 -0];
-%! rexp = char (
-%! "       Data: both +0 and -0 present",
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     #  5|___________________"      ,     
-%! "     M  3|           0      |"      ,     
-%! "     H  2|   -7            0|   7"  ,
-%! "     1   |   -9            0|"      ,
-%! "               _______"             ,
-%! "         ______|   10|_______"      ,
-%! "        f|  -17           10|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F|  -28           21|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "  -0 | 9700"                        ,
-%! "   0 | 0"                           );
-%! r = stemleaf (x, "both +0 and -0 present");
-%! assert (r, rexp);
-
-%!test
-%! ## both <= 0 and -0 present
-%! x = [-9 -7 0 -0];
-%! rexp = char (
-%! "       Data: both <= 0 and -0 present",
-%! " "                                    ,
-%! "         Fenced Letter Display"       ,
-%! " "                                    ,
-%! "     #  4|___________________"        ,     
-%! "     M  2|          -7      |"        ,     
-%! "     H  1|   -9            0|   9"    ,
-%! "     1   |   -9            0|"        ,
-%! "               _______"               ,
-%! "         ______|   13|_______"        ,
-%! "        f|  -22           13|"        ,     
-%! "         |    0            0|  out"   ,
-%! "        F|  -36           27|"        ,
-%! "         |    0            0|  far"   ,
-%! " "                                    ,
-%! "  -0 | 970"                           ,
-%! "   0 | 0"                             );
-%! r = stemleaf (x, "both <= 0 and -0 present");
-%! assert (r, rexp);
-
-%!test
-%! ##   Example from EDA: Chevrolet Prices pg. 30
-%! x = [150 250 688 695 795 795 895 895 895 ...
-%!      1099 1166 1333 1499 1693 1699 1775 1995];
-%! rexp = char (
-%! "       Data: Chevrolet Prices EDA pg.30",
-%! " "                                      ,
-%! "         Fenced Letter Display"         ,
-%! " "                                      ,
-%! "     # 17|___________________"          ,          
-%! "     M  9|         895      |"          ,
-%! "     H  5|  795         1499|   704"    ,
-%! "     1   |  150         1995|"          ,
-%! "               _______"                 ,
-%! "         ______| 1056|_______"          ,
-%! "        f| -261         2555|"          ,
-%! "         |    0            0|  out"     ,
-%! "        F|-1317         3611|"          ,
-%! "         |    0            0|  far"     ,
-%! " "                                      ,
-%! "   1 | 50"                              ,
-%! "   2 | 50"                              ,
-%! "     :"                                 ,
-%! "   6 | 88,95"                           ,
-%! "   7 | 95,95"                           ,
-%! "   8 | 95,95,95"                        ,
-%! "     :"                                 ,
-%! "  10 | 99"                              ,
-%! "  11 | 66"                              ,
-%! "     :"                                 ,
-%! "  13 | 33"                              ,
-%! "  14 | 99"                              ,
-%! "     :"                                 ,
-%! "  16 | 93,99"                           ,
-%! "  17 | 75"                              ,
-%! "     :"                                 ,
-%! "  19 | 95"                              );
-%! r = stemleaf (x, "Chevrolet Prices EDA pg.30", 1);
-%! assert (r, rexp);
-
-## Test input validation
-%!error stemleaf ()
-%!error stemleaf (1, 2, 3, 4)
-%!error <X must be a vector> stemleaf (ones (2,2), "")
-%!warning <X truncated to integer values> tmp = stemleaf ([0 0.5 1],"");
-%!error <X must be a numeric vector> stemleaf ("Hello World", "data")
-%!error <CAPTION must be a character array> stemleaf (1, 2)
-%!error <STEM_SZ must be a real integer> stemleaf (1, "", ones (2,2))
-%!error <STEM_SZ must be a real integer> stemleaf (1, "", -1)
-%!error <STEM_SZ must be a real integer> stemleaf (1, "", 1+i)
-
--- a/scripts/plot/struct2hdl.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,645 +0,0 @@
-## Copyright (C) 2012 pdiribarne
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} struct2hdl (@var{s})
-## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p})
-## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev})
-## Construct a graphics handle object @var{h} from the structure @var{s}.
-##
-## The structure must contain the fields @qcode{"handle"}, @qcode{"type"},
-## @qcode{"children"}, @qcode{"properties"}, and @qcode{"special"}.  If the
-## handle of an existing figure or axes is specified, @var{p}, the new object
-## will be created as a child of that object.  If no parent handle is provided
-## then a new figure and the necessary children will be constructed using the
-## default values from the root figure.
-##
-## A third boolean argument @var{hilev} can be passed to specify whether
-## the function should preserve listeners/callbacks, e.g., for legends or
-## hggroups.  The default is false.
-## @seealso{hdl2struct, findobj}
-## @end deftypefn
-
-## Author: pdiribarne <pdiribarne@new-host.home>
-## Created: 2012-03-04
-
-function [h, pout] = struct2hdl (s, p=[], hilev = false)
-
-  fields = {"handle", "type", "children", "properties", "special"};
-  partypes = {"root", "figure", "axes", "hggroup"};
-  othertypes = {"line", "patch", "surface", "image", "text"};
-  alltypes = [partypes othertypes];
-
-  if (nargin > 3 || ! isstruct (s))
-    print_usage ();
-  elseif (! all (isfield (s, fields)))
-    print_usage ();
-  elseif (isscalar (p))
-    if (! ishandle (p))
-      error ("struct2hdl: P is not a handle to a graphic object");
-    endif
-    if (any (strcmp (get (p).type, partypes)))
-      paridx = find (strcmp (get (p).type, alltypes));
-      kididx = find (strcmp (s.type, alltypes));
-      if (kididx <= paridx)
-        error ("struct2hdl: incompatible input handles");
-      endif
-    else
-      error ("struct2hdl: %s object can't be parent object", get (p).type);
-    endif
-    hpar = p;
-    p = [NaN; hpar];
-    ## create appropriate parent if needed
-    if (any (strcmp (s.type, othertypes)))
-      for ii = (paridx+1) : (numel (partypes)-1)
-        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
-        p = [p [NaN; hpar]];
-      endfor
-    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
-      for ii = (paridx+1) : (kididx-1)
-        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
-        p = [p [NaN; hpar]];
-      endfor
-    else
-      par = NaN;
-    endif
-  elseif (isempty (p))
-    if (any (strcmp (s.type, othertypes)))
-      par = axes ();
-    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
-      par = figure ();
-    else
-      par = NaN;
-    endif
-    p = [NaN; par];
-  endif
-  ## read parent (last column) in p and remove it if duplicate
-  par = p(2,end);
-  tst = find (p(2,:) == par);
-  if (numel (tst) > 1)
-    p = p(1:2, 1:(tst(end)-1));
-  endif
-
-  ## Place the "*mode" properties at the end to avoid having the updaters
-  ## change the mode to "manual" when the value is "auto".
-  names = fieldnames (s.properties);
-  n = strncmp (cellfun (@fliplr, names, "uniformoutput", false), "edom", 4);
-  n = (n | strcmp (names, "activepositionproperty"));
-  names = [names(!n); names(n)];
-  if (strcmp (s.type, "axes"))
-    n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition"));
-    if (strcmp (s.properties.activepositionproperty, "position"))
-      names{n_pos(1)} = "outerposition";
-      names{n_pos(2)} = "position";
-    else
-      names{n_pos(1)} = "position";
-      names{n_pos(2)} = "outerposition";
-    endif
-  endif
-  ## Reorder the properties with the mode properties coming last
-  s.properties = orderfields (s.properties, names);
-
-  ## create object
-  if (strcmp (s.type, "root"))
-    h = 0;
-    s.properties = rmfield (s.properties, ...
-                              {"callbackobject", "commandwindowsize", ...
-                               "screendepth", "screenpixelsperinch", ...
-                               "screensize"});
-  elseif (strcmp (s.type, "figure"))
-    h = figure ();
-  elseif (strcmp (s.type, "axes"))
-    ## legends and colorbars are "transformed" in normal axes
-    ## if hilev is not requested
-    if (! hilev)
-      if (strcmp (s.properties.tag, "legend"))
-        s.properties.tag = "";
-        s.properties.userdata = [];
-        par = gcf;
-      elseif (strcmp (s.properties.tag, "colorbar"))
-        s.properties.tag = "";
-        s.properties.userdata = [];
-        par = gcf;
-      endif
-    endif
-
-    [h, s] = createaxes (s, p, par);
-  elseif (strcmp (s.type, "line"))
-    h = createline (s, par);
-  elseif (strcmp (s.type, "patch"))
-    [h, s] = createpatch (s, par);
-  elseif (strcmp (s.type, "text"))
-    h = createtext (s, par);
-  elseif (strcmp (s.type, "image"))
-    h = createimage (s, par);
-  elseif (strcmp (s.type, "surface"))
-    h = createsurface (s, par);
-  elseif (strcmp (s.type, "hggroup"))
-    [h, s, p] = createhg (s, p, par, hilev);
-  else
-    error ("struct2hdl: %s objects are not implemented yet", s.type)
-  endif
-
-  ## children
-  p = [p [s.handle; h]];  # [original; new]
-  kids = s.children;
-  nkids = length (kids);
-  ii = 0;
-  while (nkids)
-    ii++;
-    if (! any (ii == s.special))
-      [h2, p] = struct2hdl (s.children(ii), [p [s.handle; h]], hilev);
-    endif
-    nkids--;
-  endwhile
-
-  ## paste properties
-  setprops (s, h, p, hilev);
-
-  pout = p;
-
-endfunction
-
-function [h, sout] = createaxes (s, p, par)
-  ## regular axes
-  if (strcmp (s.properties.tag, ""))
-    propval = {"position", s.properties.position};
-    hid = {"autopos_tag", "looseinset"};
-    for ii = 1:numel (hid)
-      prop = hid{ii};
-      if (isfield (s.properties, prop))
-        val = s.properties.(prop);
-        propval = [propval, prop, val];
-      endif
-    endfor
-    h = axes (propval{:}, "parent", par);
-
-    if (isfield (s.properties, "__plotyy_axes__"))
-      plty = s.properties.__plotyy_axes__;
-      addproperty ("__plotyy_axes__", h, "data");
-      tmp = [p [s.handle; h]];
-      tst = ismember (tmp(1:2:end), plty);
-      if (sum (tst) == numel (plty))
-        for ii = 1:numel (plty)
-          plty(ii) = tmp(find (tmp == plty(ii)) + 1);
-        endfor
-        for ii = 1:numel (plty)
-          set (plty(ii), "__plotyy_axes__", plty);
-        endfor
-      endif
-      s.properties = rmfield (s.properties, "__plotyy_axes__");
-    endif
-
-    ## delete non-default and already set properties
-    fields = fieldnames (s.properties);
-    tst = cellfun (@(x) isprop (h, x), fields);
-    s.properties = rmfield (s.properties, fields(find (tst == 0)));
-
-  elseif (strcmp (s.properties.tag, "legend"))
-    ## legends
-    oldax = s.properties.userdata.handle;
-    idx = find (p == oldax);
-    newax = p(idx+1);
-    strings = {};
-    kids = s.children;
-    kids(s.special) = [];
-    oldh = unique (arrayfun (@(x) x.properties.userdata(end), kids));
-    for ii = 1:length (oldh)
-      idx = find (p(1:2:end) == oldh(ii)) * 2;
-      if (! isempty (idx))
-        newh(ii) = p(idx);
-        if (! strcmp (get (newh(ii), "type"), "hggroup"))
-          str = get (newh(ii), "displayname");
-          strings = [strings str];
-        else
-          str = get (get (newh(ii), "children")(1), "displayname");
-          strings = [strings str];
-        endif
-      else
-        error ("struct2hdl: didn't find a legend item");
-      endif
-    endfor
-    location = s.properties.location;
-    orientation = s.properties.orientation;
-    textpos = s.properties.textposition;
-    box = s.properties.box;
-
-    h = legend (newax, newh, strings, "location", location, ...
-                "orientation", orientation);
-    set (h, "textposition", textpos); # bug makes "textposition"
-                                      # redefine the legend
-    h = legend (newax, newh, strings, "location", location, ...
-                "orientation", orientation);
-    ## box
-    if (strcmp (box, "on"))
-      legend ("boxon");
-    endif
-
-    ## visibility
-    tst = arrayfun (@(x) strcmp (x.properties.visible, "on"), kids);
-    if (! any (tst))
-      legend ("hide");
-    endif
-
-    ## remove all properties such as "textposition" that redefines
-    ## the entire legend. Also remove chidren
-    s.properties = rmfield (s.properties, ...
-                              {"userdata", "xlabel",...
-                               "ylabel", "zlabel", "location", ...
-                               "title", "string","orientation", ...
-                               "visible", "textposition"});
-
-    s.children = [];
-
-  elseif (strcmp (s.properties.tag, "colorbar"))
-    ## colorbar
-    oldax = s.properties.axes;
-    if (! isempty (idx = find (oldax == p)))
-      ax = p(idx+1);
-      location = s.properties.location;
-      h = colorbar ("peer", ax, location);
-      s.properties = rmfield (s.properties, ...
-                                {"userdata", "xlabel" ...
-                                 "ylabel", "zlabel", ...
-                                 "title", "axes"});
-      s.children= [];
-    else
-      error ("hdl2struct: didn't find an object");
-    endif
-  endif
-  sout = s;
-endfunction
-
-function h = createline (s, par)
-  h = line ("parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function [h, sout] = createpatch (s, par)
-  prp.faces = s.properties.faces;
-  prp.vertices = s.properties.vertices;
-  prp.facevertexcdata = s.properties.facevertexcdata;
-  h = patch (prp);
-  set (h, "parent", par);
-  s.properties = rmfield (s.properties,
-                            {"faces", "vertices", "facevertexcdata"});
-  addmissingprops (h, s.properties);
-  sout = s;
-endfunction
-
-function h = createtext (s, par)
-  h = text ("parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function h = createimage (s, par)
-  h = image (1, "parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function h = createsurface (s, par)
-  h = surface ("parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function [h, sout, pout] = createhg (s, p, par, hilev)
-  ## Here we infer from properties the type of hggroup we should build
-  ## an call corresponding high level functions
-  ## We manually set "hold on" to avoid next hggroup be deleted
-  ## the proper value of axes "nextplot" will finally be recovered
-
-  hold on;
-  if (hilev)
-    [h, s, p] = createhg_hilev (s, p, par);
-    if (numel (s.children) != numel (get (h).children))
-      warning (["struct2hdl: could not infer the hggroup type. ", ...
-                "Will build objects but listener/callback functions ", ...
-                "will be lost"]);
-      if (isfield (h, "bargroup"))
-        delete (get (h).bargroup);
-      else
-        delete (h);
-      endif
-      h = hggroup ("parent", par);
-      addmissingprops (h, s.properties);
-      s.special = [];
-    else
-      oldkids = s.children;
-      newkids = get (h).children;
-      nkids = numel (oldkids);
-      ii = 1;
-      while (nkids)
-        p = [p [oldkids(ii++).handle; newkids(nkids--)]];
-      endwhile
-    endif
-  else
-    h = hggroup ("parent", par);
-    addmissingprops (h, s.properties);
-    s.special = [];
-  endif
-  sout = s;
-  pout = p;
-endfunction
-
-function [h, sout, pout] = createhg_hilev (s, p, par)
-  fields = s.properties;
-  if (isfield (fields, "contourmatrix"))
-    ## contours
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-    zdata = s.properties.zdata;
-    levellist = s.properties.levellist;
-    textlist = s.properties.textlist;
-
-    ## contour creation
-    if (isempty (s.children(1).properties.zdata))
-      if (strcmpi (s.properties.fill, "on"))
-        [cm2, h] = contourf (xdata, ydata, zdata, levellist);
-      else
-        [cm2, h] = contour (xdata, ydata, zdata, levellist);
-      endif
-
-      ## labels
-      if (strcmpi (s.properties.showtext, "on"))
-        clabel (cm2, h, textlist);
-      endif
-    else
-      [cm2, h] = contour3 (xdata, ydata, zdata, levellist);
-    endif
-
-    ## delete already set properties and children
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", "zdata", ...
-                               "contourmatrix", "levellist", ...
-                               "fill", "labelspacing", ...
-                               "levellistmode", "levelstep", ...
-                               "levelstepmode", "textlist"...
-                               "textlistmode" , "textstep", ...
-                               "textstepmode", "zlevel", ...
-                               "zlevelmode"});
-
-  elseif (isfield (fields, "udata") && isfield (fields, "vdata"))
-    ## quiver
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-
-    udata = s.properties.udata;
-    vdata = s.properties.vdata;
-
-    h = quiver (xdata, ydata, udata, vdata);
-
-    ## delete already set properties and children
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", "zdata", ...
-                               "xdatasource", "ydatasource", "zdatasource", ...
-                               "udata", "vdata", "wdata", ...
-                               "udatasource", "vdatasource", "wdatasource"});
-
-  elseif (isfield (fields, "format"))
-    ##errorbar
-    form = s.properties.format;
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-    xldata = s.properties.xldata;
-    ldata = s.properties.ldata;
-    xudata = s.properties.xudata;
-    udata = s.properties.udata;
-
-    switch (form)
-      case "xerr"
-        h = errorbar (xdata, ydata, xldata, xudata, ">");
-      case "yerr"
-        h = errorbar (xdata, ydata, ldata, udata, "~");
-      case "xyerr"
-        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "~>");
-      case "box"
-        h = errorbar (xdata, ydata, xldata, xudata, "#");
-      case "boxy"
-        h = errorbar (xdata, ydata, ldata, udata, "#~");
-      case "boxxy"
-        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "#~>");
-      otherwise
-        error ("struct2hdl: couldn't guess the errorbar format");
-    endswitch
-    ## delete already set properties
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", ...
-                               "xldata", "ldata", ...
-                               "xudata", "udata", ...
-                               "xldatasource", "ldatasource", ...
-                               "xudatasource", "udatasource", ...
-                               "format"});
-
-  elseif (isfield (fields, "bargroup"))
-    ## bar plot
-    ## FIXME - here we don't have access to brothers so we first create all
-    ## the barseries of the bargroup (but the last), then retrieve information,
-    ## and rebuild the whole bargroup.
-    ## The duplicate are deleted after calling "setprops"
-
-    bargroup = s.properties.bargroup;
-    oldh = s.handle;
-
-    temp = ismember ([p(1:2:end) oldh], bargroup);
-
-    tst = sum (temp) == length (bargroup);
-
-    if (isscalar (bargroup) || !tst)
-      xdata = s.properties.xdata;
-      ydata = s.properties.ydata;
-
-      h = bar (xdata, ydata);
-
-      ## delete already set properties,
-      s.properties = rmfield (s.properties, ...
-                                {"xdata", "ydata", ...
-                                 "xdatasource", "ydatasource", ...
-                                 "bargroup", ...
-                                 "barwidth", "baseline"});
-    else
-      xdata = [];
-      ydata = [];
-
-      ##build x/y matrix
-      nbar = length (bargroup);
-      tmp = struct ("handle", NaN, "type", "", "children", [], "special", []);
-      for ii = 1:(nbar - 1)
-        idx = find (p(1:2:end) == bargroup(ii)) * 2;
-        hdl = p (idx);
-        xdata = [xdata get(hdl).xdata];
-        ydata = [ydata get(hdl).ydata];
-        tmp.children(ii) = hdl2struct (hdl);
-      endfor
-
-      xdata = [xdata s.properties.xdata];
-      ydata = [ydata s.properties.ydata];
-      width = s.properties.barwidth;
-      h = bar (ydata, width);
-
-      ## replace previous handles in "match", copy props and delete redundant
-      for ii = 1:(nbar - 1)
-        props = tmp.children(ii).properties;
-        bl = props.baseline;
-        tmp.children(ii).properties = rmfield (props, {"baseline", "bargroup"});
-        setprops (tmp.children(ii), h(ii), p, 1);
-        delete (tmp.children(ii).handle);
-        delete (bl);
-        idxpar = find (p == tmp.children(ii).handle);
-        p(idxpar) = h(ii);
-        idxkid = idxpar - 2;
-        p(idxkid) = get (h(ii), "children");
-      endfor
-      p(2,((end-nbar+2):end)) = h(1:(end-1));
-      h = h(end);
-
-      ## delete already set properties ,
-      s.properties = rmfield (s.properties, ...
-                                {"xdata", "ydata", "bargroup"...
-                                 "barwidth", "baseline"});
-    endif
-  elseif (isfield (fields, "baseline"))
-    ## stem plot
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-
-    h = stem (xdata, ydata);
-
-    ## delete already set properties,
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", ...
-                               "xdatasource", "ydatasource", ...
-                               "baseline"});
-  elseif (isfield (fields, "basevalue"))
-    ## area plot
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-    level = s.properties.basevalue;
-
-    h = area (xdata, ydata, level);
-
-    ## delete already set properties,
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", ...
-                               "xdatasource", "ydatasource"});
-  else
-    warning ("struct2hdl: could not infer the hggroup type. Will build objects but listener/callback functions will be lost");
-    h = hggroup ("parent", par);
-    addmissingprops (h, s.properties);
-    s.special = [];           # children will be treated as normal children
-  endif
-  sout = s;
-  pout = p;
-endfunction
-
-function setprops (s, h, p, hilev)
-  more off;
-  if (strcmpi (s.properties.tag, ""))
-    specs = s.children(s.special);
-    if (isempty (specs))
-      hdls = [];
-    else
-      hdls = [specs.handle];
-    endif
-    nh = length (hdls);
-    msg = "";
-    if (! nh)
-      set (h, s.properties);
-    else
-      ## Specials are objects that where automatically constructed with
-      ## current object. Among them are "x(yz)labels", "title", high
-      ## level hggroup children
-      fields = fieldnames (s.properties);
-      vals = struct2cell (s.properties);
-      idx = find (cellfun (@(x) valcomp(x, hdls) , vals));
-      s.properties = rmfield (s.properties, fields(idx));
-
-      ## set all properties but special handles
-      set (h, s.properties);
-
-      ## find  props with val == (one of special handles)
-      nf = length (idx);
-      fields = fields(idx);
-      vals = vals(idx);
-      while (nf)
-        field = fields{nf};
-        idx = find (hdls == vals{nf});
-        spec = specs(idx);
-        if (isprop (h, field))
-           h2 = get (h , field);
-           set (h2, spec.properties);
-        endif
-        nf--;
-      endwhile
-
-      ## If hggroup children  were created by high level functions,
-      ## copy only usefull properties.
-      if (hilev)
-        if (strcmp (s.type, "hggroup"))
-          nold = numel (s.children);
-          nnew = numel (get (h).children);
-
-          if (nold == nnew)
-            hnew = get (h).children;
-            ii = 1;
-            while (ii <= nnew)
-              try
-                set (hnew (ii), "displayname", ...
-                     s.children(ii).properties.displayname);
-              catch
-                sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii);
-              end_try_catch
-              ii ++;
-            endwhile
-
-          else
-            error ("struct2hdl: non-conformant number of children in hgggroup");
-          endif
-        endif
-      endif
-    endif
-
-  elseif (strcmpi (s.properties.tag, "legend")
-          || strcmpi (s.properties.tag, "colorbar"))
-    set (h, s.properties);
-  endif
-
-endfunction
-
-function out = valcomp (x, hdls)
-  if (isfloat (x) && isscalar (x))
-    out = any (x == hdls);
-  else
-    out = 0;
-  endif
-endfunction
-
-function addmissingprops (h, props)
-  hid = {"autopos_tag", "looseinset"};
-  oldfields = fieldnames (props);
-  curfields = fieldnames (get (h));
-  missing = ! ismember (oldfields, curfields);
-  idx = find (missing);
-  for ii = 1:length (idx)
-    prop = oldfields{idx(ii)};
-    if (! any (strcmp (prop, hid)))
-      addproperty (prop, h, "any");
-    endif
-  endfor
-endfunction
-
-
-## FIXME: Need validation tests
-
--- a/scripts/plot/subplot.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,477 +0,0 @@
-## Copyright (C) 1995-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} subplot (@var{rows}, @var{cols}, @var{index})
-## @deftypefnx {Function File} {} subplot (@var{rcn})
-## @deftypefnx {Function File} {} subplot (@var{hax})
-## @deftypefnx {Function File} {} subplot (@dots{}, "align")
-## @deftypefnx {Function File} {} subplot (@dots{}, "replace")
-## @deftypefnx {Function File} {} subplot (@dots{}, "position", @var{pos})
-## @deftypefnx {Function File} {} subplot (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{hax} =} subplot (@dots{})
-## Set up a plot grid with @var{rows} by @var{cols} subwindows and set the
-## current axes for plotting (@code{gca}) to the location given by @var{index}.
-##
-## If only one numeric argument is supplied, then it must be a three digit
-## value specifying the number of rows in digit 1, the number of
-## columns in digit 2, and the plot index in digit 3.
-##
-## The plot index runs row-wise; First, all columns in a row are numbered
-## and then the next row is filled.
-##
-## For example, a plot with 2x3 grid will have plot indices running as follows:
-## @tex
-## \vskip 10pt
-## \hfil\vbox{\offinterlineskip\hrule
-## \halign{\vrule#&&\qquad\hfil#\hfil\qquad\vrule\cr
-## height13pt&1&2&3\cr height12pt&&&\cr\noalign{\hrule}
-## height13pt&4&5&6\cr height12pt&&&\cr\noalign{\hrule}}}
-## \hfil
-## \vskip 10pt
-## @end tex
-## @ifnottex
-##
-## @example
-## @group
-## +-----+-----+-----+
-## |  1  |  2  |  3  |
-## +-----+-----+-----+
-## |  4  |  5  |  6  |
-## +-----+-----+-----+
-## @end group
-## @end example
-##
-## @end ifnottex
-##
-## @var{index} may also be a vector.  In this case, the new axis will enclose
-## the grid locations specified.  The first demo illustrates this:
-##
-## @example
-## demo ("subplot", 1)
-## @end example
-##
-## The index of the subplot to make active may also be specified by its axes
-## handle, @var{hax}, returned from a previous @code{subplot} command.
-##
-## If the option @qcode{"align"} is given then the plot boxes of the subwindows
-## will align, but this may leave no room for axis tick marks or labels.
-##
-## If the option @qcode{"replace"} is given then the subplot axis will be
-## reset, rather than just switching the current axis for plotting to the
-## requested subplot.
-##
-## The @qcode{"position"} property can be used to exactly position the subplot
-## axes within the current figure.  The option @var{pos} is a 4-element vector
-## [x, y, width, height] that determines the location and size of the axes.
-## The values in @var{pos} are normalized in the range [0,1].
-##
-## Any property/value pairs are passed directly to the underlying axes object.
-##
-## If the output @var{hax} is requested, subplot returns the axis handle for
-## the subplot.  This is useful for modifying the properties of a subplot
-## using @code{set}.
-## @seealso{axes, plot, gca, set}
-## @end deftypefn
-
-## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
-## Adapted-By: jwe
-
-function h = subplot (varargin)
-
-  align_axes = false;
-  replace_axes = false;
-  have_position = false;
-  initial_args_decoded = false;
-
-  if (nargin >= 3)
-    ## R, C, N?
-    arg1 = varargin{1};
-    arg2 = varargin{2};
-    arg3 = varargin{3};
-    if (   isnumeric (arg1) && isscalar (arg1)
-        && isnumeric (arg2) && isscalar (arg2)
-        && isnumeric (arg3))
-      rows = arg1;
-      cols = arg2;
-      index = arg3;
-      varargin(1:3) = [];
-      initial_args_decoded = true;
-    endif
-  endif
-
-  if (! initial_args_decoded && nargin > 1)
-    ## check for "position", pos, ...
-    if (strcmpi (varargin{1}, "position"))
-      arg = varargin{2};
-      if (isnumeric (arg) && numel (arg) == 4)
-        pos = arg;
-        varargin(1:2) = [];
-        have_position = true;
-        initial_args_decoded = true;
-      else
-        error ("subplot: POSITION must be a 4-element numeric array");
-      endif
-    endif
-  endif
-    
-  if (! initial_args_decoded && nargin > 0)
-    arg = varargin{1};
-    if (nargin == 1 && isaxes (arg))
-      ## Axes handle
-      axes (arg);
-      cf = get (0, "currentfigure");
-      set (cf, "nextplot", "add");
-      return;
-    elseif (isscalar (arg) && arg >= 0)
-      ## RCN?
-      index = rem (arg, 10);
-      arg = (arg - index) / 10;
-      cols = rem (arg, 10);
-      arg = (arg - cols) / 10;
-      rows = rem (arg, 10);
-      varargin(1) = [];
-      initial_args_decoded = true;
-    else
-      error ("subplot: expecting axes handle or RCN argument");
-    endif
-  endif
-
-  if (! initial_args_decoded)
-    print_usage ();
-  endif
-
-  if (! have_position)
-    cols = round (cols);
-    rows = round (rows);
-    index = round (index);
-
-    if (any (index < 1) || any (index > rows*cols))
-      error ("subplot: INDEX value must be >= 1 and <= ROWS*COLS");
-    endif
-
-    if (rows < 1 || cols < 1 || index < 1)
-      error ("subplot: ROWS, COLS, and INDEX must be be positive");
-    endif
-  endif
-
-  ## Process "align" and "replace" options
-  idx = strcmpi (varargin, "align");
-  if (any (idx))
-    align_axes = true;
-    varargin(idx) = [];
-  endif
-
-  idx = strcmpi (varargin, "replace");
-  if (any (idx))
-    replace_axes = true;
-    varargin(idx) = [];
-  endif
-
-  axesunits = get (0, "defaultaxesunits");
-  cf = gcf ();
-  figureunits = get (cf, "units");
-  unwind_protect
-    set (0, "defaultaxesunits", "normalized");
-    set (cf, "units", "pixels");
-
-    ## FIXME: At the moment we force gnuplot to use the aligned mode
-    ##        which will set "activepositionproperty" to "position".
-    ##        Τhis can yield to text overlap between labels and titles
-    ##        see bug #31610
-    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot"))
-      align_axes = true;
-    endif
-
-    if (! have_position)
-      pos = subplot_position (rows, cols, index, "position");
-      outerpos = subplot_position (rows, cols, index, "outerposition");
-      box = [pos(1:2), pos(1:2)+pos(3:4)];
-      outerbox = [outerpos(1:2), outerpos(1:2)+outerpos(3:4)];
-      looseinset = [box(1:2)-outerbox(1:2), outerbox(3:4)-box(3:4)];
-      if (align_axes)
-        activepositionproperty = "position";
-      else
-        activepositionproperty = "outerposition";
-      endif
-    endif
-
-    set (cf, "nextplot", "add");
-
-    found = false;
-    kids = get (cf, "children");
-    for child = kids(:)'
-      ## Check whether this child is still valid; this might not be the
-      ## case anymore due to the deletion of previous children (due to
-      ## "deletefcn" callback or for legends/colorbars that are deleted
-      ## with their corresponding axes).
-      if (! ishandle (child))
-        continue;
-      endif
-      if (strcmp (get (child, "type"), "axes"))
-        ## Skip legend and colorbar objects.
-        if (any (strcmp (get (child, "tag"), {"legend", "colorbar"})))
-          continue;
-        endif
-        objpos = get (child, "outerposition");
-        if (all (abs (objpos - outerpos) < eps) && ! replace_axes)
-          ## If the new axes are in exactly the same position
-          ## as an existing axes object, use the existing axes.
-          found = true;
-          hsubplot = child;
-        else
-          ## If the new axes overlap an old axes object, delete the old axes.
-          if (align_axes)
-            objpos = get (child, "position");
-          endif
-          x0 = pos(1);
-          x1 = x0 + pos(3);
-          y0 = pos(2);
-          y1 = y0 + pos(4);
-          objx0 = objpos(1);
-          objx1 = objx0 + objpos(3);
-          objy0 = objpos(2);
-          objy1 = objy0 + objpos(4);
-          if (! (x0 >= objx1 || x1 <= objx0 || y0 >= objy1 || y1 <= objy0))
-            delete (child);
-          endif
-        endif
-      endif
-    endfor
-
-    if (found)
-      ## Switch to existing subplot
-      set (cf, "currentaxes", hsubplot);
-    else
-      hsubplot = axes ("box", "off",
-                       "position", pos,
-                       "looseinset", looseinset,
-                       "activepositionproperty", activepositionproperty,
-                       varargin{:});
-      addproperty ("subplot_align", hsubplot, "boolean", true);
-      addlistener (hsubplot, "position", @subplot_align);
-      if (! align_axes)
-        set (hsubplot, "subplot_align", false)
-        subplot_align (hsubplot)
-      endif
-    endif
-
-  unwind_protect_cleanup
-    set (0, "defaultaxesunits", axesunits);
-    set (cf, "units", figureunits);
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = hsubplot;
-  endif
-
-endfunction
-
-function pos = subplot_position (rows, cols, index, position_property)
-
-  if (rows == 1 && cols == 1)
-    ## Trivial result for subplot (1,1,1)
-    if (strcmpi (position_property, "position"))
-      pos = get (0, "defaultaxesposition");
-    else
-      pos = get (0, "defaultaxesouterposition");
-    endif
-    return;
-  endif
-
-  if (strcmp (position_property, "outerposition"))
-    margins.left   = 0.05;
-    margins.bottom = 0.05;
-    margins.right  = 0.05;
-    margins.top    = 0.05;
-    margins.column = 0.04 / cols;
-    margins.row    = 0.04 / rows;
-    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
-    width = width / cols;
-    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
-    height = height / rows;
-  else
-    defaultaxesposition = get (0, "defaultaxesposition");
-
-    ## The outer margins surrounding all subplot "positions" are independent
-    ## of the number of rows and/or columns
-    margins.left   = defaultaxesposition(1);
-    margins.bottom = defaultaxesposition(2);
-    margins.right  = 1.0 - margins.left - defaultaxesposition(3);
-    margins.top    = 1.0 - margins.bottom - defaultaxesposition(4);
-
-    ## Fit from Matlab experiments
-    pc = 1 ./ [0.1860, (margins.left + margins.right - 1)];
-    margins.column = 1 ./ polyval (pc , cols);
-    pr = 1 ./ [0.2282, (margins.top + margins.bottom - 1)];
-    margins.row    = 1 ./ polyval (pr , rows);
-
-    ## Calculate the width/height of the subplot axes "position".
-    ## This is also consistent with Matlab
-    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
-    width = width / cols;
-    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
-    height = height / rows;
-  endif
-
-  ## Index offsets from the lower left subplot
-  yi = fix ((index(:)-1)/cols);
-  xi = index(:) - yi*cols - 1;
-  yi = (rows - 1) - yi;
-
-  ## Lower left corner of the subplot, i.e., position(1:2)
-  x0 = xi .* (width + margins.column) + margins.left;
-  y0 = yi .* (height + margins.row) + margins.bottom;
-
-  if (numel (x0) > 1)
-    ## subplot (row, col, m:n)
-    x1 = max (x0(:)) + width;
-    y1 = max (y0(:)) + height;
-    x0 = min (x0(:));
-    y0 = min (y0(:));
-    pos = [x0, y0, x1-x0, y1-y0];
-  else
-    ## subplot (row, col, num)
-    pos = [x0, y0, width, height];
-  endif
-
-endfunction
-
-function subplot_align (h, varargin)
-  persistent updating = false;
-
-  if (! updating)
-    unwind_protect
-      updating = true;
-      hfig = ancestor (h, "figure");
-      hsubplots = findall (hfig, "type", "axes", "subplot_align", "off");
-      if (! isempty (hsubplots))
-        tightinset = get (hsubplots, "tightinset");
-        if (iscell (tightinset))
-          tightinset = max (cell2mat (tightinset));
-        endif
-        looseinset = get (hsubplots, "looseinset");
-        if (iscell (looseinset))
-          looseinset = max (cell2mat (looseinset));
-        endif
-        looseinset = max (tightinset, looseinset);
-        set (hsubplots, "looseinset", looseinset);
-      endif
-    unwind_protect_cleanup
-      updating = false;
-    end_unwind_protect
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! r = 3;
-%! c = 3;
-%! fmt = {'horizontalalignment', 'center', 'verticalalignment', 'middle'};
-%! for n = 1 : r*c
-%!   subplot (r, c, n);
-%!   xlabel (sprintf ('xlabel #%d', n));
-%!   ylabel (sprintf ('ylabel #%d', n));
-%!   title (sprintf ('title #%d', n));
-%!   text (0.5, 0.5, sprintf ('subplot(%d,%d,%d)', r, c, n), fmt{:});
-%!   axis ([0 1 0 1]);
-%! end
-%! subplot (r, c, 1:3);
-%! xlabel (sprintf ('xlabel #%d:%d', 1, 3));
-%! ylabel (sprintf ('ylabel #%d:%d', 1, 3));
-%! title (sprintf ('title #%d:%d', 1, 3));
-%! text (0.5, 0.5, sprintf ('subplot(%d,%d,%d:%d)', r, c, 1, 3), fmt{:});
-%! axis ([0 1 0 1]);
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! for n = 1:4
-%!   subplot (2,2,n, 'align');
-%!   plot (x, x);
-%!   xlabel (sprintf ('xlabel (2,2,%d)', n));
-%!   ylabel (sprintf ('ylabel (2,2,%d)', n));
-%!   title (sprintf ('title (2,2,%d)', n));
-%! end
-%! subplot (1,2,1, 'align');
-%! plot (x, x);
-%! xlabel ('xlabel (1,2,1)');
-%! ylabel ('ylabel (1,2,1)');
-%! title ('title (1,2,1)');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! ax(1) = subplot (221);
-%! set (ax(1), 'tag', '1');
-%! plot (x, rand (3, 11))
-%! title ('x & y labels & ticklabels');
-%! xlabel xlabel
-%! ylabel ylabel
-%! ax(2) = subplot (222);
-%! set (ax(2), 'tag', '2');
-%! plot (x, rand (3, 11))
-%! title ('no labels');
-%! axis ('nolabel','tic')
-%! ax(3) = subplot (223);
-%! set (ax(3), 'tag', '3');
-%! plot (x, rand (3, 11))
-%! title ('no labels');
-%! axis ('nolabel','tic')
-%! ax(4) = subplot (224);
-%! set (ax(4), 'tag', '4');
-%! plot (x, rand (3, 11))
-%! title ('x & y labels & ticklabels');
-%! xlabel xlabel
-%! ylabel ylabel
-
-%!demo
-%! x = 0:10;
-%! subplot (221);
-%! plot (x, rand (3, 11))
-%! ylim ([0, 1]);
-%! text (0.5, 0.5, '{x,y}labels & {x,y}ticklabels', ...
-%!       'horizontalalignment', 'center', ...
-%!       'units', 'normalized');
-%! xlabel xlabel
-%! ylabel ylabel
-%! title title
-%! subplot (222);
-%! plot (x, rand (3, 11))
-%! axis ('labely');
-%! ylabel ylabel
-%! text (0.5, 0.5, 'no xlabels, xticklabels', ...
-%!       'horizontalalignment', 'center', ...
-%!       'units', 'normalized');
-%! subplot (223);
-%! plot (x, rand (3, 11))
-%! axis ('labelx');
-%! text (0.5, 0.5, 'no ylabels, yticklabels', ...
-%!       'horizontalalignment', 'center', ...
-%!       'units', 'normalized');
-%! xlabel xlabel
-%! title title
-%! subplot (224);
-%! plot (x, rand (3, 11))
-%! axis ('nolabel','tic');
-%! text (0.5, 0.5, 'no {x,y}labels, {x,y}ticklabels', ...
-%!       'horizontalalignment', 'center', ...
-%!       'units', 'normalized');
-
--- a/scripts/plot/surf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surf (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surf (@var{z})
-## @deftypefnx {Function File} {} surf (@dots{}, @var{c})
-## @deftypefnx {Function File} {} surf (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} surf (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} surf (@dots{})
-## Plot a 3-D surface mesh.
-##
-## The surface mesh is plotted using shaded rectangles.  The vertices of the
-## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
-## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If only a single @var{z} matrix is
-## given, then it is plotted over the meshgrid
-## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
-## Thus, columns of @var{z} correspond to different @var{x} values and rows
-## of @var{z} correspond to different @var{y} values.
-##
-## The color of the surface is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally, the color of the surface can be specified independently of
-## @var{z} by supplying a color matrix, @var{c}.
-##
-## Any property/value pairs are passed directly to the underlying surface
-## object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## Note: The exact appearance of the surface can be controlled with the
-## @code{shading} command or by using @code{set} to control surface object
-## properties.
-## @seealso{ezsurf, surfc, surfl, surfnorm, trisurf, contour, mesh, surface, meshgrid, hidden, shading, colormap, caxis}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function retval = surf (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("surf", varargin{:});
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    
-    htmp = surface (varargin{:});
-
-    if (! ishold (hax))
-      set (hax, "view", [-37.5, 30],
-                "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = peaks ();
-%! surf (Z);
-%! title ({'surf() plot of peaks() function'; 'color determined by height Z'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = sombrero ();
-%! [Fx,Fy] = gradient (Z);
-%! surf (Z, Fx+Fy);
-%! shading interp;
-%! title ({'surf() plot of peaks() function'; ...
-%!         'facecolor is interpolated, color determined by gradient of Z'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X,Y,Z] = sombrero ();
-%! [~,Fy] = gradient (Z);
-%! surf (X, Y, Z, Fy);
-%! shading interp;
-%! title ({'surf() plot of peaks() function'; ...
-%!         'facecolor is interpolated, color determined by Y-gradient of Z'});
-
--- a/scripts/plot/surface.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surface (@var{x}, @var{y}, @var{z}, @var{c})
-## @deftypefnx {Function File} {} surface (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surface (@var{z}, @var{c})
-## @deftypefnx {Function File} {} surface (@var{z})
-## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} surface (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} surface (@dots{})
-## Create a surface graphic object given matrices @var{x} and @var{y} from
-## @code{meshgrid} and a matrix of values @var{z} corresponding to the
-## @var{x} and @var{y} coordinates of the surface.
-##
-## If @var{x} and @var{y} are vectors, then a typical vertex is
-## (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus, columns of @var{z} correspond
-## to different @var{x} values and rows of @var{z} correspond to different
-## @var{y} values.  If only a single input @var{z} is given then @var{x} is
-## taken to be @code{1:rows (@var{z})} and @var{y} is
-## @code{1:columns (@var{z})}.
-##
-## Any property/value input pairs are assigned to the surface object.
-## 
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-## @seealso{surf, mesh, patch, line}
-## @end deftypefn
-
-## Author: jwe
-
-function h = surface (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("surface", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  [htmp, bad_usage] = __surface__ (hax, varargin{:});
-
-  if (bad_usage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-function [h, bad_usage] = __surface__ (ax, varargin)
-
-  h = 0;
-  bad_usage = false;
-  firststring = nargin;
-  for i = 1 : (nargin - 1)
-    if (ischar (varargin{i}))
-      firststring = i;
-      break;
-    endif
-  endfor
-
-  if (firststring > 5)
-    bad_usage = true;
-    return;
-  elseif (firststring == 5)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    c = varargin{4};
-
-    if (iscomplex (x) || iscomplex (y) || iscomplex (z) || iscomplex (c))
-      error ("mesh: X, Y, Z, C arguments must be real");
-    endif
-
-    [z_nr, z_nc] = size (z);
-    [c_nr, c_nc, c_np] = size (c);
-    if (! (z_nr == c_nr && z_nc == c_nc && (c_np == 1 || c_np == 3)))
-      error ("surface: Z and C must have the same size");
-    endif
-
-    if (isvector (x) && isvector (y) && ismatrix (z))
-      if (rows (z) == length (y) && columns (z) == length (x))
-        x = x(:)';
-        y = y(:);
-      else
-        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
-      endif
-    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
-      if (! size_equal (x, y, z))
-        error ("surface: X, Y, and Z must have the same dimensions");
-      endif
-    else
-      error ("surface: X and Y must be vectors and Z must be a matrix");
-    endif
-  elseif (firststring == 4)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    c = z;
-
-    if (iscomplex (x) || iscomplex (y) || iscomplex (z))
-      error ("mesh: X, Y, Z arguments must be real");
-    endif
-
-    if (isvector (x) && isvector (y) && ismatrix (z))
-      if (rows (z) == length (y) && columns (z) == length (x))
-        x = x(:)';
-        y = y(:);
-      else
-        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
-      endif
-    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
-      if (! size_equal (x, y, z))
-        error ("surface: X, Y, and Z must have the same dimensions");
-      endif
-    else
-      error ("surface: X and Y must be vectors and Z must be a matrix");
-    endif
-  elseif (firststring == 3)
-    z = varargin{1};
-    c = varargin{2};
-
-    if (iscomplex (z) || iscomplex (c))
-      error ("mesh: X, C arguments must be real");
-    endif
-
-    if (ismatrix (z) && !isvector (z) && !isscalar (z))
-      [nr, nc] = size (z);
-      x = 1:nc;
-      y = (1:nr)';
-    else
-      error ("surface: Z argument must be a matrix");
-    endif
-  elseif (firststring == 2)
-    z = varargin{1};
-    c = z;
-
-    if (iscomplex (z))
-      error ("mesh: Z argument must be real");
-    endif
-
-    if (ismatrix (z) && !isvector (z) && !isscalar (z))
-      [nr, nc] = size (z);
-      x = 1:nc;
-      y = (1:nr)';
-    else
-      error ("surface: Z argument must be a matrix");
-    endif
-  elseif (firststring == 1)
-    x = 1:3;
-    y = x';
-    c = z = eye (3);
-  else
-    bad_usage = true;
-    return;
-  endif
-
-  if (firststring < nargin)
-    other_args = varargin(firststring:end);
-  else
-    other_args = {};  # make a default surface object.
-  endif
-  h = __go_surface__ (ax, "xdata", x, "ydata", y, "zdata", z, "cdata", c,
-                      other_args{:});
-
-  if (! ishold ())
-    set (ax, "view", [0, 90], "box", "off");
-  endif
-
-endfunction
-
-
-## Functional tests for surface() are in surf.m, surfc.m, surfl.m, and pcolor.m
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = surface;
-%!   assert (findobj (hf, "type", "surface"), h);
-%!   assert (get (h, "xdata"), 1:3, eps);
-%!   assert (get (h, "ydata"), (1:3)', eps);
-%!   assert (get (h, "zdata"), eye (3));
-%!   assert (get (h, "cdata"), eye (3));
-%!   assert (get (h, "type"), "surface");
-%!   assert (get (h, "linestyle"), get (0, "defaultsurfacelinestyle"));
-%!   assert (get (h, "linewidth"), get (0, "defaultsurfacelinewidth"), eps);
-%!   assert (get (h, "marker"), get (0, "defaultsurfacemarker"));
-%!   assert (get (h, "markersize"), get (0, "defaultsurfacemarkersize"));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/surfc.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surfc (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surfc (@var{z})
-## @deftypefnx {Function File} {} surfc (@dots{}, @var{c})
-## @deftypefnx {Function File} {} surfc (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} surfc (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} surfc (@dots{})
-## Plot a 3-D surface mesh with underlying contour lines.
-##
-## The surface mesh is plotted using shaded rectangles.  The vertices of the
-## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
-## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If only a single @var{z} matrix is
-## given, then it is plotted over the meshgrid
-## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
-## Thus, columns of @var{z} correspond to different @var{x} values and rows
-## of @var{z} correspond to different @var{y} values.
-##
-## The color of the surface is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally, the color of the surface can be specified independently of
-## @var{z} by supplying a color matrix, @var{c}.
-##
-## Any property/value pairs are passed directly to the underlying surface
-## object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## Note: The exact appearance of the surface can be controlled with the
-## @code{shading} command or by using @code{set} to control surface object
-## properties.
-## @seealso{ezsurfc, surf, surfl, surfnorm, trisurf, contour, mesh, surface, meshgrid, hidden, shading, colormap, caxis}
-## @end deftypefn
-
-function h = surfc (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfc", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-    
-    htmp = surface (varargin{:});
-
-    set (htmp, "facecolor", "flat");
-    if (! ishold ())
-      set (hax, "view", [-37.5, 30],
-                "xgrid", "on", "ygrid", "on", "zgrid", "on",
-                "xlimmode", "manual", "ylimmode", "manual");
-    endif
-
-    drawnow ();
-
-    ## don't pass string arguments to __contour__()
-    stop_idx = find (cellfun ("isclass", varargin, "char"), 1);
-    if (isempty (stop_idx))
-      stop_idx = nargin;
-    else
-      stop_idx--;
-    endif
-
-    if (stop_idx - 1 == 1 || stop_idx - 1 == 3)
-      ## Don't pass a color matrix c to __contour__
-      stop_idx -= 1;
-    endif
-
-    zmin = get (hax, "zlim")(1);
-    [~, htmp2] = __contour__ (hax, zmin, varargin{1:stop_idx});
-
-    htmp = [htmp; htmp2];
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = peaks ();
-%! surfc (Z);
-%! title ('surfc() combines surf/contour plots');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = sombrero ();
-%! [Fx,Fy] = gradient (Z);
-%! surfc (Z, Fx+Fy);
-%! shading interp;
-%! title ({'surfc() plot of sombrero() function'; ...
-%!         'facecolor is interpolated, color determined by gradient of Z'});
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X,Y,Z] = sombrero ();
-%! [~,Fy] = gradient (Z);
-%! surfc (X,Y,Z,Fy);
-%! shading interp;
-%! title ({'surfc() plot of peaks() function'; ...
-%!         'facecolor is interpolated, color determined by Y-gradient of Z'});
-
--- a/scripts/plot/surfl.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-## Copyright (C) 2009-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surfl (@var{z})
-## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surfl (@dots{}, @var{lsrc})
-## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z}, @var{lsrc}, @var{P})
-## @deftypefnx {Function File} {} surfl (@dots{}, "cdata")
-## @deftypefnx {Function File} {} surfl (@dots{}, "light")
-## @deftypefnx {Function File} {} surfl (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} surfl (@dots{})
-##
-## Plot a 3-D surface using shading based on various lighting models.
-##
-## The surface mesh is plotted using shaded rectangles.  The vertices of the
-## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
-## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If only a single @var{z} matrix is
-## given, then it is plotted over the meshgrid
-## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
-## Thus, columns of @var{z} correspond to different @var{x} values and rows
-## of @var{z} correspond to different @var{y} values.
-##
-## The default lighting mode @qcode{"cdata"}, changes the cdata property of the
-## surface object to give the impression of a lighted surface.
-## @strong{Warning:} The alternative mode @qcode{"light"} mode which creates a
-## light object to illuminate the surface is not implemented (yet).
-##
-## The light source location can be specified using @var{lsrc}.  It can be given
-## as a 2-element vector [azimuth, elevation] in degrees, or as a 3-element
-## vector [lx, ly, lz].  The default value is rotated 45 degrees
-## counterclockwise to the current view.
-##
-## The material properties of the surface can specified using a 4-element
-## vector @var{P} = [@var{AM} @var{D} @var{SP} @var{exp}] which defaults to
-## @var{p} = [0.55 0.6 0.4 10].
-##
-## @table @asis
-## @item @qcode{"AM"} strength of ambient light
-##
-## @item @qcode{"D"} strength of diffuse reflection
-##
-## @item @qcode{"SP"} strength of specular reflection
-##
-## @item @qcode{"EXP"} specular exponent
-## @end table
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## Example:
-##
-## @example
-## @group
-## colormap (bone (64));
-## surfl (peaks);
-## shading interp;
-## @end group
-## @end example
-## @seealso{diffuse, specular, surf, shading, colormap, caxis}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function h = surfl (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfl", varargin{:});
-
-  if (nargin == 0)
-    print_usage ();
-  endif
-
-  ## Check for lighting type.
-  use_cdata = true;
-  if (ischar (varargin{end}))
-    switch (tolower (varargin{end}))
-      case "light"
-        warning ("surfl: light method not supported (yet), using cdata method instead");
-        ## This can be implemented when light objects are supported.
-        use_cdata = false;
-      case "cdata"
-        use_cdata = true;
-      otherwise
-        error ("surfl: unknown lighting method");
-    endswitch
-    varargin(end) = [];
-  endif
-
-  ## Check for reflection properties argument.
-  ##
-  ## r = [ambient light strength,
-  ##      diffuse reflection strength,
-  ##      specular reflection strength,
-  ##      specular shine]
-  if (isnumeric (varargin{end}) && length (varargin{end}) == 4)
-    r = varargin{end};
-    varargin(end) = [];
-  else
-    ## Default values.
-    r = [0.55, 0.6, 0.4, 10];
-  endif
-
-  ## Check for light vector (lv) argument.
-  have_lv = false;
-  if (isnumeric (varargin{end}))
-    len = numel (varargin{end});
-    lastarg = varargin{end};
-    if (len == 3)
-      lv = lastarg;
-      varargin(end) = [];
-      have_lv = true;
-    elseif (len == 2)
-      [lv(1), lv(2), lv(3)] = sph2cart ((lastarg(1) - 90) * pi/180, 
-                                         lastarg(2) * pi/180,
-                                         1.0);
-      varargin(end) = [];
-      have_lv = true;
-    endif
-  endif
-
-  oldfig = [];
-  if (! isempty (hax))
-    oldfig = get (0, "currentfigure");
-  endif
-  unwind_protect
-    hax = newplot (hax);
-
-    htmp = surface (varargin{:});
-    if (! ishold (hax))
-      set (hax, "view", [-37.5, 30],
-                "xgrid", "on", "ygrid", "on", "zgrid", "on", "clim", [0 1]);
-    endif
-
-    ## Get view vector (vv).
-    [az, el] = view ();
-    vv = sph2cart ((az - 90) * pi/180.0, el * pi/180.0, 1.0);
-
-    if (! have_lv)
-      ## Calculate light vector (lv) from view vector.
-      phi = pi / 4;  # 45 degrees
-      R = [cos(phi), -sin(phi), 0;
-           sin(phi),  cos(phi), 0;
-           0,         0,        1];
-      lv = (R * vv.').';
-    endif
-
-    vn = get (htmp, "vertexnormals");
-    dar = get (hax, "plotboxaspectratio");
-    vn(:,:,1) *= dar(1);
-    vn(:,:,2) *= dar(2);
-    vn(:,:,3) *= dar(3);
-
-    ## Normalize vn.
-    vn ./= repmat (sqrt (sumsq (vn, 3)), [1, 1, 3]);
-    [nr, nc] = size (get (htmp, "zdata"));
-
-    ## Ambient, diffuse, and specular term.
-    cdata = (  r(1) * ones (nr, nc)
-             + r(2) * diffuse  (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv)
-             + r(3) * specular (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv, vv, r(4)));
-    cdata ./= sum (r(1:3));
-
-    set (htmp, "cdata", cdata);
-
-  unwind_protect_cleanup
-    if (! isempty (oldfig))
-      set (0, "currentfigure", oldfig);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [X,Y,Z] = sombrero ();
-%! colormap (copper (64));
-%! surfl (X,Y,Z);
-%! shading interp;
-%! title ('surfl() with defaults');
-
-%!demo
-%! clf;
-%! [X,Y,Z] = sombrero ();
-%! colormap (copper (64));
-%! [az, el] = view ();
-%! surfl (X,Y,Z, [az+225,el], [0.2 0.6 0.4 25]);
-%! shading interp;
-%! title ('surfl() with lighting vector and material properties');
-
--- a/scripts/plot/surfnorm.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surfnorm (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surfnorm (@var{z})
-## @deftypefnx {Function File} {[@var{nx}, @var{ny}, @var{nz}] =} surfnorm (@dots{})
-## @deftypefnx {Function File} {} surfnorm (@var{h}, @dots{})
-## Find the vectors normal to a meshgridded surface.  The meshed gridded
-## surface is defined by @var{x}, @var{y}, and @var{z}.  If @var{x} and
-## @var{y} are not defined, then it is assumed that they are given by
-##
-## @example
-## @group
-## [@var{x}, @var{y}] = meshgrid (1:rows (@var{z}),
-##                    1:columns (@var{z}));
-## @end group
-## @end example
-##
-## If no return arguments are requested, a surface plot with the normal
-## vectors to the surface is plotted.  Otherwise the components of the normal
-## vectors at the mesh gridded points are returned in @var{nx}, @var{ny},
-## and @var{nz}.
-##
-## The normal vectors are calculated by taking the cross product of the
-## diagonals of each of the quadrilaterals in the meshgrid to find the
-## normal vectors of the centers of these quadrilaterals.  The four nearest
-## normal vectors to the meshgrid points are then averaged to obtain the
-## normal to the surface at the meshgridded points.
-##
-## An example of the use of @code{surfnorm} is
-##
-## @example
-## surfnorm (peaks (25));
-## @end example
-## @seealso{surf, quiver3}
-## @end deftypefn
-
-function [Nx, Ny, Nz] = surfnorm (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfnorm", varargin{:});
-
-  if (nargin != 1 && nargin != 3)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
-    z = varargin{1};
-    [x, y] = meshgrid (1:rows (z), 1:columns (z));
-    ioff = 2;
-  else
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    ioff = 4;
-  endif
-
-  if (!ismatrix (z) || isvector (z) || isscalar (z))
-    error ("surfnorm: Z argument must be a matrix");
-  endif
-  if (! size_equal (x, y, z))
-    error ("surfnorm: X, Y, and Z must have the same dimensions");
-  endif
-
-  ## Make life easier, and avoid having to do the extrapolation later, do
-  ## a simpler linear extrapolation here. This is approximative, and works
-  ## badly for closed surfaces like spheres.
-  xx = [2 .* x(:,1) - x(:,2), x, 2 .* x(:,end) - x(:,end-1)];
-  xx = [2 .* xx(1,:) - xx(2,:); xx; 2 .* xx(end,:) - xx(end-1,:)];
-  yy = [2 .* y(:,1) - y(:,2), y, 2 .* y(:,end) - y(:,end-1)];
-  yy = [2 .* yy(1,:) - yy(2,:); yy; 2 .* yy(end,:) - yy(end-1,:)];
-  zz = [2 .* z(:,1) - z(:,2), z, 2 .* z(:,end) - z(:,end-1)];
-  zz = [2 .* zz(1,:) - zz(2,:); zz; 2 .* zz(end,:) - zz(end-1,:)];
-
-  u.x = xx(1:end-1,1:end-1) - xx(2:end,2:end);
-  u.y = yy(1:end-1,1:end-1) - yy(2:end,2:end);
-  u.z = zz(1:end-1,1:end-1) - zz(2:end,2:end);
-  v.x = xx(1:end-1,2:end) - xx(2:end,1:end-1);
-  v.y = yy(1:end-1,2:end) - yy(2:end,1:end-1);
-  v.z = zz(1:end-1,2:end) - zz(2:end,1:end-1);
-
-  c = cross ([u.x(:), u.y(:), u.z(:)], [v.x(:), v.y(:), v.z(:)]);
-  w.x = reshape (c(:,1), size (u.x));
-  w.y = reshape (c(:,2), size (u.y));
-  w.z = reshape (c(:,3), size (u.z));
-
-  ## Create normal vectors as mesh vectices from normals at mesh centers
-  nx = (w.x(1:end-1,1:end-1) + w.x(1:end-1,2:end) +
-        w.x(2:end,1:end-1) + w.x(2:end,2:end)) ./ 4;
-  ny = (w.y(1:end-1,1:end-1) + w.y(1:end-1,2:end) +
-        w.y(2:end,1:end-1) + w.y(2:end,2:end)) ./ 4;
-  nz = (w.z(1:end-1,1:end-1) + w.z(1:end-1,2:end) +
-        w.z(2:end,1:end-1) + w.z(2:end,2:end)) ./ 4;
-
-  ## Normalize the normal vectors
-  len = sqrt (nx.^2 + ny.^2 + nz.^2);
-  nx = nx ./ len;
-  ny = ny ./ len;
-  nz = nz ./ len;
-
-  if (nargout == 0)
-    oldfig = [];
-    if (! isempty (hax))
-      oldfig = get (0, "currentfigure");
-    endif
-    unwind_protect
-      hax = newplot (hax);
-      
-      surf (x, y, z, varargin{ioff:end});
-      old_hold_state = get (hax, "nextplot");
-      unwind_protect
-        set (hax, "nextplot", "add");
-        plot3 ([x(:)'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:),
-               [y(:)'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:),
-               [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:),
-               varargin{ioff:end});
-      unwind_protect_cleanup
-        set (hax, "nextplot", old_hold_state);
-      end_unwind_protect
-      
-    unwind_protect_cleanup
-      if (! isempty (oldfig))
-        set (0, "currentfigure", oldfig);
-      endif
-    end_unwind_protect
-  else
-    Nx = nx;
-    Ny = ny;
-    Nz = nz;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (10);
-%! surfnorm (x, y, z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! surfnorm (peaks (10));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! surfnorm (peaks (32));
-%! shading interp;
-
--- a/scripts/plot/tetramesh.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-## Copyright (C) 2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} tetramesh (@var{T}, @var{X})
-## @deftypefnx {Function File} {} tetramesh (@var{T}, @var{X}, @var{C})
-## @deftypefnx {Function File} {} tetramesh (@dots{}, @var{property}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} tetramesh (@dots{})
-## Display the tetrahedrons defined in the m-by-4 matrix @var{T} as 3-D patches.
-##
-## @var{T} is typically the output of a Delaunay triangulation
-## of a 3-D set of points.  Every row of @var{T} contains four indices into
-## the n-by-3 matrix @var{X} of the vertices of a tetrahedron.  Every row in
-## @var{X} represents one point in 3-D space. 
-##
-## The vector @var{C} specifies the color of each tetrahedron as an index
-## into the current colormap.  The default value is 1:m where m is the number
-## of tetrahedrons; the indices are scaled to map to the full range of the
-## colormap.  If there are more tetrahedrons than colors in the colormap then
-## the values in @var{C} are cyclically repeated.
-## 
-## Calling @code{tetramesh (@dots{}, "property", "value", @dots{})} passes all
-## property/value pairs directly to the patch function as additional arguments.
-##
-## The optional return value @var{h} is a vector of patch handles where each
-## handle represents one tetrahedron in the order given by @var{T}. 
-## A typical use case for @var{h} is to turn the respective patch
-## @qcode{"visible"} property @qcode{"on"} or @qcode{"off"}.
-##
-## Type @code{demo tetramesh} to see examples on using @code{tetramesh}.
-## @seealso{trimesh, delaunay3, delaunayn, patch}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function h = tetramesh (varargin)
-
-  [reg, prop] = parseparams (varargin);
-
-  if (length (reg) < 2 || length (reg) > 3)
-    print_usage ();
-  endif
-
-  T = reg{1};
-  X = reg{2};
-
-  if (! ismatrix (T) || columns (T) != 4)
-    error ("tetramesh: T must be an n-by-4 matrix");
-  elseif (! ismatrix (X) || columns (X) != 3)
-    error ("tetramesh: X must be an n-by-3 matrix");
-  endif
-
-  size_T = rows (T);
-  cmap = colormap ();
-  
-  if (length (reg) < 3)
-    size_cmap = rows (cmap);
-    C = mod ((1:size_T)' - 1, size_cmap) + 1;
-    if (size_T < size_cmap && size_T > 1) 
-      ## expand to the available range of colors
-      C = floor ((C - 1) * (size_cmap - 1) / (size_T - 1)) + 1;
-    endif
-  else
-    C = reg{3};
-    if (! isvector (C) || size_T != length (C))
-      error ("tetramesh: C must be a vector of the same length as T");
-    endif
-  endif
-
-  hax = newplot ();
-
-  hvec = zeros (size_T, 1);
-  if (strcmp (graphics_toolkit (), "gnuplot"))
-    ## Tiny reduction of the tetrahedron size to help gnuplot by
-    ## avoiding identical faces with different colors
-    for i = 1:size_T
-      [th, p] = __shrink__ ([1 2 3 4], X(T(i, :), :), 1 - 1e-7);
-      hvec(i) = patch ("Faces", th, "Vertices", p, 
-                       "FaceColor", cmap(C(i), :), "FaceAlpha", 0.9,
-                       prop{:});
-    endfor
-  else
-    ## FLTK does not support FaceAlpha.
-    for i = 1:size_T
-      th = [1 2 3; 2 3 4; 3 4 1; 4 1 2];
-      hvec(i) = patch ("Faces", th, "Vertices", X(T(i, :), :), 
-                       "FaceColor", cmap(C(i), :), "FaceAlpha", 1.0,
-                       prop{:});
-    endfor
-  endif
-
-  if (! ishold ())
-    set (hax, "view", [-37.5, 30], "box", "off");
-  endif
-
-  if (nargout > 0)
-    h = hvec;
-  endif
-
-endfunction
-
-## shrink the tetrahedron relative to its center of gravity
-function [tri, p] = __shrink__ (T, X, sf)
-  midpoint = repmat (sum (X(T, :), 1) / 4, 12, 1);
-  p = [X([1 2 3], :); X([2 3 4], :); X([3 4 1], :); X([4 1 2], :)];
-  p = sf * (p - midpoint) + midpoint;
-  tri = reshape (1:12, 3, 4)';
-endfunction
-
-
-%!demo
-%! clf;
-%! d = [-1 1];
-%! [x,y,z] = meshgrid (d, d, d);
-%! x = [x(:); 0];
-%! y = [y(:); 0];
-%! z = [z(:); 0];
-%! tetra = delaunay3 (x, y, z);
-%! X = [x(:) y(:) z(:)];
-%! colormap (jet (64));
-%! h = tetramesh (tetra, X);
-%! set (h(1:2:end), 'Visible', 'off');
-%! axis equal;
-%! view (30, 20);
-%! title ({'tetramesh() plot', ...
-%!         'colormap = jet (64), every other tetrahedron invisible'});
-
-%!demo
-%! clf;
-%! d = [-1 1];
-%! [x,y,z] = meshgrid (d, d, d);
-%! x = [x(:); 0];
-%! y = [y(:); 0];
-%! z = [z(:); 0];
-%! tetra = delaunay3 (x, y, z);
-%! X = [x(:) y(:) z(:)];
-%! colormap (gray (256));
-%! tetramesh (tetra, X, 21:20:241, 'EdgeColor', 'w');
-%! axis equal;
-%! view (30, 20);
-%! title ({'tetramesh() plot', ...
-%!         'colormap = gray (256) with white edges'});
-
--- a/scripts/plot/text.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} text (@var{x}, @var{y}, @var{string})
-## @deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{z}, @var{string})
-## @deftypefnx {Function File} {} text (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} text (@dots{})
-## Create a text object with text @var{string} at position @var{x}, @var{y},
-## (@var{z}) on the current axes.
-##
-## Multiple locations can be specified if @var{x}, @var{y}, (@var{z}) are
-## vectors.  Multiple strings can be specified with a character matrix or
-## a cell array of strings.
-##
-## Optional property/value pairs may be used to control the appearance of the
-## text.
-##
-## The optional return value @var{h} is a vector of graphics handles to the
-## created text objects.
-## @seealso{gtext, title, xlabel, ylabel, zlabel}
-## @end deftypefn
-
-## Author: jwe
-
-## Note: The following code is rigged for Matlab compatibility and is
-##       full of hidden assumptions.  Be very wary when modifying.
-
-function h = text (varargin)
-
-  nargs = nargin;
-  offset = 0;
-
-  if (nargs > 2 && isnumeric (varargin{1}) && isnumeric (varargin{2}))
-    x = varargin{1};
-    y = varargin{2};
-
-    if (nargin > 3 && isnumeric (varargin{3}))
-      z = varargin{3};
-      offset = 4;
-    else
-      z = zeros (size (x));
-      offset = 3;
-    endif
-
-    string = varargin{offset};
-    varargin(1:offset) = [];
-
-    nx = numel (x);
-    ny = numel (y);
-    nz = numel (z);
-    if (ischar (string))
-
-      do_keyword_repl = true;
-      nt = rows (string);
-      if (nx == 1 && nt == 1)
-        ## Single text object with one line
-        string = {string};
-      elseif (nx == 1 && nt > 1)
-        ## Single text object with multiple lines
-        ## FIXME: "default" or "factory" as first row
-        ##        should be escaped to "\default" or "\factory"
-        ##        Other rows do not require escaping.
-        do_keyword_repl = false;
-        string = {string};
-      elseif (nx > 1 && nt == nx)
-        ## Mutiple text objects with different strings
-        string = cellstr (string);
-      else 
-        ## Mutiple text objects with same string
-        string = repmat ({string}, [nx, 1]);
-        nt = nx;
-      endif
-
-      ## Escape special keywords
-      if (do_keyword_repl)
-        string = regexprep (string, '^(default|factory)$', '\\$1');
-      endif
-
-    elseif (iscell (string))
-
-      nt = numel (string);
-      if (nx == 1)      
-        ## Single text object with one or more lines
-        string = {string};
-        nt = 1;
-      elseif (nx > 1 && nt == nx)
-        ## Mutiple text objects with different strings
-      else
-        ## Mutiple text objects with same string
-        string = repmat ({string}, [nx, 1]);
-        nt = nx;
-      endif
-
-    else
-
-      error ("text: STRING must be a character string or cell array of character strings");
-
-    endif
-  else  # Only PROP/VALUE pairs
-    x = y = z = 0;
-    nx = ny = nz = 1;
-    string = {""};
-    nt = 1;
-  endif
-
-  ## Any remaining inputs must occur as PROPERTY/VALUE pairs
-  if (rem (numel (varargin), 2) != 0)
-    print_usage ();
-  endif
-
-  ## Get axis argument which may be in a 'parent' PROP/VAL pair
-  [hax, varargin] = __plt_get_axis_arg__ ("text", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-
-  ## Position argument may alse be in PROP/VAL pair
-  idx = find (strcmpi (varargin, "position"), 1);
-  if (idx)
-    pos = varargin{idx+1};
-    varargin(idx:idx+1) = [];
-  else
-    pos = [x(:), y(:), z(:)];
-  endif
-
-  if (nx == ny && nx == nz && (nt == nx || nt == 1 || nx == 1))
-    htmp = zeros (nt, 1);
-    if (nx == 1)
-      htmp = __go_text__ (hax, "string", string{1},
-                               ## varargin first, in case "Units" set for pos.
-                               varargin{:},
-                               "position", pos);
-    elseif (nx == nt)
-      for n = 1:nt
-        htmp(n) = __go_text__ (hax, "string", string{n},
-                                    varargin{:},
-                                    "position", pos(n,:));
-      endfor
-      __request_drawnow__ ();
-    else
-      error ("text: dimension mismatch for coordinates and STRING");
-    endif
-  elseif (nt == nx || nt == 1 || nx == 1)
-    error ("text: dimension mismatch for coordinates");
-  else
-    error ("text: dimension mismatch between coordinates and strings");
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ha = {'left', 'center', 'right'};
-%! va = {'bottom', 'middle', 'top'};
-%! x = [0.25 0.5 0.75];
-%! y = x;
-%! for t = 0:30:359;
-%!   for nh = 1:numel (ha)
-%!     for nv = 1:numel (va)
-%!       text (x(nh), y(nv), 'Hello World', ...
-%!             'rotation', t, ...
-%!             'horizontalalignment', ha{nh}, ...
-%!             'verticalalignment', va{nv});
-%!     end
-%!   end
-%! end
-%! set (gca, 'xtick', [0.25, 0.5, 0.75], ...
-%!           'xticklabel', ha, ...
-%!           'ytick', [0.25, 0.5, 0.75], ...
-%!           'yticklabel', va);
-%! axis ([0 1 0 1]);
-%! xlabel ('horizontal alignment');
-%! ylabel ('vertical alignment');
-%! title ('text alignment and rotation (0:30:360 degrees)');
-
-%!demo
-%! clf;
-%! h = mesh (peaks, 'edgecolor', 0.7 * [1 1 1], ...
-%!                  'facecolor', 'none', ...
-%!                  'facealpha', 0);
-%! for t = 0:45:359;
-%!   text (25, 25, 0, 'Vertical Alignment = Bottom', ...
-%!                    'rotation', t, ...
-%!                    'horizontalalignment', 'left', ...
-%!                    'verticalalignment', 'bottom');
-%! end
-%! caxis ([-100 100]);
-%! title ('Vertically Aligned at Bottom');
-
-%!demo
-%! clf;
-%! axis ([0 8 0 8]);
-%! title (['1st title';'2nd title']);
-%! xlabel (['1st xlabel';'2nd xlabel']);
-%! ylabel (['1st ylabel';'2nd ylabel']);
-%! text (4, 4, {'Hello', 'World'}, ...
-%!       'horizontalalignment', 'center', ...
-%!       'verticalalignment', 'middle');
-%! grid on;
-
-%!demo
-%! clf;
-%! h = mesh (peaks (), 'edgecolor', 0.7 * [1 1 1], ...
-%!                     'facecolor', 'none', ...
-%!                     'facealpha', 0);
-%! title (['1st title';'2nd title']);
-%! xlabel (['1st xlabel';'2nd xlabel']);
-%! ylabel (['1st ylabel';'2nd ylabel']);
-%! zlabel (['1st zlabel';'2nd zlabel']);
-%! text (0, 0, 5, {'Hello', 'World'}, ...
-%!       'horizontalalignment', 'center', ...
-%!       'verticalalignment', 'middle');
-%! hold on;
-%! plot3 (0, 0, 5, '+k');
-
-%!demo
-%! clf;
-%! h = text (0.5, 0.3, 'char');
-%! assert ('char', class (get (h, 'string')));
-%! h = text (0.5, 0.4, ['char row 1'; 'char row 2']);
-%! assert ('char', class (get (h, 'string')));
-%! h = text (0.5, 0.6, {'cell2str (1,1)', 'cell2str (1,2)'; 'cell2str (2,1)', 'cell2str (2,2)'});
-%! assert ('cell', class (get (h, 'string')));
-%! h = text (0.5, 0.8, 'foobar');
-%! set (h, 'string', 1:3);
-%! h = text ([0.1, 0.1], [0.3, 0.4], 'one string & two objects');
-%! assert ('char', class (get (h(1), 'string')));
-%! assert ('char', class (get (h(2), 'string')));
-%! h = text ([0.1, 0.1], [0.5, 0.6], {'one cellstr & two objects'});
-%! assert ('cell', class (get (h(1), 'string')));
-%! assert ('cell', class (get (h(2), 'string')));
-%! h = text ([0.1, 0.1], [0.7, 0.8], {'cellstr 1 object 1', 'cellstr 2 object 2'});
-%! assert ('char', class (get (h(1), 'string')));
-%! assert ('char', class (get (h(2), 'string')));
-%! h = text ([0.1, 0.1], [0.1, 0.2], ['1st string & 1st object'; '2nd string & 2nd object']);
-%! assert ('char', class (get (h(1), 'string')));
-%! assert ('char', class (get (h(2), 'string')));
-%! h = text (0.7, 0.6, 'single string');
-%! assert ('char', class (get (h, 'string')));
-%! h = text (0.7, 0.5, {'single cell-string'});
-%! assert ('cell', class (get (h, 'string')));
-%! xlabel (1:2);
-%! ylabel (1:2);
-%! title (1:2);
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ## Single object with one line
-%!   h = text (0.5, 0.3, "single object with one line");
-%!   obs = get (h, "string");
-%!   assert (class (obs), "char");
-%!   assert (obs, "single object with one line");
-%!
-%!   ## Single object with multiple lines
-%!   h = text (0.5, 0.4, ["char row 1"; "char row 2"]);
-%!   obs = get (h, "string");
-%!   assert (class (obs), "char");
-%!   assert (obs, ["char row 1"; "char row 2"]);
-%!
-%!   ## Multiple objects with single line
-%!   h = text ([0.1, 0.1], [0.3, 0.4], "two objects with same string");
-%!   assert (class (get (h(1), "string")), "char");
-%!   assert (class (get (h(2), "string")), "char");
-%!   assert (get (h(1), "string"), "two objects with same string");
-%!   assert (get (h(2), "string"), "two objects with same string");
-%!
-%!   ## Multiple objects with multiple lines
-%!   h = text ([0.1, 0.1], [0.3, 0.4], ["string1"; "string2"]);
-%!   assert (class (get (h(1), "string")), "char");
-%!   assert (class (get (h(2), "string")), "char");
-%!   assert (get (h(1), "string"), "string1");
-%!   assert (get (h(2), "string"), "string2");
-%!
-%!   ### Tests repeated with cell input ###
-%!
-%!   ## Single object with one line
-%!   h = text (0.5, 0.3, {"single object with one line"});
-%!   obs = get (h, "string");
-%!   assert (class (obs), "cell");
-%!   assert (obs, {"single object with one line"});
-%!
-%!   ## Single object with multiple lines
-%!   h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)";
-%!                        "cell2str (2,1)", "cell2str (2,2)"});
-%!   obs = get (h, "string");
-%!   assert (class (obs), "cell");
-%!   assert (obs, {"cell2str (1,1)"; "cell2str (2,1)";
-%!                 "cell2str (1,2)"; "cell2str (2,2)"});
-%!
-%!   ## Multiple objects with single line
-%!   h = text ([0.1, 0.1], [0.5, 0.6], {"two objects with same cellstr"});
-%!   assert (class (get (h(1), "string")), "cell");
-%!   assert (class (get (h(2), "string")), "cell");
-%!   ## FIXME: is return value of cellstr, rather than string, Matlab-verified?
-%!   assert (get (h(1), "string"), {"two objects with same cellstr"});
-%!   assert (get (h(2), "string"), {"two objects with same cellstr"});
-%!
-%!   ## Multiple objects with multiple lines
-%!   h = text ([0.1, 0.1], [0.7, 0.8], {"cellstr1", "cellstr2"});
-%!   ## FIXME: is return value really char in Matlab?
-%!   assert (class (get (h(1), "string")), "char");
-%!   assert (class (get (h(2), "string")), "char");
-%!   assert (get (h(1), "string"), "cellstr1");
-%!   assert (get (h(2), "string"), "cellstr2");
-%!
-%!   ## Test special keyword processing
-%!   h = text (0.5, 0.5, "default");
-%!   assert (get (h, "string"), "default")
-%!   h = text (0.5, 0.5, "factory");
-%!   assert (get (h, "string"), "factory")
-%!
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/title.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} title (@var{string})
-## @deftypefnx {Function File} {} title (@var{string}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} title (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} title (@dots{})
-## Specify the string used as a title for the current axis.
-##
-## An optional list of @var{property}/@var{value} pairs can be used to change
-## the appearance of the created title text object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created text
-## object.
-## @seealso{xlabel, ylabel, zlabel, text}
-## @end deftypefn
-
-## Author: jwe
-
-function h = title (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("title", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  htmp = __axis_label__ (hax, "title", varargin{:});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ax = axes ();
-%! h = get (ax, 'title');
-%! title ('Test Title Text');
-
-%!demo
-%! clf;
-%! ax = axes ();
-%! h = get (ax, 'title');
-%! title ({'Multi-line'; 'Title'; 'Text'});
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! h = get (gca, 'title');
-%! title ('Test FontSize Property', 'fontsize', 16);
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ax = axes ();
-%!   h = get (ax, "title");
-%!   title ("Test Title Text");
-%!   assert (get (h, "string"), "Test Title Text");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ax = axes ();
-%!   h = get (ax, "title");
-%!   title ({'Multi-line'; 'Title'; 'Text'});
-%!   assert (get (h, "string"), {'Multi-line'; 'Title'; 'Text'});
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   h = get (gca, "title");
-%!   title ("Test FontSize Property", "fontsize", 16);
-%!   assert (get (h, "string"), "Test FontSize Property");
-%!   assert (get (h, "fontsize"), 16);
-
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/trimesh.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z}, @var{c})
-## @deftypefnx {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} trimesh (@var{tri}, @var{x}, @var{y})
-## @deftypefnx {Function File} {} trimesh (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{})
-## Plot a 3-D triangular wireframe mesh.
-## 
-## In contrast to @code{mesh}, which plots a mesh using rectangles,
-## @code{trimesh} plots the mesh using triangles.
-##
-## @var{tri} is typically the output of a Delaunay triangulation over the
-## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
-## and contains three indices into [@var{x}, @var{y}] which are the
-## vertices of the triangles in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If no @var{z} input is given then
-## the triangles are plotted as a 2-D figure.
-## 
-## The color of the trimesh is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally, the color of the mesh can be specified independently of @var{z}
-## by supplying a color matrix, @var{c}.  If @var{z} has N elements, then
-## @var{c} should be an Nx1 vector for colormap data or an Nx3 matrix for
-## RGB data.
-##
-## Any property/value pairs are passed directly to the underlying patch object.
-##
-## The optional return value @var{h} is a graphics handle to the created patch
-## object.
-## @seealso{mesh, tetramesh, triplot, trisurf, delaunay, patch, hidden}
-## @end deftypefn
-
-function h = trimesh (tri, x, y, z, varargin)
-
-  if (nargin < 3)
-    print_usage ();
-  endif
-
-  if (nargin == 3)
-    htmp = triplot (tri, x, y);
-  elseif (ischar (z))
-    htmp = triplot (tri, x, y, z, varargin{:});
-  else
-    ## Process color argument
-    if (nargin > 4 && isnumeric (varargin{1}))
-      c = varargin{1};
-      varargin(1) = [];
-      if (isvector (c))
-        if (numel (c) != numel (z))
-          error ("trimesh: C must have 'numel (Z)' elements");
-        endif
-        c = c(:);
-      elseif (rows (c) != numel (z) || columns (c) != 3)
-        error ("trimesh: TrueColor C matrix must be 'numel (Z)' rows by 3 columns");
-      endif
-    else
-      c = z(:);
-    endif
-
-    hax = newplot ();
-
-    ## Tag object as "trimesh" so that hidden() can find it.
-    htmp = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
-                  "FaceVertexCdata", c, "EdgeColor", "flat", "FaceColor", "w",
-                  "Tag", "trimesh", varargin{:});
-    if (! ishold ())
-      set (hax, "view", [-37.5, 30], "box", "off",
-                "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! old_state = rand ('state');
-%! restore_state = onCleanup (@() rand ('state', old_state));
-%! rand ('state', 10);
-%! N = 10;
-%! x = 3 - 6 * rand (N, N);
-%! y = 3 - 6 * rand (N, N);
-%! z = peaks (x, y);
-%! tri = delaunay (x(:), y(:));
-%! trimesh (tri, x(:), y(:), z(:));
-
-%% Test input validation
-%!error trimesh ()
-%!error trimesh (1)
-%!error trimesh (1,2)
-%!error <C must have 'numel \(Z\)' elements> trimesh (1,2,3,4,[5 6])
-%!error <C must have 'numel \(Z\)' elements> trimesh (1,2,3,4,[5 6]')
-%!error <TrueColor C matrix must> trimesh ([1;1],[2;2],[3;3],[4;4],zeros(3,3))
-%!error <TrueColor C matrix must> trimesh ([1;1],[2;2],[3;3],[4;4],zeros(2,2))
-
--- a/scripts/plot/triplot.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} triplot (@var{tri}, @var{x}, @var{y})
-## @deftypefnx {Function File} {} triplot (@var{tri}, @var{x}, @var{y}, @var{linespec})
-## @deftypefnx {Function File} {@var{h} =} triplot (@dots{})
-## Plot a 2-D triangular mesh.
-## 
-## @var{tri} is typically the output of a Delaunay triangulation over the
-## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
-## and contains three indices into [@var{x}, @var{y}] which are the
-## vertices of the triangles in the x-y plane.
-##
-## The linestyle to use for the plot can be defined with the argument
-## @var{linespec} of the same format as the @code{plot} command.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## patch object.
-## @seealso{plot, trimesh, trisurf, delaunay}
-## @end deftypefn
-
-function h = triplot (tri, x, y, varargin)
-
-  if (nargin < 3)
-    print_usage ();
-  endif
-
-  idx = tri(:, [1, 2, 3, 1]).';
-  nt = rows (tri);
-  handle = plot ([x(idx); NaN(1, nt)](:),
-                 [y(idx); NaN(1, nt)](:), varargin{:});
-
-  if (nargout > 0)
-    h = handle;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! old_state = rand ('state');
-%! restore_state = onCleanup (@() rand ('state', old_state));
-%! rand ('state', 2);
-%! N = 20;
-%! x = rand (N, 1);
-%! y = rand (N, 1);
-%! tri = delaunay (x, y);
-%! triplot (tri, x, y);
-
--- a/scripts/plot/trisurf.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z}, @var{c})
-## @deftypefnx {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} trisurf (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} trisurf (@dots{})
-## Plot a 3-D triangular surface.
-## 
-## In contrast to @code{surf}, which plots a surface mesh using rectangles,
-## @code{trisurf} plots the mesh using triangles.
-##
-## @var{tri} is typically the output of a Delaunay triangulation over the
-## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
-## and contains three indices into [@var{x}, @var{y}] which are the
-## vertices of the triangles in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.
-## 
-## The color of the trimesh is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally, the color of the mesh can be specified independently of @var{z}
-## by supplying a color matrix, @var{c}.  If @var{z} has N elements, then
-## @var{c} should be an Nx1 vector for colormap data or an Nx3 matrix for
-## RGB data.
-##
-## Any property/value pairs are passed directly to the underlying patch object.
-##
-## The optional return value @var{h} is a graphics handle to the created patch
-## object.
-## @seealso{surf, triplot, trimesh, delaunay, patch, shading}
-## @end deftypefn
-
-function h = trisurf (tri, x, y, z, varargin)
-
-  if (nargin < 4)
-    print_usage ();
-  endif
-
-  if (nargin > 4 && isnumeric (varargin{1}))
-    c = varargin{1};
-    varargin(1) = [];
-    if (isvector (c))
-      if (numel (c) != numel (z))
-        error ("trisurf: C must have 'numel (Z)' elements");
-      endif
-      c = c(:);
-    elseif (rows (c) != numel (z) || columns (c) != 3)
-      error ("trisurf: TrueColor C matrix must be 'numel (Z)' rows by 3 columns");
-    endif
-  else
-    c = z(:);
-  endif
-  ## FIXME: Is all this extra input parsing necessary?
-  ##        Is it for Matlab compatibility?
-  if (! any (strcmpi (varargin, "FaceColor")))
-    nfc = numel (varargin) + 1;
-    varargin(nfc+(0:1)) = {"FaceColor", "flat"};
-  else
-    nfc = find (any (strcmpi (varargin, "FaceColor")), 1);
-  endif
-  if (! any (strcmpi (varargin, "EdgeColor"))
-      && strcmpi (varargin{nfc+1}, "interp"))
-    varargin(end+(1:2)) = {"EdgeColor", "none"};
-  endif
-
-  hax = newplot ();
-
-  htmp = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)],
-                "FaceVertexCData", c, varargin{:});
-
-  if (! ishold ())
-    set (hax, "view", [-37.5, 30], "box", "off",
-              "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! N = 31;
-%! [x, y] = meshgrid (1:N);
-%! tri = delaunay (x(:), y(:));
-%! z = peaks (N);
-%! h = trisurf (tri, x, y, z, 'facecolor', 'interp');
-%! axis tight;
-%! zlim auto;
-%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! N = 31;
-%! [x, y] = meshgrid (1:N);
-%! tri = delaunay (x(:), y(:));
-%! z = peaks (N);
-%! h = trisurf (tri, x, y, z, 'facecolor', 'flat');
-%! axis tight;
-%! zlim auto;
-%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! old_state = rand ('state');
-%! restore_state = onCleanup (@() rand ('state', old_state));
-%! rand ('state', 10);
-%! N = 10;
-%! x = 3 - 6 * rand (N, N);
-%! y = 3 - 6 * rand (N, N);
-%! z = peaks (x, y);
-%! tri = delaunay (x(:), y(:));
-%! trisurf (tri, x(:), y(:), z(:));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = rand (100, 1);
-%! y = rand (100, 1);
-%! z = x.^2 + y.^2;
-%! tri = delaunay (x, y);
-%! trisurf (tri, x, y, z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = rand (100, 1);
-%! y = rand (100, 1);
-%! z = x.^2 + y.^2;
-%! tri = delaunay (x, y);
-%! trisurf (tri, x, y, z, 'facecolor', 'interp');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = rand (100, 1);
-%! y = rand (100, 1);
-%! z = x.^2 + y.^2;
-%! tri = delaunay (x, y);
-%! trisurf (tri, x, y, z, 'facecolor', 'interp', 'edgecolor', 'k');
-
-%% Test input validation
-%!error trisurf ()
-%!error trisurf (1)
-%!error trisurf (1,2)
-%!error trisurf (1,2,3)
-%!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6])
-%!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6]')
-%!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(3,3))
-%!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(2,2))
-
--- a/scripts/plot/uicontextmenu.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{handle} =} uicontextmenu ("Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uicontextmenu (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uicontextmenu", varargin, {"figure"});
-  handle = __go_uicontextmenu__ (h, args{:});
-
-endfunction
-
--- a/scripts/plot/uicontrol.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uicontrol ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uicontrol (@var{parent}, "Name", value, @dots{})
-## @deftypefnx {Function File} {} uicontrol (@var{handle})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uicontrol (varargin)
-
-  if (nargin == 1 && ishandle (varargin{1}) && strcmpi (get (varargin{1}, "type"), "uicontrol"))
-    error ("uicontrol focusing not implemented yet.");
-  else
-    [h, args] = __uiobject_split_args__ ("uicontrol", varargin, {"figure", "uipanel", "uibuttongroup"});
-    handle = __go_uicontrol__ (h, args{:});
-  endif
-
-endfunction
-
--- a/scripts/plot/uigetdir.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{dirname} =} uigetdir ()
-## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path})
-## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path}, @var{dialog_name})
-## Open a GUI dialog for selecting a directory.  If @var{init_path} is not
-## given the current working directory is used.  @var{dialog_name} may be
-## used to customize the dialog title.
-## @seealso{uigetfile, uiputfile}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function dirname = uigetdir (init_path = pwd, dialog_name = "Select Directory to Open")
-
-  if (! __octave_link_enabled__ ())
-    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
-    funcname = ["__uigetdir_", defaulttoolkit, "__"];
-    functype = exist (funcname);
-    if (! __is_function__ (funcname))
-      funcname = "__uigetdir_fltk__";
-      if (! __is_function__ (funcname))
-        error ("uigetdir: fltk graphics toolkit required");
-      elseif (! strcmp (defaulttoolkit, "gnuplot"))
-        warning ("uigetdir: no implementation for toolkit '%s', using 'fltk' instead",
-                 defaulttoolkit);
-      endif
-    endif
-  endif
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  if (!ischar (init_path) || !ischar (dialog_name))
-    error ("uigetdir: INIT_PATH and DIALOG_NAME must be string arguments");
-  endif
-
-  if (!isdir (init_path))
-    init_path = fileparts (init_path);
-  endif
-
-  if (__octave_link_enabled__ ())
-    file_filter = cell (0, 2);
-    default_file_name = "";
-    dialog_position = [240, 120];
-    dialog_mode = "dir";
-
-    [filename, dirname, filterindex] ...
-      = __octave_link_file_dialog__ (file_filter, dialog_name,
-                                     default_file_name, dialog_position,
-                                     dialog_mode, init_path);
-  else
-    dirname = feval (funcname, init_path, dialog_name);
-  endif
-endfunction
-
-
-%!demo
-%! uigetdir (pwd, 'Select Directory');
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/uigetfile.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uigetfile ()
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt})
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name})
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name}, @var{default_file})
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "Position", [@var{px} @var{py}])
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "MultiSelect", @var{mode})
-##
-## Open a GUI dialog for selecting a file and return the filename @var{fname},
-## the path to this file @var{fpath}, and the filter index @var{fltidx}.
-## @var{flt} contains a (list of) file filter string(s) in one of the following
-## formats:
-##
-## @table @asis
-## @item @qcode{"/path/to/filename.ext"}
-## If a filename is given then the file extension is extracted and used as
-## filter.  In addition, the path is selected as current path and the filename
-## is selected as default file.  Example: @code{uigetfile ("myfun.m")}
-##
-## @item A single file extension @qcode{"*.ext"}
-## Example: @code{uigetfile ("*.ext")}
-##
-## @item A 2-column cell array
-## containing a file extension in the first column and a brief description
-## in the second column.
-## Example: @code{uigetfile (@{"*.ext", "My Description";"*.xyz",
-## "XYZ-Format"@})}
-##
-## The filter string can also contain a semicolon separated list of filter
-## extensions.
-## Example: @code{uigetfile (@{"*.gif;*.png;*.jpg", "Supported Picture
-## Formats"@})}
-## @end table
-##
-## @var{dialog_name} can be used to customize the dialog title.
-## If @var{default_file} is given then it will be selected in the GUI dialog.
-## If, in addition, a path is given it is also used as current path.
-##
-## The screen position of the GUI dialog can be set using the
-## @qcode{"Position"} key and a 2-element vector containing the pixel
-## coordinates.  Two or more files can be selected when setting the
-## @qcode{"MultiSelect"} key to @qcode{"on"}.  In that case @var{fname} is a
-## cell array containing the files.
-## @seealso{uiputfile, uigetdir}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function [retfile, retpath, retindex] = uigetfile (varargin)
-
-  if (! __octave_link_enabled__ ())
-    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
-    funcname = ["__uigetfile_", defaulttoolkit, "__"];
-    functype = exist (funcname);
-    if (! __is_function__ (funcname))
-      funcname = "__uigetfile_fltk__";
-      if (! __is_function__ (funcname))
-        error ("uigetfile: fltk graphics toolkit required");
-      elseif (! strcmp (defaulttoolkit, "gnuplot"))
-        warning ("uigetfile: no implementation for toolkit '%s', using 'fltk' instead",
-               defaulttoolkit);
-      endif
-    endif
-  endif
-  
-  if (nargin > 7)
-    error ("uigetfile: number of input arguments must be less than eight");
-  endif
-
-  defaultvals = {cell(0, 2),         # File Filter
-                 "Open File",        # Dialog Title
-                 "",                 # Default file name
-                 [240, 120],         # Dialog Position (pixel x/y)
-                 "off",              # MultiSelect on/off
-                 pwd};               # Default directory
-
-  outargs = cell (6, 1);
-  for i = 1 : 6
-    outargs{i} = defaultvals{i};
-  endfor
-
-  idx1 = idx2 = [];
-  if (length (varargin) > 0)
-    for i = 1 : length (varargin)
-      val = varargin{i};
-      if (ischar (val))
-        val = tolower (val);
-        if (strcmp (val, "multiselect"))
-          idx1 = i;
-        elseif (strcmp (val, "position"))
-          idx2 = i;
-        endif
-      endif
-    endfor
-  endif
-
-  stridx = [idx1, idx2, 0];
-  if (length (stridx) > 1)
-    stridx = min (stridx(1 : end - 1));
-  endif
-
-  args = varargin;
-  if (stridx)
-    args = varargin(1 : stridx - 1);
-  endif
-
-  len = length (args);
-  if (len > 0)
-    file_filter = args{1};
-    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
-    if (length (defdir) > 0)
-      outargs{6} = defdir;
-    endif
-  else
-    outargs{1} = __file_filter__ (outargs{1});
-  endif
-
-  if (len > 1)
-    if (ischar (args{2}))
-      if (length (args{2}) > 0)
-        outargs{2} = args{2};
-      endif
-    elseif (! isempty (args{2}))
-      print_usage ();
-    endif
-  endif
-
-  if (len > 2)
-    if (ischar (args{3}))
-      [fdir, fname, fext] = fileparts (args{3});
-      if (length (fdir) > 0)
-        outargs{6} = fdir;
-      endif
-      if (length (fname) > 0 || length (fext) > 0)
-        outargs{3} = strcat (fname, fext);
-      endif
-    elseif (! isempty (args{3}))
-      print_usage ();
-    endif
-  endif
-
-  if (stridx)
-    ## we have string arguments ("position" or "multiselect")
-
-    ## check for even number of remaining arguments, prop/value pair(s)
-    if (rem (nargin - stridx + 1, 2))
-      error ("uigetfile: expecting property/value pairs");
-    endif
-
-    for i = stridx : 2 : nargin
-      prop = varargin{i};
-      val = varargin{i + 1};
-      if (strcmpi (prop, "position"))
-        if (ismatrix (val) && length (val) == 2)
-          outargs{4} = val;
-        else
-          error ("uigetfile: expecting 2-element vector for position argument");
-        endif
-      elseif (strcmpi (prop, "multiselect"))
-        if (ischar (val))
-          outargs{5} = tolower (val);
-        else
-          error ("uigetfile: expecting string argument (on/off) for multiselect");
-        endif
-      else
-        error ("uigetfile: unknown argument");
-      endif
-    endfor
-  endif
-
-  if (__octave_link_enabled__ ())
-    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
-  else
-    [retfile, retpath, retindex] = feval (funcname, outargs{:});
-  endif
-
-endfunction
-
-
-%!demo
-%! uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/uimenu.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} uimenu (@var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} uimenu (@var{h}, @var{property}, @var{value}, @dots{})
-## Create a uimenu object and return a handle to it.  If @var{h} is omitted
-## then a top-level menu for the current figure is created.  If @var{h}
-## is given then a submenu relative to @var{h} is created.
-##
-## uimenu objects have the following specific properties:
-##
-## @table @asis
-## @item @qcode{"accelerator"}
-## A string containing the key combination together with CTRL to execute this
-## menu entry (e.g., @qcode{"x"} for CTRL+x).
-##
-## @item @qcode{"callback"}
-## Is the function called when this menu entry is executed.  It can be either a
-## function string (e.g., @qcode{"myfun"}), a function handle (e.g., @@myfun)
-## or a cell array containing the function handle and arguments for the
-## callback function (e.g., @{@@myfun, arg1, arg2@}).
-##
-## @item @qcode{"checked"}
-## Can be set @qcode{"on"} or @qcode{"off"}.  Sets a mark at this menu entry.
-##
-## @item @qcode{"enable"}
-## Can be set @qcode{"on"} or @qcode{"off"}.  If disabled the menu entry
-## cannot be selected and it is grayed out.
-##
-## @item @qcode{"foregroundcolor"}
-## A color value setting the text color for this menu entry.
-##
-## @item @qcode{"label"}
-## A string containing the label for this menu entry.  A @qcode{"&"}-symbol
-## can be used to mark the @qcode{"accelerator"} character (e.g.,
-## @nospell{@qcode{"E&xit"}})
-##
-## @item @qcode{"position"}
-## An scalar value containing the relative menu position.  The entry with the
-## lowest value is at the first position starting from left or top.
-##
-## @item @qcode{"separator"}
-## Can be set @qcode{"on"} or @qcode{"off"}.  If enabled it draws a separator
-## line above the current position.  It is ignored for top level entries.
-##
-## @end table
-##
-## Examples:
-##
-## @example
-## @group
-## f = uimenu ("label", "&File", "accelerator", "f");
-## e = uimenu ("label", "&Edit", "accelerator", "e");
-## uimenu (f, "label", "Close", "accelerator", "q", ...
-##            "callback", "close (gcf)");
-## uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ...
-##            "callback", "grid (gca)");
-## @end group
-## @end example
-## @seealso{figure}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function hui = uimenu (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uimenu", varargin, {"figure", "uicontextmenu", "uimenu"});
-
-  tmp = __go_uimenu__ (h, args{:});
-
-  if (nargout > 0)
-    hui = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! surfl (peaks);
-%! colormap (copper (64));
-%! shading ('interp');
-%! f = uimenu ('label', '&File', 'accelerator', 'f');
-%! e = uimenu ('label', '&Edit', 'accelerator', 'e');
-%! uimenu (f, 'label', 'Close', 'accelerator', 'q', 'callback', 'close (gcf)');
-%! uimenu (e, 'label', 'Toggle &Grid', 'accelerator', 'g', 'callback', 'grid (gca)');
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ui = uimenu ("label", "mylabel");
-%!   assert (findobj (hf, "type", "uimenu"), ui);
-%!   assert (get (ui, "label"), "mylabel");
-%!   assert (get (ui, "checked"), "off");
-%!   assert (get (ui, "separator"), "off");
-%!   assert (get (ui, "enable"), "on");
-%!   assert (get (ui, "position"), 9);
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
-%% check for top level menus file, edit, and help
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   uif = findall (hf, "label", "&file");
-%!   assert (ishghandle (uif));
-%!   uie = findall (hf, "label", "&edit");
-%!   assert (ishghandle (uie));
-%!   uih = findall (hf, "label", "&help");
-%!   assert (ishghandle (uih));
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   uie = findall (hf, "label", "&edit");
-%!   myui = uimenu (uie, "label", "mylabel");
-%!   assert (ancestor (myui, "uimenu", "toplevel"), uie);
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
--- a/scripts/plot/uipanel.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uipanel ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uipanel (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uipanel (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uipanel", varargin, {"figure", "uipanel", "uibuttongroup"});
-  handle = __go_uipanel__ (h, args{:});
-
-endfunction
-
--- a/scripts/plot/uipushtool.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uipushtool ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uipushtool (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uipushtool (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uipushtool", varargin, {"uitoolbar"}, 0);
-  if (isempty (h))
-    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
-    if (isempty (h))
-      h = uitoolbar ();
-    else
-      h = h(1);
-    endif
-  endif
-  handle = __go_uipushtool__ (h, args{:});
-
-endfunction
-
--- a/scripts/plot/uiputfile.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile ()
-## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt})
-## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name})
-## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name}, @var{default_file})
-## Open a GUI dialog for selecting a file.  @var{flt} contains a (list of) file
-## filter string(s) in one of the following formats:
-##
-## @table @asis
-## @item @qcode{"/path/to/filename.ext"}
-## If a filename is given the file extension is extracted and used as filter.
-## In addition the path is selected as current path and the filename is
-## selected as default file.  Example: @code{uiputfile ("myfun.m")}
-##
-## @item @qcode{"*.ext"}
-## A single file extension.
-## Example: @code{uiputfile ("*.ext")}
-##
-## @item @code{@{"*.ext", "My Description"@}}
-## A 2-column cell array containing the file extension in the 1st column and
-## a brief description in the 2nd column.
-## Example: @code{uiputfile (@{"*.ext","My Description";"*.xyz",
-## "XYZ-Format"@})}
-## @end table
-##
-## The filter string can also contain a semicolon separated list of filter
-## extensions.
-## Example: @code{uiputfile (@{"*.gif;*.png;*.jpg",
-## "Supported Picture Formats"@})}
-##
-## @var{dialog_name} can be used to customize the dialog title.
-## If @var{default_file} is given it is preselected in the GUI dialog.
-## If, in addition, a path is given it is also used as current path.
-## @seealso{uigetfile, uigetdir}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function [retfile, retpath, retindex] = uiputfile (varargin)
-
-  if (! __octave_link_enabled__ ())
-    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
-    funcname = ["__uiputfile_", defaulttoolkit, "__"];
-    functype = exist (funcname);
-    if (! __is_function__ (funcname))
-      funcname = "__uiputfile_fltk__";
-      if (! __is_function__ (funcname))
-        error ("uiputfile: fltk graphics toolkit required");
-      elseif (! strcmp (defaulttoolkit, "gnuplot"))
-        warning ("uiputfile: no implementation for toolkit '%s', using 'fltk' instead",
-               defaulttoolkit);
-      endif
-    endif
-  endif
-
-  if (nargin > 3)
-    print_usage ();
-  endif
-
-  defaultvals = {cell(0, 2),     # File Filter
-                 "Save File",    # Dialog Title
-                 "",             # Default file name
-                 [240, 120],     # Dialog Position (pixel x/y)
-                 "create",
-                 pwd};           # Default directory
-
-  outargs = cell (6, 1);
-  for i = 1 : 6
-    outargs{i} = defaultvals{i};
-  endfor
-
-  if (nargin > 0)
-    file_filter = varargin{1};
-    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
-    if (length (defdir) > 0)
-      outargs{6} = defdir;
-    endif
-  else
-    outargs{1} = __file_filter__ (outargs{1});
-  endif
-
-  if (nargin > 1)
-    if (ischar (varargin{2}))
-      outargs{2} = varargin{2};
-    elseif (! isempty (varargin{2}))
-      print_usage ();
-    endif
-  endif
-
-  if (nargin > 2)
-    if (ischar (varargin{3}))
-      [fdir, fname, fext] = fileparts (varargin{3});
-      if (! isempty (fdir))
-        outargs{6} = fdir;
-      endif
-      if (! isempty (fname) || ! isempty (fext))
-        outargs{3} = strcat (fname, fext);
-      endif
-    elseif (! isempty (varargin{3}))
-      print_usage ();
-    endif
-  endif
-
-  if (__octave_link_enabled__ ())
-    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
-  else
-    [retfile, retpath, retindex] = feval (funcname, outargs{:});
-  endif
-
-endfunction
-
-
-%!demo
-%! uiputfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/uiresume.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} uiresume (@var{h})
-## Resume program execution suspended with @code{uiwait}.  The handle @var{h}
-## must be the same as the on specified in @code{uiwait}.  If the handle
-## is invalid or there is no @code{uiwait} call pending for the figure
-## with handle @var{h}, this function does nothing.
-## @seealso{uiwait}
-## @end deftypefn
-
-## Author: goffioul
-
-function uiresume (h)
-
-  if (! isfigure (h))
-    error ("uiresume: invalid figure handle H");
-  endif
-
-  try
-    uiwait_state = get (h, "__uiwait_state__");
-    if (strcmp (uiwait_state, "active"))
-      set (h, "__uiwait_state__", "triggered");
-    endif
-  catch
-    ## Ignore exception
-  end_try_catch
-
-endfunction
-
--- a/scripts/plot/uitoggletool.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uitoggletool ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uitoggletool (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uitoggletool (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0);
-  if (isempty (h))
-    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
-    if (isempty (h))
-      h = uitoolbar ();
-    else
-      h = h(1);
-    endif
-  endif
-  handle = __go_uitoggletool__ (h, args{:});
-
-endfunction
-
--- a/scripts/plot/uitoolbar.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uitoolbar ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uitoolbar (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uitoolbar (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uitoolbar", varargin, {"figure"});
-  handle = __go_uitoolbar__ (h, args{:});
-
-endfunction
-
--- a/scripts/plot/uiwait.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} uiwait
-## @deftypefnx {Function File} {} uiwait (@var{h})
-## @deftypefnx {Function File} {} uiwait (@var{h}, @var{timeout})
-## Suspend program execution until the figure with handle @var{h} is
-## deleted or @code{uiresume} is called.  When no figure handle is specified,
-## this function uses the current figure.
-##
-## If the figure handle is invalid or there is no current figure, this
-## functions returns immediately.
-##
-## When specified, @var{timeout} defines the number of seconds to wait
-## for the figure deletion or the @code{uiresume} call.  The timeout value
-## must be at least 1.  If a smaller value is specified, a warning is issued
-## and a timeout value of 1 is used instead.  If a non-integer value is
-## specified, it is truncated towards 0.  If @var{timeout} is not specified,
-## the program execution is suspended indefinitely.
-## @seealso{uiresume, waitfor}
-## @end deftypefn
-
-## Author: goffioul
-
-function uiwait (varargin)
-
-  h = [];
-  timeout = [];
-
-  if (nargin == 0)
-    h = get (0, "currentfigure");
-  else
-    h = varargin{1};
-    if (! isfigure (h))
-      error ("uiwait: invalid figure handle H");
-    endif
-    if (nargin > 1)
-      timeout = varargin{2};
-    endif
-  endif
-
-  if (! isempty (h))
-    unwind_protect
-      try
-        addproperty ("__uiwait_state__", h, "radio", "none|{active}|triggered");
-      catch
-        if (! strcmp (get (h, "__uiwait_state__"), "none"))
-          error ("uiwait: an active uiwait call for this figure already exists");
-        endif
-        set (h, "__uiwait_state__", "active");
-      end_try_catch
-      waitfor_args = {h, "__uiwait_state__", "triggered"};
-      if (! isempty (timeout))
-        waitfor_args(end+1:end+2) = {"timeout", timeout};
-      endif
-      waitfor (waitfor_args{:});
-    unwind_protect_cleanup
-      if (ishandle (h) && isprop (h, "__uiwait_state__"))
-        set (h, "__uiwait_state__", "none");
-      endif
-    end_unwind_protect
-  endif
-
-endfunction
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__actual_axis_position__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,86 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} __actual_axis_position__ (@var{h})
+## @deftypefnx {Function File} {} __actual_axis_position__ (@var{axis_struct})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott
+
+function pos = __actual_axis_position__ (h)
+
+  if (ishandle (h))
+    axis_obj = get (h);
+  elseif (isstruct (h))
+    axis_obj = h;
+    h = axis_obj.__cbar_hax__;
+  endif
+
+  ## Get figure size in pixels
+  orig_fig_units = get (axis_obj.parent, "units");
+  orig_fig_position = get (axis_obj.parent, "position");
+  unwind_protect
+    set (axis_obj.parent, "units", "pixels");
+    fig_position = get (axis_obj.parent, "position");
+  unwind_protect_cleanup
+    set (axis_obj.parent, "units", orig_fig_units);
+    set (axis_obj.parent, "position", orig_fig_position);
+  end_unwind_protect
+  ## Get axes size in pixels
+  if (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
+      && strcmp (axis_obj.activepositionproperty, "outerposition"))
+    pos_in_pixels = axis_obj.outerposition .* fig_position([3, 4, 3, 4]);
+  else
+    pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]);
+  endif
+
+  nd = __calc_dimensions__ (h);
+
+  if (strcmp (axis_obj.plotboxaspectratiomode, "manual")
+      || strcmp (axis_obj.dataaspectratiomode, "manual"))
+    ## When using {rltb}margin, Gnuplot does not handle the specified
+    ## aspect ratio properly, so handle it here.
+    if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
+      aspect_ratio_2d = axis_obj.plotboxaspectratio(1:2);
+    else
+      ## FIXME: This works for "axis square", but has not been
+      ##        thoroughly tested for other aspect ratios.
+      aspect_ratio_2d = [max(axis_obj.plotboxaspectratio(1:2)), ...
+                             axis_obj.plotboxaspectratio(3)/sqrt(2)];
+    endif
+    orig_aspect_ratio_2d = pos_in_pixels(3:4);
+    rel_aspect_ratio_2d =  aspect_ratio_2d ./ orig_aspect_ratio_2d;
+    rel_aspect_ratio_2d = rel_aspect_ratio_2d ./ max (rel_aspect_ratio_2d);
+    if (rel_aspect_ratio_2d(1) < rel_aspect_ratio_2d(2));
+      dx = (1.0 - rel_aspect_ratio_2d(1)) * pos_in_pixels(3);
+      pos_in_pixels = pos_in_pixels + dx*[0.5, 0.0, -1.0, 0.0];
+    elseif (rel_aspect_ratio_2d(1) > rel_aspect_ratio_2d(2))
+      dy = (1.0 - rel_aspect_ratio_2d(2)) * pos_in_pixels(4);
+      pos_in_pixels = pos_in_pixels + dy*[0.0, 0.5, 0.0, -1.0];
+    endif
+    pos = pos_in_pixels ./ fig_position([3, 4, 3, 4]);
+  elseif (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
+          && strcmp (axis_obj.activepositionproperty, "outerposition"))
+    pos = axis_obj.outerposition;
+  else
+    pos = axis_obj.position;
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__default_plot_options__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,35 @@
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{options} =} __default_plot_options__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function options = __default_plot_options__ ()
+
+  options.key = "";
+  options.color = [];
+  options.linestyle = [];
+  options.marker = [];
+  options.errorstyle = [];
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__gnuplot_drawnow__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,410 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __gnuplot_drawnow__ (@var{h}, @var{term}, @var{file}, @var{mono}, @var{debug_file})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function __gnuplot_drawnow__ (h, term, file, mono = false, debug_file)
+
+  if (nargin < 1 || nargin > 5 || nargin == 2)
+    print_usage ();
+  endif
+
+  if (nargin >= 3 && nargin <= 5)
+    ## Produce various output formats, or redirect gnuplot stream to a
+    ## debug file.
+    plot_stream = [];
+    fid = [];
+    default_plot_stream = get (h, "__plot_stream__");
+    unwind_protect
+      plot_stream = __gnuplot_open_stream__ (2, h);
+      gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream);
+      if (gnuplot_supports_term)
+        enhanced = gnuplot_set_term (plot_stream(1), true, h, term, file);
+        __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
+        if (nargin == 5)
+          fid = fopen (debug_file, "wb");
+          enhanced = gnuplot_set_term (fid, true, h, term, file);
+          __go_draw_figure__ (h, fid, enhanced, mono);
+        endif
+      else
+        error ('__gnuplot_drawnow__: the gnuplot terminal, "%s", is not available',
+               gnuplot_trim_term (term));
+      endif
+    unwind_protect_cleanup
+      set (h, "__plot_stream__", default_plot_stream);
+      if (! isempty (plot_stream))
+        pclose (plot_stream(1));
+        if (numel (plot_stream) > 1)
+          pclose (plot_stream(2));
+        endif
+        if (numel (plot_stream) > 2)
+          waitpid (plot_stream(3));
+        endif
+      endif
+      if (! isempty (fid))
+        fclose (fid);
+      endif
+    end_unwind_protect
+  else  # nargin == 1
+    ##  Graphics terminal for display.
+    plot_stream = get (h, "__plot_stream__");
+    if (isempty (plot_stream))
+      plot_stream = __gnuplot_open_stream__ (2, h);
+      new_stream = true;
+    else
+      new_stream = false;
+    endif
+    term = gnuplot_default_term (plot_stream);
+    if (strcmp (term, "dumb"))
+      ## popen2 eats stdout of gnuplot, use temporary file instead
+      dumb_tmp_file = tmpnam ();
+      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h,
+                                   term, dumb_tmp_file);
+    else
+      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h, term);
+    endif
+    __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
+    fflush (plot_stream(1));
+    if (strcmp (term, "dumb"))
+      fid = -1;
+      while (fid < 0)
+        pause (0.1);
+        fid = fopen (dumb_tmp_file, 'r');
+      endwhile
+      ## reprint the plot on screen
+      [a, count] = fscanf (fid, '%c', Inf);
+      fclose (fid);
+      if (count > 0)
+        if (a(1) == 12)
+          a = a(2:end);  # avoid ^L at the beginning
+        endif
+        puts (a);
+      endif
+      unlink (dumb_tmp_file);
+    endif
+  endif
+
+endfunction
+
+function enhanced = gnuplot_set_term (plot_stream, new_stream, h, term, file)
+  ## Generate the gnuplot "set terminal <term> ..." command.
+  ## When "term" originates from print.m, it may include other options.
+  if (nargin < 4)
+    ## This supports the gnuplot graphics toolkit.
+    term = gnuplot_default_term (plot_stream);
+    opts_str = "";
+  else
+    ## Get the one word terminal id and save the remaining as options to be
+    ## passed on to gnuplot.  The terminal may respect the graphics toolkit.
+    [term, opts_str] = gnuplot_trim_term (term);
+    term = lower (term);
+    if (strcmp (term, "lua"))
+      ## Replace "lua tikz" with just "tikz"
+      term = "tikz";
+      opts_str = strrep (opts_str, "tikz", "");
+    endif
+  endif
+
+  if (strfind (opts_str, "noenhanced"))
+    enhanced = false;
+  else
+    enhanced = gnuplot_is_enhanced_term (plot_stream, term);
+  endif
+
+  ## Set the terminal.
+  if (! isempty (term))
+
+    if (enhanced)
+      enh_str = "enhanced";
+    else
+      enh_str = "";
+    endif
+
+    if (! isempty (h) && isfigure (h))
+
+      ## Generate gnuplot title string for plot windows.
+      if (output_to_screen (term) && ! strcmp (term, "dumb"))
+        fig.numbertitle = get (h, "numbertitle");
+        fig.name = strrep (get (h, "name"), '"', '\"');
+        if (strcmp (get (h, "numbertitle"), "on"))
+          title_str = sprintf ("Figure %d", h);
+        else
+          title_str = "";
+        endif
+        if (! isempty (fig.name) && ! isempty (title_str))
+          title_str = sprintf ("%s: %s", title_str, fig.name);
+        elseif (! isempty (fig.name) && isempty (title_str))
+          title_str = fig.name;
+        endif
+        if (! isempty (title_str))
+          title_str = sprintf ('title "%s"', title_str);
+        endif
+        if (strcmp (term, "aqua"))
+          ## Adjust axes-label and tick-label spacing.
+          opts_str = sprintf ('%s font "%s,%d"', opts_str,
+                              get (0, "defaultaxesfontname"),
+                              get (0, "defaultaxesfontsize") / 1.5);
+        endif
+      else
+        title_str = "";
+      endif
+
+      if (! (any (strfind (opts_str, " size ") > 0)
+          || any (strfind (opts_str, "size ") == 1)))
+        ## Get figure size in pixels.  Rely on listener to handle coversion.
+        units = get (h, "units");
+        unwind_protect
+          set (h, "units", "pixels");
+          position_in_pixels = get (h, "position");
+        unwind_protect_cleanup
+          set (h, "units", units);
+        end_unwind_protect
+        gnuplot_pos = position_in_pixels(1:2);
+        gnuplot_size = position_in_pixels(3:4);
+        if (! (output_to_screen (term)
+               || any (strcmp (term, {"canvas", "emf", "gif", "jpeg", ...
+                                      "pbm", "png", "pngcairo", "svg"}))))
+          ## Convert to inches
+          gnuplot_pos = gnuplot_pos / 72;
+          gnuplot_size = gnuplot_size / 72;
+        endif
+        if (all (gnuplot_size > 0))
+          terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
+                                 "gif", "jpeg", "latex", "pbm", "pdf", ...
+                                 "pdfcairo", "postscript", "png", ...
+                                 "pngcairo", "pstex", "pslatex", "svg", "tikz"};
+          if (__gnuplot_has_feature__ ("windows_figure_position"))
+            terminals_with_size{end+1} = "windows";
+          endif
+          if (__gnuplot_has_feature__ ("x11_figure_position"))
+            terminals_with_size{end+1} = "x11";
+          endif
+          if (__gnuplot_has_feature__ ("wxt_figure_size"))
+            terminals_with_size{end+1} = "wxt";
+          endif
+          switch (term)
+            case terminals_with_size
+              size_str = sprintf ("size %.12g,%.12g", gnuplot_size);
+            case "tikz"
+              size_str = sprintf ("size %gin,%gin", gnuplot_size);
+            case "dumb"
+              new_stream = 1;
+              if (!isempty (getenv ("COLUMNS")) && !isempty (getenv ("LINES")))
+                ## Let dumb use full text screen size (minus prompt lines).
+                n = sprintf ("%i", -2 - length (find (sprintf ("%s", PS1) == "\n")));
+                ## n = the number of times \n appears in PS1
+                size_str = ["size " getenv("COLUMNS") "," getenv("LINES") n];
+              else
+                ## Use the gnuplot default.
+                size_str = "";
+              endif
+            case {"aqua", "fig", "corel"}
+              size_str = sprintf ("size %g %g", gnuplot_size);
+            case "dxf"
+              size_str = "";
+            otherwise
+              size_str = "";
+          endswitch
+          if ((strcmp (term, "x11")
+               && __gnuplot_has_feature__ ("x11_figure_position"))
+              || (strcmpi (term, "windows")
+                  && __gnuplot_has_feature__ ("windows_figure_position")))
+            ## X11/Windows allows the window to be positioned as well.
+            units = get (0, "units");
+            unwind_protect
+              set (0, "units", "pixels");
+              screen_size = get (0, "screensize")(3:4);
+            unwind_protect_cleanup
+              set (0, "units", units);
+            end_unwind_protect
+            if (all (screen_size > 0))
+              ## For X11/Windows, set the figure positon as well as the size
+              ## gnuplot position is UL, Octave's is LL (same for screen/window)
+              gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2);
+              gnuplot_pos = max (gnuplot_pos, 1);
+              size_str = sprintf ("%s position %d,%d", size_str,
+                                  gnuplot_pos(1), gnuplot_pos(2));
+            endif
+          endif
+        else
+          size_str = "";
+          warning ("gnuplot_set_term: size is zero");
+        endif
+      else
+        ## A specified size take priority over the figure properies.
+        size_str = "";
+      endif
+    else
+      if (isempty (h))
+        disp ("gnuplot_set_term: figure handle is empty");
+      elseif (! isfigure (h))
+        disp ("gnuplot_set_term: not a figure handle");
+      endif
+      title_str = "";
+      size_str = "";
+    endif
+
+    ## Set the gnuplot terminal (type, enhanced, title, options & size).
+    term_str = ["set terminal " term];
+    if (! isempty (enh_str))
+      term_str = [term_str " " enh_str];
+    endif
+    if (! isempty (title_str))
+      term_str = [term_str " " title_str];
+    endif
+    if (isempty (strfind (term, "corel")))
+      if (! isempty (size_str) && new_stream)
+        ## size_str comes after other options to permit specification of
+        ## the canvas size for terminals cdr/corel.
+        term_str = [term_str " " size_str];
+      endif
+      if (nargin > 3 && ischar (opts_str))
+        ## Options must go last.
+        term_str = [term_str " " opts_str];
+      endif
+    else
+      if (nargin > 3 && ischar (opts_str))
+        ## Options must go last.
+        term_str = [term_str " " opts_str];
+      endif
+      if (! isempty (size_str) && new_stream)
+        ## size_str comes after other options to permit specification of
+        ## the canvas size for terminals cdr/corel.
+        term_str = [term_str " " size_str];
+      endif
+    endif
+    if (! __gnuplot_has_feature__ ("has_termoption_dashed"))
+      ## If "set termoption dashed" isn't available add "dashed" option
+      ## to the "set terminal ..." command, if it is supported.
+      if (any (strcmp (term, {"aqua", "cgm", "eepic", "emf", "epslatex", ...
+                              "fig", "pcl5", "mp", "next", "openstep", "pdf", ...
+                              "pdfcairo", "pngcairo", "postscript", ...
+                              "pslatex", "pstext", "svg", "tgif", "x11"})))
+        term_str = [term_str " dashed"];
+      endif
+    endif
+    if (any (strcmp (term, {"aqua", "wxt"})))
+      term_str = [term_str, " ", "dashlength 1"];
+    elseif (any (strcmp (term, {"epslatex", "postscript", "pslatex"})))
+      term_str = [term_str, " ", "dashlength 2"];
+    endif
+
+    ## Work around the gnuplot feature of growing the x11 window and
+    ## flickering window (x11, windows, & wxt) when the mouse and
+    ## multiplot are set in gnuplot.
+    fputs (plot_stream, "unset multiplot;\n");
+    flickering_terms = {"x11", "windows", "wxt", "dumb"};
+    if (! any (strcmp (term, flickering_terms))
+        || have_non_legend_axes (h)
+        || numel (findall (h, "type", "image")) > 0)
+      fprintf (plot_stream, "%s\n", term_str);
+      if (nargin == 5)
+        if (! isempty (file))
+          fprintf (plot_stream, "set output '%s';\n", file);
+        endif
+      endif
+      fputs (plot_stream, "set multiplot;\n");
+    elseif (any (strcmp (term, flickering_terms)))
+      fprintf (plot_stream, "%s\n", term_str);
+      if (nargin == 5)
+        if (! isempty (file))
+          fprintf (plot_stream, "set output '%s';\n", file);
+        endif
+      endif
+    endif
+    if (__gnuplot_has_feature__ ("has_termoption_dashed"))
+      fprintf (plot_stream, "set termoption dashed\n")
+    endif
+  else
+    ## gnuplot will pick up the GNUTERM environment variable itself
+    ## so no need to set the terminal type if not also setting the
+    ## figure title, enhanced mode, or position.
+  endif
+
+endfunction
+
+function term = gnuplot_default_term (plot_stream)
+  term = lower (getenv ("GNUTERM"));
+  ## If not specified, guess the terminal type.
+  if (isempty (term) || ! __gnuplot_has_terminal__ (term, plot_stream))
+    if (isguirunning () && __gnuplot_has_terminal__ ("qt", plot_stream))
+      term = "qt";
+    elseif (ismac ())
+      term = "aqua";
+    elseif (! isunix ())
+      term = "windows";
+    elseif (! isempty (getenv ("DISPLAY")))
+      term = "x11";
+    else
+      term = "dumb";
+    endif
+  endif
+endfunction
+
+function [term, opts] = gnuplot_trim_term (string)
+  ## Extract the terminal type and terminal options (from print.m)
+  string = strtrim (string);
+  [term, opts] = strtok (string, ' ');
+  if (! isempty (opts))
+    opts(1) = "";  # trim extra space from strtok
+  endif
+endfunction
+
+function have_enhanced = gnuplot_is_enhanced_term (plot_stream, term)
+  ## Don't include pstex, pslatex or epslatex here as the TeX commands
+  ## should not be interpreted in that case.
+  persistent enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", ...
+                                   "jpeg", "pdf", "pdfcairo", "pm", "png", ...
+                                   "pngcairo", "postscript", "qt", "svg",  ...
+                                   "windows", "wxt", "x11"};
+
+  if (nargin < 2)
+    ## Determine the default gnuplot terminal.
+    term = gnuplot_default_term (plot_stream);
+  endif
+  have_enhanced = any (strcmp (term, enhanced_terminals));
+endfunction
+
+function ret = output_to_screen (term)
+  ret = any (strcmpi (term, 
+                     {"aqua", "dumb", "pm", "qt", "windows", "wxt", "x11"}));
+endfunction
+
+function retval = have_non_legend_axes (h)
+  retval = false;
+  all_axes = findall (h, "type", "axes");
+  if (! isempty (all_axes))
+    n_all_axes = numel (all_axes);
+    all_axes_tags = get (all_axes, "tag");
+    legend_axes = strcmp (all_axes_tags, "legend");
+    if (! isempty (legend_axes))
+      n_legend_axes = sum (legend_axes);
+      retval = (n_all_axes - n_legend_axes) > 1;
+    endif
+  endif
+endfunction
+
+
+## No test needed for internal helper function.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__next_line_color__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,54 @@
+## Copyright (C) 2013 Carl Osterwisch
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{rgb} =} __next_line_color__ (@var{reset})
+## Undocumented internal function.
+## @end deftypefn
+
+## Return the next line color in the rotation.
+
+## Author: Carl Osterwisch
+## Author: jwe
+
+function rgb = __next_line_color__ (reset)
+
+  persistent reset_colors = true;
+
+  if (nargin == 1)
+    ## Indicates whether the next call will increment or not
+    reset_colors = reset;
+  else
+    ## Find and return the next line color
+    ca = gca ();
+    colororder = get (ca, "colororder");
+    if (reset_colors)
+      color_index = 1;
+      reset_colors = false;
+    else
+      ## Executed when "hold all" is active
+      n_kids = length (get (ca, "children"));
+      n_colors = rows (colororder);
+      color_index = mod (n_kids, n_colors) + 1;
+    endif
+    rgb = colororder(color_index,:);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__next_line_style__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,58 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{style} =} __next_line_style__ (@var{reset})
+## Undocumented internal function.
+## @end deftypefn
+
+## Return the next line style in the rotation.
+
+
+function [linestyle, marker] = __next_line_style__ (reset)
+
+  persistent reset_style = true;
+
+  if (nargin == 1)
+    ## Indicates whether the next call will increment or not
+    reset_style = reset;
+  else
+    ## Find and return the next line style
+    ca = gca ();
+    style_rotation = get (ca, "linestyleorder");
+    if (ischar (style_rotation))
+      style_rotation = strsplit (style_rotation, "|");
+    endif
+    nStyles = length (style_rotation);
+    if (reset_style || (nStyles < 2))
+      style_index = 1;
+      reset_style = false;
+    else
+      ## Executed when "hold all" is active
+      nChildren = length (get (ca, "Children"));
+      nColors = rows (get (ca, "ColorOrder"));
+      style_index = mod (floor (nChildren/nColors), nStyles) + 1;
+    endif
+    options = __pltopt__ ("__next_line_style__",
+                          style_rotation(style_index));
+    linestyle = options.linestyle;
+    marker = options.marker;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__plt_get_axis_arg__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,67 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{h}, @var{varargin}, @var{narg}] =} __plt_get_axis_arg__ (@var{caller}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin)
+
+  h = [];
+  parent = find (strcmpi (varargin, "parent"), 1);
+  
+
+  ## Look for a scalar which is a graphics handle but not the
+  ## Root Figure (0) or an ordinary figure (integer).
+  if (numel (varargin) > 0 && numel (varargin{1}) == 1
+      && ishandle (varargin{1}) && varargin{1} != 0 && ! isfigure (varargin{1}))
+    htmp = varargin{1};
+    if (! isaxes (htmp))
+      error ("%s: expecting first argument to be axes handle", caller);
+    endif
+    if (! strcmp (get (htmp, "tag"), "legend"))
+      h = htmp;
+      varargin(1) = [];
+    endif
+  ## Look for "parent"/axis prop/value pair
+  elseif (numel (varargin) > 1 && ! isempty (parent))
+    if (parent < numel (varargin) && ishandle (varargin{parent+1}))
+      htmp = varargin{parent+1};
+      if (isaxes (htmp) && ! strcmp (get (htmp, "tag"), "legend"))
+        h = htmp;
+        varargin(parent:parent+1) = [];
+      else
+        ## 'parent' property for some other type like hggroup
+        h = ancestor (htmp, "axes");
+      endif
+    else
+      error ("%s: expecting parent value to be axes handle", caller);
+    endif
+  endif
+
+  narg = length (varargin);
+
+endfunction
+
+
+## No test needed for internal helper function.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__pltopt__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,235 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
+## Undocumented internal function.
+## @end deftypefn
+
+## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
+##
+## Decode plot option strings.
+##
+## @var{opt} can currently be some combination of the following:
+##
+## @table @code
+## @item "-"
+## For solid linestyle (default).
+##
+## @item "--"
+## For dashed line style.
+##
+## @item "-."
+## For linespoints plot style.
+##
+## @item ":"
+## For dots plot style.
+##
+## @item "r"
+## Red line color.
+##
+## @item "g"
+## Green line color.
+##
+## @item "b"
+## Blue line color.
+##
+## @item "c"
+## Cyan line color.
+##
+## @item "m"
+## Magenta line color.
+##
+## @item "y"
+## Yellow line color.
+##
+## @item "k"
+## Black line color.
+##
+## @item "w"
+## White line color.
+##
+## @item ";title;"
+## Here @code{"title"} is the label for the key.
+##
+## @item "+"
+## @itemx "o"
+## @itemx "*"
+## @itemx "."
+## @itemx "x"
+## @itemx "s"
+## @itemx "d"
+## @itemx "^"
+## @itemx "v"
+## @itemx ">"
+## @itemx "<"
+## @itemx "p"
+## @itemx "h"
+## Used in combination with the points or linespoints styles, set the point
+## style.
+## @end table
+##
+## The legend may be fixed to include the name of the variable
+## plotted in some future version of Octave.
+
+## Author: jwe
+
+function [options, valid] = __pltopt__ (caller, opt, err_on_invalid = true)
+
+  options = __default_plot_options__ ();
+  valid = true;
+
+  if (ischar (opt))
+    opt = cellstr (opt);
+  elseif (! iscellstr (opt))
+    error ("__pltopt__: argument must be a character string or cell array of character strings");
+  endif
+
+  nel = numel (opt);
+
+  for i = nel:-1:1
+    [options(i), valid] = __pltopt1__ (caller, opt{i}, err_on_invalid);
+    if (! err_on_invalid && ! valid)
+      return;
+    endif
+  endfor
+
+endfunction
+
+## Really decode plot option strings.
+
+## Author: Rick Niles <niles@axp745.gsfc.nasa.gov>
+## Adapted-By: jwe
+## Maintainer: jwe
+
+function [options, valid] = __pltopt1__ (caller, opt, err_on_invalid)
+
+  options = __default_plot_options__ ();
+  valid = true;
+
+  have_linestyle = false;
+  have_marker = false;
+
+  ## If called by __errplot__, extract the linestyle before proceeding.
+  if (strcmp (caller, "__errplot__"))
+    if (strncmp (opt, "#~>", 3))
+      n = 3;
+    elseif (strncmp (opt, "#~", 2) || strncmp (opt, "~>", 2))
+      n = 2;
+    elseif (strncmp (opt, "~", 1) || strncmp (opt, ">", 1)
+            || strncmp (opt, "#", 1))
+      n = 1;
+    else
+      n = 0;
+    endif
+    options.errorstyle = opt(1:n);
+    opt(1:n) = [];
+  else
+    options.errorstyle = "~";
+  endif
+
+  while (! isempty (opt))
+    if (strncmp (opt, "--", 2) || strncmp (opt, "-.", 2))
+      options.linestyle = opt(1:2);
+      have_linestyle = true;
+      n = 2;
+    else
+      topt = opt(1);
+      n = 1;
+      if (topt == "-" || topt == ":")
+        have_linestyle = true;
+        options.linestyle = topt;
+      elseif (topt == "+" || topt == "o" || topt == "*"
+              || topt == "." || topt == "x" || topt == "s"
+              || topt == "d" || topt == "^" || topt == "v"
+              || topt == ">" || topt == "<" || topt == "p"
+              || topt == "h" || topt == "@")
+        have_marker = true;
+        ## Check for long form marker styles
+        if (any (topt == "sdhp"))
+          if (strncmp (opt, "square", 6))
+            n = 6;
+          elseif (strncmp (opt, "diamond", 7))
+            n = 7;
+          elseif (strncmp (opt, "hexagram", 8))
+            n = 8;
+          elseif (strncmp (opt, "pentagram", 9))
+            n = 9;
+          endif
+        endif
+        ## Backward compatibility.  Leave undocumented.
+        if (topt == "@")
+          topt = "+";
+        endif
+        options.marker = topt;
+      ## Numeric color specs are for backward compatibility.  Don't document.
+      elseif (topt == "k" || topt == "0")
+        options.color = [0, 0, 0];
+      elseif (topt == "r" || topt == "1")
+        options.color = [1, 0, 0];
+      elseif (topt == "g" || topt == "2")
+        options.color = [0, 1, 0];
+      elseif (topt == "b" || topt == "3")
+        options.color = [0, 0, 1];
+      elseif (topt == "y")
+        options.color = [1, 1, 0];
+      elseif (topt == "m" || topt == "4")
+        options.color = [1, 0, 1];
+      elseif (topt == "c" || topt == "5")
+        options.color = [0, 1, 1];
+      elseif (topt == "w" || topt == "6")
+        options.color = [1, 1, 1];
+      elseif (isspace (topt))
+        ## Do nothing.
+      elseif (topt == ";")
+        t = index (opt(2:end), ";");
+        if (t)
+          options.key = opt(2:t);
+          n = t+1;
+        else
+          if (err_on_invalid)
+            error ("%s: unfinished key label", caller);
+          else
+            valid = false;
+            options = __default_plot_options__ ();
+            return;
+          endif
+        endif
+      else
+        if (err_on_invalid)
+          error ("%s: unrecognized format character: '%s'", caller, topt);
+        else
+          valid = false;
+          options = __default_plot_options__ ();
+          return;
+        endif
+      endif
+    endif
+    opt(1:n) = [];
+  endwhile
+
+  if (! have_linestyle && have_marker)
+    options.linestyle = "none";
+  endif
+
+  if (have_linestyle && ! have_marker)
+    options.marker = "none";
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/allchild.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,64 @@
+## Copyright (C) 2008-2012 Bill Denney
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} allchild (@var{handles})
+## Find all children, including hidden children, of a graphics object.
+##
+## This function is similar to @code{get (h, "children")}, but also returns
+## hidden objects (HandleVisibility = @qcode{"off"}).  If @var{handles} is a
+## scalar, @var{h} will be a vector.  Otherwise, @var{h} will be a cell
+## matrix of the same size as @var{handles} and each cell will contain a
+## vector of handles.
+## @seealso{findall, findobj, get, set}
+## @end deftypefn
+
+## Author: Bill Denney <bill@denney.ws>
+
+function h = allchild (handles)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  shh = get (0, "showhiddenhandles");
+  unwind_protect
+    set (0, "showhiddenhandles", "on");
+    h = get (handles, "children");
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", shh);
+  end_unwind_protect
+
+endfunction
+
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   kids = allchild (hf);
+%!   assert (get (kids, "type"), {"axes"; "uimenu"; "uimenu"; "uimenu"});
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!error allchild ()
+%!error allchild (1, 2)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ancestor.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,116 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{parent} =} ancestor (@var{h}, @var{type})
+## @deftypefnx {Function File} {@var{parent} =} ancestor (@var{h}, @var{type}, "toplevel")
+## Return the first ancestor of handle object @var{h} whose type matches
+## @var{type}, where @var{type} is a character string.  If @var{type} is a
+## cell array of strings, return the first parent whose type matches
+## any of the given type strings.
+##
+## If the handle object @var{h} itself is of type @var{type}, return @var{h}.
+##
+## If @qcode{"toplevel"} is given as a third argument, return the highest
+## parent in the object hierarchy that matches the condition, instead
+## of the first (nearest) one.
+## @seealso{findobj, findall, allchild}
+## @end deftypefn
+
+function p = ancestor (h, type, toplevel)
+
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (ischar (type))
+    type = { type };
+  elseif (! iscellstr (type))
+    error ("ancestor: TYPE must be a string or cell array of strings");
+  endif
+
+  find_first = true;
+  if (nargin == 3)
+    if (ischar (toplevel) && strcmpi (toplevel, "toplevel"))
+      find_first = false;
+    else
+      error ('ancestor: third argument must be "toplevel"');
+    endif
+  endif
+
+  if (isempty (h))
+    p = [];
+  else
+    p = cell (numel (h), 1);
+    h = num2cell (h);
+    for nh = 1:numel (h)
+      while (true)
+        if (isempty (h{nh}) || ! ishandle (h{nh}))
+          break;
+        endif
+        if (any (strcmpi (get (h{nh}, "type"), type)))
+          p{nh} = h{nh};
+          if (find_first)
+            break;
+          endif
+        endif
+        h{nh} = get (h{nh}, "parent");
+      endwhile
+    endfor
+    if (nh == 1)
+      p = p{1};
+    endif
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hl = line;
+%!   assert (ancestor (hl, "axes"), gca);
+%!   assert (ancestor (hl, "figure"), hf);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!    hg1 = hggroup ("parent", gca);
+%!    hg2 = hggroup ("parent", hg1);
+%!    hl = line ("parent", hg2);
+%!    assert (ancestor (hl, "line"), hl);
+%!    assert (ancestor (hl, "axes"), gca);
+%!    assert (ancestor (hl, "figure"), hf);
+%!    assert (ancestor (hl, "hggroup"), hg2);
+%!    assert (ancestor (hl, "hggroup", "toplevel"), hg1);
+%!    assert (ancestor (hl, {"hggroup", "axes"}), hg2);
+%!    assert (ancestor (hl, {"hggroup", "axes"}, "toplevel"), gca);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!assert (ancestor ([], "axes"), [])
+
+%!error ancestor ()
+%!error ancestor (1,2,3)
+%!error <TYPE must be a string> ancestor (1,2)
+%!error <third argument must be "toplevel"> ancestor (1, "axes", "foo")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/axes.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,82 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} axes ()
+## @deftypefnx {Function File} {} axes (@var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} axes (@var{hax})
+## @deftypefnx {Function File} {@var{h} =} axes (@dots{})
+## Create an axes object and return a handle to it, or set the current
+## axes to @var{hax}.
+##
+## Called without any arguments, or with @var{property}/@var{value} pairs,
+## construct a new axes.  For accepted properties and corresponding
+## values, @pxref{XREFset,,set}.
+##
+## Called with a single axes handle argument @var{hax}, the function makes
+## @var{hax} the current axis.  It also restacks the axes in the
+## corresponding figure so that @var{hax} is the first entry in the list
+## of children.  This causes @var{hax} to be displayed on top of any other
+## axes objects (Z-order stacking).
+## 
+## @seealso {gca, set, get}
+## @end deftypefn
+
+## Author: jwe
+
+function h = axes (varargin)
+
+  if (nargin == 0 || nargin > 1)
+    ## Create an axes object.
+    idx = find (strcmpi (varargin(1:2:end), "parent"), 1, "first");
+    if (! isempty (idx) && length (varargin) >= 2*idx)
+      cf = varargin{2*idx};
+      varargin([2*idx-1, 2*idx]) = [];
+    else
+      cf = gcf ();
+    endif
+    htmp = __go_axes__ (cf, varargin{:});
+    if (__is_handle_visible__ (htmp))
+      set (ancestor (cf, "figure"), "currentaxes", htmp);
+    endif
+  else
+    ## ARG is axes handle.
+    htmp = varargin{1};
+    if (isscalar (htmp) && isaxes (htmp))
+      if (__is_handle_visible__ (htmp))
+        parent = ancestor (htmp, "figure");
+        set (0, "currentfigure", parent);
+        set (parent, "currentaxes", htmp);
+
+        ## restack
+        ch = get (parent, "children")(:);
+        idx = (ch == htmp);
+        ch = [ch(idx); ch(!idx)];
+        set (parent, "children", ch);
+      endif
+    else
+      error ("axes: H must be a scalar axes handle");
+    endif
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/cla.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,108 @@
+## Copyright (C) 2008-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} cla
+## @deftypefnx {Command} {} cla reset
+## @deftypefnx {Function File} {} cla (@var{hax})
+## @deftypefnx {Function File} {} cla (@var{hax}, "reset")
+## Clear the current axes.
+##
+## @code{cla} operates by deleting child graphic objects with visible
+## handles (HandleVisibility = @qcode{"on"}).
+##
+## If the optional argument @qcode{"reset"} is specified, delete all child
+## objects including those with hidden handles and reset all axis properties
+## to their defaults.  However, the following properties are not reset:
+## Position, Units.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{clf, delete, reset}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2008-10-03
+
+function cla (varargin)
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 0)
+    hax = gca;
+    do_reset = false;
+  elseif (nargin == 1)
+    if (isscalar (varargin{1}) && isaxes (varargin{1}))
+      hax = varargin{1};
+      do_reset = false;
+    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
+      hax = gca;
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  else
+    if (isscalar (varargin{1}) && isaxes (varargin{1})
+        && ischar (varargin{2}) && strcmpi (varargin{2}, "reset"))
+      hax = varargin{1};
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  endif
+
+  if (! do_reset)
+    delete (get (hax, "children"));
+  else
+    __go_axes_init__ (hax, "replace");
+    __request_drawnow__ ();
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot (1:10);
+%!   assert (! isempty (get (gca, "children")));
+%!   cla ();
+%!   assert (isempty (get (gca, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax = gca;
+%!   plot (hax, 1:10);
+%!   set (hax, "interpreter", "tex");
+%!   cla (hax);
+%!   kids = get (hax, "children");
+%!   assert (numel (kids), 0);
+%!   assert (get (hax, "interpreter"), "tex");
+%!   plot (hax, 1:10);
+%!   cla (hax, "reset");
+%!   kids = get (hax, "children");
+%!   assert (numel (kids), 0);
+%!   assert (get (hax, "interpreter"), "none");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/clf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,124 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} clf
+## @deftypefnx {Command} {} clf reset
+## @deftypefnx {Function File} {} clf (@var{hfig})
+## @deftypefnx {Function File} {} clf (@var{hfig}, "reset")
+## @deftypefnx {Function File} {@var{h} =} clf (@dots{})
+## Clear the current figure window.
+## 
+## @code{clf} operates by deleting child graphics objects with visible
+## handles (HandleVisibility = @qcode{"on"}).
+##
+## If the optional argument @qcode{"reset"} is specified, delete all child
+## objects including those with hidden handles and reset all figure
+## properties to their defaults.  However, the following properties are not
+## reset: Position, Units, PaperPosition, PaperUnits.
+##
+## If the first argument @var{hfig} is a figure handle, then operate on
+## this figure rather than the current figure returned by @code{gcf}.
+## 
+## The optional return value @var{h} is the graphics handle of the figure
+## window that was cleared.
+## @seealso{cla, close, delete, reset}
+## @end deftypefn
+
+## Author: jwe
+
+function h = clf (varargin)
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 0)
+    hfig = gcf;
+    do_reset = false;
+  elseif (nargin == 1)
+    if (isscalar (varargin{1}) && isfigure (varargin{1}))
+      hfig = varargin{1};
+      do_reset = false;
+    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
+      hfig = gcf;
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  else
+    if (isscalar (varargin{1}) && isfigure (varargin{1})
+        && ischar (varargin{2}) && strcmpi (varargin{2}, "reset"))
+      hfig = varargin{1};
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  endif
+
+  if (do_reset)
+    ## Select all the children, including the one with hidden handles.
+    delete (allchild (hfig));
+    reset (hfig);
+  else
+    ## Select only the chilren with visible handles.
+    delete (get (hfig, "children"));
+  endif
+
+  if (nargout > 0)
+    h = hfig;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   assert (! isempty (get (gcf, "children")));
+%!   clf;
+%!   assert (isempty (get (gcf, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   clf;
+%!   assert (isempty (get (gcf, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!xtest
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot (1:10);
+%!   set (hf, "papertype", "tabloid");
+%!   clf (hf);
+%!   assert (isempty (get (gcf, "children")));
+%!   assert (get (hf, "papertype"), "tabloid");
+%!   plot (1:10);
+%!   clf (hf, "reset");
+%!   kids = get (hf, "children");
+%!   assert (isempty (get (gcf, "children")));
+%!   assert (get (hf, "papertype"), "usletter");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/close.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,109 @@
+## Copyright (C) 2002-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} close
+## @deftypefnx {Command} {} close (@var{h})
+## @deftypefnx {Command} {} close all
+## @deftypefnx {Command} {} close all hidden
+## Close figure window(s).
+##
+## When called with no arguments, close the current figure.  This is equivalent
+## to @code{close (gcf)}.  If the input @var{h} is a graphic handle, or vector
+## of graphics handles, then close each figure in @var{h}.
+##
+## If the argument @qcode{"all"} is given then all figures with visible handles
+## (HandleVisibility = @qcode{"on"}) are closed.
+##
+## If the argument @qcode{"all hidden"} is given then all figures, including
+## hidden ones, are closed.
+##
+## Implementation Note: @code{close} operates by calling the function specified
+## by the @qcode{"closerequestfcn"} property for each figure.  By default, the
+## function @code{closereq} is used.  It is possible that the function invoked
+## will delay or abort removing the figure.  To remove a figure without
+## executing any callback functions use @code{delete}.  When writing a callback
+## function to close a window do not use @code{close} to avoid recursion.
+##
+## @seealso{closereq, delete}
+## @end deftypefn
+
+## Author: jwe
+## 2010-05-02   PBig    allow empty argument
+
+function retval = close (arg1, arg2)
+
+  figs = [];
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 0)
+    ## Close current figure.
+    ## Can't use gcf because it opens a new plot window if one does not exist.
+    figs = get (0, "currentfigure");
+    if (figs == 0)  # don't close root figure
+      figs = [];
+    endif
+  elseif (nargin == 1)
+    if (ischar (arg1) && strcmpi (arg1, "all"))
+      figs = (get (0, "children"))';
+      figs = figs(isfigure (figs));
+    elseif (isfigure (arg1))
+      figs = arg1;
+    elseif (isempty (arg1))
+      figs = [];
+    else
+      error ('close: first argument must be "all" or a figure handle');
+    endif
+  elseif (   ischar (arg1) && strcmpi (arg1, "all")
+          && ischar (arg2) && strcmpi (arg2, "hidden"))
+    figs = (allchild (0))';
+    figs = figs(isfigure (figs));
+  else
+    error ('close: expecting argument to be "all hidden"');
+  endif
+
+  for h = figs
+    __go_execute_callback__ (h, "closerequestfcn");
+  endfor
+
+  if (nargout > 0)
+    retval = 1;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   close (hf);
+%!   objs = findobj ("type", "figure");
+%!   assert (! any (objs == hf));
+%! unwind_protect_cleanup
+%!   if (isfigure (hf))
+%!     close (hf);
+%!   endif
+%! end_unwind_protect
+
+%!error close (1,2,3)
+%!error <first argument must be "all" or a figure> close ({"all"})
+%!error <first argument must be "all" or a figure> close ("all_and_more")
+%!error <first argument must be "all" or a figure> close (-1)
+%!error <expecting argument to be "all hidden"> close "all" hid"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/closereq.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,46 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} closereq ()
+## Close the current figure and delete all graphics objects associated with it.
+##
+## By default, the @qcode{"closerequestfcn"} property of a new plot figure
+## points to this function.
+## @seealso{close, delete}
+## @end deftypefn
+
+## Author: jwe
+
+function closereq ()
+
+  if (nargin != 0)
+    print_usage ();
+  endif
+
+  cf = gcbf ();
+  if (isempty (cf))
+    warning ("closereq: calling closereq from octave prompt is not supported, use 'close' instead");
+    cf = get (0, "currentfigure");
+  endif
+  if (! isempty (cf) && isfigure (cf))
+    delete (cf);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/colstyle.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,90 @@
+## Copyright (C) 2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{style}, @var{color}, @var{marker}, @var{msg}] =} colstyle (@var{linespec})
+## Parse @var{linespec} and return the line style, color, and markers given.
+## In the case of an error, the string @var{msg} will return the text of the
+## error.
+## @end deftypefn
+
+function [l, c, m, msg] = colstyle (style)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  if (! ischar (style))
+    error ("colstyle: STYLE must be a string");
+  endif
+
+  try
+    opt = __pltopt__ ("colstyle", style);
+    l = opt.linestyle;
+    c = opt.color;
+    m = opt.marker;
+    msg = [];
+    switch (c)
+      case [0 0 0]
+        c = "k";
+      case [1 0 0]
+        c = "r";
+      case [0 1 0]
+        c = "g";
+      case [0 0 1]
+        c = "b";
+      case [1 1 0]
+        c = "y";
+      case [1 0 1]
+        c = "m";
+      case [0 1 1]
+        c = "c";
+      case [0 1 1]
+        c = "w";
+    endswitch
+  catch
+    l = c = m = [];
+    msg = lasterr ();
+  end_try_catch
+
+endfunction
+
+
+%!test
+%! [l, c, m, msg] = colstyle ("r:x");
+%! assert (isempty (msg));
+%! assert (l, ":");
+%! assert (c, "r");
+%! assert (m, "x");
+
+%!test
+%! [l, c, m, msg] = colstyle (".");
+%! assert (isempty (msg));
+%! assert (l, "none");
+%! assert (c, []);
+%! assert (m, ".");
+
+%!test
+%! [l, c, m, msg] = colstyle ("~");
+%! assert (msg, "colstyle: unrecognized format character: '~'");
+
+%% Test input validation
+%!error colstyle ()
+%!error colstyle (1, 2)
+%!error colstyle (1.5)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/copyobj.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,154 @@
+## Copyright (C) 2012 pdiribarne
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{hnew} =} copyobj (@var{horig})
+## @deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
+## Construct a copy of the graphic object associated with handle @var{horig}
+## and return a handle @var{hnew} to the new object.
+##
+## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
+## specified, the copied object will be created as a child of @var{hparent}.
+## @seealso{struct2hdl, hdl2struct, findobj}
+## @end deftypefn
+
+## Author: pdiribarne <pdiribarne@new-host.home>
+## Created: 2012-04-01
+
+function hnew = copyobj (horig, hparent = 0)
+
+  partypes = {"root", "figure", "axes", "hggroup"};
+  othertypes = {"line", "patch", "surface", "image", "text"};
+  alltypes = [partypes othertypes];
+
+  if (! ishandle (horig) || nargin > 2)
+    print_usage ();
+  elseif (! ishandle (hparent))
+    hparent = figure (fix (hparent));
+  elseif (! any (strcmpi (get (hparent).type, partypes)))
+    print_usage ();
+  endif
+
+  ## current figure and axes
+  cf = gcf ();
+  ca = gca ();
+  
+  ## compatibility of input handles
+  kididx = find (strcmp (alltypes, get (horig).type));
+  paridx = find (strcmp (alltypes, get (hparent).type));
+
+  if (kididx <= paridx)
+    error ("copyobj: %s object can't be children to %s.",
+           alltypes{kididx}, alltypes{paridx});
+  elseif (nargin == 1)
+    str = hdl2struct (horig);
+    hnew = struct2hdl (str);
+  else
+    str = hdl2struct (horig);
+    hnew = struct2hdl (str, hparent);
+  endif
+
+  ## reset current figure (and eventually axes) to original
+  set (0, "currentfigure", cf);
+  if (get (hnew, "parent") == cf)
+    set (cf, "currentaxes", ca)
+  endif
+  
+endfunction
+
+
+%!demo
+%! hdl = figure (1234);
+%! clf;
+%! hold on;
+%! x = 1:10;
+%! y = x.^2;
+%! dy = 2 * (.2 * x);
+%! y2 = (x - 3).^2;
+%! hg = errorbar (x, y, dy,'#~');
+%! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
+%! plot (x, y2, 'ok-');
+%! legend ('errorbar', 'line');
+%! hnew = copyobj (hdl);
+
+%!#demo
+%! ## FIXME: This demo fails for an obscure reason.
+%! ## It appears that there is something wrong with Octave code for patches.
+%! ## This demo must remain commented out until patch() has been reworked.
+%! unwind_protect
+%!   hdl = figure (1234);
+%!   clf;
+%!   subplot (2,2,1);
+%!   hold on;
+%!   contourf (rand (10, 10));
+%!   colorbar ();
+%!   subplot (2,2,2);
+%!   quiver (rand (10, 10), rand (10, 10));
+%!   subplot (2,2,3);
+%!   colormap (jet (64));
+%!   hold on;
+%!   sombrero ();
+%!   colorbar ('peer', gca, 'NorthOutside');
+%!   subplot (2,2,4);
+%!   imagesc (rand (30, 30));
+%!   text (15, 15, 'Rotated text', ...
+%!         'HorizontAlalignment', 'Center', 'Rotation', 30);
+%!   hnew = copyobj (hdl);
+%! unwind_protect_cleanup
+%!   close all;
+%! end_unwind_protect
+
+%!testif HAVE_MAGICK
+%! toolkit = graphics_toolkit ();
+%! graphics_toolkit ("gnuplot");
+%! unwind_protect
+%!   h1 = figure ("visible", "off");
+%!   x = 0:0.1:2*pi;
+%!   y1 = sin (x);
+%!   y2 = exp (x - 1);
+%!   ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
+%!   xlabel ("X");
+%!   ylabel (ax(1), "Axis 1");
+%!   ylabel (ax(2), "Axis 2");
+%!   axes (ax(1));
+%!   text (0.5, 0.5, "Left Axis", ...
+%!         "color", [0 0 1], "horizontalalignment", "center");
+%!   axes (ax(2));
+%!   text (4.5, 80, "Right Axis", ...
+%!         "color", [0 0.5 0], "horizontalalignment", "center");
+%!   s1 = hdl2struct (h1);
+%!   h2 = struct2hdl (s1);
+%!   s2 = hdl2struct (h2);
+%!   png1 = strcat (tmpnam (), ".png");
+%!   png2 = strcat (tmpnam (), ".png");
+%!   unwind_protect
+%!     print (h1, png1);
+%!     [img1, map1, alpha1] = imread (png1);
+%!     print (h2, png2);
+%!     [img2, map2, alpha2] = imread (png2);
+%!   unwind_protect_cleanup
+%!     unlink (png1);
+%!     unlink (png2);
+%!   end_unwind_protect
+%!   assert (img1, img2);
+%!   assert (map1, map2);
+%!   assert (alpha1, alpha2);
+%! unwind_protect_cleanup
+%!   close (h1);
+%!   close (h2);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/figure.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,127 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} figure
+## @deftypefnx {Command} {} figure @var{n}
+## @deftypefnx {Function File} {} figure (@var{n})
+## @deftypefnx {Function File} {} figure (@dots{}, "@var{property}", @var{value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} figure (@var{dots})
+## Create a new figure window for plotting.
+##
+## If no arguments are specified, a new figure with the next available number
+## is created.
+##
+## If called with an integer @var{n}, and no such numbered figure exists, then
+## a new figure with the specified number is created.  If the figure already
+## exists then it is made visible and becomes the current figure for plotting.
+## 
+## Multiple property-value pairs may be specified for the figure object, but
+## they must appear in pairs.
+##
+## The optional return value @var{h} is a graphics handle to the created figure
+## object.
+## @seealso{axes, gcf, clf, close}
+## @end deftypefn
+
+## Author: jwe, Bill Denney
+
+function h = figure (varargin)
+
+  nargs = nargin;
+
+  if (mod (nargs, 2) == 0)
+    f = NaN;
+    init_new_figure = true;
+  else
+    arg = varargin{1};
+    if (ischar (arg))
+      arg = str2double (arg);
+    endif
+    if (isfigure (arg))
+      f = arg;
+      init_new_figure = false;
+      varargin(1) = [];
+      nargs--;
+    elseif (isnumeric (arg) && isscalar (arg) && arg > 0 && arg == fix (arg))
+      f = arg;
+      init_new_figure = true;
+      varargin(1) = [];
+      nargs--;
+    else
+      error ("figure: N must be figure handle or figure number");
+    endif
+  endif
+
+  if (rem (nargs, 2) == 1)
+    error ("figure: PROPERTY/VALUE arguments must be in pairs");
+  endif
+
+  ## Check to see if we already have a figure on the screen.  If we do,
+  ## then update it if it is different from the figure we are creating
+  ## or switching to.
+  cf = get (0, "currentfigure");   # Can't use gcf () because it calls figure()
+  if (! isempty (cf) && cf != 0)
+    if (init_new_figure || cf != f)
+      drawnow ();
+    endif
+  endif
+
+  if (init_new_figure)
+    if (ismac () && strcmp (graphics_toolkit (), "fltk"))
+      ## FIXME: Hack for fltk-aqua to work around bug #31931
+      f = __go_figure__ (f);
+      drawnow ();
+      if (! isempty (varargin))
+        set (f, varargin{:});
+      endif
+    else
+      f = __go_figure__ (f, varargin{:});
+    endif
+    __add_default_menu__ (f);
+  elseif (nargs > 0)
+    set (f, varargin{:});
+  endif
+
+  set (0, "currentfigure", f);
+  ## When switching to figure N, make figure visible and on top of stack.
+  if (! init_new_figure)
+    set (f, "visible", "on");
+  endif
+
+  if (nargout > 0)
+    h = f;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (hf, gcf);
+%!   assert (isfigure (hf));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!error <N must be figure handle or figure number> figure ({1})
+%!error <N must be figure handle or figure number> figure ([1 2])
+%!error <N must be figure handle or figure number> figure (-1)
+%!error <N must be figure handle or figure number> figure (1.5)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/findall.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,65 @@
+## Copyright (C) 2008-2012 Bill Denney
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} findall ()
+## @deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
+## @deftypefnx {Function File} {@var{h} =} findall ("-property", @var{prop_name})
+## @deftypefnx {Function File} {@var{h} =} findall ("-regexp", @var{prop_name}, @var{pattern})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "flat", @dots{})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "-depth", @var{d}, @dots{})
+## Find graphics object, including hidden ones, with specified property values.
+##
+## The return value @var{h} is a list of handles to the found graphic objects.
+##
+## @code{findall} performs the same search as @code{findobj}, but it
+## includes hidden objects (HandleVisibility = @qcode{"off"}).  For full
+## documentation, @pxref{XREFfindobj,,findobj}.
+## @seealso{findobj, allchild, get, set}
+## @end deftypefn
+
+## Author: Bill Denney <bill@denney.ws>
+
+function h = findall (varargin)
+
+  unwind_protect
+    shh = get (0, "showhiddenhandles");
+    set (0, "showhiddenhandles", "on");
+    h = findobj (varargin{:});
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", shh);
+  end_unwind_protect
+
+endfunction
+
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = findall (hf);
+%!   all_handles(1) = {"figure"};
+%!   all_handles(2:14,1) = {"uimenu"};
+%!   assert (get (h, "type"), all_handles);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/findfigs.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,77 @@
+## Copyright (C) 2008 Bill Denney
+## Copyright (C) 2012 Carnë Draug
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} findfigs ()
+## Find all visible figures that are currently off the screen and move them
+## onto the screen.
+## @seealso{allchild, figure, get, set}
+## @end deftypefn
+
+## Author: Bill Denney <bill@denney.ws>
+## Modified by: Carnë Draug <carandraug+dev@gmail.com>
+
+function findfigs ()
+
+  hfigs = allchild (0);
+  units = get (0, "units");
+  unwind_protect
+    set (0, "units", "pixels");
+    screensize = get (0, "screensize");
+  unwind_protect_cleanup
+    set (0, "units", units);
+  end_unwind_protect
+
+  ## give the monitor a margin so that the figure must not just
+  ## marginally be on the monitor.
+  margin = 30;
+  screensize(1:2) += margin;
+  screensize(3:4) -= margin;
+
+  hfigs = hfigs(strcmp (get (hfigs, "visible"), "on"));
+  for hf = hfigs'
+    units = get (hf, "units");
+    unwind_protect
+      set (hf, "units", "pixels");
+      pos = get (hf, "position");
+      ## Test if (in order):
+      ## The left side is outside the right side of the screen
+      ## The bottom is above the top of the screen
+      ## The right side is outside the left of the screen
+      ## the top is below the bottom of the screen
+      if (pos(1) > screensize(3)
+          || pos(2) > screensize(4)
+          || pos(1)+pos(3) < screensize(1)
+          || pos(2)+pos(4) < screensize(2))
+
+        ## the new position will be at the top left of the screen
+        ## (all moved figures will overlap).  The bottom left is chosen
+        ## instead of the top left because that allows for the unknown
+        ## amount of space for the menu bar and the title bar.
+        pos(1) = screensize(1);
+        pos(2) = screensize(2);
+        set (hf, "position", pos);
+      endif
+    unwind_protect_cleanup
+      set (hf, "units", units);
+    end_unwind_protect
+  endfor
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/findobj.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,420 @@
+## Copyright (C) 2007-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} findobj ()
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
+## @deftypefnx {Function File} {@var{h} =} findobj ("-property", @var{prop_name})
+## @deftypefnx {Function File} {@var{h} =} findobj ("-regexp", @var{prop_name}, @var{pattern})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "flat", @dots{})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "-depth", @var{d}, @dots{})
+## Find graphics object with specified property values.
+##
+## The simplest form is
+##
+## @example
+## findobj (@var{prop_name}, @var{prop_value})
+## @end example
+##
+## @noindent
+## which returns the handles of all objects which have a property named
+## @var{prop_name} that has the value @var{prop_value}.  If multiple
+## property/value pairs are specified then only objects meeting all of the
+## conditions are returned.
+##
+## The search can be limited to a particular set of objects and their
+## descendants, by passing a handle or set of handles @var{hlist} as the first
+## argument.
+##
+## The depth of the object hierarchy to search can be limited with the
+## @qcode{"-depth"} argument.  An example of searching only three generations
+## of children is:
+##
+## @example
+## findobj (@var{hlist}, "-depth", 3, @var{prop_name}, @var{prop_value})
+## @end example
+##
+## Specifying a depth @var{d} of 0, limits the search to the set of objects
+## passed in @var{hlist}.  A depth @var{d} of 0 is equivalent to the
+## @qcode{"flat"} argument.
+##
+## A specified logical operator may be applied to the pairs of @var{prop_name}
+## and @var{prop_value}.  The supported logical operators are:
+## @qcode{"-and"}, @qcode{"-or"},
+## @qcode{"-xor"}, @qcode{"-not"}.
+##
+## Objects may also be matched by comparing a regular expression to the
+## property values, where property values that match
+## @code{regexp (@var{prop_value}, @var{pattern})} are returned.
+##
+## Finally, objects may be matched by property name only by using the
+## @qcode{"-property"} option.
+##
+## Implementation Note: The search only includes objects with visible
+## handles (HandleVisibility = @qcode{"on"}).  @xref{XREFfindall,,findall}, to
+## search for all objects including hidden ones.
+## @seealso{findall, allchild, get, set}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+
+function h = findobj (varargin)
+
+  depth = NaN;
+  if (nargin == 0)
+    handles = 0;
+    n1 = 0;
+  else
+    if (! isempty (varargin{1}))
+      if (ishandle (varargin{1}(1)))
+        handles = varargin{1};
+        n1 = 2;
+      else
+        handles = 0;
+        n1 = 1;
+      endif
+    else
+      ## Return [](0x1) for compatibility.
+      h = zeros (0, 1);
+      return;
+    endif
+    if (n1 <= nargin)
+      if (ischar (varargin{n1}))
+        if (strcmpi (varargin{n1}, "flat"))
+          depth = 0;
+          n1 = n1 + 1;
+        elseif (strcmpi (varargin{n1}, "-depth"))
+          depth = varargin{n1+1};
+          n1 = n1 + 2;
+        endif
+      else
+        error ("findobj: properties and options must be strings");
+      endif
+    endif
+  endif
+
+  if (n1 <= nargin && nargin > 0)
+    args = varargin(n1 : nargin);
+  else
+    args = {};
+  endif
+
+  regularexpression = [];
+  property          = [];
+  logicaloperator   = {};
+  pname             = {};
+  pvalue            = {};
+  np = 1;
+  na = 1;
+  operatorprecedence = {"-not", "-and", "-or", "-xor"};
+
+  while (na <= numel (args))
+    regularexpression(np) = 0;
+    property(np) = 0;
+    logicaloperator{np} = "and";
+    if (ischar (args{na}))
+      if (strcmpi (args{na}, "-regexp"))
+        if (na + 2 <= numel (args))
+          regularexpression(np) = 1;
+          na = na + 1;
+          pname{np} = args{na};
+          na = na + 1;
+          pvalue{np} = args{na};
+          na = na + 1;
+          np = np + 1;
+        else
+          error ("findobj: inconsistent number of arguments");
+        endif
+      elseif (strcmpi (args{na}, "-property"))
+        if (na + 1 <= numel (args))
+          na = na + 1;
+          property(np) = 1;
+          pname{np} = args{na};
+          na = na + 1;
+          pvalue{np} = [];
+          np = np + 1;
+        else
+          error ("findobj: inconsistent number of arguments");
+        endif
+      elseif (! strcmp (args{na}(1), "-"))
+        ## Parameter/value pairs.
+        if (na + 1 <= numel (args))
+          pname{np} = args{na};
+          na = na + 1;
+          pvalue{np} = args{na};
+          na = na + 1;
+          if (na <= numel (args))
+            if (ischar (args{na}))
+              if (any (strcmpi (args{na}, operatorprecedence)))
+                logicaloperator{np} = args{na}(2:end);
+                na = na+1;
+              endif
+            else
+              error ("findobj: properties and options must be strings");
+            endif
+          else
+            logicaloperator{np} = "and";
+          endif
+          np = np + 1;
+        else
+          error ("findobj: inconsistent number of arguments");
+        endif
+      else
+        ## This is sloppy ... but works like Matlab.
+        if (strcmpi (args{na}, "-not"))
+          h = [];
+          return;
+        endif
+        na = na + 1;
+      endif
+    else
+      error ("findobj: properties and options must be strings");
+    endif
+  endwhile
+
+  numpairs = np - 1;
+  if (! isempty (logicaloperator))
+    logicaloperator = shift (logicaloperator, 1);
+  endif
+
+  ## Load all objects which qualify for being searched.
+  idepth = 0;
+  h = handles;
+  while (numel (handles) && ! (idepth >= depth))
+    children = [];
+    for n = 1 : numel (handles)
+      children = [children; get(handles(n), "children")];
+    endfor
+    handles = children;
+    h = [h; children];
+    idepth = idepth + 1;
+  endwhile
+
+  if (numpairs > 0)
+    match = true (numel (h), numpairs);
+    for nh = 1 : numel (h)
+      p = get (h(nh));
+      for np = 1 : numpairs
+        fields = fieldnames (p);
+        fieldindex = find (strcmpi (fields, pname{np}), 1);
+        if (numel (fieldindex))
+          pname{np} = fields{fieldindex};
+          if (property(np))
+            match(nh,np) = true;
+          else
+            if (regularexpression(np))
+              foo = regexp (p.(pname{np}), pvalue{np}, "once");
+              if (isempty (foo))
+                match(nh,np) = false;
+              else
+                match(nh,np) = foo;
+              endif
+            elseif (numel (p.(pname{np})) == numel (pvalue{np}))
+              if (ischar (pvalue{np}) && ischar (p.(pname{np})))
+                match(nh,np) = strcmpi (pvalue{np}, p.(pname{np}));
+              elseif (isnumeric (pvalue{np} && isnumeric (p.(pname{np}))))
+                match(nh,np) = (pvalue{np} == p.(pname{np}));
+              else
+                match(nh,np) = isequal (pvalue{np}, p.(pname{np}));
+              endif
+            else
+              match(nh,np) = false;
+            endif
+          endif
+        else
+          match(nh,np) = false;
+        endif
+      endfor
+    endfor
+
+    if (numpairs > 1)
+      for no = 1 : numel (operatorprecedence)
+        pairs = find (strcmp (logicaloperator(2:end), ...
+                              operatorprecedence{no}(2:end)));
+        for np = sort (pairs, "descend")
+          if (no == 1)
+            match(:,np+1) = ! match(:,np+1);
+            logicaloperator(np+1) = {"and"};
+          else
+            match(:,np) = feval (logicaloperator{np+1}, match(:,np), ...
+                                 match(:,np+1));
+            logicaloperator(np+1) = [];
+            match(:,np+1) = [];
+            numpairs = numpairs - 1;
+          endif
+          if (numpairs < 2)
+            break;
+          endif
+        endfor
+        if (numpairs < 2)
+          break;
+        endif
+      endfor
+    endif
+  else
+    match = true (numel (h), 1);
+  endif
+
+  h = h(match);
+  h = h(:);
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = findobj (gca (), "-property", "foo");
+%!   assert (isempty (h));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot (1:10);
+%!   set (h, "tag", "foobar");
+%!   g = findobj (gcf (), "tag", "foobar", "type", "line", "color", [0 0 1]);
+%!   assert (g, h);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   obj = findobj (hf, "type", "line");
+%!   assert (l, obj);
+%!   assert (gca, findobj (hf, "type", "axes"));
+%!   assert (hf, findobj (hf, "type", "figure"));
+%!   assert (isempty (findobj (hf, "type", "xyzxyz")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   subplot (2,2,1);
+%!    imagesc (rand (10));
+%!   subplot (2,2,2);
+%!    surf (peaks);
+%!   subplot (2,2,3);
+%!    contour (peaks);
+%!   subplot (2,2,4);
+%!    plot (peaks);
+%!   h1 = findobj (gcf (), "-regexp", "Type", "image|surface|hggroup");
+%!   h2 = findobj (gcf (), "Type", "image",
+%!                  "-or", "Type", "surface",
+%!                  "-or", "Type", "hggroup");
+%!   assert (h2, h1);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! toolkit = graphics_toolkit ("gnuplot");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h1 = subplot (2,2,1);
+%!   h2 = subplot (2,2,2);
+%!   h3 = subplot (2,2,3, "userdata", struct ("foo", "bar"));
+%!   h4 = subplot (2,2,4);
+%!   h = findobj (hf, "userdata", struct ("foo", "bar"));
+%!   assert (h, h3);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!test
+%! toolkit = graphics_toolkit ("gnuplot");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h1 = subplot (2,2,1, "tag", "1");
+%!   h2 = subplot (2,2,2, "tag", "2");
+%!   h3 = subplot (2,2,3, "tag", "3");
+%!   h4 = subplot (2,2,4, "tag", "4");
+%!   h = findobj (hf, "type", "axes", "-not", "tag", "1");
+%!   assert (h, [h4; h3; h2])
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h1 = subplot (2, 2, 1);
+%!   set (h1, "userdata", struct ("column", 1, "row", 1));
+%!   h2 = subplot (2, 2, 2);
+%!   set (h2, "userdata", struct ("column", 2, "row", 1));
+%!   h3 = subplot (2, 2, 3);
+%!   set (h3, "userdata", struct ("column", 1, "row", 2));
+%!   h4 = subplot (2, 2, 4);
+%!   set (h4, "userdata", struct ("column", 2, "row", 2));
+%!   h = findobj (hf, "type", "axes",
+%!                "-not", "userdata", struct ("column", 1, "row", 1));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+%! assert (h, [h4; h3; h2])
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ha = axes ();
+%!   plot (1:10);
+%!   h = findobj (hf, "type", "figure",
+%!                "-or", "parent", hf,
+%!                "-and", "type", "axes");
+%! unwind_protect_cleanup
+%!   close (hf)
+%! end_unwind_protect
+%! assert (h, [hf; ha])
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   set (hf, "tag", "foo");
+%!   h1 = subplot (2,2,1, "tag", "foo");
+%!   h2 = subplot (2,2,2, "tag", "bar");
+%!   h3 = subplot (2,2,3, "tag", "foo");
+%!   h4 = subplot (2,2,4, "tag", "bar");
+%!   h = findobj (hf, "type", "axes", "-xor", "tag", "foo");
+%!   assert (h, [hf; h4; h2]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax1 = subplot (2,1,1);
+%!    hl1 = plot (rand (10,1));
+%!   hax2 = subplot (2,1,2);
+%!    hl2 = plot (rand (10,1));
+%!   hobj = findobj (hf);
+%!   assert (hobj, [hf; hax2; hax1; hl2; hl1]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gca.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,75 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} gca ()
+## Return a handle to the current axis object.
+##
+## The current axis is the default target for graphics output.  In the case
+## of a figure with multiple axes, @code{gca} returns the last created axes
+## or the last axes that was clicked on with the mouse.
+##
+## If no current axes object exists, create one and return its handle.  The
+## handle may then be used to examine or set properties of the axes.  For
+## example,
+##
+## @example
+## @group
+## ax = gca ();
+## set (ax, "position", [0.5, 0.5, 0.5, 0.5]);
+## @end group
+## @end example
+##
+## @noindent
+## creates an empty axes object and then changes its location and size in the
+## figure window.
+##
+## Note: To find the current axis without creating a new axes object if it
+## does not exist, query the @qcode{"CurrentAxes"} property of a figure.
+##
+## @example
+## get (gcf, "currentaxes");
+## @end example
+## @seealso{gcf, gco, gcbf, gcbo, get, set}
+## @end deftypefn
+
+## Author: jwe
+
+function h = gca ()
+
+  if (nargin == 0)
+    h = get (gcf (), "currentaxes");
+    if (isempty (h))
+      h = axes ();
+    endif
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! ax = axes;
+%! unwind_protect
+%!   assert (gca, ax);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gcbf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,39 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{fig} =} gcbf ()
+## Return a handle to the figure containing the object whose callback is
+## currently executing.
+##
+## If no callback is executing, this function returns the empty matrix.  The
+## handle returned by this function is the same as the second output argument
+## of @code{gcbo}.
+##
+## @seealso{gcbo, gcf, gco, gca, get, set}
+## @end deftypefn
+
+function fig = gcbf ()
+
+  [~, fig] = gcbo ();
+
+endfunction
+
+
+%!assert (isempty (gcbf))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gcbo.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,48 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} gcbo ()
+## @deftypefnx {Function File} {[@var{h}, @var{fig}] =} gcbo ()
+## Return a handle to the object whose callback is currently executing.
+## 
+## If no callback is executing, this function returns the empty matrix.  This
+## handle is obtained from the root object property @qcode{"CallbackObject"}.
+##
+## When called with a second output argument, return the handle of the figure
+## containing the object whose callback is currently executing.  If no callback
+## is executing the second output is also set to the empty matrix.
+##
+## @seealso{gcbf, gco, gca, gcf, get, set}
+## @end deftypefn
+
+function [h, fig] = gcbo ()
+
+  h = get (0, "callbackobject");
+  fig = [];
+
+  if (! isempty (h) && nargout > 1)
+    fig = ancestor (h, "figure");
+  endif
+
+endfunction
+
+
+%!test
+%! assert (isempty (gcbo));
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gcf.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,79 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} gcf ()
+## Return a handle to the current figure.
+##
+## The current figure is the default target for graphics output.  If multiple
+## figures exist, @code{gcf} returns the last created figure or the last figure
+## that was clicked on with the mouse.
+##
+## If a current figure does not exist, create one and return its handle.  The
+## handle may then be used to examine or set properties of the figure.  For
+## example,
+##
+## @example
+## @group
+## fplot (@@sin, [-10, 10]);
+## fig = gcf ();
+## set (fig, "numbertitle", "off", "name", "sin plot")
+## @end group
+## @end example
+##
+## @noindent
+## plots a sine wave, finds the handle of the current figure, and then
+## renames the figure window to describe the contents.
+##
+## Note: To find the current figure without creating a new one if it does not
+## exist, query the @qcode{"CurrentFigure"} property of the root graphics
+## object.
+##
+## @example
+## get (0, "currentfigure");
+## @end example
+##
+## @seealso{gca, gco, gcbf, gcbo, get, set}
+## @end deftypefn
+
+## Author: jwe, Bill Denney
+
+function h = gcf ()
+
+  if (nargin == 0)
+    h = get (0, "currentfigure");
+    if (isempty (h) || h == 0)
+      ## We only have a root figure object, so create a new figure
+      ## object and make it the current figure.
+      h = figure ();
+    endif
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (gcf, hf);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gco.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,47 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} gco ()
+## @deftypefnx {Function File} {@var{h} =} gco (@var{fig})
+## Return a handle to the current object of the current figure, or a handle
+## to the current object of the figure with handle @var{fig}.
+##
+## The current object of a figure is the object that was last clicked on.  It
+## is stored in the @qcode{"CurrentObject"} property of the target figure.
+##
+## If the last mouse click did not occur on any child object of the figure,
+## then the current object is the figure itself.
+##
+## If no mouse click occurred in the target figure, this function returns an
+## empty matrix.
+##
+## Programming Note: The value returned by this function is not necessarily the
+## same as the one returned by @code{gcbo} during callback execution.  An
+## executing callback can be interrupted by another callback and the current
+## object may be changed.
+##
+## @seealso{gcbo, gca, gcf, gcbf, get, set}
+## @end deftypefn
+
+function h = gco ()
+
+  h = get (get (0, "currentfigure"), "currentobject");
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ginput.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,60 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput (@var{n})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput ()
+## Return the position and type of mouse button clicks and/or key strokes
+## in the current figure window.
+##
+## If @var{n} is defined, then capture @var{n} events before returning.
+## When @var{n} is not defined @code{ginput} will loop until the return key
+## @key{RET} is pressed.
+##
+## The return values @var{x}, @var{y} are the coordinates where the mouse
+## was clicked in the units of the current axes.  The return value @var{button}
+## is 1, 2, or 3 for the left, middle, or right button.  If a key is pressed
+## the ASCII value is returned in @var{button}.
+## @seealso{gtext, waitforbuttonpress}
+## @end deftypefn
+
+function varargout = ginput (n)
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  f = gcf ();
+  a = gca ();  # Create an axis, if necessary
+  drawnow ();
+  toolkit = get (f, "__graphics_toolkit__");
+
+  varargout = cell (1, nargout);
+  if (nargin == 0)
+    [varargout{:}] = feval (["__" toolkit "_ginput__"], f);
+  else
+    [varargout{:}] = feval (["__" toolkit "_ginput__"], f, n);
+  endif
+
+endfunction
+
+
+## Remove from test statistics.  No real tests possible.
+%!test
+%! assert (1);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gnuplot_binary.in	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,65 @@
+## Copyright (C) 2008-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Loadable Function} {[@var{prog}, @var{args}] =} gnuplot_binary ()
+## @deftypefnx {Loadable Function} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{})
+## Query or set the name of the program invoked by the plot command
+## when the graphics toolkit is set to "gnuplot".  Additional arguments to
+## pass to the external plotting program may also be given.
+## The default value is @qcode{"gnuplot"} with no additional arguments.
+## @xref{Installation}.
+## @seealso{graphics_toolkit}
+## @end deftypefn
+
+## Author: jwe
+
+function [prog, args] = gnuplot_binary (new_prog, varargin)
+
+  persistent gp_binary = %OCTAVE_CONF_GNUPLOT%;
+  persistent gp_args = {};
+
+  if (nargout > 0 || nargin == 0)
+    prog = gp_binary;
+    args = gp_args;
+  endif
+
+  if (nargin == 1)
+    if (! ischar (new_prog) || isempty (new_prog))
+      error ("gnuplot_binary: NEW_PROG must be a non-empty string");
+    endif
+    gp_binary = new_prog;
+  endif
+
+  if (nargin > 1)
+    if (! iscellstr (varargin))
+      error ("gnuplot_binary: arguments must be character strings");
+    endif
+    gp_args = varargin;
+  endif
+
+endfunction
+
+
+%!test
+%! orig_val = gnuplot_binary ();
+%! old_val = gnuplot_binary ("X");
+%! assert (orig_val, old_val);
+%! assert (gnuplot_binary (), "X");
+%! gnuplot_binary (orig_val);
+%! assert (gnuplot_binary (), orig_val);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/graphics_toolkit.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,106 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{name} =} graphics_toolkit ()
+## @deftypefnx {Function File} {@var{name} =} graphics_toolkit (@var{hlist})
+## @deftypefnx {Function File} {} graphics_toolkit (@var{name})
+## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name})
+## Query or set the default graphics toolkit which is assigned to new figures.
+## 
+## With no inputs, return the current default graphics toolkit.  If the input
+## is a list of figure graphic handles, @var{hlist}, then return the name
+## of the graphics toolkit in use for each figure.
+## 
+## When called with a single input @var{name} set the default graphics toolkit
+## to @var{name}.  If the toolkit is not already loaded, it is initialized by
+## calling the function @code{__init_@var{name}__}.  If the first input
+## is a list of figure handles, @var{hlist}, then the graphics toolkit is set
+## to @var{name} for these figures only.
+## 
+## @seealso{available_graphics_toolkits}
+## @end deftypefn
+
+function retval = graphics_toolkit (name, hlist = [])
+
+  if (nargin > 2)
+    print_usage ();
+  endif
+
+  if (nargout > 0 || nargin == 0)
+    retval = get (0, "defaultfigure__graphics_toolkit__");
+  endif
+
+  if (nargin == 0)
+    return;
+  elseif (nargin == 1)
+    if (all (isfigure (name)))
+      hlist = name;
+      retval = get (hlist, "__graphics_toolkit__");
+      return;
+    elseif (! ischar (name))
+      error ("graphics_toolkit: invalid graphics toolkit NAME");
+    endif
+  elseif (nargin == 2)
+    ## Swap input arguments
+    [hlist, name] = deal (name, hlist);
+    if (! all (isfigure (hlist)))
+      error ("graphics_toolkit: invalid figure handle list HLIST");
+    elseif (! ischar (name))
+      error ("graphics_toolkit: invalid graphics toolkit NAME");
+    endif
+  endif
+
+  if (! any (strcmp (loaded_graphics_toolkits (), name)))
+    feval (["__init_", name, "__"]);
+    if (! any (strcmp (loaded_graphics_toolkits (), name)))
+      error ("graphics_toolkit: %s toolkit was not correctly loaded", name);
+    endif
+  endif
+
+  if (isempty (hlist))
+    set (0, "defaultfigure__graphics_toolkit__", name);
+  else
+    set (hlist, "__graphics_toolkit__", name);
+  endif
+
+endfunction
+
+
+%!testif HAVE_FLTK
+%! unwind_protect
+%!   hf = figure ("visible", "off");
+%!   toolkit = graphics_toolkit ();
+%!   assert (get (0, "defaultfigure__graphics_toolkit__"), toolkit);
+%!   graphics_toolkit (hf, "fltk");
+%!   assert (graphics_toolkit (hf), "fltk");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!testif HAVE_FLTK
+%! old_toolkit = graphics_toolkit ();
+%! switch (old_toolkit)
+%!   case {"gnuplot"}
+%!     new_toolkit = "fltk";
+%!   otherwise
+%!     new_toolkit = "gnuplot";
+%! endswitch
+%! assert (graphics_toolkit (new_toolkit), old_toolkit);
+%! assert (graphics_toolkit (old_toolkit), new_toolkit);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/hdl2struct.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,172 @@
+## Copyright (C) 2012 pdiribarne
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{s} =} hdl2struct (@var{h})
+## Return a structure, @var{s}, whose fields describe the properties
+## of the object, and its children, associated with the handle, @var{h}.
+##
+## The fields of the structure @var{s} are @qcode{"type"}, @qcode{"handle"},
+## @qcode{"properties"}, @qcode{"children"}, and @qcode{"special"}.
+## @seealso{struct2hdl, findobj}
+## @end deftypefn
+
+## Author: pdiribarne <pdiribarne@new-host.home>
+## Created: 2012-03-04
+
+function s = hdl2struct (h)
+
+  if (nargin != 1 || !ishandle (h))
+    print_usage ();
+  endif
+
+  hiddenh = get (0, "showhiddenhandles");
+  if (strcmp (hiddenh, "on"))
+    set (0, "showhiddenhandles", "off");
+  endif
+
+  ## main object
+  main = get (h);
+  s.handle = h;
+  s.type =  main.type;
+  s.properties  = getprops (h);
+  s.children = [];
+  s.special = [];
+
+  ## sweep all children but legends, colorbars, uimenu and hggroup children
+  ## in reverse order
+  kids = main.children;
+  lg = findobj (h, "-depth", 1, "tag", "legend");
+  cb = findobj (h, "-depth", 1, "tag", "colorbar");
+  ui = findobj (h, "-depth", 1, "type", "uimenu");
+  nkids = length (kids);
+  ii = 0;
+  while (nkids)
+    if (! any (kids (nkids) == lg) && ! any (kids (nkids) == cb)
+          && ! any (kids (nkids) == ui) && ! strcmp (main.type, "hggroup"))
+      ii++;
+      s.children(ii) = hdl2struct (kids(nkids));
+    endif
+    nkids--;
+  endwhile
+
+  ## add non "children" children objects (title, xlabel, ...) and
+  ## hggroup children and tag theim in "special"
+  special = [];
+  if (strcmp (main.type, "hggroup"))
+    special = main.children;
+  endif
+  special = [special getspecial(h)];
+  nsp = length (special);
+  while (nsp)
+    ii++;
+    s.children(ii) = hdl2struct (special(nsp));
+    s.special(nsp) = ii;
+    nsp--;
+  endwhile
+
+  ## look for legends and colorbars among "main"'s brothers and add them
+  ## to the children list
+  if (strcmp (main.type, "axes"))
+    par = main.parent;
+    lg = findobj (par, "-depth", 1, "tag", "legend");
+    if (! isempty (lg))
+      idx = arrayfun (@(x) get(x).userdata.handle(end) == h, lg);
+      lg = lg(find (idx));
+    endif
+    nlg = length (lg);
+    if (nlg == 1)
+      ii++;
+      s.children(ii) = hdl2struct (lg);
+    elseif (nlg > 1)
+      error ("hdl2struct: more than one legend found");
+    endif
+
+    cb = findobj (par, "-depth", 1, "tag", "colorbar");
+    if (! isempty (cb))
+      idx = arrayfun (@(x) get(x).axes == h, cb);
+      cb = cb(find (idx));
+    endif
+
+    ncb = length (cb);
+    if (ncb == 1)
+      ii++;
+      s.children(ii) = hdl2struct (cb);
+    elseif (nlg > 1)
+      error ("hdl2struct: more than one colorbar found");
+    endif
+  endif
+
+  set (0, "showhiddenhandles", hiddenh);
+
+endfunction
+
+function hdlist = getspecial (h)
+  obj = get (h);
+  ## return handles to special children
+  fields = fieldnames (obj);
+  hdlist = [];
+
+  regkids = get ( h, "children");
+  set (0, "showhiddenhandles", "on");
+  allkids = get ( h, "children");
+  set (0, "showhiddenhandles", "off");
+  speckids = arrayfun (@(x) ! any (x == regkids), allkids);
+  hdlist = allkids (find (speckids));
+  hdlist = reshape (hdlist, 1, numel (hdlist));
+
+endfunction
+
+function prpstr = getprops (h)
+  obj = get (h);
+  ## get usefull properties rejecting readonly, children, handles ...
+  fields = fieldnames (obj);
+  hdlist = [];
+
+  forbid = {"beingdeleted", "busyaction", "buttondownfcn", ...
+            "children", "clipping", "createfcn", ...
+            "deletefcn", "handlevisibility", "hittest", ...
+            "interruptible", "parent", "selected" ,...
+            "selectionhighlight", "type", "__modified__", ...
+            "uicontextmenu", "__graphics_toolkit__", "currentaxes", ...
+            "currentcharacter", "currentobject","tightinset", ...
+            "currentpoint", "extent"};
+
+  nflds = length (fields);
+  ii = 0;
+  while (nflds)
+    prop = fields{nflds};
+    val = obj.(fields{nflds});
+    ii++;
+    if (! any (strcmp (prop, forbid)))
+      prpstr.(prop) = val;
+    endif
+    nflds--;
+  endwhile
+
+  ## hidden properties
+  hidden = {"autopos_tag", "looseinset"};
+  for ii = 1:numel (hidden)
+    if (isprop (h, hidden{ii}))
+      prpstr.(hidden{ii}) = get (h, hidden{ii});
+    endif
+  endfor
+
+endfunction
+
+
+## FIXME: need validation tests
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/hggroup.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,71 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} hggroup ()
+## @deftypefnx {Function File} {} hggroup (@var{hax})
+## @deftypefnx {Function File} {} hggroup (@dots{}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} hggroup (@dots{})
+## Create handle graphics group object with axes parent @var{hax}.
+##
+## If no parent is specified, the group is created in the current axes.
+##
+## Multiple property/value pairs may be specified for the hggroup, but they
+## must appear in pairs.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## hggroup object.
+##
+## Programming Note: An hggroup is a way to group base graphics objects such
+## as line objects or patch objects into a single unit which can react
+## appropriately.  For example, the individual lines of a contour plot are
+## collected into a single hggroup so that they can be made visible/invisible
+## with a single command, @code{set (hg_handle, "visible", "off")}.
+## 
+## @seealso{addproperty, addlistener}
+## @end deftypefn
+
+## Author: goffioul
+
+function h = hggroup (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("hggroup", varargin{:});
+  
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  htmp = __go_hggroup__ (hax, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = hggroup;
+%!   assert (findobj (hf, "type", "hggroup"), h);
+%!   assert (get (h, "type"), "hggroup");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/hold.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,200 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} hold
+## @deftypefnx {Command} {} hold on
+## @deftypefnx {Command} {} hold off
+## @deftypefnx {Command} {} hold all
+## @deftypefnx {Function File} {} hold (@var{hax}, @dots{})
+## Toggle or set the @qcode{"hold"} state of the plotting engine which
+## determines whether new graphic objects are added to the plot or replace
+## the existing objects.
+##
+## @table @code
+## @item hold on
+## Retain plot data and settings so that subsequent plot commands are displayed
+## on a single graph.
+##
+## @item hold all
+## Retain plot line color, line style, data, and settings so that subsequent
+## plot commands are displayed on a single graph with the next line color and
+## style.
+##
+## @item hold off
+## Restore default graphics settings which clear the graph and reset axis
+## properties before each new plot command.  (default).
+##
+## @item hold
+## Toggle the current hold state.
+## @end table
+##
+## When given the additional argument @var{hax}, the hold state is modified
+## for this axis rather than the current axes returned by @code{gca}.
+##
+## To query the current hold state use the @code{ishold} function.
+## @seealso{ishold, cla, clf, newplot}
+## @end deftypefn
+
+function hold (varargin)
+
+  if (nargin > 0 && isscalar (varargin{1}) && isaxes (varargin{1}))
+    hax = varargin{1};
+    varargin(1) = [];
+    nargs = numel (varargin);
+    ## FIXME: Should this be ancestor (hax, "parent")?
+    hfig = get (hax, "parent");
+  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}))
+    print_usage ();
+  else
+    hax = gca ();
+    hfig = gcf ();
+    nargs = numel (varargin);
+  endif
+
+  hold_all = false;
+  if (nargs == 0)
+    turn_hold_off = ishold (hax);
+  elseif (nargs == 1)
+    state = tolower (varargin{1});
+    switch (state)
+      case "off"
+        turn_hold_off = true;
+      case "all"
+        turn_hold_off = false;
+        hold_all = true;
+      case "on"
+        turn_hold_off = false;
+      otherwise
+        error ("hold: invalid hold STATE");
+    endswitch
+  else
+    print_usage ();
+  endif
+
+  if (turn_hold_off)
+    set (hax, "nextplot", "replace");
+  else
+    set (hax, "nextplot", "add");
+    set (hfig, "nextplot", "add");
+  endif
+  set (hax, "__hold_all__", hold_all);
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t = linspace (0, 2*pi, 100);
+%! plot (t, sin (t));
+%! hold on;
+%! plot (t, cos (t));
+%! title ({'hold on', '2 plots shown on same graph'});
+%! hold off;
+
+%!demo
+%! clf;
+%! t = linspace (0, 2*pi, 100);
+%! plot (t, sin (t));
+%! hold all;
+%! plot (t, cos (t));
+%! title ({'hold all', '2 plots shown on same graph with linestyle also preserved'});
+%! hold off;
+
+%!demo
+%! clf;
+%! A = rand (100);
+%! [X, Y] = find (A > 0.95);
+%! imshow (A);
+%! hold on;
+%! plot (X, Y, 'o');
+%! hold off;
+%! title ('hold with image and plot');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! hold on;
+%! imagesc (1 ./ hilb (4));
+%! plot (1:4, '-s');
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! hold on;
+%! imagesc (1 ./ hilb (2));
+%! imagesc (1 ./ hilb (4));
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! hold on;
+%! plot (1:4, '-s');
+%! imagesc (1 ./ hilb (4));
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! t = linspace (-3, 3, 50);
+%! [x, y] = meshgrid (t, t);
+%! z = peaks (x, y);
+%! contourf (x, y, z, 10);
+%! hold on;
+%! plot (x(:), y(:), '^');
+%! patch ([-1.0 1.0 1.0 -1.0 -1.0], [-1.0 -1.0 1.0 1.0 -1.0], 'red');
+%! xlim ([-2.0 2.0]);
+%! ylim ([-2.0 2.0]);
+%! colorbar ('SouthOutside');
+%! title ('Test script for some plot functions');
+
+## hold on test
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   p = plot ([0 1]);
+%!   assert (! ishold);
+%!   hold on;
+%!   assert (ishold);
+%!   p1 = fill ([0 1 1], [0 0 1], "black");
+%!   p2 = fill ([0 1 0], [0 1 1], "red");
+%!   assert (length (get (hf, "children")), 1);
+%!   assert (length (get (gca, "children")), 3);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## hold off test
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   p = plot ([0 1]);
+%!   assert (! ishold);
+%!   hold on;
+%!   assert (ishold);
+%!   p1 = fill ([0 1 1], [0 0 1], "black");
+%!   hold off;
+%!   p2 = fill ([0 1 0], [0 1 1], "red");
+%!   assert (length (get (hf, "children")), 1);
+%!   assert (length (get (gca, "children")), 1);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/isaxes.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,56 @@
+## Copyright (C) 2013 Rik Wehbring
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} isaxes (@var{h})
+## Return true if @var{h} is an axes graphics handle and false otherwise.
+##
+## If @var{h} is a matrix then return a logical array which is true where
+## the elements of @var{h} are axes graphics handles and false where
+## they are not.
+## @seealso{isaxes, ishandle}
+## @end deftypefn
+
+## Author: jwe
+
+function retval = isaxes (h)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  hlist = ishandle (h);
+  if (any (hlist))
+    retval(hlist) = strcmp (get (h(hlist), "type"), "axes");
+  else
+    retval = hlist;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax = axes ();
+%!   assert (isaxes (hax));
+%!   assert (! isaxes (-hax));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/isfigure.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,55 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} isfigure (@var{h})
+## Return true if @var{h} is a figure graphics handle and false otherwise.
+##
+## If @var{h} is a matrix then return a logical array which is true where
+## the elements of @var{h} are figure graphics handles and false where
+## they are not.
+## @seealso{isaxes, ishandle}
+## @end deftypefn
+
+## Author: jwe
+
+function retval = isfigure (h)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  hlist = ishandle (h);
+  if (any (hlist))
+    retval(hlist) = strcmp (get (h(hlist), "type"), "figure");
+  else
+    retval = hlist;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (isfigure (hf));
+%!   assert (! isfigure (-hf));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ishghandle.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,64 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ishghandle (@var{h})
+## Return true if @var{h} is a graphics handle and false otherwise.
+##
+## This function is equivalent to @code{ishandle} and is provided for
+## compatibility with @sc{matlab}.
+## @seealso{ishandle}
+## @end deftypefn
+
+function retval = ishghandle (h)
+  ## This function is just included for compatibility as Octave has
+  ## no simulink equivalent.
+  retval = ishandle (h);
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (ishghandle (hf));
+%!   assert (! ishghandle (-hf));
+%!   l = line;
+%!   ax = gca;
+%!   assert (ishghandle (ax));
+%!   assert (! ishghandle (-ax));
+%!   assert (ishghandle (l));
+%!   assert (! ishghandle (-l));
+%!   p = patch;
+%!   assert (ishghandle (p));
+%!   assert (! ishghandle (-p));
+%!   s = surface;
+%!   assert (ishghandle (s));
+%!   assert (! ishghandle (-s));
+%!   t = text;
+%!   assert (ishghandle (t));
+%!   assert (! ishghandle (-t));
+%!   i = image ([1]);
+%!   assert (ishghandle (i));
+%!   assert (! ishghandle (-i));
+%!   hg = hggroup;
+%!   assert (ishghandle (hg));
+%!   assert (! ishghandle (-hg));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ishold.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,84 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} ishold
+## @deftypefnx {Function File} {} ishold (@var{hax})
+## @deftypefnx {Function File} {} ishold (@var{hfig})
+## Return true if the next plot will be added to the current plot, or
+## false if the plot device will be cleared before drawing the next plot.
+##
+## If the first argument is an axes handle @var{hax} or figure handle
+## @var{hfig} then operate on this plot rather than the current one.
+## @seealso{hold, newplot}
+## @end deftypefn
+
+function retval = ishold (h)
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    fig = gcf ();
+    ax = get (fig, "currentaxes");
+  else
+    if (ishandle (h))
+      if (strcmp (get (h, "type"), "figure"))
+        fig = h;
+        ax = get (fig, "currentaxes");
+      elseif (strcmp (get (h, "type"), "axes"))
+        ax = h;
+        fig = get (ax, "parent");
+      else
+        error ("ishold: H must be an axes or figure graphics handle");
+      endif
+    else
+      error ("ishold: H must be an axes or figure graphics handle");
+    endif
+  endif
+
+  retval = (strcmp (get (fig, "nextplot"), "add")
+            && ! isempty (ax) && strcmp (get (ax, "nextplot"), "add"));
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (! ishold);
+%!   assert (isempty (get (hf, "currentaxes")));
+%!   assert (get (hf, "NextPlot"), "add");
+%!   l = plot ([0 1]);
+%!   assert (! ishold);
+%!   assert (! ishold (gca));
+%!   assert (get (gca, "NextPlot"), "replace");
+%!   assert (get (hf, "NextPlot"), "add");
+%!   hold;
+%!   assert (ishold);
+%!   assert (ishold (gca));
+%!   assert (get (gca, "NextPlot"), "add");
+%!   assert (get (hf, "NextPlot"), "add");
+%!   p = fill ([0 1 1], [0 0 1],"black");
+%!   assert (length (get (hf, "children")), 1);
+%!   assert (length (get (gca, "children")), 2);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/isprop.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,61 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{res} =} isprop (@var{h}, "@var{prop}")
+## Return true if @var{prop} is a property of the object with handle @var{h}.
+##
+## @var{h} may also be an array of handles in which case @var{res} will be a
+## logical array indicating whether each handle has the property @var{prop}.
+## @seealso{get, set}
+## @end deftypefn
+
+## Author: Ben Abbott  <bpabbott@mac.com>
+
+function res = isprop (h, prop)
+
+  if (nargin != 2)
+    print_usage ();
+  endif
+
+  if (! all (ishandle (h)))
+    error ("isprop: H must be a graphics handle or vector of handles");
+  elseif (! ischar (prop))
+    error ("isprop: PROP name must be a string");
+  endif
+
+  res = false (size (h));
+  for i = 1:numel (res)
+    try
+      v = get (h(i), prop);
+      res(i) = true;
+    end_try_catch
+  endfor
+endfunction
+
+
+%!assert (isprop (0, "foobar"), false)
+%!assert (isprop (0, "screenpixelsperinch"), true)
+%!assert (isprop (zeros (2, 3), "visible"), true (2, 3))
+
+%!error isprop ()
+%!error isprop (1)
+%!error isprop (1,2,3)
+%!error <H must be a graphics handle> isprop ({1}, "visible")
+%!error <PROP name must be a string> isprop (0, {"visible"})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/linkprop.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,102 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{hlink} =} linkprop (@var{h}, @var{prop})
+## @deftypefnx {Function File} {@var{hlink} =} linkprop (@var{h}, @{@var{prop1}, @var{prop2}, @dots{}@})
+## Link graphics object properties, such that a change in one is
+## propagated to the others.
+##
+## @var{prop} can be a string for a single property, or a cell array of strings
+## for multiple properties.  @var{h} is an array of graphics handles which
+## will have their properties linked.
+##
+## An example of the use of @code{linkprop} is
+##
+## @example
+## @group
+## x = 0:0.1:10;
+## subplot (1,2,1);
+## h1 = plot (x, sin (x));
+## subplot (1,2,2);
+## h2 = plot (x, cos (x));
+## hlink = linkprop ([h1, h2], @{"color","linestyle"@});
+## set (h1, "color", "green");
+## set (h2, "linestyle", "--");
+## @end group
+## @end example
+##
+## @end deftypefn
+
+function hlink = linkprop (h, prop)
+  if (ischar (prop))
+    prop = {prop};
+  elseif (!iscellstr (prop))
+    error ("linkprop: properties must be a string or cell string array");
+  endif
+
+  for i = 1 : numel (h)
+    for j = 1 : numel (prop)
+      addlistener (h(i), prop{j}, {@update_prop, h, prop{j}});
+    endfor
+  endfor
+
+  ## This should be an object that when destroyed removes the links
+  ## The below is not quite right. As when you call "clear hlink" the
+  ## hggroup continues to exist.
+  hlink = hggroup ();
+  set (hlink, "deletefcn", {@delete_prop, h, prop});
+endfunction
+
+function update_prop (h, d, hlist, prop)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      val = get (h, prop);
+      for hh = hlist(:)'
+        if (hh != h)
+          oldval = get (hh, prop);
+          if (! isequal (val, oldval))
+            set (hh, prop, val);
+          endif
+        endif
+      endfor
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function delete_prop (h, d, hlist, prop)
+  ## FIXME. Actually need to delete the linked properties.
+  ## However, only warn if the graphics objects aren't being deleted.
+  warn = false;
+  for h = hlist(:)'
+    if (ishandle (h) && !strcmpi (get (h, "beingdeleted"), "on"))
+      warn = true;
+      break;
+    endif
+  endfor
+  if (warn)
+    warning ("linkprop: can not remove linked properties");
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/meshgrid.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,135 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}, @var{y})
+## @deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x})
+## @deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x})
+## Given vectors of @var{x} and @var{y} coordinates, return matrices @var{xx}
+## and @var{yy} corresponding to a full 2-D grid.
+##
+## The rows of @var{xx} are copies of @var{x}, and the columns of @var{yy} are
+## copies of @var{y}.  If @var{y} is omitted, then it is assumed to be the same
+## as @var{x}.
+##
+## If the optional @var{z} input is given, or @var{zz} is requested, then the
+## output will be a full 3-D grid.
+##
+## @code{meshgrid} is most frequently used to produce input for a 2-D or 3-D
+## function that will be plotted.  The following example creates a surface
+## plot of the ``sombrero'' function.
+##
+## @example
+## @group
+## f = @@(x,y) sin (sqrt (x.^2 + y.^2)) ./ sqrt (x.^2 + y.^2);
+## range = linspace (-8, 8, 41);
+## [@var{X}, @var{Y}] = meshgrid (range, range);  
+## Z = f (X, Y);
+## surf (X, Y, Z);
+## @end group
+## @end example
+##
+## Programming Note: @code{meshgrid} is restricted to 2-D or 3-D grid
+## generation.  The @code{ndgrid} function will generate 1-D through N-D
+## grids.  However, the functions are not completely equivalent.  If @var{x}
+## is a vector of length M and @var{y} is a vector of length N, then
+## @code{meshgrid} will produce an output grid which is NxM@.  @code{ndgrid}
+## will produce an output which is @nospell{MxN} (transpose) for the same
+## input.  Some core functions expect @code{meshgrid} input and others expect
+## @code{ndgrid} input.  Check the documentation for the function in question
+## to determine the proper input format.
+## @seealso{ndgrid, mesh, contour, surf}
+## @end deftypefn
+
+## Author: jwe
+
+function [xx, yy, zz] = meshgrid (x, y, z)
+
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin < 2)
+    y = x;
+  endif
+
+  ## Use repmat to ensure that result values have the same type as the inputs
+
+  if (nargout < 3)
+    if (! (isvector (x) && isvector (y)))
+      error ("meshgrid: X and Y must be vectors");
+    endif
+    xx = repmat (x(:).', length (y), 1);
+    yy = repmat (y(:), 1, length (x));
+  else
+    if (nargin < 3)
+      z = y;
+    endif
+    if (! (isvector (x) && isvector (y) && isvector (z)))
+      error ("meshgrid: X, Y, and Z must be vectors");
+    endif
+    lenx = length (x);
+    leny = length (y);
+    lenz = length (z);
+    xx = repmat (repmat (x(:).', leny, 1), [1, 1, lenz]);
+    yy = repmat (repmat (y(:), 1, lenx), [1, 1, lenz]);
+    zz = reshape (repmat (z(:).', lenx*leny, 1)(:), leny, lenx, lenz);
+  endif
+
+endfunction
+
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! z = 1:4;
+%! [XX, YY, ZZ] = meshgrid (x, y, z);
+%! assert (size_equal (XX, YY, ZZ));
+%! assert (ndims (XX), 3);
+%! assert (size (XX), [3, 2, 4]);
+%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
+%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! [XX, YY] = meshgrid (x, y);
+%! assert (size_equal (XX, YY));
+%! assert (ndims (XX), 2);
+%! assert (size (XX), [3, 2]);
+%! assert (XX(1) * YY(1), x(1) * y(1));
+%! assert (XX(end) * YY(end), x(end) * y(end));
+
+%!test
+%! x = 1:3;
+%! [XX1, YY1] = meshgrid (x, x);
+%! [XX2, YY2] = meshgrid (x);
+%! assert (size_equal (XX1, XX2, YY1, YY2));
+%! assert (ndims (XX1), 2);
+%! assert (size (XX1), [3, 3]);
+%! assert (XX1, XX2);
+%! assert (YY1, YY2);
+
+%% Test input validation
+%!error meshgrid ()
+%!error meshgrid (1,2,3,4)
+%!error <X and Y must be vectors> meshgrid (ones (2,2), 1:3)
+%!error <X and Y must be vectors> meshgrid (1:3, ones (2,2))
+%!error <X, Y, and Z must be vectors> [X,Y,Z] = meshgrid (1:3, 1:3, ones (2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/module.mk	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,80 @@
+FCN_FILE_DIRS += plot
+
+plot_util_GEN_FCN_FILES = \
+  plot/util/gnuplot_binary.m
+
+GEN_FCN_FILES += $(plot_util_GEN_FCN_FILES)
+
+plot_util_PRIVATE_FCN_FILES = \
+  plot/util/private/__add_default_menu__.m \
+  plot/util/private/__fltk_ginput__.m \
+  plot/util/private/__fltk_print__.m \
+  plot/util/private/__ghostscript__.m \
+  plot/util/private/__gnuplot_get_var__.m \
+  plot/util/private/__gnuplot_ginput__.m \
+  plot/util/private/__gnuplot_has_feature__.m \
+  plot/util/private/__gnuplot_has_terminal__.m \
+  plot/util/private/__gnuplot_open_stream__.m \
+  plot/util/private/__gnuplot_print__.m \
+  plot/util/private/__gnuplot_version__.m \
+  plot/util/private/__go_draw_axes__.m \
+  plot/util/private/__go_draw_figure__.m \
+  plot/util/private/__print_parse_opts__.m \
+  plot/util/private/__tight_eps_bbox__.m
+
+plot_util_FCN_FILES = \
+  plot/util/__actual_axis_position__.m \
+  plot/util/allchild.m \
+  plot/util/ancestor.m \
+  plot/util/axes.m \
+  plot/util/cla.m \
+  plot/util/clf.m \
+  plot/util/close.m \
+  plot/util/closereq.m \
+  plot/util/colstyle.m \
+  plot/util/copyobj.m \
+  plot/util/__default_plot_options__.m \
+  plot/util/figure.m \
+  plot/util/findall.m \
+  plot/util/findfigs.m \
+  plot/util/findobj.m \
+  plot/util/gca.m \
+  plot/util/gcbf.m \
+  plot/util/gcbo.m \
+  plot/util/gcf.m \
+  plot/util/gco.m \
+  plot/util/ginput.m \
+  plot/util/__gnuplot_drawnow__.m \
+  plot/util/graphics_toolkit.m \
+  plot/util/hdl2struct.m \
+  plot/util/hggroup.m \
+  plot/util/hold.m \
+  plot/util/isaxes.m \
+  plot/util/isfigure.m \
+  plot/util/ishghandle.m \
+  plot/util/ishold.m \
+  plot/util/isprop.m \
+  plot/util/linkprop.m \
+  plot/util/meshgrid.m \
+  plot/util/ndgrid.m \
+  plot/util/newplot.m \
+  plot/util/__next_line_color__.m \
+  plot/util/__next_line_style__.m \
+  plot/util/__plt_get_axis_arg__.m \
+  plot/util/__pltopt__.m \
+  plot/util/printd.m \
+  plot/util/print.m \
+  plot/util/refreshdata.m \
+  plot/util/refresh.m \
+  plot/util/saveas.m \
+  plot/util/shg.m \
+  plot/util/struct2hdl.m \
+  plot/util/subplot.m \
+  $(plot_util_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(plot_util_FCN_FILES)
+
+PKG_ADD_FILES += plot/util/PKG_ADD
+
+DIRSTAMP_FILES += plot/util/$(octave_dirstamp)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ndgrid.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,124 @@
+## Copyright (C) 2006-2012 Alexander Barth
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x1}, @var{x2}, @dots{}, @var{x}n)
+## @deftypefnx {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x})
+## Given n vectors @var{x1}, @dots{}, @var{x}n, @code{ndgrid} returns
+## n arrays of dimension n.  The elements of the i-th output argument
+## contains the elements of the vector @var{x}i repeated over all
+## dimensions different from the i-th dimension.  Calling ndgrid with
+## only one input argument @var{x} is equivalent to calling ndgrid with
+## all n input arguments equal to @var{x}:
+##
+## [@var{y1}, @var{y2}, @dots{}, @var{y}n] = ndgrid (@var{x}, @dots{}, @var{x})
+##
+## Programming Note: @code{ndgrid} is very similar to the function
+## @code{meshgrid} except that the first two dimensions are transposed in
+## comparison to @code{meshgrid}.  Some core functions expect @code{meshgrid}
+## input and others expect @code{ndgrid} input.  Check the documentation for
+## the function in question to determine the proper input format.
+## @seealso{meshgrid}
+## @end deftypefn
+
+## Author: Alexander Barth <abarth@marine.usf.edu>
+
+function varargout = ndgrid (varargin)
+
+  if (nargin == 0)
+    print_usage ();
+  elseif (nargin == 1)
+    n = max ([nargout, 1]);
+    ## If only one input argument is given, repeat it n-times
+    varargin(1:n) = varargin(1);
+  elseif (nargin >= nargout)
+    n = max ([nargin, 1]);
+  else
+    error ("ndgrid: wrong number of input arguments");
+  endif
+
+  ## Determine the size of the output arguments
+
+  shape = zeros (1, n);
+  for i = 1:n
+    if (! isvector (varargin{i}) && ! isempty (varargin{i}))
+      error ("ndgrid: arguments must be vectors");
+    endif
+    shape(i) = length (varargin{i});
+  endfor
+
+  for i = 1:n
+    ## size for reshape
+    r = ones (1, n);
+    r(i) = shape(i);
+
+    ## size for repmat
+    s = shape;
+    s(i) = 1;
+
+    varargout{i} = repmat (reshape (varargin{i}, r), s);
+  endfor
+
+endfunction
+
+
+%!test
+%! x = 1:3;
+%! assert (isequal (ndgrid (x), x(:)));
+
+%!test
+%! x = 1:3;
+%! [XX, YY] = ndgrid (x);
+%! assert (size_equal (XX, YY));
+%! assert (isequal (XX, repmat(x(:), 1, numel(x))));
+%! assert (isequal (YY, repmat(x, numel(x), 1)));
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! z = 1:4;
+%! [XX, YY, ZZ] = ndgrid (x, y, z);
+%! assert (size_equal (XX, YY, ZZ));
+%! assert (ndims (XX), 3);
+%! assert (size (XX), [2, 3, 4]);
+%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
+%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! [XX1, YY1] = meshgrid (x, y);
+%! [XX2, YY2] = ndgrid (x, y);
+%! assert (size_equal (XX1, YY1));
+%! assert (size_equal (XX2, YY2));
+%! assert (ndims (XX1), 2);
+%! assert (size (XX1), [3, 2]);
+%! assert (size (XX2), [2, 3]);
+%! assert (XX2(1) * YY2(1), x(1) * y(1));
+%! assert (XX2(end) * YY2(end), x(end) * y(end));
+%! assert (XX1, XX2.');
+%! assert (YY1, YY2.');
+
+%!assert (ndgrid ([]), zeros(0,1))
+%!assert (ndgrid ([], []), zeros(0,0))
+
+%% Test input validation
+%!error ndgrid ()
+%!error <wrong number of input arguments> [a,b,c] = ndgrid (1:3,1:3)
+%!error <arguments must be vectors> ndgrid (ones (2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/newplot.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,194 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} newplot ()
+## @deftypefnx {Function File} {} newplot (@var{hfig})
+## @deftypefnx {Function File} {} newplot (@var{hax})
+## @deftypefnx {Function File} {@var{hax} =} newplot (@dots{})
+## Prepare graphics engine to produce a new plot.
+##
+## This function is called at the beginning of all high-level plotting
+## functions.  It is not normally required in user programs.  @code{newplot}
+## queries the @qcode{"NextPlot"} field of the current figure and axis to
+## determine what to do.
+##
+## @multitable @columnfractions .25 .75
+## @headitem Figure NextPlot @tab Action
+## @item @qcode{"new"} @tab Create a new figure and make it the current figure.
+##
+## @item @qcode{"add"} (default) @tab Add new graphic objects to the current figure.
+##
+## @item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
+## set to @qcode{"on"}.  Set NextPlot property to @qcode{"add"}.  This
+## typically clears a figure, but leaves in place hidden objects such as
+## menubars.  This is equivalent to @code{clf}.
+##
+## @item @qcode{"replace"} @tab Delete all child objects of the figure and
+## reset all figure properties to their defaults.  However, the following
+## four properties are not reset: Position, Units, PaperPosition, PaperUnits.
+##  This is equivalent to @code{clf reset}.
+## @end multitable
+##
+## @multitable @columnfractions .25 .75
+## @headitem Axis NextPlot @tab Action
+## @item @qcode{"add"} @tab Add new graphic objects to the current axes.  This is
+## equivalent to @code{hold on}.
+##
+## @item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
+## set to @qcode{"on"}, but leave axis properties unmodified.  This typically
+## clears a plot, but preserves special settings such as log scaling for
+## axes.  This is equivalent to @code{cla}.
+##
+## @item @qcode{"replace"} (default) @tab Delete all child objects of the
+## axis and reset all axis properties to their defaults.  However, the
+## following properties are not reset: Position, Units.  This is equivalent
+## to @code{cla reset}.
+## @end multitable
+##
+## If the optional input @var{hfig} or @var{hax} is given then prepare the
+## specified figure or axes rather than the current figure and axes.
+##
+## The optional return value @var{hax} is a graphics handle to the created
+## axes object (not figure).
+##
+## @strong{Caution:} Calling @code{newplot} may change the current figure and
+## current axis.
+## @end deftypefn
+
+## FIXME: The Matlab function takes an optional list of file handles, hsave,
+##        which are not deleted when the figure and axes are prepared.
+##        I'm sure there is a good reason for that, but coding such
+##        compatibility is really tricky and doesn't serve much purpose since
+##        newplot is nearly exclusively used by Octave's internal plotting
+##        functions.  In Octave's case the argument is almost always null,
+##        or occasionally the axis handle to plot into.
+
+function hax = newplot (hsave = [])
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  cf = [];
+  ca = [];
+
+  if (! isempty (hsave))
+    ## Find the first valid axes 
+    ca = ancestor (hsave, "axes", "toplevel"); 
+    ca = ca(find (ca, 1));
+    ## Next, find the figure associated with any axis found
+    if (! isempty (ca))
+      cf = ancestor (ca, "figure", "toplevel");
+    else
+      cf = ancestor (hsave, "figure", "toplevel"); 
+      cf = cf(find (cf, 1));
+    endif
+  endif
+
+  if (isempty (cf))
+    ## get current figure, or create a new one if necessary
+    cf = gcf ();
+  else
+    ## switch to figure provided without causing other updates
+    set (0, "currentfigure", cf);
+  endif
+
+  fnp = get (cf, "nextplot");
+  switch (fnp)
+    case "add"
+      ## Default case.  Doesn't require action.
+    case "new"
+      ## Ordinarily, create a new figure to hold plot.
+      ## But, if user has requested preparing a specific axis, then
+      ## use the existing figure to hold the requested axis.
+      if (isempty (ca))
+        cf = figure ();
+      endif
+    case "replacechildren"
+      kids = get (cf, "children");
+      if (! isempty (ca))
+        kids(kids == ca) = [];
+      endif
+      delete (kids);
+    case "replace"
+      kids = allchild (cf);
+      if (! isempty (ca))
+        kids(kids == ca) = [];
+      endif
+      delete (kids);
+      reset (cf);
+  endswitch
+  set (cf, "nextplot", "add");  # Matlab compatibility
+
+  if (isempty (ca))
+    ca = gca ();
+  else
+    set (cf, "currentaxes", ca);
+  endif
+
+  ## FIXME: Is this necessary anymore?
+  ##        It seems like a kluge that belongs somewhere else.
+  if (strcmp (get (ca, "__hold_all__"), "off"))
+    __next_line_color__ (true);
+    __next_line_style__ (true);
+  else
+    __next_line_color__ (false);
+    __next_line_style__ (false);
+  endif
+
+  anp = get (ca, "nextplot");
+  switch (anp)
+    case "add"
+      ## Default case.  Doesn't require action.
+    case "replacechildren"
+      delete (get (ca, "children"));
+    case "replace"
+      __go_axes_init__ (ca, "replace");
+      __request_drawnow__ ();
+      ## FIXME: The code above should perform the following:
+      ###########################
+      ## delete (allchild (ca));
+      ## reset (ca);
+      ###########################
+      ## Actually, __go_axes_init__ does both less and more.
+      ## It doesn't really remove all children since it re-instantiates
+      ## xlabel, ylabel, zlabel, and title text objects.
+      ## Also it preserves font properties like fontsize.
+      ## For the time being, in order to have axis labels and title work,
+      ## the above code is is required.
+  endswitch
+
+  if (nargout > 0)
+    hax = ca;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   p = plot ([0, 1]);
+%!   hax = newplot ();
+%!   assert (hax, gca);
+%!   assert (isempty (get (gca, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/print.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,710 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} print ()
+## @deftypefnx {Function File} {} print (@var{options})
+## @deftypefnx {Function File} {} print (@var{filename}, @var{options})
+## @deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options})
+## Print a plot, or save it to a file.
+##
+## Both output formatted for printing (PDF and PostScript), and many bitmapped
+## and vector image formats are supported.
+##
+## @var{filename} defines the name of the output file.  If the
+## file name has no suffix, one is inferred from the specified
+## device and appended to the file name.  If no filename is
+## specified, the output is sent to the printer.
+##
+## @var{h} specifies the handle of the figure to print.  If no handle is
+## specified the current figure is used.
+##
+## For output to a printer, PostScript file, or PDF file,
+## the paper size is specified by the figure's @code{papersize}
+## property.  The location and size of the image on the page are
+## specified by the figure's @code{paperposition} property.  The
+## orientation of the page is specified by the figure's
+## @code{paperorientation} property.
+##
+## The width and height of images are specified by the figure's
+## @code{paperpositon(3:4)} property values.
+##
+## The @code{print} command supports many @var{options}:
+##
+## @table @code
+## @item -f@var{h}
+##   Specify the handle, @var{h}, of the figure to be printed.  The
+## default is the current figure.
+##
+## @item -P@var{printer}
+##   Set the @var{printer} name to which the plot is sent if no
+## @var{filename} is specified.
+##
+## @item -G@var{ghostscript_command}
+##   Specify the command for calling Ghostscript.  For Unix and Windows
+## the defaults are @qcode{"gs"} and @qcode{"gswin32c"}, respectively.
+##
+## @item  -color
+## @itemx -mono
+##   Color or monochrome output.
+##
+## @item  -solid
+## @itemx -dashed
+##   Force all lines to be solid or dashed, respectively.
+##
+## @item  -portrait
+## @itemx -landscape
+##   Specify the orientation of the plot for printed output.  For
+## non-printed output the aspect ratio of the output corresponds to
+## the plot area defined by the @qcode{"paperposition"} property in the
+## orientation specified.  This option is equivalent to changing
+## the figure's @qcode{"paperorientation"} property.
+##
+## @item  -TextAlphaBits=@var{n}
+## @itemx -GraphicsAlphaBits=@var{n}
+##   Octave is able to produce output for various printers, bitmaps, and
+## vector formats by using Ghostscript.
+## For bitmap and printer output anti-aliasing is applied using
+## Ghostscript's TextAlphaBits and GraphicsAlphaBits options.
+## The default number of bits for each is 4.
+## Allowed values for @var{N} are 1, 2, or 4.
+##
+## @item -d@var{device}
+##   The available output format is specified by the option @var{device},
+## and is one of:
+##
+##   @table @code
+##   @item  ps
+##   @itemx ps2
+##   @itemx psc
+##   @itemx psc2
+##     PostScript (level 1 and 2, mono and color).  The FLTK graphics
+## toolkit generates PostScript level 3.0.
+##
+##   @item  eps
+##   @itemx eps2
+##   @itemx epsc
+##   @itemx epsc2
+##     Encapsulated PostScript (level 1 and 2, mono and color).  The FLTK
+## graphic toolkit generates PostScript level 3.0.
+##
+##   @item  tex
+##   @itemx epslatex
+##   @itemx epslatexstandalone
+##   @itemx pstex
+##   @itemx pslatex
+##   @itemx pdflatex
+##     Generate a @LaTeX{} (or @TeX{}) file for labels and eps/ps/pdf
+## for graphics.  The file produced by @code{epslatexstandalone} can be
+## processed directly by @LaTeX{}.  The other formats are intended to
+## be included in a @LaTeX{} (or @TeX{}) document.  The @code{tex} device
+## is the same as the @code{epslatex} device.  The @code{pdflatex} device
+## is only available for the FLTK graphics toolkit.
+##
+##   @item tikz
+##     Generate a @LaTeX{} file using PGF/TikZ@.  For the FLTK toolkit
+## the result is PGF.
+##
+##   @item  ill
+##   @itemx aifm
+##     Adobe Illustrator (Obsolete for Gnuplot versions > 4.2)
+##
+##   @item  cdr
+##   @itemx @nospell{corel}
+##     CorelDraw
+##
+##   @item dxf
+##     AutoCAD
+##
+##   @item  emf
+##   @itemx meta
+##     Microsoft Enhanced Metafile
+##
+##   @item fig
+##     XFig.  For the Gnuplot graphics toolkit, the additional options
+## @option{-textspecial} or @option{-textnormal} can be used to control
+## whether the special flag should be set for the text in
+## the figure.  (default is @option{-textnormal})
+##
+##   @item hpgl
+##     HP plotter language
+##
+##   @item mf
+##     Metafont
+##
+##   @item png
+##     Portable network graphics
+##
+##   @item  jpg
+##   @itemx jpeg
+##     JPEG image
+##
+##   @item gif
+##     GIF image (only available for the Gnuplot graphics toolkit)
+##
+##   @item pbm
+##     PBMplus
+##
+##   @item svg
+##     Scalable vector graphics
+##
+##   @item pdf
+##     Portable document format
+##   @end table
+##
+##   If the device is omitted, it is inferred from the file extension,
+## or if there is no filename it is sent to the printer as PostScript.
+##
+## @item -d@var{ghostscript_device}
+##   Additional devices are supported by Ghostscript.
+## Some examples are;
+##
+##   @table @code
+##   @item ljet2p
+##     HP LaserJet @nospell{IIP}
+##
+##   @item ljet3
+##     HP LaserJet III
+##
+##   @item deskjet
+##     HP DeskJet and DeskJet Plus
+##
+##   @item cdj550
+##     HP DeskJet 550C
+##
+##   @item paintjet
+##     HP PointJet
+##
+##   @item pcx24b
+##     24-bit color PCX file format
+##
+##   @item ppm
+##     Portable Pixel Map file format
+##
+##   @item pdfwrite
+##     Produces pdf output from eps
+##   @end table
+##
+##   For a complete list, type @code{system ("gs -h")} to see what formats
+## and devices are available.
+##
+##   When Ghostscript output is sent to a printer the size is determined
+## by the figure's @qcode{"papersize"} property.  When the output
+## is sent to a file the size is determined by the plot box defined by
+## the figure's @qcode{"paperposition"} property.
+##
+## @item -append
+##   Append PostScript or PDF output to a pre-existing file of the same type.
+##
+## @item -r@var{NUM}
+##   Resolution of bitmaps in pixels per inch.  For both metafiles and
+## SVG the default is the screen resolution; for other formats it is 150 dpi.
+## To specify screen resolution, use @qcode{"-r0"}.
+##
+## @item  -loose
+## @itemx -tight
+##   Force a tight or loose bounding box for eps files.  The default is loose.
+##
+## @item -@var{preview}
+##   Add a preview to eps files.  Supported formats are:
+##
+##   @table @code
+##   @item -interchange
+##     Provide an interchange preview.
+##
+##   @item -metalfile
+##     Provide a metafile preview.
+##
+##   @item -pict
+##     Provide pict preview.
+##
+##   @item -tiff
+##     Provide a tiff preview.
+##   @end table
+##
+## @item -S@var{xsize},@var{ysize}
+##   Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG@.  For
+## PS, EPS, PDF, and other vector formats the plot size is in points.
+## This option is equivalent to changing the size of the plot box
+## associated with the @qcode{"paperposition"} property.  When using the
+## command form of the print function you must quote the
+## @var{xsize},@var{ysize} option.  For example, by writing @w{"-S640,480"}.
+##
+## @item  -F@var{fontname}
+## @itemx -F@var{fontname}:@var{size}
+## @itemx -F:@var{size}
+##   Use @var{fontname} and/or @var{fontsize} for all text.
+## @var{fontname} is ignored for some devices: dxf, fig, hpgl, etc.
+## @end table
+##
+## The filename and options can be given in any order.
+##
+## Example: Print to a file using the svg device.
+##
+## @example
+## @group
+## figure (1);
+## clf ();
+## surf (peaks);
+## print -dsvg figure1.svg
+## @end group
+## @end example
+##
+## Example: Print to an HP DeskJet 550C.
+##
+## @example
+## @group
+## clf ();
+## surf (peaks);
+## print -dcdj550
+## @end group
+## @end example
+##
+## @seealso{saveas, orient, figure}
+## @end deftypefn
+
+function print (varargin)
+
+  opts = __print_parse_opts__ (varargin{:});
+
+  opts.pstoedit_cmd = @pstoedit;
+  opts.fig2dev_cmd = @fig2dev;
+  opts.latex_standalone = @latex_standalone;
+  opts.lpr_cmd = @lpr;
+  opts.epstool_cmd = @epstool;
+
+  if (! isfigure (opts.figure))
+    error ("print: no figure to print");
+  endif
+
+  orig_figure = get (0, "currentfigure");
+  set (0, "currentfigure", opts.figure);
+
+  if (opts.append_to_file)
+    [~, ~, ext] = fileparts (opts.ghostscript.output);
+    opts.ghostscript.prepend = strcat (tmpnam (), ext);
+    copyfile (opts.ghostscript.output, opts.ghostscript.prepend);
+  endif
+
+  unwind_protect
+
+    ## Modify properties as specified by options
+    props = [];
+
+    drawnow ();
+
+    ## print() requires figure units to be "pixels"
+    props(1).h = opts.figure;
+    props(1).name = "units";
+    props(1).value = {get(opts.figure, "units")};
+    set (opts.figure, "units", "pixels");
+
+    ## graphics toolkit tranlates figure position to eps bbox in points
+    fpos = get (opts.figure, "position");
+    props(2).h = opts.figure;
+    props(2).name = "position";
+    props(2).value = {fpos};
+    fpos(3:4) = opts.canvas_size;
+    set (opts.figure, "position", fpos);
+
+    ## Set figure background to none. This is done both for
+    ## consistency with Matlab and to elliminate the visible
+    ## box along the figure's perimeter.
+    props(3).h = opts.figure;
+    props(3).name = "color";
+    props(3).value{1} = get (props(3).h, props(3).name);
+    set (props(3).h, "color", "none");
+
+    if (opts.force_solid != 0)
+      h = findall (opts.figure, "-property", "linestyle");
+      m = numel (props);
+      for n = 1:numel (h)
+        props(m+n).h = h(n);
+        props(m+n).name = "linestyle";
+        props(m+n).value = {get(h(n), "linestyle")};
+      endfor
+      if (opts.force_solid > 0)
+        linestyle = "-";
+      else
+        linestyle = "--";
+      endif
+      set (h, "linestyle", linestyle);
+    endif
+
+    if (opts.use_color < 0
+        && ! strcmp (get (opts.figure, "__graphics_toolkit__"), "gnuplot"))
+      color_props = {"color", "facecolor", "edgecolor", "colormap"};
+      for c = 1:numel (color_props)
+        h = findall (opts.figure, "-property", color_props{c});
+        hnone = findall (opts.figure, color_props{c}, "none");
+        h = setdiff (h, hnone);
+        m = numel (props);
+        for n = 1:numel (h)
+          if (ishandle (h(n)))
+            ## Need to verify objects exist since callbacks may delete objects
+            ## as the colors for others are modified.
+            rgb = get (h(n), color_props{c});
+            props(end+1).h = h(n);
+            props(end).name = color_props{c};
+            props(end).value = {get(h(n), color_props{c})};
+            if (isnumeric (rgb))
+              ## convert RGB color to RGB gray scale
+              xfer = repmat ([0.30, 0.59, 0.11], rows (rgb), 1);
+              ggg = repmat (sum (xfer .* rgb, 2), 1, 3);
+              set (h(n), color_props{c}, ggg);
+            endif
+          endif
+        endfor
+      endfor
+    endif
+
+    if (! isempty (opts.font) || ! isempty (opts.fontsize))
+      h = findall (opts.figure, "-property", "fontname");
+      m = numel (props);
+      for n = 1:numel (h)
+        if (ishandle (h(n)))
+          if (! isempty (opts.font))
+            props(end+1).h = h(n);
+            props(end).name = "fontname";
+            props(end).value = {get(h(n), "fontname")};
+          endif
+        endif
+        if (ishandle (h(n)))
+          if (! isempty (opts.fontsize))
+            props(end+1).h = h(n);
+            props(end).name = "fontsize";
+            props(end).value = {get(h(n), "fontsize")};
+          endif
+        endif
+      endfor
+      if (! isempty (opts.font))
+        set (h(ishandle (h)), "fontname", opts.font);
+      endif
+      if (! isempty (opts.fontsize))
+        if (ischar (opts.fontsize))
+          fontsize = str2double (opts.fontsize);
+        else
+          fontsize = opts.fontsize;
+        endif
+        if (! isempty (opts.scalefontsize) && ! opts.scalefontsize != 1)
+          ## This is done to work around the bbox being whole numbers.
+          fontsize = fontsize * opts.scalefontsize;
+        endif
+        set (h(ishandle (h)), "fontsize", fontsize);
+      endif
+    endif
+
+    ## call the graphcis toolkit print script
+    switch (get (opts.figure, "__graphics_toolkit__"))
+      case "gnuplot"
+        opts = __gnuplot_print__ (opts);
+      otherwise
+        opts = __fltk_print__ (opts);
+    endswitch
+
+  unwind_protect_cleanup
+    ## restore modified properties
+    if (isstruct (props))
+      for n = numel (props):-1:1
+        if (ishandle (props(n).h))
+          set (props(n).h, props(n).name, props(n).value{1});
+        endif
+      endfor
+    endif
+
+    ## Unlink temporary files
+    for n = 1:numel (opts.unlink)
+      [status, output] = unlink (opts.unlink{n});
+      if (status != 0)
+        warning ("print.m: %s, '%s'", output, opts.unlink{n});
+      endif
+    endfor
+  end_unwind_protect
+
+  if (isfigure (orig_figure))
+    set (0, "currentfigure", orig_figure);
+  endif
+
+endfunction
+
+function cmd = epstool (opts, filein, fileout)
+  ## As epstool does not work with pipes, a subshell is used to
+  ## permit piping. Since this solution does not work with the DOS
+  ## command shell, the -tight and -preview options are disabled if
+  ## output must be piped.
+
+  ## DOS Shell:
+  ##   gs.exe [...] -sOutputFile=<filein> - & epstool -bbox -preview-tiff <filein> <fileout> & del <filein>
+  ## Unix Shell;
+  ##   cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein>
+
+  dos_shell = (ispc () && ! isunix ());
+
+  cleanup = "";
+  if (nargin < 3)
+    fileout = opts.name;
+  elseif (isempty (fileout))
+    fileout = "-";
+  endif
+
+  if (nargin < 2 || strcmp (filein, "-") || isempty (filein))
+    pipein = true;
+    filein = strcat (tmpnam (), ".eps");
+    if (dos_shell)
+      cleanup = sprintf ("& del %s ", strrep (filein, '/', '\'));
+    else
+      cleanup = sprintf ("; rm %s ", filein);
+    endif
+  else
+    pipein = false;
+    filein = strcat ("'", strtrim (filein), "'");
+  endif
+  if (strcmp (fileout, "-"))
+    pipeout = true;
+    fileout = strcat (tmpnam (), ".eps");
+    if (dos_shell)
+      cleanup = horzcat (cleanup, sprintf ("& del %s ", strrep (fileout, '/', '\')));
+    else
+      cleanup = horzcat (cleanup, sprintf ("; rm %s ", fileout));
+    endif
+  else
+    pipeout = false;
+    fileout = strcat ("'", strtrim (fileout), "'");
+  endif
+
+  if (! isempty (opts.preview) && opts.tight_flag)
+    warning ("print:previewandtight",
+             "print.m: eps preview may not be combined with -tight");
+  endif
+  if (! isempty (opts.preview) || opts.tight_flag)
+    if (! isempty (opts.epstool_binary))
+      if (opts.tight_flag)
+        cmd = "--copy --bbox";
+      elseif (! isempty (opts.preview))
+        switch (opts.preview)
+          case "tiff"
+            cmd = sprintf ("--add-%s-preview --device tiffg3", opts.preview);
+          case {"tiff6u", "tiff6p", "metafile"}
+            cmd = sprintf ("--add-%s-preview --device bmpgray", opts.preview);
+          case {"tiff4", "interchange"}
+            cmd = sprintf ("--add-%s-preview", opts.preview);
+          case "pict"
+            cmd = sprintf ("--add-%s-preview --mac-single", opts.preview);
+          otherwise
+            error ("print:invalidpreview",
+                   "print.m: epstool cannot include preview for format '%s'",
+                   opts.preview);
+        endswitch
+        if (! isempty (opts.ghostscript.resolution))
+          cmd = sprintf ("%s --dpi %d", cmd, opts.ghostscript.resolution);
+        endif
+      else
+        cmd = "";
+      endif
+      if (! isempty (cmd))
+        cmd = sprintf ("%s --quiet %s %s %s ", opts.epstool_binary,
+                       cmd, filein, fileout);
+      endif
+      if (pipein)
+        if (dos_shell)
+          filein(filein=="'") = "\"";
+          gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
+                                    "device", "epswrite",
+                                    "source", "-",
+                                    "output", filein);
+          cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd);
+        else
+          cmd = sprintf ("cat > %s ; %s", filein, cmd);
+        endif
+      endif
+      if (pipeout)
+        if (dos_shell)
+          cmd = sprintf ("%s & type %s", cmd, fileout);
+        else
+          cmd = sprintf ("%s ; cat %s", cmd, fileout);
+        endif
+      endif
+      if (! isempty (cleanup))
+        if (pipeout && dos_shell)
+          error ("print:epstoolpipe",
+                 "print.m: cannot pipe output of 'epstool' for DOS shell");
+        elseif (pipeout)
+          cmd = sprintf ("( %s %s )", cmd, cleanup);
+        else
+          cmd = sprintf ("%s %s", cmd, cleanup);
+        endif
+      endif
+    elseif (isempty (opts.epstool_binary))
+      error ("print:noepstool", "print.m: 'epstool' not found in PATH");
+    endif
+  else
+    if (pipein && pipeout)
+      if (dos_shell)
+        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
+                               "device", "epswrite",
+                               "source", "-",
+                               "output", "-");
+      else
+        cmd = " cat ";
+      endif
+    elseif (pipein && ! pipeout)
+      if (dos_shell)
+        ## ghostscript expects double, not single, quotes
+        fileout(fileout=="'") = "\"";
+        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
+                               "device", "epswrite",
+                               "source", "-",
+                               "output", fileout);
+      else
+        cmd = sprintf (" cat > %s ", fileout);
+      endif
+    elseif (! pipein && pipeout)
+      if (dos_shell)
+        cmd = sprintf (" type %s ", filein);
+      else
+        cmd = sprintf (" cat %s ", filein);
+      endif
+    else
+      if (dos_shell)
+        cmd = sprintf (" copy %s %s ", filein, fileout);
+      else
+        cmd = sprintf (" cp %s %s ", filein, fileout);
+      endif
+    endif
+  endif
+  if (opts.debug)
+    fprintf ("epstool command: '%s'\n", cmd);
+  endif
+endfunction
+
+function cmd = fig2dev (opts, devopt)
+  if (nargin < 2)
+    devopt =  opts.devopt;
+  endif
+  dos_shell = (ispc () && ! isunix ());
+  if (! isempty (opts.fig2dev_binary))
+    if (dos_shell)
+      ## FIXME - is this the right thing to do for DOS?
+      cmd = sprintf ("%s -L %s 2> NUL", opts.fig2dev_binary, devopt);
+    else
+      cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt);
+    endif
+  elseif (isempty (opts.fig2dev_binary))
+    error ("print:nofig2dev", "print.m: 'fig2dev' not found in PATH");
+  endif
+  if (opts.debug)
+    fprintf ("fig2dev command: '%s'\n", cmd);
+  endif
+endfunction
+
+function latex_standalone (opts)
+  n = find (opts.name == ".", 1, "last");
+  if (! isempty (n))
+    opts.name = opts.name(1:n-1);
+  endif
+  latexfile = strcat (opts.name, ".tex");
+  switch (opts.devopt)
+    case {"pdflatexstandalone"}
+      packages = "\\usepackage{graphicx,color}";
+      graphicsfile = strcat (opts.name, "-inc.pdf");
+    case {"pslatexstandalone"}
+      packages = "\\usepackage{epsfig,color}";
+      graphicsfile = strcat (opts.name, "-inc.ps");
+    otherwise
+      packages = "\\usepackage{epsfig,color}";
+      graphicsfile = strcat (opts.name, "-inc.eps");
+  endswitch
+  papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}",
+                       opts.canvas_size, opts.canvas_size);
+  prepend = {"\\documentclass{minimal}";
+             packages;
+             papersize;
+             "\\begin{document}";
+             "\\centering"};
+  postpend = {"\\end{document}"};
+  fid = fopen (latexfile, "r");
+  if (fid >= 0)
+    latex = fscanf (fid, "%c", Inf);
+    status = fclose (fid);
+    if (status != 0)
+      error ("print:errorclosingfile",
+             "print.m: error closing file '%s'", latexfile);
+    endif
+    ## TODO - should this be fixed in GL2PS?
+    latex = strrep (latex, "\\includegraphics{}",
+                    sprintf ("\\includegraphics{%s}", graphicsfile));
+  else
+    error ("print:erroropeningfile",
+           "print.m: error opening file '%s'", latexfile);
+  endif
+  fid = fopen (latexfile, "w");
+  if (fid >= 0)
+    fprintf (fid, "%s\n", prepend{:});
+    fprintf (fid, "%s", latex);
+    fprintf (fid, "%s\n", postpend{:});
+    status = fclose (fid);
+    if (status != 0)
+      error ("print:errorclosingfile",
+             "print.m: error closing file '%s'", latexfile);
+    endif
+  else
+    error ("print:erroropeningfile",
+           "print.m: error opening file '%s'", latexfile);
+  endif
+endfunction
+
+function cmd = lpr (opts)
+  if (nargin < 2)
+    devopt =  opts.devopt;
+  endif
+  if (! isempty (opts.lpr_binary))
+    cmd = opts.lpr_binary;
+    if (! isempty (opts.lpr_options))
+      cmd = sprintf ("%s %s", cmd, opts.lpr_options);
+    endif
+    if (! isempty (opts.printer))
+      cmd = sprintf ("%s -P %s", cmd, opts.printer);
+    endif
+  elseif (isempty (opts.lpr_binary))
+    error ("print:nolpr", "print.m: 'lpr' not found in PATH");
+  endif
+  if (opts.debug)
+    fprintf ("lpr command: '%s'\n", cmd);
+  endif
+endfunction
+
+function cmd = pstoedit (opts, devopt)
+  if (nargin < 2)
+    devopt =  opts.devopt;
+  endif
+  dos_shell = (ispc () && ! isunix ());
+  if (! isempty (opts.pstoedit_binary))
+    if (dos_shell)
+      cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt);
+    else
+      ## FIXME - is this the right thing to do for DOS?
+      cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt);
+    endif
+  elseif (isempty (opts.pstoedit_binary))
+    error ("print:nopstoedit", "print.m: 'pstoedit' not found in PATH");
+  endif
+  if (opts.debug)
+    fprintf ("pstoedit command: '%s'\n", cmd);
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/printd.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,115 @@
+## Copyright (C) 2013 Michael D. Godfrey
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public
+## License as published by the Free Software Foundation;
+## either version 3 of the License, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied
+## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+## PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public
+## License along with Octave; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} printd (@var{obj}, @var{filename})
+## @deftypefnx {Function File} {@var{out_file} =} printd (@dots{})
+##
+## Convert any object acceptable to @code{disp} into the format
+## selected by the suffix of @var{filename}.  If the return argument
+## @var{out_file} is given, the name of the created file is returned.
+##
+## This function is intended to facilitate manipulation of the output
+## of functions such as @code{stemleaf}.
+## @seealso{stemleaf}
+## @end deftypefn
+
+## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
+## Description: Convert objects into other file formats.
+
+function pr_out = printd (obj, filename)
+  ## Convert any object acceptable to disp() into various display formats.
+  ## obj is the input object.
+  ## filename is the output file (with required suffix).
+
+  ## Extract .suffix from filename
+  if ((sufix = rindex (filename, ".")) <= 0)
+    error ("The output filename: %s requires a suffix.\nOptions are: pdf ps eps txt jpg jpeg", filename);
+  endif
+  opt = substr (filename, sufix+1);
+  [pf, tempf, mag] = mkstemp ("oct-XXXXXX", 1);  # Safe version of tmpnam()
+  fprintf (pf, "%s", disp (obj));
+  frewind (pf);
+
+  ## It seems best to only use convert for image output.  Its ps and pdf
+  ## are badly rendered.
+  opt = lower (opt);
+  switch (opt)
+    case "pdf"
+      enscr = sprintf (
+                       "enscript --no-header -o %s.ps %s ; ps2pdf %s.ps %s.pdf; mv %s.pdf %s;exit",...
+                       tempf, tempf, tempf, tempf, tempf, filename);
+      system (enscr);
+      delete ([tempf ".ps"]);
+    case "ps"
+      enscr = sprintf ("enscript --no-header -o %s %s ; exit", filename, tempf);
+      system (enscr);
+    case "eps"
+      enscr = sprintf (
+                       "enscript --no-header -o %s.ps %s ; ps2eps --ignoreBB %s.ps; mv %s.eps %s; exit",...
+                       tempf, tempf, tempf, tempf, filename);
+      system (enscr);
+      delete ([tempf ".ps"]);
+    case "txt"
+      enscr = sprintf ("cp %s %s", tempf, filename);
+      system (enscr);
+    case {"jpg", "jpeg"}
+      enscr = sprintf ("convert -trim txt:%s  jpg:%s", tempf, filename);
+      system (enscr);
+    otherwise
+      fclose (pf);
+      delete (tempf);
+      error ("Unknown conversion type: %s.\nOptions are: pdf ps eps txt jpg jpeg", opt);
+
+  endswitch
+  fclose (pf);
+  delete (tempf);
+  pr_out =  sprintf ("%s file %s written\n", opt, filename);
+endfunction
+
+
+%!demo
+%! r2 = char (
+%! 'stem step: 10, data: unsorted.',
+%! 'Hinges:    lo: 12, hi: 42'     ,
+%! '   1 | 22118'                  ,
+%! '   2 | 28'                     ,
+%! '   3 | 98'                     ,
+%! '   4 | 244'                    ,
+%! '   5 | 2'                      );
+%! printd (r2, 'test_p.txt');
+%! system ('cat test_p.txt');
+%! delete ('test_p.txt');
+
+%!test
+%! r2 = char (
+%! "stem step: 10, data: unsorted.",
+%! "Hinges:    lo: 12, hi: 42"     ,
+%! "   1 | 22118"                  ,
+%! "   2 | 28"                     ,
+%! "   3 | 98"                     ,
+%! "   4 | 244"                    ,
+%! "   5 | 2"                      );
+%! printd (r2, "test_p.txt");
+%! r4 = fileread ("test_p.txt");
+%! delete ("test_p.txt");
+%! r2 = disp (r2);
+%! assert (r4, r2);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__add_default_menu__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,119 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __add_default_menu__ (@var{fig})
+## Add default menu to figure.  All uimenu handles have
+## their @qcode{"HandleVisibility"} property set to @qcode{"off"}.
+## @end deftypefn
+
+## Author: Kai Habel
+
+function __add_default_menu__ (fig)
+
+  ## Only FLTK toolkit currently provides menubar
+  if (! strcmp (get (fig, "__graphics_toolkit__"), "fltk"))
+    return;
+  endif
+
+  obj = findall (fig, "-depth", 1, "tag", "__default_menu__", "label", "&File");
+  if (isempty (obj))
+    ## FIXME: uimenu() will cause menubar to be displayed, even though property
+    ##        menubar remains set at "none".  So, forcibly turn menubar status
+    ##        on and then off to force figure to hide menubar.
+    menubar_state = get (fig, "menubar");
+    set (fig, "menubar", "figure");
+
+    __f = uimenu (fig, "label", "&File", "handlevisibility", "off",
+                       "tag", "__default_menu__");
+      uimenu (__f, "label", "Save &As", "callback", @save_cb);
+      uimenu (__f, "label", "&Save", "callback", @save_cb);
+      uimenu (__f, "label", "&Close", "callback", "close (gcf)");
+
+    __e = uimenu (fig, "label", "&Edit", "handlevisibility", "off",
+                       "tag", "__default_menu__");
+      uimenu (__e, "label", "&Grid", "callback", @grid_cb);
+      uimenu (__e, "label", "Auto&scale", "callback", @autoscale_cb);
+      gm = uimenu (__e, "label", "GUI &Mode");
+        uimenu (gm, "label", "Pan+Zoom", "callback", @guimode_cb);
+        uimenu (gm, "label", "Rotate+Zoom", "callback", @guimode_cb);
+        uimenu (gm, "label", "None", "callback", @guimode_cb);
+
+    __h = uimenu (fig, "label", "&Help", "handlevisibility", "off",
+                       "tag", "__default_menu__");
+      uimenu (__h, "label", "A&bout", "enable", "off");
+
+    ## FIXME: This drawnow () must occur after at least one menu item has
+    ##        been defined to avoid sizing issues in new figures.
+    ##        This may lead to flicker.  The real fix must be in the C++ code. 
+    drawnow ();
+
+    set (fig, "menubar", menubar_state);
+  endif
+
+endfunction
+
+function save_cb (h, e)
+  lbl = get (gcbo, "label");
+  if (strcmp (lbl, "&Save"))
+    fname = get (gcbo, "userdata");
+    if (isempty (fname))
+      __save_as__ (gcbo);
+    else
+      saveas (gcbo, fname);
+    endif
+  elseif (strcmp (lbl, "Save &As"))
+    __save_as__ (gcbo);
+  endif
+endfunction
+
+function __save_as__ (caller)
+  [filename, filedir] = uiputfile ({"*.pdf;*.ps;*.gif;*.png;*.jpg",
+                                    "Supported Graphic Formats"},
+                                   "Save Figure",
+                                   pwd);
+  if (filename != 0)
+    fname = [filedir filesep() filename];
+    obj = findall (gcbf, "label", "&Save");
+    if (! isempty (obj))
+      set (obj(1), "userdata", fname);
+    endif
+    saveas (caller, fname);
+  endif
+endfunction
+
+function grid_cb (h, e)
+  grid;
+endfunction
+
+function autoscale_cb (h, e)
+  axis ("auto");
+endfunction
+
+function guimode_cb (h, e)
+  lbl = get (h, "label");
+  switch (lbl)
+    case "Pan+Zoom"
+      gui_mode ("2D");
+    case "Rotate+Zoom"
+      gui_mode ("3D");
+    case "None"
+      gui_mode ("None");
+  endswitch
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__fltk_ginput__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,95 @@
+## Copyright (C) 2010-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __fltk_ginput__ (@var{f}, @var{n})
+## Undocumented internal function.
+## @end deftypefn
+
+## This is ginput.m implementation for fltk.
+
+function [x, y, button] = __fltk_ginput__ (f, n = -1)
+
+  if (isempty (get (f, "currentaxes")))
+    error ("ginput: must have at least one axes");
+  endif
+
+  x = y = button = [];
+  ginput_accumulator (0, 0, 0, 0);  # initialize accumulator
+
+  unwind_protect
+
+    orig_windowbuttondownfcn = get (f, "windowbuttondownfcn");
+    set (f, "windowbuttondownfcn", @ginput_windowbuttondownfcn);
+
+    orig_ginput_keypressfcn = get (f, "keypressfcn");
+    set (f, "keypressfcn", @ginput_keypressfcn);
+
+    do
+      __fltk_redraw__ ();
+
+      ## Release CPU.
+      sleep (0.01);
+
+      [x, y, n0, button] = ginput_accumulator (-1, 0, 0, 0);
+    until (n0 == n || n0 < 0)
+
+  unwind_protect_cleanup
+    set (f, "windowbuttondownfcn", orig_windowbuttondownfcn);
+    set (f, "keypressfcn", orig_ginput_keypressfcn);
+  end_unwind_protect
+
+endfunction
+
+function [x, y, n, button] = ginput_accumulator (mode, xn, yn, btn)
+  persistent x y n button;
+
+  if (mode == 0)
+    ## Initialize.
+    x = y = button = [];
+    n = 0;
+  elseif (mode == 1)
+    ## Append mouse button or key press.
+    x = [x; xn];
+    y = [y; yn];
+    button = [button; btn];
+    n += 1;
+  elseif (mode == 2)
+    ## The end due to Enter.
+    n = -1;
+ endif
+
+endfunction
+
+function ginput_windowbuttondownfcn (src, data)
+  point = get (get (src,"currentaxes"), "currentpoint");
+  button = data;
+  ginput_accumulator (1, point(1,1), point(2,1), button);
+endfunction
+
+function ginput_keypressfcn (src, evt)
+  point = get (get (src, "currentaxes"), "currentpoint");
+  key = evt.Key;
+  if (key == 10)
+    ## Enter key stops ginput.
+    ginput_accumulator (2, NaN, NaN, NaN);
+  else
+    ginput_accumulator (1, point(1,1), point(2,1), key);
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__fltk_print__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,174 @@
+## Copyright (C) 2010-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __fltk_print__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+function opts = __fltk_print__ (opts)
+
+  dos_shell = (ispc () && ! isunix ());
+
+  set (0, "currentfigure", opts.figure);
+  drawnow ("expose");
+  __fltk_redraw__ ();
+
+  if (! isempty (opts.fig2dev_binary))
+    ## fig2dev is prefered for conversion to emf
+    fig2dev_devices = {"pstex", "mf", "emf"};
+  else
+    fig2dev_devices = {"pstex", "mf"};
+  endif
+
+  gl2ps_device = {};
+  pipeline = {};
+  switch (lower (opts.devopt))
+    case {"eps", "eps2", "epsc", "epsc2"}
+      ## format GL2PS_EPS
+      gl2ps_device = {"eps"};
+      ## FIXME: use epstool to tighten bbox and provide preview.
+      pipeline = {opts.epstool_cmd(opts, "-", opts.name)};
+    case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ...
+          "pslatexstandalone", "pdflatexstandalone"}
+      ## format GL2PS_TEX
+      n = find (opts.devopt == "l", 1);
+      suffix = opts.devopt(1:n-1);
+      dot = find (opts.name == ".", 1, "last");
+      if ((! isempty (dot))
+          && any (strcmpi (opts.name(dot:end), ...
+                  {strcat(".", suffix), ".tex", "."})))
+        name = opts.name(1:dot-1);
+        if (dot < numel (opts.name)
+            && any (strcmpi (opts.name(dot+1:end), {"eps", "ps", "pdf"})))
+          ## If user provides eps/ps/pdf suffix, use it.
+          suffix = opts.name(dot+1:end);
+        endif
+      else
+        error ("print:invalid-suffix", 
+               "invalid suffix '%s' for device '%s'.",
+               opts.name(dot:end), lower (opts.devopt));
+      endif
+      gl2ps_device = {sprintf("%snotxt", lower (suffix))};
+      gl2ps_device{2} = "tex";
+      if (dos_shell)
+        ## FIXME: this will only work on MinGW with the MSYS shell
+        pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
+        pipeline{2} = sprintf ("cat > %s.tex", name);
+      else
+        pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
+        pipeline{2} = sprintf ("cat > %s.tex", name);
+      endif
+    case "tikz"
+      ## format GL2PS_PGF
+      gl2ps_device = {"pgf"};
+      pipeline = {sprintf("cat > %s", opts.name)};
+    case "svg"
+      ## format GL2PS_SVG
+      gl2ps_device = {"svg"};
+      pipeline = {sprintf("cat > %s", opts.name)};
+    case fig2dev_devices
+      cmd_pstoedit = opts.pstoedit_cmd (opts, "fig");
+      cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt);
+      if (strcmp (opts.devopt, "pstex"))
+        [~, ~, ext] = fileparts (opts.name);
+        if (any (strcmpi (ext, {".ps", ".tex", "."})))
+          opts.name = opts.name(1:end-numel(ext));
+        endif
+        opts.name = strcat (opts.name, ".ps");
+        cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
+        gl2ps_device = {"eps"};
+        pipeline = {cmd};
+        cmd_fig2dev = opts.fig2dev_cmd (opts, "pstex_t");
+        gl2ps_device{2} = "eps";
+        pipeline{2} = sprintf ("%s | %s > %s", cmd_pstoedit,
+                               cmd_fig2dev, strrep(opts.name, ".ps", ".tex"));
+      else
+        cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
+        gl2ps_device = {"eps"};
+        pipeline = {cmd};
+      endif
+    case "aifm"
+      cmd = opts.pstoedit_cmd (opts, "ps2ai");
+      gl2ps_device = {"eps"};
+      pipeline = {sprintf("%s > %s", cmd, opts.name)};
+    case {"dxf", "emf", "fig", "hpgl"}
+      cmd = opts.pstoedit_cmd (opts);
+      gl2ps_device = {"eps"};
+      pipeline = {sprintf("%s > %s", cmd, opts.name)};
+    case {"corel", "gif"}
+      error ("print:unsupporteddevice",
+             "print.m: %s output is not available for the FLTK graphics toolkit",
+             upper (opts.devopt));
+    case opts.ghostscript.device
+      opts.ghostscript.source = "-";
+      opts.ghostscript.output = opts.name;
+      if (opts.send_to_printer)
+        opts.unlink(strcmp (opts.unlink, opts.ghostscript.output)) = [];
+        opts.ghostscript.output = "-";
+      endif
+      [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
+      if (opts.send_to_printer || isempty (opts.name))
+        cmd_lpr = opts.lpr_cmd (opts);
+        cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr);
+      else
+        cmd = sprintf ("%s", cmd_gs);
+      endif
+      if (! isempty (cmd_cleanup))
+        gl2ps_device = {"eps"};
+        if (dos_shell)
+          pipeline = {sprintf("%s & %s", cmd, cmd_cleanup)};
+        else
+          pipeline = {sprintf("%s ; %s", cmd, cmd_cleanup)};
+        endif
+      else
+        gl2ps_device = {"eps"};
+        pipeline = {cmd};
+      endif
+    otherwise
+      error (sprintf ("print:no%soutput", opts.devopt),
+             "print.m: %s output is not available for GL2PS output",
+             upper (opts.devopt));
+  endswitch
+
+  opts.pipeline = pipeline;
+
+  ## Tell gl2ps to use different rendering options for 2D plots
+  haxes = findall (opts.figure, "type", "axes");
+  vw = get (haxes, "view");
+  if (iscell (vw))
+    vw = vertcat (vw{:});
+  endif
+  is2D = all (abs (vw(:,2)) == 90);
+  if (is2D)
+    gl2ps_device{end} = [gl2ps_device{end}, "is2D"];
+  endif
+
+  for n = 1:numel (pipeline)
+    if (opts.debug)
+      fprintf ("fltk-pipeline: '%s'\n", pipeline{n});
+    endif
+    drawnow (gl2ps_device{n}, strcat ('|',pipeline{n}));
+  endfor
+
+  if (! isempty (strfind (opts.devopt, "standalone")))
+    opts.latex_standalone (opts);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__ghostscript__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,171 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __ghostscript__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-07-26
+
+function [gs_cmd, cleanup_cmd] = __ghostscript__ (varargin);
+
+  opts.binary = "";
+  opts.source = "-";
+  opts.output = "-";
+  opts.device = "";
+  opts.epscrop = false;
+  opts.antialiasing  = false;
+  opts.antialiasing_textalphabits = 4;,
+  opts.antialiasing_graphicsalphabits = 4;
+  opts.resolution = 150;
+  opts.papersize = "";
+  opts.pageoffset = [0 0];
+  opts.debug = false;
+  opts.level = [];
+  opts.prepend = "";
+
+  offsetfile = "";
+  offset_ps = {};
+  cleanup_cmd = "";
+
+  args = varargin;
+  n = find (cellfun ("isclass", args, "struct"));
+  if (! isempty (n))
+    f = fieldnames (args{n});
+    for m = 1:numel (f)
+      opts.(f{m}) = args{n}.(f{m});
+    endfor
+    args(n) = [];
+  endif
+  for n = 1:2:numel (args)
+    opts.(args{n}) = args{n+1};
+  endfor
+
+  if (isempty (opts.papersize))
+    format_for_printer = false;
+  else
+    format_for_printer = true;
+  endif
+
+  gs_opts = sprintf ("-dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=%s", opts.device);
+
+  if (! isempty (opts.level) && ismember (opts.level, [1, 2, 3]))
+    gs_opts = sprintf ("%s -dLanguageLevel=%d", gs_opts, round (opts.level));
+  endif
+
+  if (opts.antialiasing && isempty (strfind (opts.device, "write")))
+    ## Apply anti-aliasing to all bitmap formats/devices
+    gs_opts = sprintf ("%s -dTextAlphaBits=%d -dGraphicsAlphaBits=%d",
+                       gs_opts, opts.antialiasing_textalphabits,
+                       opts.antialiasing_graphicsalphabits);
+    gs_opts = sprintf ("%s -r%dx%d", gs_opts, [1, 1] * opts.resolution);
+  elseif (any (strcmp (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
+    gs_opts = sprintf ("%s -dEmbedAllFonts=true", gs_opts);
+    if (strcmp (opts.device, "pdfwrite"))
+      ## Optimize for loading
+      gs_opts = sprintf ("%s -dOptimize=true", gs_opts);
+    endif
+  endif
+
+  if (opts.epscrop)
+    ## papersize is specified by the eps bbox
+    gs_opts = sprintf ("%s -dEPSCrop", gs_opts);
+  endif
+  if (format_for_printer)
+    if (ischar (opts.papersize))
+      gs_opts = sprintf ("%s -sPAPERSIZE=%s", gs_opts, opts.papersize);
+    elseif (isnumeric (opts.papersize) && numel (opts.papersize) == 2)
+      gs_opts = sprintf ("%s -dDEVICEWIDTHPOINTS=%d -dDEVICEHEIGHTPOINTS=%d",
+                         gs_opts, opts.papersize);
+      if (opts.papersize(1) > opts.papersize(2))
+        ## Lanscape mode: This option will result in automatic rotation of the
+        ##                document page if the requested page size matches one
+        ##                of the default page sizes
+        gs_opts = sprintf ("%s -dNORANGEPAGESIZE", gs_opts);
+      endif
+    else
+      error ("print:badpapersize", "__ghostscript__.m: invalid 'papersize'");
+    endif
+    gs_opts = sprintf ("%s -dFIXEDMEDIA", gs_opts);
+    ## "pageoffset" is relative to the coordinates, not the BBox LLHC.
+    str = sprintf ("%s [%d %d] %s", "<< /Margins [0 0] /.HWMargins [0 0 0 0] /PageOffset",
+                   opts.pageoffset, ">> setpagedevice");
+    offset_ps = {"%!PS-Adobe-3.0", str, "%%EOF"};
+    if (isfield (opts, "offsetfile"))
+      offsetfile = opts.offsetfile;
+      cleanup_cmd = "";
+    else
+      offsetfile = strcat (tmpnam (), ".ps");
+      cleanup_cmd = sprintf ("rm %s", offsetfile);
+    endif
+    unwind_protect
+      fid = fopen (offsetfile, "w");
+      if (fid == -1)
+        error ("print:fopenfailed", "__ghostscript__.m: fopen () failed");
+      endif
+      fprintf (fid, "%s\n", offset_ps{:});
+    unwind_protect_cleanup
+      status = fclose (fid);
+      if (status == -1)
+        error ("print:fclosefailed", "__ghostscript__.m: fclose () failed");
+      endif
+    end_unwind_protect
+    if (opts.debug)
+      fprintf ("---- begin %s ----\n", offsetfile);
+      fprintf ("%s\n", offset_ps{:});
+      fprintf ("----- end %s -----\n", offsetfile);
+    endif
+  endif
+
+  if (isempty (opts.binary))
+    error ("print:no_ghostscript", "__ghostscript__.m: ghostscript is required.");
+  elseif (isempty (opts.output))
+    cmd = sprintf ("%s %s", opts.binary, gs_opts);
+  else
+    cmd = sprintf ("%s %s -sOutputFile=\"%s\"", opts.binary, gs_opts, opts.output);
+  endif
+  if (! isempty (opts.prepend)
+      && any (strcmpi (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
+    ## FIXME - Fonts get may be mangled when appending ps/ps2.
+    ##         See "How to concatenate several PS files" at the link,
+    ##         http://en.wikibooks.org/wiki/PostScript_FAQ
+    cmd = sprintf ("%s %s", cmd, opts.prepend);
+    if (isempty (cleanup_cmd))
+      cleanup_cmd = sprintf ("rm %s", opts.prepend);
+    else
+      cleanup_cmd = sprintf ("%s ; rm %s", cleanup_cmd, opts.prepend);
+    endif
+  endif
+  if (! isempty (offsetfile) && format_for_printer)
+    cmd = sprintf ("%s %s", cmd, offsetfile);
+  endif
+  if (! isempty (opts.source))
+    cmd = sprintf ("%s %s", cmd, opts.source);
+  endif
+
+  if (opts.debug)
+    fprintf ("Ghostscript command: '%s'\n", cmd);
+  endif
+
+  gs_cmd = cmd;
+
+endfunction
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_get_var__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,150 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{value} =} __gnuplot_get_var__ (@var{h}, @var{name}, @var{fmt})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2009-02-07
+
+function gp_var_value = __gnuplot_get_var__ (h, gp_var_name, fmt = "")
+
+  if (numel (h) == 1 && isfigure (h))
+    if (isempty (get (gcf, "__plot_stream__")))
+      ostream = __gnuplot_open_stream__ (2, h);
+    else
+      ostream = get (h, "__plot_stream__");
+    endif
+  else
+    ostream = h;
+  endif
+  if (numel (ostream) < 1)
+    error ("__gnuplot_get_var__: stream to gnuplot not open");
+  elseif (ispc ())
+    if (numel (ostream) == 1)
+      error ("__gnuplot_get_var__: Need mkfifo that is not implemented under Windows");
+    endif
+    use_mkfifo = false;
+    istream = ostream(2);
+    ostream = ostream(1);
+  else
+    use_mkfifo = true;
+    ostream = ostream(1);
+  endif
+
+  if (use_mkfifo)
+    gpin_name = tmpnam ();
+
+    ## Mode: 0600 == 6*8*8
+    [err, msg] = mkfifo (gpin_name, 6*8*8);
+
+    if (err)
+      error ("__gnuplot_get_var__: Can not make FIFO (%s)", msg);
+    endif
+  endif
+
+  gp_var_name = strtrim (gp_var_name);
+  n = min (strfind (gp_var_name, " "), strfind (gp_var_name, ",")) - 1;
+  if (isempty (n))
+    n = numel (gp_var_name);
+  endif
+
+  unwind_protect
+
+    ## Notes: Variables may be undefined if user closes gnuplot by "q"
+    ## or Alt-F4.  Further, this abrupt close also requires the leading
+    ## "\n" on the next line.
+    if (use_mkfifo)
+      fprintf (ostream, "\nset print \"%s\";\n", gpin_name);
+      fflush (ostream);
+      [gpin, err] = fopen (gpin_name, "r");
+      if (err)
+        ## Try a second time, and then give an error.
+        [gpin, err] = fopen (gpin_name, "r");
+      endif
+      if (err)
+        error ("__gnuplot_get_var__: can not open FIFO");
+      endif
+      gp_cmd = sprintf ("\nif (exists(\"%s\")) print %s; else print NaN\n",
+                        gp_var_name(1:n), gp_var_name);
+      fputs (ostream, gp_cmd);
+
+      ## Close output file, to force it to be flushed
+      fputs (ostream, "set print;\n");
+      fflush (ostream);
+
+      ## Now read from fifo.
+      reading = true;
+      str = {};
+      while (reading)
+        str{end+1} = fgets (gpin);
+        if (isnumeric (str{end}) && (str{end} == -1))
+          reading = false;
+          str = str(1:(end-1));
+        endif
+      endwhile
+      str = strcat (str{:});
+      fclose (gpin);
+    else
+      ## Direct gnuplot to print to <STDOUT>
+      fprintf (ostream, "set print \"-\";\n");
+      fflush (ostream);
+      gp_cmd = sprintf ("\nif (exists(\"%s\")) print \"OCTAVE: \", %s; else print NaN\n",
+                        gp_var_name(1:n), gp_var_name);
+      fputs (ostream, gp_cmd);
+      fflush (ostream);
+      ## Direct gnuplot to print to <STDERR>
+      fputs (ostream, "set print;\n");
+      fflush (ostream);
+
+      str = {};
+      while (isempty (str))
+        str = fread (istream, "*char")';
+        if (isempty (str))
+          sleep (0.05);
+        else
+          str = regexp (str, 'OCTAVE:.*', "match");
+          str = str{end}(8:end);
+        endif
+        fclear (istream);
+      endwhile
+    endif
+
+    ## Strip out EOLs and the continuation character "|"
+    str(str=="\n" | str=="\r") = "";
+    n_continue = strfind (str, " \\ ");
+    if (! isempty (n_continue))
+      str(n_continue+1) = "";
+    endif
+
+    if (isempty (fmt))
+      gp_var_value = strtrim (str);
+    else
+      gp_var_value = sscanf (str, fmt);
+    endif
+
+  unwind_protect_cleanup
+    if (use_mkfifo)
+      unlink (gpin_name);
+    endif
+  end_unwind_protect
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_ginput__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,149 @@
+## Copyright (C) 2004-2012 Petr Mikulik
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __gnuplot_ginput__ (@var{f}, @var{n})
+## Undocumented internal function.
+## @end deftypefn
+
+## This is ginput.m implementation for gnuplot and X11.
+## It requires gnuplot 4.1 and later.
+
+## This file initially bore the copyright statement
+## Petr Mikulik
+## History: June 2006; August 2005; June 2004; April 2004
+## License: public domain
+
+function [x, y, button] = __gnuplot_ginput__ (f, n)
+
+  if (compare_versions (__gnuplot_version__ (), "4.0", "<="))
+    error ("ginput: version %s of gnuplot not supported", gnuplot_version ());
+  endif
+
+  ostream = get (f, "__plot_stream__");
+  if (numel (ostream) < 1)
+    error ("ginput: stream to gnuplot not open");
+  elseif (ispc ())
+    if (numel (ostream) == 1)
+      error ("ginput: Need mkfifo that is not implemented under Windows");
+    endif
+    use_mkfifo = false;
+    istream = ostream(2);
+    ostream = ostream(1);
+  else
+    use_mkfifo = true;
+    ostream = ostream(1);
+  endif
+
+  if (nargin == 1)
+    x = zeros (100, 1);
+    y = zeros (100, 1);
+    button = zeros (100, 1);
+  else
+    x = zeros (n, 1);
+    y = zeros (n, 1);
+    button = zeros (n, 1);
+  endif
+
+  if (use_mkfifo)
+    gpin_name = tmpnam ();
+
+    ##Mode: 6*8*8 ==  0600
+    [err, msg] = mkfifo (gpin_name, 6*8*8);
+
+    if (err)
+      error ("ginput: Can not open fifo (%s)", msg);
+    endif
+  endif
+
+  unwind_protect
+
+    k = 0;
+    while (true)
+      k++;
+
+      ## Notes: MOUSE_* can be undefined if user closes gnuplot by "q"
+      ## or Alt-F4. Further, this abrupt close also requires the leading
+      ## "\n" on the next line.
+      if (use_mkfifo)
+        fprintf (ostream, "set print \"%s\";\n", gpin_name);
+        fflush (ostream);
+        [gpin, err] = fopen (gpin_name, "r");
+        if (err)
+          error ("ginput: Can not open FIFO (%s)", msg);
+        endif
+        fputs (ostream, "pause mouse any;\n\n");
+        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
+
+        ## Close output file, to force it to be flushed
+        fputs (ostream, "set print;\n");
+        fflush (ostream);
+
+        ## Now read from fifo.
+        [x(k), y(k), button(k), count] = fscanf (gpin, "%f %f %d", "C");
+        fclose (gpin);
+      else
+        fputs (ostream, "set print \"-\";\n");
+        fflush (ostream);
+        fputs (ostream, "pause mouse any;\n\n");
+        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print \"OCTAVE: \", MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
+
+        ## Close output file, to force it to be flushed
+        fputs (ostream, "set print;\n");
+        fflush (ostream);
+
+        str = {};
+        while (isempty (str))
+          str = fread (istream, "*char")';
+          if (isempty (str))
+            sleep (0.05);
+          else
+            str = regexp (str, 'OCTAVE:\s+[-+.\d]+\s+[-+.\d]+\s+\d*', 'match');
+          endif
+          fclear (istream);
+        endwhile
+        [x(k), y(k), button(k), count] = sscanf (str{end}(8:end), "%f %f %d", "C");
+      endif
+
+      if ([x(k), y(k), button(k)] == [0, 0, -1])
+        ## Mousing not active (no plot yet).
+        break;
+      endif
+
+      if (button(k) == 0x0D || button(k) == 0x0A)
+        ## Stop when hitting a RETURN or ENTER key.
+        x(k:end) = [];
+        y(k:end) = [];
+        button(k:end) = [];
+        break;
+      endif
+      if (nargin > 1 && k == n)
+        ## Input argument n was given, stop when k == n.
+        break;
+      endif
+
+    endwhile
+
+  unwind_protect_cleanup
+    if (use_mkfifo)
+      unlink (gpin_name);
+    endif
+  end_unwind_protect
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_has_feature__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,64 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{has_feature} =} __gnuplot_has_feature__ (@var{feature})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2009-01-27
+
+function res = __gnuplot_has_feature__ (feature)
+  persistent features = {"x11_figure_position",
+                         "wxt_figure_size",
+                         "transparent_patches",
+                         "transparent_surface",
+                         "epslatex_implies_eps_filesuffix",
+                         "epslatexstandalone_terminal",
+                         "screen_coordinates_for_{lrtb}margin",
+                         "variable_GPVAL_TERMINALS",
+                         "key_has_font_properties",
+                         "windows_figure_position",
+                         "has_termoption_dashed"};
+  persistent has_features;
+
+  if (isempty (has_features))
+    try
+      gnuplot_version = __gnuplot_version__ ();
+    catch
+      ## Don't throw an error if gnuplot isn't installed
+      gnuplot_version = "0.0.0";
+    end_try_catch
+    versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3"};
+    operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
+    have_features = false (size (features));
+    for n = 1 : numel (have_features)
+      has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});
+    endfor
+  endif
+
+  n = find (strcmpi (feature, features));
+  if (isempty (n))
+    res = NaN;
+  else
+    res = has_features(n);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_has_terminal__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,65 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{has_terminal} =} __gnuplot_has_terminal__ (@var{terminal})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-09-13
+
+function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream)
+
+  term = strtrim (term);
+  term = lower (strtok (term, " "));
+
+  if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
+    if (nargin < 2)
+      plot_stream = __gnuplot_open_stream__ (2);
+    endif
+    available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
+    available_terminals = regexp (available_terminals, '\w+', "match");
+    if (nargin < 2 && ! isempty (plot_stream))
+      pclose (plot_stream(1));
+      if (numel (plot_stream) > 1)
+        pclose (plot_stream(2));
+      endif
+      if (numel (plot_stream) > 2)
+        waitpid (plot_stream(3));
+      endif
+    endif
+  else
+    ## Gnuplot 4.0 terminals. No new terminals were added until 4.4 which
+    ## allows the list of terminals to be obtained from GPVAL_TERMINALS.
+    available_terminals = {"aifm", "aqua", "canvas", "cgm", "corel", ...
+                           "dumb", "dxf", "eepic", "emf", "epslatex", ...
+                           "epson_180dpi", "fig", "gif", "gnugraph", ...
+                           "gpic", "hp2623A", "hp2648", "hp500c", ...
+                           "hpgl", "hpljii", "hppj", "imagen", "jpeg", ...
+                           "latex", "mf", "mif", "mp", "pbm", "pdf", ...
+                           "pm", "png", "postscript", "pslatex", ...
+                           "pstex", "pstricks", "qms", "regis", "rgip", ...
+                           "svg", "texdraw", "tgif", "tkcanvas", ...
+                           "tpic", "windows", "x11", "xlib", "xterm"};
+  endif
+
+  gnuplot_supports_term = any (strcmp (term, available_terminals));
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_open_stream__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,46 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{stream} =} __gnuplot_open_stream__ (@var{npipes}, @var{h})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2009-04-11
+
+function plot_stream = __gnuplot_open_stream__ (npipes, h)
+  [prog, args] = gnuplot_binary ();
+  if (npipes > 1)
+    [plot_stream(1), plot_stream(2), pid] = popen2 (prog, args{:});
+    if (pid < 0)
+      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
+    else
+      plot_stream(3) = pid;
+    endif
+  else
+    plot_stream = popen (sprintf ("%s ", prog, args{:}), "w");
+    if (plot_stream < 0)
+      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
+    endif
+  endif
+  if (nargin > 1)
+    set (h, "__plot_stream__", plot_stream);
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_print__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,316 @@
+## Copyright (C) 1999-2012 Daniel Heiserer
+## Copyright (C) 2001 Laurent Mazet
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __gnuplot_print__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
+## Adapted-By: jwe
+
+function opts = __gnuplot_print__ (opts)
+
+  dos_shell = (ispc () && ! isunix ());
+
+  if (isempty (opts.fontsize))
+    ## If no fontsize, determine the nominal axes fontsize.
+    defaultfontsize = get (0, "defaultaxesfontsize");
+    axesfontsize = get (findobj (opts.figure, "type", "axes"), "fontsize");
+    if (iscell (axesfontsize))
+      axesfontsize = round (median (cell2mat (axesfontsize)));
+    endif
+    if (isempty (axesfontsize))
+      opts.fontsize = defaultfontsize;
+    else
+      opts.fontsize = axesfontsize;
+    endif
+  endif
+  ## The axes-label and tick-label spacing is determined by
+  ## the font spec given in "set terminal ..."
+  gp_opts = font_spec (opts);
+
+  pipeline = "";
+
+  switch (lower (opts.devopt))
+    case {"eps", "eps2", "epsc", "epsc2"}
+      if (any (strcmp (opts.devopt, {"eps", "epsc"})))
+        gp_opts = [gp_opts " level1"];
+      endif
+      if (opts.tight_flag || ! isempty (opts.preview))
+        tmp_file = strcat (tmpnam (), ".eps");
+        eps_drawnow (opts, tmp_file, gp_opts);
+        if (dos_shell)
+          cleanup = [" & del " strrep(tmp_file, '/', '\')];
+        else
+          cleanup = [" ; rm " tmp_file];
+        endif
+        pipeline = {sprintf("%s %s",
+                            opts.epstool_cmd (opts, tmp_file, opts.name),
+                            cleanup)};
+      else
+        eps_drawnow (opts, opts.name, gp_opts);
+      endif
+    case {"epslatex", "pslatex", "pstex", "epslatexstandalone"}
+      dot = find (opts.name == ".", 1, "last");
+      n = find (opts.devopt == "l", 1);
+      suffix = opts.devopt(1:n-1);
+      if (! isempty (dot))
+        if (any (strcmpi (opts.name(dot:end), {["." suffix], ".tex", "."})))
+          name = opts.name(1:dot-1);
+        else
+          error ("print:invalid-suffix", 
+                 "invalid suffix '%s' for device '%s'.",
+                 opts.name(dot:end), lower (opts.devopt));
+        endif
+      endif
+      if (strfind (opts.devopt, "standalone"))
+        term = sprintf ("%s ",
+                        strrep (opts.devopt, "standalone", " standalone"));
+      else
+        term = sprintf ("%s ", opts.devopt);
+      endif
+      if (__gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
+        suffix = "tex";
+      else
+        ## Gnuplot 4.0 wants a ".eps" suffix.
+        suffix = "eps";
+      endif
+      local_drawnow ([term " " gp_opts],
+                     strcat (name, ".", suffix), opts);
+    case "tikz"
+      if (__gnuplot_has_terminal__ ("tikz"))
+        local_drawnow (["lua tikz " gp_opts], opts.name, opts);
+      else
+        error (sprintf ("print:no%soutput", opts.devopt),
+               "print.m: '%s' output is not available for gnuplot-%s",
+               upper (opts.devopt), __gnuplot_version__ ());
+      endif
+    case "svg"
+      local_drawnow (["svg dynamic " gp_opts], opts.name, opts);
+    case {"aifm", "corel", "eepic", "emf", "fig"}
+      local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
+    case {"pdfcairo", "pngcairo"}
+      if (__gnuplot_has_terminal__ (opts.devopt))
+        local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
+      else
+        error (sprintf ("print:no%soutput", opts.devopt),
+               "print.m: '%s' output is not available for gnuplot-%s",
+               upper (opts.devopt), __gnuplot_version__ ());
+      endif
+    case {"canvas", "dxf", "hpgl", "mf", "gif", "pstricks", "texdraw"}
+      local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
+    case opts.ghostscript.device
+      gp_opts = font_spec (opts, "devopt", "eps");
+      opts.ghostscript.output = opts.name;
+      opts.ghostscript.source = strcat (tmpnam (), ".eps");
+      eps_drawnow (opts, opts.ghostscript.source, gp_opts);
+      [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
+      if (opts.send_to_printer || isempty (opts.name))
+        cmd_lpr = opts.lpr_cmd (opts);
+        cmd = [cmd_gs " | " cmd_lpr];
+      else
+        cmd = cmd_gs;
+      endif
+      if (dos_shell)
+        cmd = sprintf ("%s & del %s", cmd,
+                       strrep (opts.ghostscript.source, '/', '\'));
+      else
+        cmd = sprintf ("%s ; rm %s", cmd, opts.ghostscript.source);
+      endif
+      if (! isempty (cmd_cleanup))
+        if (dos_shell)
+          pipeline = {[cmd " & " cmd_cleanup]};
+        else
+          pipeline = {[cmd " ; " cmd_cleanup]};
+        endif
+      else
+        pipeline = {cmd};
+      endif
+    otherwise
+      error (sprintf ("print:no%soutput", opts.devopt),
+             "print.m: %s output is not available for the Gnuplot graphics toolkit",
+             upper (opts.devopt));
+  endswitch
+
+
+  opts.pipeline = pipeline;
+
+  for n = 1:numel (pipeline)
+    if (opts.debug)
+      fprintf ("gnuplot-pipeline: '%s'\n", pipeline{n});
+    endif
+    [status, output] = system (pipeline{n});
+    if (status)
+      fprintf ("%s\n%s\n%s\n",
+               "---------- output begin ----------",
+               output,
+               "----------- output end -----------");
+      error ("gnuplot:failedpipe", "print: failed to print");
+    endif
+  endfor
+
+endfunction
+
+function eps_drawnow (opts, epsfile, gp_opts)
+  [h, fontsize] = get_figure_text_objs (opts);
+  unwind_protect
+    fontsize_2x = cellfun (@times, {2}, fontsize, "uniformoutput", false);
+    set (h, {"fontsize"}, fontsize_2x);
+    local_drawnow (["postscript eps " gp_opts], epsfile, opts);
+  unwind_protect_cleanup
+    set (h, {"fontsize"}, fontsize);
+  end_unwind_protect
+endfunction
+
+function local_drawnow (term, file, opts)
+  if (opts.use_color < 0)
+    mono = true;
+  else
+    mono = false;
+  endif
+  set (0, "currentfigure", opts.figure);
+  if (isempty (opts.debug_file) || ! opts.debug)
+    drawnow (term, file, mono);
+  else
+    drawnow (term, file, mono, opts.debug_file);
+  endif
+endfunction
+
+function f = font_spec (opts, varargin)
+  for n = 1:2:numel (varargin)
+    opts.(varargin{n}) = varargin{n+1};
+  endfor
+  f = "";
+  switch (opts.devopt)
+    case "cgm"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case {"eps", "eps2", "epsc", "epsc2"}
+      ## Gnuplot renders fonts as half their specification, which
+      ## results in a tight spacing for the axes-labels and tick-labels.
+      ## Compensate for the half scale. This will produce the proper
+      ## spacing for the requested fontsize.
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, 2 * opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", 2 * opts.fontsize);
+      endif
+    case "svg"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        fontsize = round (opts.fontsize * 0.75);
+        f = sprintf ('fname "%s" fsize %d', opts.font, fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('fname "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        fontsize = round (opts.fontsize * 0.75);
+        f = sprintf ("%s fsize %d", f, fontsize);
+      endif
+    case "pdf"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("fsize %d", f, opts.fontsize);
+      endif
+    case {"pdfcairo", "pngcairo"}
+      if (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      endif
+    case {"epslatex", "epslatexstandalone"}
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case "pslatex"
+      if (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case {"gif", "jpeg", "png"}
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s ,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ('font "%d"', opts.fontsize);
+      endif
+    case "emf"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('"%s" %d', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('"%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case "canvas"
+      if (! isempty (opts.fontsize))
+        f = sprintf ("fsize %d", opts.fontsize);
+      endif
+    case {"aifm", "corel"}
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ("%s %d", opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ("%s", opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case "fig"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ("font %s fontsize %d", opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ("font %s", opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("fontsize %d", opts.fontsize);
+      endif
+  endswitch
+endfunction
+
+function [h, fontsize] = get_figure_text_objs (opts)
+  h = findall (opts.figure, "-property", "fontsize");
+  hp = get (h, "parent");
+  if (iscell (hp))
+    hp = cell2mat (hp);
+  endif
+  ## Do not change the text objects fontsizes for the children of a
+  ## legend axes.  These will be handled by the fontsize listener.
+  is_legend_key_string = strcmp (get (hp, "tag"), "legend") ...
+                       & isprop (hp, "string") ...
+                       & isprop (hp, "location") ...
+                       & strcmp (get (hp, "type"), "axes");
+  h(is_legend_key_string) = [];
+  fontsize = get (h, "fontsize");
+  switch (numel (fontsize))
+    case 0
+      fontsize = {};
+    case 1
+      fontsize = {fontsize};
+  endswitch
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_version__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,51 @@
+## Copyright (C) 2006-2012 Daniel Sebald
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{version} =} __gnuplot_version__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Return the version of gnuplot we are using.  Note that we do not
+## attempt to handle the case of the user switching to different
+## versions of gnuplot during the same session.
+
+function version = __gnuplot_version__ ()
+
+  persistent __version__ = "";
+
+  if (isempty (__version__))
+    [status, output] = system (sprintf ('"%s" --version', gnuplot_binary ()));
+    if (status != 0)
+      ## This message ends in a newline so that the traceback messages
+      ## are skipped and people might actually see the message, read it,
+      ## comprehend it, take the advice it gives, and stop asking us
+      ## why plotting fails when gnuplot is not found.
+      error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n");
+    endif
+    output = strrep (output, "gnuplot", "");
+    output = strrep (output, "patchlevel", ".");
+    output = strrep (output, "\n", "");
+    output = strrep (output, "\r", "");
+    __version__ = strrep (output, " ", "");
+  endif
+
+  version = __version__;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__go_draw_axes__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,2662 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __go_draw_axes__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function __go_draw_axes__ (h, plot_stream, enhanced, mono,
+                           bg_is_set, fg_is_set, hlgnd)
+
+  showhiddenhandles = get (0, "showhiddenhandles");
+  unwind_protect
+    set (0, "showhiddenhandles", "on");
+    axis_obj = __get__ (h);
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", showhiddenhandles);
+  end_unwind_protect
+
+  parent_figure_obj = get (axis_obj.parent);
+  gnuplot_term = __gnuplot_get_var__ (axis_obj.parent, "GPVAL_TERM");
+
+  ## Set to false for plotyy axes.
+  ymirror = true;
+  if (isfield (axis_obj, "__plotyy_axes__"))
+    if (all (ishandle (axis_obj.__plotyy_axes__)))
+      ymirror = false;
+    else
+      h = axis_obj.__plotyy_axes__;
+      h = h(ishandle (h));
+      h = h(isprop (h, "__plotyy_axes__"));
+      rmappdata (h, "__plotyy_axes__");
+    endif
+  endif
+
+  nd = __calc_dimensions__ (h);
+
+  if (strcmp (axis_obj.dataaspectratiomode, "manual")
+      && strcmp (axis_obj.xlimmode, "manual")
+      && strcmp (axis_obj.ylimmode, "manual"))
+    ## All can't be "manual"
+    axis_obj.plotboxaspectratiomode = "auto";
+  endif
+
+  if (strcmp (axis_obj.dataaspectratiomode, "manual")
+      && strcmp (axis_obj.xlimmode, "manual")
+      && strcmp (axis_obj.ylimmode, "manual")
+      && (nd == 2 || all (mod (axis_obj.view, 90) == 0)))
+    ## FIXME - adjust plotboxaspectratio to respect other
+    fpos = get (axis_obj.parent, "position");
+    apos = axis_obj.position;
+  endif
+
+  pos = __actual_axis_position__ (h);
+
+  if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
+    dr = axis_obj.dataaspectratio;
+    if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
+      dr = dr(1) / dr(2);
+    else
+      ## FIXME - need to properly implement 3D
+      dr = mean (dr(1:2)) / dr(3);
+    endif
+  else
+    dr = 1;
+  endif
+
+  if (strcmp (axis_obj.activepositionproperty, "position"))
+    if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin"))
+      if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
+        x = [1, 1];
+      else
+        ## 3D plots need to be sized down to fit in the window.
+        x = 1.0 ./ sqrt ([2, 2.5]);
+      endif
+      fprintf (plot_stream, "set tmargin screen %.15g;\n",
+               pos(2)+pos(4)/2+x(2)*pos(4)/2);
+      fprintf (plot_stream, "set bmargin screen %.15g;\n",
+               pos(2)+pos(4)/2-x(2)*pos(4)/2);
+      fprintf (plot_stream, "set lmargin screen %.15g;\n",
+               pos(1)+pos(3)/2-x(1)*pos(3)/2);
+      fprintf (plot_stream, "set rmargin screen %.15g;\n",
+               pos(1)+pos(3)/2+x(1)*pos(3)/2);
+      sz_str = "";
+    else
+      fprintf (plot_stream, "set tmargin 0;\n");
+      fprintf (plot_stream, "set bmargin 0;\n");
+      fprintf (plot_stream, "set lmargin 0;\n");
+      fprintf (plot_stream, "set rmargin 0;\n");
+
+      if (nd == 3 && all (axis_obj.view == [0, 90]))
+        ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot
+        pos(3:4) = pos(3:4) * 1.4;
+        pos(1:2) = pos(1:2) - pos(3:4) * 0.125;
+      endif
+
+      fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2));
+
+      if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
+        sz_str = sprintf ("set size ratio %.15g", -dr);
+      else
+        sz_str = "set size noratio";
+      endif
+      sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4));
+    endif
+  else ## activepositionproperty == outerposition
+    fprintf (plot_stream, "unset tmargin;\n");
+    fprintf (plot_stream, "unset bmargin;\n");
+    fprintf (plot_stream, "unset lmargin;\n");
+    fprintf (plot_stream, "unset rmargin;\n");
+    fprintf (plot_stream, "set origin %g, %g;\n", pos(1:2));
+    sz_str = "";
+    if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
+      sz_str = sprintf ("ratio %g", -dr);
+    else
+      sz_str = "noratio";
+    endif
+    sz_str = sprintf ("set size %s %g, %g;\n", sz_str, pos(3:4));
+  endif
+  if (! isempty (sz_str))
+    fputs (plot_stream, sz_str);
+  endif
+
+  ## Reset all labels, axis-labels, tick-labels, and title
+  ## FIXME - We should have an function to initialize the axis.
+  ##         Presently, this is dispersed in this function.
+  fputs (plot_stream, "unset label;\n");
+  fputs (plot_stream, "unset xtics;\n");
+  fputs (plot_stream, "unset ytics;\n");
+  fputs (plot_stream, "unset ztics;\n");
+  fputs (plot_stream, "unset x2tics;\n");
+  fputs (plot_stream, "unset x2tics;\n");
+
+  if (! isempty (axis_obj.title))
+    t = get (axis_obj.title);
+    if (isempty (t.string))
+      fputs (plot_stream, "unset title;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      fprintf (plot_stream, "set title \"%s\" %s %s;\n",
+               undo_string_escapes (tt), fontspec,
+               __do_enhanced_option__ (enhanced, t));
+    endif
+  endif
+
+  if (! isempty (axis_obj.xlabel))
+    t = get (axis_obj.xlabel);
+    angle = t.rotation;
+    colorspec = get_text_colorspec (axis_obj.xcolor, mono);
+    if (isempty (t.string))
+      fprintf (plot_stream, "unset xlabel;\n");
+      fprintf (plot_stream, "unset x2label;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      if (strcmpi (axis_obj.xaxislocation, "top"))
+        fprintf (plot_stream, "set x2label \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      else
+        fprintf (plot_stream, "set xlabel \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      endif
+      fprintf (plot_stream, " rotate by %f;\n", angle);
+      if (strcmpi (axis_obj.xaxislocation, "top"))
+        fprintf (plot_stream, "unset xlabel;\n");
+      else
+        fprintf (plot_stream, "unset x2label;\n");
+      endif
+    endif
+  endif
+
+  if (! isempty (axis_obj.ylabel))
+    t = get (axis_obj.ylabel);
+    angle = t.rotation;
+    colorspec = get_text_colorspec (axis_obj.ycolor, mono);
+    if (isempty (t.string))
+      fprintf (plot_stream, "unset ylabel;\n");
+      fprintf (plot_stream, "unset y2label;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      if (strcmpi (axis_obj.yaxislocation, "right"))
+        fprintf (plot_stream, "set y2label \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      else
+        fprintf (plot_stream, "set ylabel \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      endif
+      fprintf (plot_stream, " rotate by %f;\n", angle);
+      if (strcmpi (axis_obj.yaxislocation, "right"))
+        fprintf (plot_stream, "unset ylabel;\n");
+      else
+        fprintf (plot_stream, "unset y2label;\n");
+      endif
+    endif
+  endif
+
+  if (! isempty (axis_obj.zlabel))
+    t = get (axis_obj.zlabel);
+    angle = t.rotation;
+    colorspec = get_text_colorspec (axis_obj.zcolor, mono);
+    if (isempty (t.string))
+      fputs (plot_stream, "unset zlabel;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      fprintf (plot_stream, "set zlabel \"%s\" %s %s %s",
+               undo_string_escapes (tt), colorspec, fontspec,
+               __do_enhanced_option__ (enhanced, t));
+      fprintf (plot_stream, " rotate by %f;\n", angle);
+    endif
+  endif
+
+  if (strcmpi (axis_obj.xaxislocation, "top"))
+    xaxisloc = "x2";
+    xaxisloc_using = "x2";
+  else
+    xaxisloc = "x";
+    xaxisloc_using = "x1";
+    if (strcmpi (axis_obj.xaxislocation, "zero"))
+      fputs (plot_stream, "set xzeroaxis;\n");
+    endif
+  endif
+  if (strcmpi (axis_obj.yaxislocation, "right"))
+    yaxisloc = "y2";
+    yaxisloc_using = "y2";
+  else
+    yaxisloc = "y";
+    yaxisloc_using = "y1";
+    if (strcmpi (axis_obj.yaxislocation, "zero"))
+      fputs (plot_stream, "set yzeroaxis;\n");
+    endif
+  endif
+
+  have_grid = false;
+
+  if (strcmpi (axis_obj.xgrid, "on"))
+    have_grid = true;
+    fprintf (plot_stream, "set grid %stics;\n", xaxisloc);
+  else
+    fprintf (plot_stream, "set grid no%stics;\n", xaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.ygrid, "on"))
+    have_grid = true;
+    fprintf (plot_stream, "set grid %stics;\n", yaxisloc);
+  else
+    fprintf (plot_stream, "set grid no%stics;\n", yaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.zgrid, "on"))
+    have_grid = true;
+    fputs (plot_stream, "set grid ztics;\n");
+  else
+    fputs (plot_stream, "set grid noztics;\n");
+  endif
+
+  if (strcmpi (axis_obj.xminorgrid, "on"))
+    have_grid = true;
+    if (strcmp (axis_obj.xscale, "log"))
+      m = 10;
+    else
+      m = 5;
+    endif
+    fprintf (plot_stream, "set m%stics %d;\n", xaxisloc, m);
+    fprintf (plot_stream, "set grid m%stics;\n", xaxisloc);
+  else
+    fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.yminorgrid, "on"))
+    have_grid = true;
+    if (strcmp (axis_obj.yscale, "log"))
+      m = 10;
+    else
+      m = 5;
+    endif
+    fprintf (plot_stream, "set m%stics %d;\n", yaxisloc, m);
+    fprintf (plot_stream, "set grid m%stics;\n", yaxisloc);
+  else
+    fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.zminorgrid, "on"))
+    have_grid = true;
+    if (strcmp (axis_obj.zscale, "log"))
+      m = 10;
+    else
+      m = 5;
+    endif
+    fprintf (plot_stream, "set mztics %d;\n", m);
+    fputs (plot_stream, "set grid mztics;\n");
+  else
+    fputs (plot_stream, "set grid nomztics;\n");
+  endif
+
+  ## The grid front/back/layerdefault option also controls the
+  ## appearance of tics, so it is used even if the grid is absent.
+  if (strcmpi (axis_obj.layer, "top"))
+    fputs (plot_stream, "set grid front;\n");
+    fputs (plot_stream, "set border front;\n");
+  else
+    fputs (plot_stream, "set grid layerdefault;\n");
+    ## FIXME -- the gnuplot help says that "layerdefault" should work
+    ## for set border too, but it fails for me with gnuplot 4.2.5.  So
+    ## use "back" instead.
+    fputs (plot_stream, "set border back;\n");
+  endif
+
+  fprintf (plot_stream, "set grid linewidth %f, linewidth %f;\n",
+           axis_obj.linewidth, axis_obj.linewidth);
+
+  if (! have_grid)
+    fputs (plot_stream, "unset grid;\n");
+  endif
+
+  xlogscale = strcmpi (axis_obj.xscale, "log");
+  ylogscale = strcmpi (axis_obj.yscale, "log");
+  zlogscale = strcmpi (axis_obj.zscale, "log");
+
+  ## Detect logscale and negative lims
+  if (xlogscale && all (axis_obj.xlim < 0))
+    axis_obj.xsgn = -1;
+    if (strcmp (axis_obj.xdir, "reverse"))
+      axis_obj.xdir = "normal";
+    elseif (strcmp (axis_obj.xdir, "normal"))
+      axis_obj.xdir = "reverse";
+    endif
+    axis_obj.xtick = -flip (axis_obj.xtick);
+    axis_obj.xticklabel = flip (axis_obj.xticklabel);
+    axis_obj.xlim = -flip (axis_obj.xlim);
+  else
+    axis_obj.xsgn = 1;
+  endif
+  if (ylogscale && all (axis_obj.ylim < 0))
+    axis_obj.ysgn = -1;
+    if (strcmp (axis_obj.ydir, "reverse"))
+      axis_obj.ydir = "normal";
+    elseif (strcmp (axis_obj.ydir, "normal"))
+      axis_obj.ydir = "reverse";
+    endif
+    axis_obj.ytick = -flip (axis_obj.ytick);
+    axis_obj.yticklabel = flip (axis_obj.yticklabel);
+    axis_obj.ylim = -flip (axis_obj.ylim);
+  else
+    axis_obj.ysgn = 1;
+  endif
+  if (zlogscale && all (axis_obj.zlim < 0))
+    axis_obj.zsgn = -1;
+    if (strcmp (axis_obj.zdir, "reverse"))
+      axis_obj.zdir = "normal";
+    elseif (strcmp (axis_obj.zdir, "normal"))
+      axis_obj.zdir = "reverse";
+    endif
+    axis_obj.ztick = -flip (axis_obj.ztick);
+    axis_obj.zticklabel = flip (axis_obj.zticklabel);
+    axis_obj.zlim = -flip (axis_obj.zlim);
+  else
+    axis_obj.zsgn = 1;
+  endif
+
+  xlim = axis_obj.xlim;
+  ylim = axis_obj.ylim;
+  zlim = axis_obj.zlim;
+  clim = axis_obj.clim;
+
+  do_tics (axis_obj, plot_stream, ymirror, mono, gnuplot_term);
+
+  fputs (plot_stream, "unset logscale;\n");
+  if (xlogscale)
+    fprintf (plot_stream, "set logscale %s;\n", xaxisloc);
+  endif
+  if (ylogscale)
+    fprintf (plot_stream, "set logscale %s;\n", yaxisloc);
+  endif
+  if (zlogscale)
+    fputs (plot_stream, "set logscale z;\n");
+  endif
+
+  xautoscale = strcmpi (axis_obj.xlimmode, "auto");
+  yautoscale = strcmpi (axis_obj.ylimmode, "auto");
+  zautoscale = strcmpi (axis_obj.zlimmode, "auto");
+  cautoscale = strcmpi (axis_obj.climmode, "auto");
+  cdatadirect = false;
+  truecolor = false;
+
+  fputs (plot_stream, "set clip two;\n");
+
+  kids = axis_obj.children;
+  ## Remove the axis labels and title from the children, and
+  ## preserved the original order.
+  [jnk, k] = setdiff (kids, [axis_obj.xlabel; axis_obj.ylabel; ...
+                             axis_obj.zlabel; axis_obj.title]);
+  kids = kids (sort (k));
+
+  if (nd == 3)
+    fputs (plot_stream, "set parametric;\n");
+    fputs (plot_stream, "set style data lines;\n");
+    fputs (plot_stream, "set surface;\n");
+    fputs (plot_stream, "unset contour;\n");
+  endif
+
+  data_idx = 0;
+  data = cell ();
+  is_image_data = [];
+  hidden_removal = NaN;
+  view_map = false;
+
+  if (! cautoscale && clim(1) == clim(2))
+    clim(2)++;
+  endif
+  addedcmap = [];
+
+  ximg_data = {};
+  ximg_data_idx = 0;
+
+  while (! isempty (kids))
+
+    obj = get (kids(end));
+
+    if (isfield (obj, "xdata"))
+      obj.xdata = double (obj.xdata);
+    endif
+    if (isfield (obj, "ydata"))
+      obj.ydata = double (obj.ydata);
+    endif
+    if (isfield (obj, "zdata"))
+      obj.zdata = double (obj.zdata);
+    endif
+
+    if (isfield (obj, "units"))
+      units = obj.units;
+      unwind_protect
+        set (kids(end), "units", "data");
+        obj = get (kids(end));
+      unwind_protect_cleanup
+        set (kids(end), "units", units);
+      end_unwind_protect
+    endif
+    kids = kids(1:(end-1));
+
+    if (strcmp (obj.visible, "off"))
+      continue;
+    endif
+
+    if (xlogscale && isfield (obj, "xdata"))
+      obj.xdata = axis_obj.xsgn * obj.xdata;
+      obj.xdata(obj.xdata<=0) = NaN;
+    endif
+    if (ylogscale && isfield (obj, "ydata"))
+      obj.ydata = axis_obj.ysgn * obj.ydata;
+      obj.ydata(obj.ydata<=0) = NaN;
+    endif
+    if (zlogscale && isfield (obj, "zdata"))
+      obj.zdata = axis_obj.zsgn * obj.zdata;
+      obj.zdata(obj.zdata<=0) = NaN;
+    endif
+
+    ## Check for facecolor interpolation for surfaces.
+    doing_interp_color = ...
+       isfield (obj, "facecolor") && strcmp (obj.facecolor, "interp");
+
+    switch (obj.type)
+      case "image"
+        img_data = obj.cdata;
+        img_xdata = obj.xdata;
+        img_ydata = obj.ydata;
+
+        if (ndims (img_data) == 3)
+          truecolor = true;
+        elseif (strcmpi (obj.cdatamapping, "direct"))
+          cdatadirect = true;
+        endif
+        data_idx++;
+        is_image_data(data_idx) = true;
+        parametric(data_idx) = false;
+        have_cdata(data_idx) = false;
+        have_3d_patch(data_idx) = false;
+
+        if (img_xdata(2) < img_xdata(1))
+          img_xdata = img_xdata(2:-1:1);
+          img_data = img_data(:,end:-1:1,:);
+        elseif (img_xdata(1) == img_xdata(2))
+          img_xdata = img_xdata(1) + [0, columns(img_data)-1];
+        endif
+        if (img_ydata(2) < img_ydata(1))
+          img_ydata = img_ydata(2:-1:1);
+          img_data = img_data(end:-1:1,:,:);
+        elseif (img_ydata(1) == img_ydata(2))
+          img_ydata = img_ydata(1) + [0, rows(img_data)-1];
+        endif
+
+        [y_dim, x_dim] = size (img_data(:,:,1));
+        if (x_dim > 1)
+          dx = abs (img_xdata(2)-img_xdata(1))/(x_dim-1);
+        else
+          x_dim = 2;
+          img_data = [img_data, img_data];
+          dx = abs (img_xdata(2)-img_xdata(1));
+        endif
+        if (y_dim > 1)
+          dy = abs (img_ydata(2)-img_ydata(1))/(y_dim-1);
+        else
+          y_dim = 2;
+          img_data = [img_data; img_data];
+          dy = abs (img_ydata(2)-img_ydata(1));
+        endif
+
+        x_origin = min (img_xdata);
+        y_origin = min (img_ydata);
+
+        if (ndims (img_data) == 3)
+          data{data_idx} = permute (img_data, [3, 1, 2])(:);
+          format = "1:2:3";
+          imagetype = "rgbimage";
+        else
+          data{data_idx} = img_data(:);
+          format = "1";
+          imagetype = "image";
+        endif
+
+        titlespec{data_idx} = "title \"\"";
+        usingclause{data_idx} = sprintf ("binary array=%dx%d scan=yx origin=(%.15g,%.15g) dx=%.15g dy=%.15g using %s",
+            x_dim, y_dim, x_origin, y_origin, dx, dy, format);
+        withclause{data_idx} = sprintf ("with %s;", imagetype);
+
+      case "line"
+        if (strcmp (obj.linestyle, "none")
+            && (! isfield (obj, "marker")
+                || (isfield (obj, "marker")
+                    && strcmp (obj.marker, "none"))))
+          continue;
+        endif
+        data_idx++;
+        is_image_data(data_idx) = false;
+        parametric(data_idx) = true;
+        have_cdata(data_idx) = false;
+        have_3d_patch(data_idx) = false;
+        if (isempty (obj.displayname))
+          titlespec{data_idx} = "title \"\"";
+        else
+          tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+          titlespec{data_idx} = ['title "' tmp '"'];
+        endif
+        usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
+        errbars = "";
+        if (nd == 3)
+          xdat = obj.xdata(:);
+          ydat = obj.ydata(:);
+          if (! isempty (obj.zdata))
+            zdat = obj.zdata(:);
+          else
+            zdat = zeros (size (xdat));
+          endif
+          data{data_idx} = [xdat, ydat, zdat]';
+          usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", numel (xdat));
+          ## fputs (plot_stream, "set parametric;\n");
+        else
+          xdat = obj.xdata(:);
+          ydat = obj.ydata(:);
+          data{data_idx} = [xdat, ydat]';
+          usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s",
+                                          rows (xdat), xaxisloc_using, yaxisloc_using);
+        endif
+
+        style = do_linestyle_command (obj, obj.color, data_idx, mono,
+                                      plot_stream, errbars);
+
+        withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                        style{1}, data_idx);
+
+        if (length (style) > 1)
+          data_idx++;
+          is_image_data(data_idx) = is_image_data(data_idx - 1);
+          parametric(data_idx) = parametric(data_idx - 1);
+          have_cdata(data_idx) = have_cdata(data_idx - 1);
+          have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+          titlespec{data_idx} = "title \"\"";
+          usingclause{data_idx} = usingclause{data_idx - 1};
+          data{data_idx} = data{data_idx - 1};
+          withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                        style{2}, data_idx);
+        endif
+        if (length (style) > 2)
+          data_idx++;
+          is_image_data(data_idx) = is_image_data(data_idx - 1);
+          parametric(data_idx) = parametric(data_idx - 1);
+          have_cdata(data_idx) = have_cdata(data_idx - 1);
+          have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+          titlespec{data_idx} = "title \"\"";
+          usingclause{data_idx} = usingclause{data_idx - 1};
+          data{data_idx} = data{data_idx - 1};
+          withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                        style{3}, data_idx);
+        endif
+
+     case "patch"
+       cmap = parent_figure_obj.colormap;
+       [nr, nc] = size (obj.xdata);
+
+       if (! isempty (obj.cdata))
+         cdat = obj.cdata;
+         if (strcmpi (obj.cdatamapping, "direct"))
+           cdatadirect = true;
+         endif
+       else
+         cdat = [];
+       endif
+
+       data_3d_idx = NaN;
+       for i = 1:nc
+         xcol = obj.xdata(:,i);
+         ycol = obj.ydata(:,i);
+         if (nd == 3)
+           if (! isempty (obj.zdata))
+             zcol = obj.zdata(:,i);
+           else
+             zcol = zeros (size (xcol));
+           endif
+         endif
+
+         if (! isnan (xcol) && ! isnan (ycol))
+           ## Is the patch closed or not
+           if (strcmp (obj.facecolor, "none"))
+             hidden_removal = false;
+           else
+
+             if (isnan (hidden_removal))
+               hidden_removal = true;
+             endif
+             if (nd == 3)
+               if (numel (xcol) > 3)
+                 error ("__go_draw_axes__: gnuplot (as of v4.2) only supports 3-D filled triangular patches");
+               else
+                 if (isnan (data_3d_idx))
+                   data_idx++;
+                   data_3d_idx = data_idx;
+                   is_image_data(data_idx) = false;
+                   parametric(data_idx) = false;
+                   have_cdata(data_idx) = true;
+                   have_3d_patch(data_idx) = true;
+                   withclause{data_3d_idx} = sprintf ("with pm3d");
+                   usingclause{data_3d_idx} =  "using 1:2:3:4";
+                   data{data_3d_idx} = [];
+                 endif
+                 local_idx = data_3d_idx;
+                 ccdat = NaN;
+               endif
+             else
+               data_idx++;
+               local_idx = data_idx;
+               is_image_data(data_idx) = false;
+               parametric(data_idx) = false;
+               have_cdata(data_idx) = false;
+               have_3d_patch(data_idx) = false;
+             endif
+
+             if (i > 1 || isempty (obj.displayname))
+               titlespec{local_idx} = "title \"\"";
+             else
+               tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+               titlespec{local_idx} = ['title "' tmp '"'];
+             endif
+             if (isfield (obj, "facecolor"))
+               if ((strcmp (obj.facecolor, "flat")
+                   || strcmp (obj.facecolor, "interp"))
+                   && isfield (obj, "cdata"))
+                 if (ndims (obj.cdata) == 2
+                     && (columns (obj.cdata) == nc
+                         && (rows (obj.cdata) == 1
+                             || rows (obj.cdata) == 3)))
+                   ccol = cdat (:, i);
+                 elseif (ndims (obj.cdata) == 2
+                     && (rows (obj.cdata) == nc
+                         && (columns (obj.cdata) == 1
+                             || columns (obj.cdata) == 3)))
+                   ccol = cdat (i, :);
+                 elseif (ndims (obj.cdata) == 3)
+                   ccol = permute (cdat (:, i, :), [1, 3, 2]);
+                 else
+                   ccol = cdat;
+                 endif
+                 if (strcmp (obj.facecolor, "flat"))
+                   if (isequal (size (ccol), [1, 3]))
+                     ## RGB Triplet
+                     color = ccol;
+                   elseif (nd == 3 && numel (xcol) == 3)
+                     ccdat = ccol;
+                   else
+                     if (cdatadirect)
+                       r = round (ccol);
+                     else
+                       r = 1 + round ((rows (cmap) - 1)
+                                      * (ccol - clim(1))/(clim(2) - clim(1)));
+                     endif
+                     r = max (1, min (r, rows (cmap)));
+                     color = cmap(r, :);
+                   endif
+                 elseif (strcmp (obj.facecolor, "interp"))
+                   if (nd == 3 && numel (xcol) == 3)
+                     ccdat = ccol;
+                     if (! isvector (ccdat))
+                       tmp = rows (cmap) + rows (addedcmap) + ...
+                            [1 : rows(ccdat)];
+                       addedcmap = [addedcmap; ccdat];
+                       ccdat = tmp(:);
+                     else
+                       ccdat = ccdat(:);
+                     endif
+                   else
+                     if (sum (diff (ccol)))
+                       warning ("\"interp\" not supported, using 1st entry of cdata");
+                     endif
+                     if (cdatadirect)
+                       r = round (ccol);
+                     else
+                       r = 1 + round ((rows (cmap) - 1)
+                                      * (ccol - clim(1))/(clim(2) - clim(1)));
+                     endif
+                     r = max (1, min (r, rows (cmap)));
+                     color = cmap(r(1),:);
+                   endif
+                 endif
+               elseif (isnumeric (obj.facecolor))
+                 color = obj.facecolor;
+               else
+                 color = [0, 1, 0];
+               endif
+             else
+               color = [0, 1, 0];
+             endif
+
+             if (nd == 3 && numel (xcol) == 3)
+               if (isnan (ccdat))
+                 ccdat = (rows (cmap) + rows (addedcmap) + 1) * ones(3, 1);
+                 addedcmap = [addedcmap; reshape(color, 1, 3)];
+               endif
+               data{data_3d_idx} = [data{data_3d_idx}, ...
+                                    [[xcol; xcol(end)], [ycol; ycol(end)], ...
+                                    [zcol; zcol(end)], [ccdat; ccdat(end)]]'];
+             else
+               if (mono)
+                 colorspec = "";
+               elseif (__gnuplot_has_feature__ ("transparent_patches")
+                       && isscalar (obj.facealpha))
+                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\" fillstyle transparent solid %f",
+                                    round (255*color), obj.facealpha);
+               else
+                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                      round (255*color));
+               endif
+
+               withclause{data_idx} = sprintf ("with filledcurve %s",
+                                             colorspec);
+               data{data_idx} = [xcol, ycol]';
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2)",
+                                                numel (xcol));
+             endif
+           endif
+         endif
+
+         ## patch outline
+         if (!(strcmp (obj.edgecolor, "none")
+                && (strcmp (obj.marker, "none")
+                    || (strcmp (obj.markeredgecolor, "none")
+                        && strcmp (obj.markerfacecolor, "none")))))
+
+           data_idx++;
+           is_image_data(data_idx) = false;
+           parametric(data_idx) = false;
+           have_cdata(data_idx) = false;
+           have_3d_patch(data_idx) = false;
+           titlespec{data_idx} = "title \"\"";
+           usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
+
+           if (isfield (obj, "markersize"))
+             mdat = obj.markersize / 3;
+           endif
+
+           if (isfield (obj, "edgecolor"))
+             ## FIXME
+             ## This is the wrong thing to do as edgecolor, markeredgecolor
+             ## and markerfacecolor can have different values and we should
+             ## treat them seperately. However, the below allow the scatter
+             ## functions to work as expected, where only one of these values
+             ## is set
+             if (strcmp (obj.edgecolor, "none"))
+               if (strcmp (obj.markeredgecolor, "none"))
+                 ec = obj.markerfacecolor;
+               else
+                 ec = obj.markeredgecolor;
+               endif
+             else
+               ec = obj.edgecolor;
+             endif
+
+             if ((strcmp (ec, "flat")
+                  || strcmp (ec, "interp"))
+                 && isfield (obj, "cdata"))
+               if (ndims (obj.cdata) == 2
+                   && (columns (obj.cdata) == nc
+                       && (rows (obj.cdata) == 1
+                           || rows (obj.cdata) == 3)))
+                 ccol = cdat (:, i);
+               elseif (ndims (obj.cdata) == 2
+                       && (rows (obj.cdata) == nc
+                           && (columns (obj.cdata) == 1
+                               || columns (obj.cdata) == 3)))
+                 ccol = cdat (i, :);
+               elseif (ndims (obj.cdata) == 3)
+                 ccol = permute (cdat (:, i, :), [1, 3, 2]);
+               else
+                 ccol = cdat;
+               endif
+               if (strcmp (ec, "flat"))
+                 if (numel (ccol) == 3)
+                   color = ccol;
+                 else
+                   if (isscalar (ccol))
+                     ccol = repmat (ccol, numel (xcol), 1);
+                   endif
+                   color = "flat";
+                   have_cdata(data_idx) = true;
+                 endif
+               elseif (strcmp (ec, "interp"))
+                 if (numel (ccol) == 3)
+                   warning ("\"interp\" not supported, using 1st entry of cdata");
+                   color = ccol(1,:);
+                 else
+                   if (isscalar (ccol))
+                     ccol = repmat (ccol, numel (xcol), 1);
+                   endif
+                   color = "interp";
+                   have_cdata(data_idx) = true;
+                 endif
+               endif
+             elseif (isnumeric (ec))
+               color = ec;
+             else
+               color = [0, 0, 0];
+             endif
+           else
+             color = [0, 0, 0];
+           endif
+
+           if (isfield (obj, "linestyle"))
+             switch (obj.linestyle)
+               case "-"
+                 lt = "lt 1";
+               case "--"
+                 lt = "lt 2";
+               case ":"
+                 lt = "lt 3";
+               case "-."
+                 lt = "lt 6";
+               case "none"
+                 lt = "";
+               otherwise
+                 lt = "";
+             endswitch
+           else
+             lt = "";
+           endif
+
+           if (isfield (obj, "linewidth"))
+             lw = sprintf ("linewidth %f", obj.linewidth);
+           else
+             lw  = "";
+           endif
+
+           [pt, pt2, obj] = gnuplot_pointtype (obj);
+           if (! isempty (pt))
+             pt = sprintf ("pointtype %s", pt);
+           endif
+           if (! isempty (pt2))
+             pt2 = sprintf ("pointtype %s", pt2);
+           endif
+
+           if (mono)
+             colorspec = "";
+           else
+             if (ischar (color))
+               colorspec = "palette";
+             else
+               colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                    round (255*color));
+             endif
+           endif
+
+           sidx = 1;
+           if (isempty (lt))
+             style = "";
+           else
+             style = "lines";
+           endif
+           tmpwith = {};
+
+           facesame = true;
+           if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
+               && !strcmp (obj.markerfacecolor, "none"))
+             if (strcmp (obj.markerfacecolor, "auto")
+                 || ! isnumeric (obj.markerfacecolor)
+                 || (isnumeric (obj.markerfacecolor)
+                     && isequal (color, obj.markerfacecolor)))
+               style = strcat (style, "points");
+               if (isfield (obj, "markersize"))
+                 if (length (mdat) == nc)
+                   m = mdat(i);
+                 else
+                   m = mdat;
+                 endif
+                 ps = sprintf ("pointsize %f", m / 3);
+               else
+                 ps = "";
+               endif
+
+               tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                        style, lw, pt2, lt, ps,
+                                        colorspec);
+             else
+               facesame = false;
+               if (! isempty (style))
+                 tmpwith{sidx} = sprintf ("with %s %s %s %s",
+                                          style, lw, lt,
+                                          colorspec);
+                 sidx ++;
+               endif
+               if (isnumeric (obj.markerfacecolor) && ! mono)
+                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                      round (255*obj.markerfacecolor));
+               endif
+               style = "points";
+               if (isfield (obj, "markersize"))
+                 if (length (mdat) == nc)
+                   m = mdat(i);
+                 else
+                   m = mdat;
+                 endif
+                 ps = sprintf ("pointsize %f", m / 3);
+               else
+                 ps = "";
+               endif
+               tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                        style, lw, pt2, lt, ps,
+                                        colorspec);
+             endif
+           endif
+
+           if (isfield (obj, "markeredgecolor")
+               && !strcmp (obj.markeredgecolor, "none"))
+             if (facesame && !isempty (pt)
+                 && (strcmp (obj.markeredgecolor, "auto")
+                     || ! isnumeric (obj.markeredgecolor)
+                     || (isnumeric (obj.markeredgecolor)
+                         && isequal (color, obj.markeredgecolor))))
+               if (sidx == 1 && ((length (style) == 5
+                        && strncmp (style, "lines", 5))
+                       || isempty (style)))
+                 style = strcat (style, "points");
+                 if (isfield (obj, "markersize"))
+                   if (length (mdat) == nc)
+                     m = mdat(i);
+                   else
+                     m = mdat;
+                   endif
+                   ps = sprintf ("pointsize %f", m / 3);
+                 else
+                   ps = "";
+                 endif
+                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                          style, lw, pt, lt, ps,
+                                          colorspec);
+               endif
+             else
+               if (!isempty (style))
+                 if (length (tmpwith) < sidx || isempty (tmpwith{sidx}))
+                   tmpwith{sidx} = sprintf ("with %s %s %s %s",
+                                            style, lw, lt,
+                                            colorspec);
+                 endif
+                 sidx ++;
+               endif
+
+               if (!isempty (pt))
+                 if (! mono)
+                   if (strcmp (obj.markeredgecolor, "auto"))
+                     colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                          round (255*color));
+                   elseif (isnumeric (obj.markeredgecolor) && ! mono)
+                     colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                          round (255*obj.markeredgecolor));
+                   endif
+                 endif
+                 style = "points";
+                 if (isfield (obj, "markersize"))
+                   if (length (mdat) == nc)
+                     m = mdat(i);
+                   else
+                     m = mdat;
+                   endif
+                   ps = sprintf ("pointsize %f", m / 3);
+                 else
+                   ps = "";
+                 endif
+                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                          style, lw, pt, lt, ps,
+                                          colorspec);
+               endif
+             endif
+           endif
+
+           if (isempty (tmpwith))
+             withclause{data_idx} = sprintf ("with %s %s %s %s %s",
+                                             style, lw, pt, lt,
+                                             colorspec);
+           else
+             withclause{data_idx} = tmpwith{1};
+           endif
+           if (nd == 3)
+             if (ischar (color))
+               if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
+                                   [zcol; zcol(1)], [ccol; ccol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol, zcol, ccol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4)", columns (data{data_idx}));
+             else
+               if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
+                                   [zcol; zcol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol, zcol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
+             endif
+           else
+             if (ischar (color))
+               if (! isnan (xcol) && ! isnan (ycol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
+                                   [ccol; ccol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol, ccol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
+             else
+               if (! isnan (xcol) && ! isnan (ycol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", columns (data{data_idx}));
+             endif
+           endif
+
+           if (length (tmpwith) > 1)
+             data_idx++;
+             is_image_data(data_idx) = is_image_data(data_idx - 1);
+             parametric(data_idx) = parametric(data_idx - 1);
+             have_cdata(data_idx) = have_cdata(data_idx - 1);
+             have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+             titlespec{data_idx} = "title \"\"";
+             usingclause{data_idx} = usingclause{data_idx - 1};
+             data{data_idx} = data{data_idx - 1};
+             withclause{data_idx} = tmpwith{2};
+           endif
+           if (length (tmpwith) > 2)
+             data_idx++;
+             is_image_data(data_idx) = is_image_data(data_idx - 1);
+             parametric(data_idx) = parametric(data_idx - 1);
+             have_cdata(data_idx) = have_cdata(data_idx - 1);
+             have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+             titlespec{data_idx} = "title \"\"";
+             usingclause{data_idx} = usingclause{data_idx - 1};
+             data{data_idx} = data{data_idx - 1};
+             withclause{data_idx} = tmpwith{3};
+           endif
+         endif
+       endfor
+
+      case "surface"
+        view_map = true;
+        if (! (strcmp (obj.edgecolor, "none")
+               && strcmp (obj.facecolor, "none")))
+          data_idx++;
+          is_image_data(data_idx) = false;
+          parametric(data_idx) = false;
+          have_cdata(data_idx) = true;
+          have_3d_patch(data_idx) = false;
+          style = do_linestyle_command (obj, obj.edgecolor,
+                                        data_idx, mono,
+                                        plot_stream);
+
+          if (isempty (obj.displayname))
+            titlespec{data_idx} = "title \"\"";
+          else
+            tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+            titlespec{data_idx} = ['title "' tmp '"'];
+          endif
+          withclause{data_idx} = sprintf ("with pm3d linestyle %d",
+                                          data_idx);
+          withpm3d = true;
+          pm3didx = data_idx;
+
+          xdat = obj.xdata;
+          ydat = obj.ydata;
+          zdat = obj.zdata;
+          cdat = obj.cdata;
+
+          err = false;
+          if (! size_equal (zdat, cdat))
+            err = true;
+          endif
+          if (isvector (xdat) && isvector (ydat) && ismatrix (zdat))
+            if (rows (zdat) == length (ydat)
+                && columns (zdat) == length (xdat))
+              [xdat, ydat] = meshgrid (xdat, ydat);
+            else
+              err = true;
+            endif
+          elseif (ismatrix (xdat) && ismatrix (ydat) && ismatrix (zdat))
+            if (! size_equal (xdat, ydat, zdat))
+              err = true;
+            endif
+          else
+            err = true;
+          endif
+          if (err)
+            error ("__go_draw_axes__: invalid grid data");
+          endif
+          xlen = columns (zdat);
+          ylen = rows (zdat);
+          if (xlen == columns (xdat) && xlen == columns (ydat)
+              && ylen == rows (xdat) && ylen == rows (ydat))
+            len = 4 * xlen;
+            zz = zeros (ylen, len);
+            k = 1;
+            for kk = 1:4:len
+              zz(:,kk)   = xdat(:,k);
+              zz(:,kk+1) = ydat(:,k);
+              zz(:,kk+2) = zdat(:,k);
+              zz(:,kk+3) = cdat(:,k);
+              k++;
+            endfor
+            data{data_idx} = zz.';
+          endif
+
+          if (doing_interp_color)
+            interp_str = "interpolate 0, 0";
+          else
+            ## No interpolation of facecolors.
+            interp_str = "";
+          endif
+          usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3):($4)", ylen, xlen);
+
+          flat_interp_face = (strcmp (obj.facecolor, "flat")
+                              || strcmp (obj.facecolor, "interp"));
+          flat_interp_edge = (strcmp (obj.edgecolor, "flat")
+                              || strcmp (obj.edgecolor, "interp"));
+
+          facecolor_none_or_white = (strcmp (obj.facecolor, "none")
+                                     || (isnumeric (obj.facecolor)
+                                         && all (obj.facecolor == 1)));
+          hidden_removal = false;
+          fputs (plot_stream, "set style increment default;\n");
+          if (flat_interp_edge && facecolor_none_or_white)
+            withpm3d = false;
+            withclause{data_idx} = sprintf ("with %s palette", style {1});
+            fputs (plot_stream, "unset pm3d\n");
+            if (all (obj.facecolor == 1))
+              hidden_removal = true;
+            endif
+          elseif (facecolor_none_or_white)
+            if (all (obj.facecolor == 1))
+              hidden_removal = true;
+            endif
+            fputs (plot_stream,"unset pm3d;\n");
+            fputs (plot_stream,"set style increment user;\n");
+            withpm3d = false;
+            withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                            style{1}, data_idx);
+            fputs (plot_stream, "unset pm3d\n");
+          endif
+
+          if (doing_interp_color)
+            ## "depthorder" interferes with interpolation of colors.
+            dord = "scansautomatic";
+          else
+            dord = "depthorder";
+          endif
+
+          if (flat_interp_face && strcmp (obj.edgecolor, "flat"))
+            fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n",
+                     interp_str, dord);
+          elseif (!facecolor_none_or_white)
+            if (strcmp (obj.edgecolor, "none"))
+              if (__gnuplot_has_feature__ ("transparent_surface")
+                  && isscalar (obj.facealpha))
+                fprintf (plot_stream,
+                         "set style fill transparent solid %f;\n",
+                         obj.facealpha);
+              endif
+              fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n",
+                       interp_str, dord);
+            else
+              fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n",
+                       data_idx, interp_str, dord);
+
+              if (__gnuplot_has_feature__ ("transparent_surface")
+                  && isscalar (obj.facealpha))
+                fprintf (plot_stream,
+                         "set style fill transparent solid %f;\n",
+                         obj.facealpha);
+              endif
+            endif
+          endif
+
+          zz = [];
+          if (length (style) > 1)
+            len = 3 * xlen;
+            zz = zeros (ylen, len);
+            k = 1;
+            for kk = 1:3:len
+              zz(:,kk)   = xdat(:,k);
+              zz(:,kk+1) = ydat(:,k);
+              zz(:,kk+2) = zdat(:,k);
+              k++;
+            endfor
+            zz = zz.';
+
+            data_idx++;
+            is_image_data(data_idx) = is_image_data(data_idx - 1);
+            parametric(data_idx) = parametric(data_idx - 1);
+            have_cdata(data_idx) = false;
+            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+            titlespec{data_idx} = "title \"\"";
+            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
+            data{data_idx} = zz;
+            withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                            style{2}, data_idx);
+
+          endif
+          if (length (style) > 2)
+            data_idx++;
+            is_image_data(data_idx) = is_image_data(data_idx - 1);
+            parametric(data_idx) = parametric(data_idx - 1);
+            have_cdata(data_idx) = false;
+            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+            titlespec{data_idx} = "title \"\"";
+            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
+            data{data_idx} = zz;
+            withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                            style{3}, data_idx);
+          endif
+          if (withpm3d && strcmp (style{1}, "linespoints"))
+            if (isempty (zz))
+              len = 3 * xlen;
+              zz = zeros (ylen, len);
+              k = 1;
+              for kk = 1:3:len
+                zz(:,kk)   = xdat(:,k);
+                zz(:,kk+1) = ydat(:,k);
+                zz(:,kk+2) = zdat(:,k);
+                k++;
+              endfor
+              zz = zz.';
+            endif
+            data_idx++;
+            is_image_data(data_idx) = is_image_data(data_idx - 1);
+            parametric(data_idx) = parametric(data_idx - 1);
+            have_cdata(data_idx) = false;
+            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+            titlespec{data_idx} = "title \"\"";
+            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
+            data{data_idx} = zz;
+            withclause{data_idx} = sprintf ("with points linestyle %d",
+                                            pm3didx);
+          endif
+        endif
+
+      case "text"
+        [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string");
+        fontspec = create_fontspec (f, s, gnuplot_term);
+        lpos = obj.position;
+        halign = obj.horizontalalignment;
+        valign = obj.verticalalignment;
+        angle = obj.rotation;
+        units = obj.units;
+        color = obj.color;
+        if (strcmpi (units, "normalized"))
+          units = "graph";
+        elseif (strcmp (axis_obj.yaxislocation, "right")
+                && strcmp (units, "data"))
+          units = "second";
+        else
+          units = "";
+        endif
+
+        if (isnumeric (color))
+          colorspec = get_text_colorspec (color, mono);
+        endif
+
+        if (ischar (obj.string))
+          num_lines = rows (obj.string);
+        else
+          num_lines = numel (obj.string);
+        endif
+        switch (valign)
+          ## Text offset in characters. Relies on gnuplot for font metrics.
+          case "top"
+            dy = -0.5;
+          case "cap"
+            dy = -0.5;
+          case "middle"
+            dy = 0.5 * (num_lines - 1);
+          case "baseline"
+            dy = 0.5 + (num_lines - 1);
+          case "bottom"
+            dy = 0.5 + (num_lines - 1);
+        endswitch
+        ## Gnuplot's Character units are different for x/y and vary with
+        ## fontsize. The aspect ratio of 1:1.7 was determined by experiment
+        ## to work for eps/ps/etc. For the MacOS aqua terminal a value of 2.5
+        ## is needed. However, the difference is barely noticable.
+        dx_and_dy = [(-dy * sind (angle)), (dy * cosd (angle))] .* [1.7 1];
+
+        ## FIXME: Multiline text produced the gnuplot
+        ##        "warning: ft_render: skipping glyph"
+        if (nd == 3)
+          ## This produces the desired vertical alignment in 3D.
+          fprintf (plot_stream,
+                   "set label \"%s\" at %s %.15e,%.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
+                   undo_string_escapes (label), units, lpos(1),
+                   lpos(2), lpos(3), halign, angle, dx_and_dy, fontspec,
+                   __do_enhanced_option__ (enhanced, obj), colorspec);
+        else
+          fprintf (plot_stream,
+                   "set label \"%s\" at %s %.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
+                   undo_string_escapes (label), units,
+                   lpos(1), lpos(2), halign, angle, dx_and_dy, fontspec,
+                   __do_enhanced_option__ (enhanced, obj), colorspec);
+        endif
+
+      case "hggroup"
+        ## Push group children into the kid list.
+        if (isempty (kids))
+          kids = obj.children;
+        elseif (! isempty (obj.children))
+          kids = [kids; obj.children];
+        endif
+
+      otherwise
+        error ("__go_draw_axes__: unknown object class, %s",
+               obj.type);
+    endswitch
+
+  endwhile
+
+  ## This is need to prevent warnings for rotations in 3D plots, while
+  ## allowing colorbars with contours.
+  if (nd == 2 || (data_idx > 1 && !view_map))
+    fputs (plot_stream, "set pm3d implicit;\n");
+  else
+    fputs (plot_stream, "set pm3d explicit;\n");
+  endif
+
+  if (isnan (hidden_removal) || hidden_removal)
+    fputs (plot_stream, "set hidden3d;\n");
+  else
+    fputs (plot_stream, "unset hidden3d;\n");
+  endif
+
+  have_data = (! (isempty (data) || all (cellfun ("isempty", data))));
+
+  ## Note we don't use the [xy]2range of gnuplot as we don't use the
+  ## dual axis plotting features of gnuplot.
+  if (isempty (xlim))
+    return;
+  endif
+  if (strcmpi (axis_obj.xdir, "reverse"))
+    xdir = "reverse";
+  else
+    xdir = "noreverse";
+  endif
+  fprintf (plot_stream, "set xrange [%.15e:%.15e] %s;\n", xlim, xdir);
+  if (strcmpi (axis_obj.xaxislocation, "top"))
+    fprintf (plot_stream, "set x2range [%.15e:%.15e] %s;\n", xlim, xdir);
+  endif
+
+  if (isempty (ylim))
+    return;
+  endif
+  if (strcmpi (axis_obj.ydir, "reverse"))
+    ydir = "reverse";
+  else
+    ydir = "noreverse";
+  endif
+  fprintf (plot_stream, "set yrange [%.15e:%.15e] %s;\n", ylim, ydir);
+  if (strcmpi (axis_obj.yaxislocation, "right"))
+    fprintf (plot_stream, "set y2range [%.15e:%.15e] %s;\n", ylim, ydir);
+  endif
+
+  if (nd == 3)
+    if (isempty (zlim))
+      return;
+    endif
+    if (strcmpi (axis_obj.zdir, "reverse"))
+      zdir = "reverse";
+    else
+      zdir = "noreverse";
+    endif
+    fprintf (plot_stream, "set zrange [%.15e:%.15e] %s;\n", zlim, zdir);
+  endif
+
+  cmap = parent_figure_obj.colormap;
+  cmap_sz = rows (cmap);
+  if (! any (isinf (clim)))
+    if (truecolor || ! cdatadirect)
+      if (rows (addedcmap) > 0)
+        for i = 1:data_idx
+          if (have_3d_patch(i))
+            data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz;
+           endif
+        endfor
+        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim(1), clim(2) *
+                 (cmap_sz + rows (addedcmap)) / cmap_sz);
+      else
+        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim);
+      endif
+    else
+      fprintf (plot_stream, "set cbrange [1:%d];\n", cmap_sz +
+               rows (addedcmap));
+    endif
+  endif
+
+  if (strcmpi (axis_obj.box, "on"))
+    if (nd == 3)
+      fputs (plot_stream, "set border 4095;\n");
+    else
+      fputs (plot_stream, "set border 431;\n");
+    endif
+  else
+    if (nd == 3)
+      fputs (plot_stream, "set border 895;\n");
+    elseif (! isempty (axis_obj.ytick))
+      if (strcmpi (axis_obj.yaxislocation, "right"))
+        fprintf (plot_stream, "unset ytics; set y2tics %s nomirror\n",
+                 axis_obj.tickdir);
+        if (strcmpi (axis_obj.xaxislocation, "top"))
+          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 12;\n");
+        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 9;\n");
+        else # xaxislocation == zero
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 8;\n");
+          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
+                   axis_obj.linewidth);
+        endif
+      elseif (strcmpi (axis_obj.yaxislocation, "left"))
+        fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
+                 axis_obj.tickdir);
+        if (strcmpi (axis_obj.xaxislocation, "top"))
+          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 6;\n");
+        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 3;\n");
+        else # xaxislocation == zero
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 2;\n");
+          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
+                   axis_obj.linewidth);
+        endif
+      else # yaxislocation == zero
+        fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
+                 axis_obj.tickdir);
+        if (strcmpi (axis_obj.xaxislocation, "top"))
+          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 4;\n");
+        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 1;\n");
+        else # xaxislocation == zero
+          fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
+                   axis_obj.tickdir);
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "unset border;\n");
+          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
+                   axis_obj.linewidth);
+        endif
+        fprintf (plot_stream, "set yzeroaxis lt -1 lw %f;\n",
+                 axis_obj.linewidth);
+      endif
+    endif
+  endif
+
+  if (strcmpi (axis_obj.visible, "off"))
+    fputs (plot_stream, "unset border; unset tics\n");
+  else
+    fprintf (plot_stream, "set border lw %f;\n", axis_obj.linewidth);
+  endif
+
+  if (! isempty (hlgnd) && ! isempty (hlgnd.children)
+      && any (strcmpi (get (hlgnd.children, "visible"), "on")))
+    if (strcmpi (hlgnd.box, "on"))
+      box = "box";
+    else
+      box = "nobox";
+    endif
+    if (strcmpi (hlgnd.orientation, "vertical"))
+      horzvert = "vertical";
+    else
+      horzvert = "horizontal";
+    endif
+    if (strcmpi (hlgnd.textposition, "right"))
+      reverse = "reverse";
+    else
+      reverse = "noreverse";
+    endif
+    inout = "inside";
+    keypos = hlgnd.location;
+    if (ischar (keypos))
+      keypos = lower (keypos);
+      keyout = strfind (keypos, "outside");
+      if (! isempty (keyout))
+        inout = "outside";
+        keypos = keypos(1:keyout-1);
+      endif
+    endif
+    switch (keypos)
+      case "north"
+        pos = "center top";
+      case "south"
+        pos = "center bottom";
+      case "east"
+        pos = "right center";
+      case "west"
+        pos = "left center";
+      case "northeast"
+        pos = "right top";
+      case "northwest"
+        pos = "left top";
+      case "southeast"
+        pos = "right bottom";
+      case "southwest"
+        pos = "left bottom";
+      case "best"
+        pos = "";
+        warning ("legend: 'Best' not yet implemented for location specifier.\n");
+        ## Least conflict with data in plot.
+        ## Least unused space outside plot.
+      otherwise
+        pos = "";
+    endswitch
+    if (__gnuplot_has_feature__ ("key_has_font_properties"))
+      [fontname, fontsize] = get_fontname_and_size (hlgnd);
+      fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
+    else
+      fontspec = "";
+    endif
+    textcolors = get (findobj (hlgnd.children, "type", "text"), "color");
+    if (iscell (textcolors))
+      textcolors = cell2mat (textcolors);
+      textcolors = unique (textcolors, "rows");
+    endif
+    if (rows (textcolors) > 1)
+      ## Gnuplot is unable to assign arbitrary colors to each text entry
+      ## for the key/legend.  But, the text color can be set to match the
+      ## color of the plot object.
+      colorspec = "textcolor variable";
+    else
+      colorspec = get_text_colorspec (textcolors, mono);
+    endif
+    fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s;\n",
+             inout, pos, box, reverse, horzvert, fontspec, colorspec);
+  else
+    fputs (plot_stream, "unset key;\n");
+  endif
+  fputs (plot_stream, "set style data lines;\n");
+
+  cmap = [cmap; addedcmap];
+  cmap_sz = cmap_sz + rows (addedcmap);
+  if (length (cmap) > 0)
+    fprintf (plot_stream,
+             "set palette positive color model RGB maxcolors %i;\n",
+             cmap_sz);
+    fprintf (plot_stream,
+             "set palette file \"-\" binary record=%d using 1:2:3:4;\n",
+             cmap_sz);
+    fwrite (plot_stream, [1:cmap_sz; cmap.'], "float32");
+    fwrite (plot_stream, "\n");
+  endif
+
+  fputs (plot_stream, "unset colorbox;\n");
+
+  if (have_data)
+    if (nd == 2)
+      plot_cmd = "plot";
+    else
+      plot_cmd = "splot";
+      rot_x = 90 - axis_obj.view(2);
+      rot_z = axis_obj.view(1);
+      while (rot_z < 0)
+        rot_z += 360;
+      endwhile
+      fputs (plot_stream, "set ticslevel 0;\n");
+      if (view_map && rot_x == 0 && rot_z == 0)
+        fputs (plot_stream, "set view map;\n");
+      else
+        fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z);
+      endif
+    endif
+    if (have_3d_patch (1))
+      fputs (plot_stream, "set pm3d depthorder\n");
+      fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
+               usingclause{1}, titlespec{1}, withclause{1});
+    elseif (is_image_data (1))
+      if (numel (is_image_data) > 1 && is_image_data(2))
+        ## Remove terminating semicolon
+        n = max (strfind (withclause{1}, ";"));
+        if (! isempty (n))
+          withclause{1} = withclause{1}(1:n-1);
+        endif
+      endif
+      fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
+               usingclause{1}, titlespec{1}, withclause{1});
+    else
+      fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
+               usingclause{1}, titlespec{1}, withclause{1});
+    endif
+    for i = 2:data_idx
+      if (have_3d_patch (i))
+        fprintf (plot_stream, ", \"-\" %s %s %s \\\n",
+                 usingclause{i}, titlespec{i}, withclause{i});
+      elseif (is_image_data (i))
+        if (! is_image_data (i-1))
+          fputs (plot_stream, "; ");
+          if (bg_is_set)
+            fputs (plot_stream, "unset obj 1; \\\n");
+            bg_is_set = false;
+          endif
+          if (fg_is_set)
+            fputs (plot_stream, "unset obj 2; \\\n");
+            fg_is_set = false;
+          endif
+          if (numel (is_image_data) > i && is_image_data(i+1))
+            ## Remove terminating semicolon
+            n = max (strfind (withclause{i}, ";"));
+            if (! isempty (n))
+              withclause{i} = withclause{i}(1:n-1);
+            endif
+          endif
+          fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
+                   usingclause{i}, titlespec{i}, withclause{i});
+        else
+          ## For consecutive images continue with the same plot command
+          fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", ",",
+                   usingclause{i}, titlespec{i}, withclause{i});
+        endif
+      elseif (is_image_data (i-1))
+        if (bg_is_set)
+          fputs (plot_stream, "unset obj 1; \\\n");
+          bg_is_set = false;
+        endif
+        if (fg_is_set)
+          fputs (plot_stream, "unset obj 2; \\\n");
+          fg_is_set = false;
+        endif
+        fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
+                 usingclause{i}, titlespec{i}, withclause{i});
+      else
+        fprintf (plot_stream, ", \"-\" binary format='%%float64' %s %s %s \\\n",
+                 usingclause{i}, titlespec{i}, withclause{i});
+      endif
+    endfor
+    fputs (plot_stream, ";\n");
+    for i = 1:data_idx
+      if (have_3d_patch (i))
+        ## Can't write 3d patch data as binary as can't plot more than
+        ## a single patch at a time and have to plot all patches together
+        ## so that the gnuplot depth ordering is done correctly
+        for j = 1 : 4 : columns (data{i})
+          if (j != 1)
+            fputs (plot_stream, "\n\n");
+          endif
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j).');
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n", data{i}(:,j+1).');
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+2).');
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+3).');
+        endfor
+        fputs (plot_stream, "e\n");
+      elseif (is_image_data(i))
+        fwrite (plot_stream, data{i}, "float32");
+      else
+        __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i),
+                                have_cdata(i));
+      endif
+    endfor
+  else
+    fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n");
+  endif
+
+  ## Needed to allow mouse rotation with pcolor.
+  if (view_map)
+    fputs (plot_stream, "unset view;\n");
+  endif
+
+  if (bg_is_set)
+    fputs (plot_stream, "unset obj 1;\n");
+    bg_is_set = false;
+  endif
+
+  fflush (plot_stream);
+
+endfunction
+
+function x = flip (x)
+  if (rows (x) == 1)
+    x = fliplr (x);
+  elseif (columns (x) == 1 || ischar (x))
+    x = flipud (x);
+  else
+    x = flipud (fliplr (x));
+  endif
+endfunction
+
+function fontspec = create_fontspec (f, s, gp_term)
+  if (strcmp (f, "*") || strcmp (gp_term, "tikz"))
+    fontspec = sprintf ("font \",%d\"", s);
+  else
+    fontspec = sprintf ("font \"%s,%d\"", f, s);
+  endif
+endfunction
+
+function style = do_linestyle_command (obj, linecolor, idx, mono,
+                                       plot_stream, errbars = "")
+  style = {};
+
+  fprintf (plot_stream, "set style line %d default;\n", idx);
+  fprintf (plot_stream, "set style line %d", idx);
+
+  found_style = false;
+  if (isnumeric (linecolor))
+    color = linecolor;
+    if (! mono)
+      fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+               round (255*color));
+    endif
+  else
+    color = [0, 0, 0];
+  endif
+
+  if (isfield (obj, "linestyle"))
+    switch (obj.linestyle)
+      case "-"
+        lt = "1";
+      case "--"
+        lt = "2";
+      case ":"
+        lt = "3";
+      case "-."
+        lt = "6";
+      case "none"
+        lt = "";
+      otherwise
+        lt = "";
+    endswitch
+
+    if (! isempty (lt))
+      fprintf (plot_stream, " linetype %s", lt);
+    endif
+
+  else
+    lt = "";
+  endif
+  if (! isempty (errbars))
+    found_style = true;
+  endif
+
+  if (isfield (obj, "linewidth"))
+    fprintf (plot_stream, " linewidth %f", obj.linewidth);
+    found_style = true;
+  endif
+
+  [pt, pt2, obj] = gnuplot_pointtype (obj);
+
+  if (! isempty (pt))
+    found_style = true;
+  endif
+
+  sidx = 1;
+  if (isempty (errbars))
+    if (isempty (lt))
+      style {sidx} = "";
+    else
+      style {sidx} = "lines";
+    endif
+
+    facesame = true;
+    if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
+        && !strcmp (obj.markerfacecolor, "none"))
+      if (strcmp (obj.markerfacecolor, "auto")
+          || ! isnumeric (obj.markerfacecolor)
+          || (isnumeric (obj.markerfacecolor)
+              && isequal (color, obj.markerfacecolor)))
+        if (! isempty (pt2))
+          fprintf (plot_stream, " pointtype %s", pt2);
+          style {sidx} = strcat (style{sidx}, "points");
+        endif
+        if (isfield (obj, "markersize"))
+          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+        endif
+      else
+        facesame = false;
+        if (! found_style)
+          fputs (plot_stream, " default");
+        endif
+        fputs (plot_stream, ";\n");
+        if (! isempty (style {sidx}))
+          sidx ++;
+          idx ++;
+        else
+          fputs (plot_stream, ";\n");
+        endif
+        fprintf (plot_stream, "set style line %d default;\n", idx);
+        fprintf (plot_stream, "set style line %d", idx);
+        if (isnumeric (obj.markerfacecolor) && ! mono)
+          fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+                   round (255*obj.markerfacecolor));
+        endif
+        if (! isempty (pt2))
+          style {sidx} = "points";
+          fprintf (plot_stream, " pointtype %s", pt2);
+        endif
+        if (isfield (obj, "markersize"))
+          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+        endif
+      endif
+    endif
+    if (isfield (obj, "markeredgecolor")
+        && !strcmp (obj.markeredgecolor, "none"))
+      if (facesame && !isempty (pt)
+          && (strcmp (obj.markeredgecolor, "auto")
+              || ! isnumeric (obj.markeredgecolor)
+              || (isnumeric (obj.markeredgecolor)
+                  && isequal (color, obj.markeredgecolor))))
+        if (sidx == 1 && ((length (style {sidx}) == 5
+            && strncmp (style{sidx}, "lines", 5)) || isempty (style {sidx})))
+          if (! isempty (pt))
+            style {sidx} = strcat (style{sidx}, "points");
+            fprintf (plot_stream, " pointtype %s", pt);
+          endif
+          if (isfield (obj, "markersize"))
+            fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+          endif
+        endif
+      else
+        if (! found_style)
+          fputs (plot_stream, " default");
+        endif
+        fputs (plot_stream, ";\n");
+        if (!isempty (style {sidx}))
+          sidx ++;
+          idx ++;
+        else
+          fputs (plot_stream, ";\n");
+        endif
+        fprintf (plot_stream, "set style line %d default;\n", idx);
+        fprintf (plot_stream, "set style line %d", idx);
+        if (! mono)
+          if (strcmp (obj.markeredgecolor, "auto"))
+            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+                     round (255*color));
+          elseif (isnumeric (obj.markeredgecolor) && ! mono)
+            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+                     round (255*obj.markeredgecolor));
+          endif
+        endif
+        if (! isempty (pt))
+          style {sidx} = "points";
+          fprintf (plot_stream, " pointtype %s", pt);
+        endif
+        if (isfield (obj, "markersize"))
+          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+        endif
+      endif
+    endif
+  else
+    style{1} = errbars;
+    fputs (plot_stream, " pointtype 0");
+  endif
+
+  if (! found_style && isempty (style {1}))
+    fputs (plot_stream, " default");
+  endif
+
+  fputs (plot_stream, ";\n");
+
+endfunction
+
+function [pt, pt2, obj] = gnuplot_pointtype (obj)
+  if (isfield (obj, "marker"))
+    switch (obj.marker)
+      case "+"
+        pt = pt2 = "1";
+      case "o"
+        pt = "6";
+        pt2 = "7";
+      case "*"
+        pt = pt2 = "3";
+      case "."
+        pt = "6";
+        pt2 = "7";
+        if (isfield (obj, "markerfacecolor")
+            || strcmp (obj.markerfacecolor, "none"))
+          obj.markerfacecolor = "auto";
+        endif
+        if (isfield (obj, "markersize"))
+          obj.markersize /= 3;
+        else
+          obj.markersize = 5;
+        endif
+      case "x"
+        pt = pt2 = "2";
+      case {"square", "s"}
+        pt = "4";
+        pt2 = "5";
+      case {"diamond", "d"}
+        pt = "12";
+        pt2 = "13";
+      case "^"
+        pt = "8";
+        pt2 = "9";
+      case "v"
+        pt = "10";
+        pt2 = "11";
+      case ">"
+        ## FIXME: should be triangle pointing right, use triangle pointing up
+        pt = "8";
+        pt2 = "9";
+      case "<"
+        ## FIXME: should be triangle pointing left, use triangle pointing down
+        pt = "10";
+        pt2 = "11";
+      case {"pentagram", "p"}
+        ## FIXME: should be pentagram, using pentagon
+        pt = "14";
+        pt2 = "15";
+      case {"hexagram", "h"}
+        ## FIXME: should be 6 pt start, using "*" instead
+        pt = pt2 = "3";
+      case "none"
+        pt = pt2 = "";
+      otherwise
+        pt = pt2 = "";
+    endswitch
+  else
+    pt = pt2 = "";
+  endif
+endfunction
+
+function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata)
+
+  ## DATA is already transposed.
+
+  ## FIXME -- this may need to be converted to C++ for speed.
+
+  ## Convert NA elements to normal NaN values because fprintf writes
+  ## "NA" and that confuses gnuplot.
+  idx = find (isna (data));
+  if (any (idx))
+    data(idx) = NaN;
+  endif
+
+  if (nd == 2)
+    fwrite (plot_stream, data, "float64");
+  elseif (nd == 3)
+    if (parametric)
+      fwrite (plot_stream, data, "float64");
+    else
+      nr = rows (data);
+      if (cdata)
+        for j = 1:4:nr
+          fwrite (plot_stream, data(j:j+3,:), "float64");
+        endfor
+      else
+        for j = 1:3:nr
+          fwrite (plot_stream, data(j:j+2,:), "float64");
+        endfor
+      endif
+    endif
+  endif
+
+endfunction
+
+function do_tics (obj, plot_stream, ymirror, mono, gnuplot_term)
+
+  obj.xticklabel = ticklabel_to_cell (obj.xticklabel);
+  obj.yticklabel = ticklabel_to_cell (obj.yticklabel);
+  obj.zticklabel = ticklabel_to_cell (obj.zticklabel);
+
+  if (strcmp (obj.xminorgrid, "on"))
+    obj.xminortick = "on";
+  endif
+  if (strcmp (obj.yminorgrid, "on"))
+    obj.yminortick = "on";
+  endif
+  if (strcmp (obj.zminorgrid, "on"))
+    obj.zminortick = "on";
+  endif
+
+  [fontname, fontsize] = get_fontname_and_size (obj);
+  fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
+
+  ## A Gnuplot tic scale of 69 is equivalent to Octave's 0.5.
+  ticklength = sprintf ("scale %4.1f", (69/0.5)*obj.ticklength(1));
+
+  if (strcmpi (obj.xaxislocation, "top"))
+    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+               obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
+               obj.xcolor, "x", plot_stream, true, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
+               obj.xsgn, gnuplot_term);
+  elseif (strcmpi (obj.xaxislocation, "zero"))
+    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
+               "axis", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
+               obj.xcolor, "x2", plot_stream, true, mono, "axis",
+               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
+               obj.xsgn, gnuplot_term);
+  else
+    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
+               obj.xcolor, "x2", plot_stream, true, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
+               obj.xsgn, gnuplot_term);
+  endif
+  if (strcmpi (obj.yaxislocation, "right"))
+    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+               obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
+               obj.ycolor, "y", plot_stream, ymirror, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
+               obj.ysgn, gnuplot_term);
+  elseif (strcmpi (obj.yaxislocation, "zero"))
+    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
+               "axis", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
+               obj.ycolor, "y2", plot_stream, ymirror, mono, "axis",
+               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
+               obj.ysgn, gnuplot_term);
+  else
+    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
+               obj.ycolor, "y2", plot_stream, ymirror, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
+               obj.ysgn, gnuplot_term);
+  endif
+  do_tics_1 (obj.ztickmode, obj.ztick, obj.zminortick, obj.zticklabelmode,
+             obj.zticklabel, obj.zcolor, "z", plot_stream, true, mono,
+             "border", obj.tickdir, ticklength, fontname, fontspec,
+             obj.interpreter, obj.zscale, obj.zsgn, gnuplot_term);
+endfunction
+
+function do_tics_1 (ticmode, tics, mtics, labelmode, labels, color, ax,
+                    plot_stream, mirror, mono, axispos, tickdir, ticklength,
+                    fontname, fontspec, interpreter, scale, sgn, gnuplot_term)
+  persistent warned_latex = false;
+  if (strcmpi (interpreter, "tex"))
+    for n = 1 : numel (labels)
+      labels{n} = __tex2enhanced__ (labels{n}, fontname, false, false);
+    endfor
+  elseif (strcmpi (interpreter, "latex"))
+    if (! warned_latex)
+      warning ("latex markup not supported for tick marks");
+      warned_latex = true;
+    endif
+  endif
+  if (strcmp (scale, "log"))
+    num_mtics = 10;
+    if (any (strcmp (gnuplot_term, {"tikz", "pstex", "pslatex", "epslatex"})))
+      fmt = "$10^{%T}$";
+    else
+      fmt = "10^{%T}";
+    endif
+    if (sgn < 0)
+      fmt = strcat ("-", fmt);
+    endif
+  else
+    fmt = "%g";
+    num_mtics = 5;
+  endif
+  colorspec = get_text_colorspec (color, mono);
+  if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual"))
+    if (isempty (tics))
+      fprintf (plot_stream, "unset %stics;\nunset m%stics;\n", ax, ax);
+    elseif (strcmpi (labelmode, "manual"))
+      if (ischar (labels))
+        labels = cellstr (labels);
+      endif
+      if (isnumeric (labels))
+        labels = num2str (real (labels(:)));
+      endif
+      if (ischar (labels))
+        labels = permute (cellstr (labels), [2, 1]);
+      endif
+      if (iscellstr (labels))
+        k = 1;
+        ntics = numel (tics);
+        nlabels = numel (labels);
+        fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
+        if (mirror)
+          fprintf (plot_stream, "set %stics add %s %s %s mirror (", ax,
+                   tickdir, ticklength, axispos);
+        else
+          fprintf (plot_stream, "set %stics add %s %s %s nomirror (", ax,
+                   tickdir, ticklength, axispos);
+        endif
+
+        labels = regexprep (labels, '%', "%%");
+        for i = 1:ntics
+          fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i));
+          if (i < ntics)
+            fputs (plot_stream, ", ");
+          endif
+          if (k > nlabels)
+            k = 1;
+          endif
+        endfor
+        fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec);
+        if (strcmp (mtics, "on"))
+          fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
+        else
+          fprintf (plot_stream, "unset m%stics;\n", ax);
+        endif
+      else
+        error ("__go_draw_axes__: unsupported type of ticklabel");
+      endif
+    else
+      fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
+      if (mirror)
+        fprintf (plot_stream, "set %stics %s %s %s mirror (", ax, tickdir,
+                 ticklength, axispos);
+      else
+        fprintf (plot_stream, "set %stics %s %s %s nomirror (", ax, tickdir,
+                 ticklength, axispos);
+      endif
+      fprintf (plot_stream, " %.15g,", tics(1:end-1));
+      fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec);
+      if (strcmp (mtics, "on"))
+        fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
+      else
+        fprintf (plot_stream, "unset m%stics;\n", ax);
+      endif
+    endif
+  else
+    fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
+    if (mirror)
+      fprintf (plot_stream, "set %stics %s %s %s mirror %s %s;\n", ax,
+               axispos, tickdir, ticklength, colorspec, fontspec);
+    else
+      fprintf (plot_stream, "set %stics %s %s %s nomirror %s %s;\n", ax,
+               tickdir, ticklength, axispos, colorspec, fontspec);
+    endif
+    if (strcmp (mtics, "on"))
+      fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
+    else
+      fprintf (plot_stream, "unset m%stics;\n", ax);
+    endif
+  endif
+endfunction
+
+function ticklabel = ticklabel_to_cell (ticklabel)
+  if (isnumeric (ticklabel))
+    ## Use upto 5 significant digits
+    ticklabel = num2str (ticklabel(:), 5);
+  endif
+  if (ischar (ticklabel))
+    if (rows (ticklabel) == 1 && any (ticklabel == "|"))
+      ticklabel = ostrsplit (ticklabel, "|");
+    else
+      ticklabel = cellstr (ticklabel);
+    endif
+  elseif (isempty (ticklabel))
+    ticklabel = {""};
+  else
+    ticklabel = ticklabel;
+  endif
+endfunction
+
+function colorspec = get_text_colorspec (color, mono)
+  if (mono)
+    colorspec = "";
+  else
+    colorspec = sprintf ("textcolor rgb \"#%02x%02x%02x\"",
+                         round (255*color));
+  endif
+endfunction
+
+function [f, s, fnt, it, bld] = get_fontname_and_size (t)
+  if (isempty (t.fontname) || strcmp (t.fontname, "*"))
+    fnt = "{}";
+  else
+    fnt = t.fontname;
+  endif
+  f = fnt;
+  it = false;
+  bld = false;
+  if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold"))
+    if (! isempty (t.fontangle)
+        && (strcmpi (t.fontangle, "italic")
+            || strcmpi (t.fontangle, "oblique")))
+      f = [f "-bolditalic"];
+      it = true;
+      bld = true;
+    else
+      f = [f "-bold"];
+      bld = true;
+    endif
+  elseif (! isempty (t.fontangle)
+          && (strcmpi (t.fontangle, "italic")
+              || strcmpi (t.fontangle, "oblique")))
+    f = [f "-italic"];
+    it = true;
+  endif
+  if (isempty (t.fontsize))
+    s = 10;
+  else
+    s = t.fontsize;
+  endif
+endfunction
+
+function [str, f, s] = __maybe_munge_text__ (enhanced, obj, fld)
+
+  persistent warned_latex = false;
+
+  if (strcmp (fld, "string"))
+    [f, s, fnt, it, bld] = get_fontname_and_size (obj);
+  else
+    f = "Helvetica";
+    s = 10;
+    fnt = f;
+    it = false;
+    bld = false;
+  endif
+
+  ## The text object maybe multiline, and may be of any class
+  str = getfield (obj, fld);
+  if (ischar (str) && rows (str) > 1)
+    str = cellstr (str);
+  elseif (isnumeric (str))
+    str = cellstr (num2str (str(:)));
+  endif
+  if (iscellstr (str))
+    for n = 1:numel (str)
+      if (isnumeric (str{n}))
+        str{n} = num2str (str{n});
+      endif
+    endfor
+    str = sprintf ("%s\n", str{:})(1:end-1);
+  endif
+
+  if (enhanced)
+    if (strcmpi (obj.interpreter, "tex"))
+      if (iscellstr (str))
+        for n = 1:numel (str)
+          str{n} = __tex2enhanced__ (str{n}, fnt, it, bld);
+        endfor
+      else
+        str = __tex2enhanced__ (str, fnt, it, bld);
+      endif
+    elseif (strcmpi (obj.interpreter, "latex"))
+      if (! warned_latex)
+        warning ("latex markup not supported for text objects");
+        warned_latex = true;
+      endif
+    elseif (enhanced)
+      str = no_super_sub_scripts (str);
+    endif
+  endif
+endfunction
+
+function str = no_super_sub_scripts (str)
+  if (iscellstr (str))
+    labels = str;
+  else
+    labels = cellstr (str);
+  endif
+  for marker = "_^" 
+    for m = 1 : numel (labels)
+      n1 = strfind (labels{m}, sprintf ("\\%s", marker));
+      n2 = strfind (labels{m}, marker);
+      if (! isempty (n1))
+        n1 = n1 + 1;
+        n2 = setdiff (n2, n1);
+      endif
+      for n = numel (n2):-1:1
+        labels{m} = [labels{m}(1:n2(n)-1), "\\", labels{m}(n2(n):end)];
+      endfor
+    endfor
+  endfor
+  if (iscellstr (str))
+    str = labels;
+  else
+    str = char (labels);
+  endif
+endfunction
+
+function str = __tex2enhanced__ (str, fnt, it, bld)
+  persistent sym = __setup_sym_table__ ();
+  persistent flds = fieldnames (sym);
+
+  [s, e, m] = regexp (str, "\\\\([a-zA-Z]+|0)", "start", "end", "matches");
+
+  for i = length (s) : -1 : 1
+    ## special case for "\0"  and replace with "{/Symbol \306}'
+    if (strncmp (m{i}, '\0', 2))
+      str = [str(1:s(i) - 1) '{/Symbol \306}' str(s(i) + 2:end)];
+    else
+      f = m{i}(2:end);
+      if (isfield (sym, f))
+        g = getfield (sym, f);
+        ## FIXME The symbol font doesn't seem to support bold or italic
+        ##if (bld)
+        ##  if (it)
+        ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+        ##  else
+        ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+        ##  endif
+        ##elseif (it)
+        ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+        ##endif
+        str = [str(1:s(i) - 1) g str(e(i) + 1:end)];
+      elseif (strncmp (f, "rm", 2))
+        bld = false;
+        it = false;
+        str = [str(1:s(i) - 1) '/' fnt ' ' str(s(i) + 3:end)];
+      elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2))
+        it = true;
+        if (bld)
+          str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)];
+        else
+          str = [str(1:s(i) - 1) '/' fnt '-italic ' str(s(i) + 3:end)];
+        endif
+      elseif (strncmp (f, "bf", 2))
+        bld = true;
+        if (it)
+          str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)];
+        else
+          str = [str(1:s(i) - 1) '/' fnt '-bold ' str(s(i) + 3:end)];
+        endif
+      elseif (strcmpi (f, "color"))
+        ## FIXME Ignore \color but remove trailing {} block as well
+        d = strfind (str(e(i) + 1:end),'}');
+        if (isempty (d))
+          warning ('syntax error in \color argument');
+        else
+          str = [str(1:s(i) - 1) str(e(i) + d + 1:end)];
+        endif
+      elseif (strcmpi (f, "fontname"))
+        b1 = strfind (str(e(i) + 1:end),'{');
+        b2 = strfind (str(e(i) + 1:end),'}');
+        if (isempty (b1) || isempty (b2))
+          warning ('syntax error in \fontname argument');
+        else
+          str = [str(1:s(i) - 1), '/', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
+                 '{}', str(e(i) + b2(1) + 1:end)];
+        endif
+      elseif (strcmpi (f, "fontsize"))
+        b1 = strfind (str(e(i) + 1:end),'{');
+        b2 = strfind (str(e(i) + 1:end),'}');
+        if (isempty (b1) || isempty (b2))
+          warning ('syntax error in \fontname argument');
+        else
+          str = [str(1:s(i) - 1), '/=', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
+                 '{}', str(e(i) + b2(1) + 1:end)];
+        endif
+      else
+        ## Last desperate attempt to treat the symbol. Look for things
+        ## like \pix, that should be translated to the symbol Pi and x
+        for j = 1 : length (flds)
+          if (strncmp (flds{j}, f, length (flds{j})))
+            g = getfield (sym, flds{j});
+            ## FIXME The symbol font doesn't seem to support bold or italic
+            ##if (bld)
+            ##  if (it)
+            ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+            ##  else
+            ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+            ##  endif
+            ##elseif (it)
+            ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+            ##endif
+            str = [str(1:s(i) - 1) g str(s(i) + length (flds{j}) + 1:end)];
+            break;
+          endif
+        endfor
+      endif
+    endif
+  endfor
+
+  ## Prepend @ to things  things like _0^x or _{-100}^{100} for
+  ## alignment But need to put the shorter of the two arguments first.
+  ## Carful of nested {} and unprinted characters when defining
+  ## shortest.. Don't have to worry about things like ^\theta as they
+  ## are already converted to ^{/Symbol q}.
+
+  ## FIXME -- This is a mess... Is it worth it just for a "@" character?
+
+  [s, m] = regexp (str,'[_\^]','start','matches');
+  i = 1;
+  p = 0;
+  while (i < length (s))
+    if (i < length (s))
+      if (str(s(i) + p + 1) == "{")
+        s1 = strfind (str(s(i) + p + 2:end),'{');
+        si = 1;
+        l1 = strfind (str(s(i) + p + 1:end),'}');
+        li = 1;
+        while (li <= length (l1) && si <= length (s1))
+          if (l1(li) < s1(si))
+            if (li == si)
+              break;
+            endif
+            li++;
+          else
+            si++;
+          endif
+        endwhile
+        l1 = l1 (min (length (l1), si));
+        if (s(i) + l1 + 1 == s(i+1))
+          if (str(s(i + 1) + p + 1) == "{")
+            s2 = strfind (str(s(i + 1) + p + 2:end),'{');
+            si = 1;
+            l2 = strfind (str(s(i + 1) + p + 1:end),'}');
+            li = 1;
+            while (li <= length (l2) && si <= length (s2))
+              if (l2(li) < s2(si))
+                if (li == si)
+                  break;
+                endif
+                li++;
+              else
+                si++;
+              endif
+            endwhile
+            l2 = l2 (min (length (l2), si));
+            if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <=
+                length_string (str(s(i+1)+p+2:s(i+1)+p+l2-1)))
+              ## Shortest already first!
+              str = [str(1:s(i)+p-1) "@" str(s(i)+p:end)];
+            else
+              ## Have to swap sub/super-script to get shortest first.
+              str = [str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2), ...
+                     str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)];
+            endif
+          else
+            ## Have to swap sub/super-script to get shortest first.
+            str = [str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1), ...
+                   str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)];
+          endif
+          i += 2;
+          p ++;
+        else
+          i++;
+        endif
+      else
+        if (s(i+1) == s(i) + 2)
+          ## Shortest already first!
+          str = [str(1:s(i)+p-1) "@" str(s(i)+p:end)];
+          p ++;
+          i += 2;
+        else
+          i ++;
+        endif
+      endif
+    else
+      i ++;
+    endif
+  endwhile
+
+endfunction
+
+function l = length_string (s)
+  l = length (s) - length (strfind (s,'{')) - length (strfind (s,'}'));
+  m = regexp (s, '/([\w-]+|[\w-]+=\d+)', 'matches');
+  if (!isempty (m))
+    l = l - sum (cellfun ("length", m));
+  endif
+endfunction
+
+function sym = __setup_sym_table__ ()
+  ## Setup the translation table for TeX to gnuplot enhanced mode.
+  sym.forall = '{/Symbol \042}';
+  sym.exists = '{/Symbol \044}';
+  sym.ni = '{/Symbol \047}';
+  sym.cong = '{/Symbol \100}';
+  sym.Delta = '{/Symbol D}';
+  sym.Phi = '{/Symbol F}';
+  sym.Gamma = '{/Symbol G}';
+  sym.vartheta = '{/Symbol J}';
+  sym.Lambda = '{/Symbol L}';
+  sym.Pi = '{/Symbol P}';
+  sym.Theta = '{/Symbol Q}';
+  sym.Sigma = '{/Symbol S}';
+  sym.varsigma = '{/Symbol V}';
+  sym.Omega = '{/Symbol W}';
+  sym.Xi = '{/Symbol X}';
+  sym.Psi = '{/Symbol Y}';
+  sym.perp = '{/Symbol \136}';
+  sym.alpha = '{/Symbol a}';
+  sym.beta = '{/Symbol b}';
+  sym.chi = '{/Symbol c}';
+  sym.delta = '{/Symbol d}';
+  sym.epsilon = '{/Symbol e}';
+  sym.phi = '{/Symbol f}';
+  sym.gamma = '{/Symbol g}';
+  sym.eta = '{/Symbol h}';
+  sym.iota = '{/Symbol i}';
+  sym.varphi = '{/Symbol j}';
+  sym.kappa = '{/Symbol k}';
+  sym.lambda = '{/Symbol l}';
+  sym.mu = '{/Symbol m}';
+  sym.nu = '{/Symbol n}';
+  sym.o =  '{/Symbol o}';
+  sym.pi = '{/Symbol p}';
+  sym.theta = '{/Symbol q}';
+  sym.rho = '{/Symbol r}';
+  sym.sigma = '{/Symbol s}';
+  sym.tau = '{/Symbol t}';
+  sym.upsilon = '{/Symbol u}';
+  sym.varpi = '{/Symbol v}';
+  sym.omega = '{/Symbol w}';
+  sym.xi = '{/Symbol x}';
+  sym.psi = '{/Symbol y}';
+  sym.zeta = '{/Symbol z}';
+  sym.sim = '{/Symbol \176}';
+  sym.Upsilon = '{/Symbol \241}';
+  sym.prime = '{/Symbol \242}';
+  sym.leq = '{/Symbol \243}';
+  sym.infty = '{/Symbol \245}';
+  sym.clubsuit = '{/Symbol \247}';
+  sym.diamondsuit = '{/Symbol \250}';
+  sym.heartsuit = '{/Symbol \251}';
+  sym.spadesuit = '{/Symbol \252}';
+  sym.leftrightarrow = '{/Symbol \253}';
+  sym.leftarrow = '{/Symbol \254}';
+  sym.uparrow = '{/Symbol \255}';
+  sym.rightarrow = '{/Symbol \256}';
+  sym.downarrow = '{/Symbol \257}';
+  sym.circ = '{/Symbol \260}';
+  sym.pm = '{/Symbol \261}';
+  sym.geq = '{/Symbol \263}';
+  sym.times = '{/Symbol \264}';
+  sym.propto = '{/Symbol \265}';
+  sym.partial = '{/Symbol \266}';
+  sym.bullet = '{/Symbol \267}';
+  sym.div = '{/Symbol \270}';
+  sym.neq = '{/Symbol \271}';
+  sym.equiv = '{/Symbol \272}';
+  sym.approx = '{/Symbol \273}';
+  sym.ldots = '{/Symbol \274}';
+  sym.mid = '{/Symbol \275}';
+  sym.aleph = '{/Symbol \300}';
+  sym.Im = '{/Symbol \301}';
+  sym.Re = '{/Symbol \302}';
+  sym.wp = '{/Symbol \303}';
+  sym.otimes = '{/Symbol \304}';
+  sym.oplus = '{/Symbol \305}';
+  sym.oslash = '{/Symbol \306}';
+  sym.cap = '{/Symbol \307}';
+  sym.cup = '{/Symbol \310}';
+  sym.supset = '{/Symbol \311}';
+  sym.supseteq = '{/Symbol \312}';
+  sym.subset = '{/Symbol \314}';
+  sym.subseteq = '{/Symbol \315}';
+  sym.in = '{/Symbol \316}';
+  sym.notin = '{/Symbol \317}';
+  sym.angle = '{/Symbol \320}';
+  sym.bigtriangledown = '{/Symbol \321}';
+  sym.langle = '{/Symbol \341}';
+  sym.rangle = '{/Symbol \361}';
+  sym.nabla = '{/Symbol \321}';
+  sym.prod = '{/Symbol \325}';
+  sym.surd = '{/Symbol \326}';
+  sym.cdot = '{/Symbol \327}';
+  sym.neg = '{/Symbol \330}';
+  sym.wedge = '{/Symbol \331}';
+  sym.vee = '{/Symbol \332}';
+  sym.Leftrightarrow = '{/Symbol \333}';
+  sym.Leftarrow = '{/Symbol \334}';
+  sym.Uparrow = '{/Symbol \335}';
+  sym.Rightarrow = '{/Symbol \336}';
+  sym.Downarrow = '{/Symbol \337}';
+  sym.diamond = '{/Symbol \340}';
+  sym.copyright = '{/Symbol \343}';
+  sym.lfloor = '{/Symbol \353}';
+  sym.lceil  = '{/Symbol \351}';
+  sym.rfloor = '{/Symbol \373}';
+  sym.rceil  = '{/Symbol \371}';
+  sym.int = '{/Symbol \362}';
+endfunction
+
+function retval = __do_enhanced_option__ (enhanced, obj)
+  retval = "";
+  if (enhanced)
+    if (strcmpi (obj.interpreter, "none"))
+      retval = "noenhanced";
+    else
+      retval = "enhanced";
+    endif
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__go_draw_figure__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,206 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __go_draw_figure__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function __go_draw_figure__ (h, plot_stream, enhanced, mono)
+
+  htype = get (h, "type");
+  if (strcmp (htype, "figure"))
+    ## Get complete list of children.
+    kids = allchild (h);
+    nkids = length (kids);
+
+    if (nkids > 0)
+      fputs (plot_stream, "\nreset;\n");
+      fputs (plot_stream, "set autoscale keepfix;\n");
+      fputs (plot_stream, "set origin 0, 0\n");
+      fputs (plot_stream, "set size 1, 1\n");
+      bg = get (h, "color");
+      if (isnumeric (bg))
+        fprintf (plot_stream, "set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * bg);
+        bg_is_set = true;
+      else
+        bg_is_set = false;
+      endif
+      fg_was_set = false;
+
+      for i = nkids:-1:1
+        type = get (kids(i), "type");
+        switch (type)
+          case "axes"
+            if (strcmpi (get (kids (i), "tag"), "legend"))
+              ## This is so ugly. If there was a way of getting
+              ## gnuplot to give us the text extents of strings
+              ## then we could get rid of this mess.
+              lh = getfield (get (kids(i), "userdata"), "handle");
+              if (isscalar (lh))
+                ## We have a legend with a single parent. It'll be handled
+                ## below as a gnuplot key to the axis it corresponds to
+                continue;
+              else
+                ca = lh(1);
+                ## Rely upon listener to convert axes position
+                ## to "normalized" units.
+                legend_axes_units = get (kids(i), "units");
+                legend_axes_position = get (kids(i), "position");
+                legend_axes_outerposition = get (kids(i), "outerposition");
+                legend_axes_box = get (kids(i), "box");
+                legend_axes_ylim = get (kids(i), "ylim");
+                orig_axes_units = get (ca, "units");
+                hlgnd = get (kids(i));
+
+                unwind_protect
+                  set (ca, "units", "normalized");
+                  set (kids(i), "units", "normalized", "box", "off",
+                       "ylim", [-2, -1], "position", get (ca(1), "position"),
+                       "outerposition", get (ca(1), "outerposition"));
+
+                  ## Create a new set of lines with the appropriate
+                  ## displaynames, etc
+                  toberm = [];
+                  hobj = get (kids(i), "children");
+                  for j = numel (hobj) : -1 : 1
+                    if (! strcmp (get (hobj(j), "type"), "text"))
+                      continue;
+                    endif
+                    displayname = get (hobj(j), "string");
+                    ll = [];
+                    lm = [];
+                    for k = numel (hobj) : -1 : 1
+                      if (! strcmp (get (hobj(k), "type"), "line"))
+                        continue;
+                      endif
+                      if (get (hobj(j), "userdata")
+                          != get (hobj(k), "userdata"))
+                        continue;
+                      endif
+                      if (! strcmp (get (hobj(k), "linestyle"), "none"))
+                        ll = hobj(k);
+                      endif
+                      if (! strcmp (get (hobj(k), "marker"), "none"))
+                        lm = hobj(k);
+                      endif
+                    endfor
+
+                    if (! isempty (ll))
+                      if (!isempty (lm))
+                        toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", get(ll,"linestyle"), "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
+                      else
+                        toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(ll,"color"), "linestyle", get(ll,"linestyle"), "marker", "none", "displayname", displayname, "parent", kids(i))];
+                      endif
+                    elseif (! isempty (lm))
+                      toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", "none", "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
+                    endif
+                  endfor
+                  if (bg_is_set)
+                    fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
+                  endif
+                  __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
+                                    bg_is_set, false, hlgnd);
+                unwind_protect_cleanup
+                  ## Return axes "units" and "position" back to
+                  ## their original values.
+                  set (ca, "units", orig_axes_units);
+                  set (kids(i), "units", legend_axes_units,
+                       "box", legend_axes_box,
+                       "ylim", legend_axes_ylim,
+                       "position", legend_axes_position,
+                       "outerposition", legend_axes_outerposition);
+                  delete (toberm);
+                  bg_is_set = false;
+                end_unwind_protect
+              endif
+            else
+              ## Rely upon listener to convert axes position
+              ## to "normalized" units.
+              orig_axes_units = get (kids(i), "units");
+              orig_axes_position = get (kids(i), "position");
+              unwind_protect
+                set (kids(i), "units", "normalized");
+                fg = get (kids(i), "color");
+                if (isnumeric (fg) && strcmp (get (kids(i), "visible"), "on"))
+                  fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * fg);
+                  fg_is_set = true;
+                  fg_was_set = true;
+                elseif (fg_was_set)
+                  fprintf (plot_stream, "unset obj 2\n");
+                  fg_is_set = false;
+                  fg_was_set = false;
+                else
+                  fg_is_set = false;
+                endif
+                if (bg_is_set)
+                  fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
+                endif
+                ## Find if this axes has an associated legend axes and pass it
+                ## to __go_draw_axes__
+                hlegend = [];
+                fkids = get (h, "children");
+                for j = 1 : numel (fkids)
+                  if (ishandle (fkids (j))
+                      && strcmp (get (fkids (j), "type"), "axes")
+                      && (strcmp (get (fkids (j), "tag"), "legend")))
+                    udata = get (fkids (j), "userdata");
+                    if (isscalar (udata.handle)
+                        && ! isempty (intersect (udata.handle, kids (i))))
+                      hlegend = get (fkids (j));
+                      break;
+                    endif
+                  endif
+                endfor
+                __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
+                                  bg_is_set, fg_is_set, hlegend);
+              unwind_protect_cleanup
+                ## Return axes "units" and "position" back to
+                ## their original values.
+                set (kids(i), "units", orig_axes_units);
+                set (kids(i), "position", orig_axes_position);
+                bg_is_set = false;
+                fg_is_set = false;
+              end_unwind_protect
+            endif
+          case "uimenu"
+            ## ignore uimenu objects
+            kids(i) = [];
+          otherwise
+            error ("__go_draw_figure__: unknown object class, %s", type);
+        endswitch
+      endfor
+      if (isempty (kids))
+        fputs (plot_stream, "\nreset; clear;\n");
+        fflush (plot_stream);
+      else
+        fputs (plot_stream, "\nunset multiplot;\n");
+      endif
+    else
+      fputs (plot_stream, "\nreset; clear;\n");
+      fflush (plot_stream);
+    endif
+  else
+    error ("__go_draw_figure__: expecting figure object, found '%s'",
+           htype);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__print_parse_opts__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,654 @@
+## Copyright (C) 2010-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{args} =} __print_parse_opts__ (@var{propname}, @var{propvalue})
+## @deftypefnx {Function File} {@var{args} =} __print_parse_opts__ (@var{struct})
+## Undocumented internal function.
+## @end deftypefn
+
+function arg_st = __print_parse_opts__ (varargin)
+
+  persistent warn_on_missing_binary = true
+
+  arg_st.append_to_file = false;
+  arg_st.canvas_size = [];
+  arg_st.debug = false;
+  arg_st.debug_file = "octave-print-commands.log";
+  arg_st.devopt = "";
+  arg_st.epstool_binary = __quote_path__ (__find_binary__ ("epstool"));
+  arg_st.figure = get (0, "currentfigure");
+  arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev"));
+  arg_st.fontsize = "";
+  arg_st.font = "";
+  arg_st.scalefontsize = 1;
+  arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid
+  arg_st.formatted_for_printing = false;
+  arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ());
+  arg_st.ghostscript.debug = false;
+  arg_st.ghostscript.device = "";
+  arg_st.ghostscript.epscrop = true;
+  arg_st.ghostscript.level = [];
+  arg_st.ghostscript.output = "";
+  arg_st.ghostscript.papersize = "";
+  arg_st.ghostscript.pageoffset = [];
+  arg_st.ghostscript.resolution = 150;
+  arg_st.ghostscript.antialiasing = false;
+  arg_st.ghostscript.antialiasing_textalphabits = 4;
+  arg_st.ghostscript.antialiasing_graphicsalphabits = 4;
+  arg_st.loose = false;
+  arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr"));
+  arg_st.name = "";
+  arg_st.orientation = "";
+  arg_st.pstoedit_binary = __quote_path__ (__find_binary__ ("pstoedit"));
+  arg_st.preview = "";
+  arg_st.printer = "";
+  arg_st.send_to_printer = false;
+  arg_st.special_flag = "textnormal";
+  arg_st.tight_flag = false;
+  arg_st.use_color = 0; # 0=default, -1=mono, +1=color
+
+  if (isunix ())
+    arg_st.lpr_options = "-l";
+  elseif (ispc ())
+    arg_st.lpr_options = "-o l";
+  else
+    arg_st.lpr_options = "";
+  endif
+  arg_st.unlink = {};
+
+  if (nargin > 0 && isfigure (varargin{1}))
+    arg_st.figure = varargin{1};
+    varargin(1) = [];
+  endif
+
+  for i = 1:numel (varargin)
+    arg = strtrim (varargin{i});
+    if (ischar (arg))
+      if (strcmp (arg, "-color"))
+        arg_st.use_color = 1;
+      elseif (strcmp (arg, "-append"))
+        arg_st.append_to_file = true;
+      elseif (strcmp (arg, "-mono"))
+        arg_st.use_color = -1;
+      elseif (strcmp (arg, "-solid"))
+        arg_st.force_solid = 1;
+      elseif (strcmp (arg, "-dashed"))
+        arg_st.force_solid = -1;
+      elseif (strncmp (arg, "-portrait", length (arg)))
+        arg_st.orientation = "portrait";
+      elseif (strncmp (arg, "-landscape", length (arg)))
+        arg_st.orientation = "landscape";
+      elseif (strcmp (arg, "-loose"))
+        arg_st.loose = true;
+        arg_st.tight_flag = false;
+      elseif (strcmp (arg, "-tight"))
+        arg_st.loose = false;
+        arg_st.tight_flag = true;
+      elseif (strcmp (arg, "-textspecial"))
+        arg_st.special_flag = "textspecial";
+      elseif (any (strcmp (arg, {"-interchange", "-metafile", "-pict", "-tiff"})))
+        arg_st.preview = arg(2:end);
+      elseif (strncmp (arg, "-debug", 6))
+        arg_st.debug = true;
+        arg_st.ghostscript.debug = true;
+        if (length (arg) > 7)
+          arg_st.debug_file = arg(8:end);
+        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-d")
+        arg_st.devopt = tolower (arg(3:end));
+      elseif (length (arg) > 2 && arg(1:2) == "-P")
+        arg_st.printer = arg;
+      elseif (strncmp (arg, "-EPSTOOL:", 9))
+        arg_st.epstool_binary = arg{10:end};
+      elseif (strncmp (arg, "-FIG2DEV:", 9))
+        arg_st.fig2dev_binary = arg{10:end};
+      elseif (strncmp (arg, "-PSTOEDIT:", 9))
+        arg_st.pstoedit_binary = arg{10:end};
+      elseif (strncmpi (arg, "-textalphabits=", 15))
+        n = find (arg == "=");
+        if (! isempty (n) && n == numel (arg) - 1 && any (arg(end) == "124"))
+          arg_st.ghostscript.antialiasing_textalphabits = str2num (arg(end));
+        else
+          error ("print: improper syntax, or value, for TextAlphaBits");
+        endif
+      elseif (strncmpi (arg, "-graphicsalphabits=", 19))
+        n = find (arg == "=");
+        if (! isempty (n) && n == numel (arg) - 1 && any (arg(end) == "124"))
+          arg_st.ghostscript.antialiasing_graphicsalphabits = str2num (arg(end));
+        else
+          error ("print: improper syntax, or value, for GraphicsAlphaBits");
+        endif
+      elseif ((length (arg) > 2) && arg(1:2) == "-G")
+        arg_st.ghostscript.binary = file_in_path (getenv ("PATH"), arg(3:end));
+        if (isempty (arg_st.ghostscript.binary))
+          error ("print: Ghostscript binary ""%s"" could not be located",
+                 arg(3:end));
+        else
+          arg_st.ghostscript.binary = __quote_path__ (arg_st.ghostscript.binary);
+        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-F")
+        idx = rindex (arg, ":");
+        if (idx)
+          arg_st.font = arg(3:idx-1);
+          arg_st.fontsize = str2num (arg(idx+1:end));
+        else
+          arg_st.font = arg(3:end);
+        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-S")
+        arg_st.canvas_size = str2num (arg(3:end));
+      elseif (length (arg) > 2 && arg(1:2) == "-r")
+        arg_st.ghostscript.resolution = str2double (arg(3:end));
+      elseif (length (arg) > 2 && arg(1:2) == "-f")
+        arg_st.figure = str2num (arg(3:end));
+      elseif (length (arg) >= 1 && arg(1) == "-")
+        error ("print: unknown option '%s'", arg);
+      elseif (length (arg) > 0)
+        arg_st.name = tilde_expand (arg);
+      endif
+    elseif (isfigure (arg))
+      arg_st.figure = arg;
+    else
+      error ("print: expecting inputs to be character string options or a figure handle");
+    endif
+  endfor
+
+  if (arg_st.ghostscript.resolution == 0)
+    ## Do as Matlab does.
+    arg_st.ghostscript.resolution = get (0, "screenpixelsperinch");
+  endif
+
+  if (isempty (arg_st.orientation))
+    if (isfigure (arg_st.figure))
+      arg_st.orientation = get (arg_st.figure, "paperorientation");
+    else
+      ## Allows tests to be run without error.
+      arg_st.orientation = "portrait";
+    endif
+  endif
+
+  if (isempty (arg_st.ghostscript.binary))
+    arg_st.ghostscript.binary = __ghostscript_binary__ ();
+  endif
+
+  dot = rindex (arg_st.name, ".");
+  if (isempty (arg_st.devopt))
+    if (dot == 0)
+      arg_st.devopt = "psc";
+    else
+      arg_st.devopt = tolower (arg_st.name(dot+1:end));
+    endif
+  endif
+
+  if (arg_st.use_color == 0)
+    if (any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt)))
+      arg_st.use_color = -1;
+    else
+      arg_st.use_color = 1;
+    endif
+  endif
+
+  if (strcmp (arg_st.devopt, "tex"))
+    arg_st.devopt = "epslatex";
+  elseif (strcmp (arg_st.devopt, "ill"))
+    arg_st.devopt = "aifm";
+  elseif (strcmp (arg_st.devopt, "cdr"))
+    arg_st.devopt = "corel";
+  elseif (strcmp (arg_st.devopt, "meta"))
+    arg_st.devopt = "emf";
+  elseif (strcmp (arg_st.devopt, "jpg"))
+    arg_st.devopt = "jpeg";
+  endif
+
+  dev_list = {"aifm", "corel", "fig", "png", "jpeg", ...
+              "gif", "pbm", "pbmraw", "dxf", "mf", ...
+              "svg", "hpgl", "ps", "ps2", "psc", ...
+              "psc2", "eps", "eps2", "epsc", "epsc2", ...
+              "emf", "pdf", "pslatex", "epslatex", "epslatexstandalone", ...
+              "pslatexstandalone", "pdflatexstandalone", ...
+              "pstex", "tiff", "tiffn" "tikz", "pcxmono", ...
+              "pcx24b", "pcx256", "pcx16", "pgm", "pgmraw", ...
+              "ppm", "ppmraw", "pdflatex", "texdraw", ...
+              "pdfcairo", "pngcairo", "pstricks", ...
+              "epswrite", "pswrite", "ps2write", "pdfwrite"};
+
+  suffixes = {"ai", "cdr", "fig", "png", "jpg", ...
+              "gif", "pbm", "pbm", "dxf", "mf", ...
+              "svg", "hpgl", "ps", "ps", "ps", ...
+              "ps", "eps", "eps", "eps", "eps", ...
+              "emf", "pdf", "tex", "tex", "tex", ...
+              "tex", "tex", ...
+              "ps", "tiff", "tiff", "tikz", "pcx", ...
+              "pcx", "pcx", "pcx", "pgm", "pgm", ...
+              "ppm", "ppm", "tex", "tex", ...
+              "pdf", "png", "tex", ...
+              "eps", "ps", "ps", "pdf"};
+
+  if (isfigure (arg_st.figure))
+    __graphics_toolkit__ = get (arg_st.figure, "__graphics_toolkit__");
+  else
+    ## Allow tests when no figures are present.
+    __graphics_toolkit__ = get (0, "defaultfigure__graphics_toolkit__");
+  endif
+
+  if (strcmp (__graphics_toolkit__, "gnuplot")
+      && __gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
+    suffixes(strncmp (dev_list, "epslatex", 8)) = {"eps"};
+  endif
+
+  match = strcmpi (dev_list, arg_st.devopt);
+  if (any (match))
+    default_suffix = suffixes {match};
+  else
+    default_suffix = arg_st.devopt;
+  endif
+
+  if (dot == 0 && ! isempty (arg_st.name))
+    arg_st.name = strcat (arg_st.name, ".", default_suffix);
+  endif
+
+  if (arg_st.append_to_file)
+    if (isempty (arg_st.name))
+      arg_st.append_to_file = false;
+    elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ...
+                                          "ps", "ps2", "psc", "psc2", "pdf"})))
+      have_ghostscript = ! isempty (__ghostscript_binary__ ());
+      if (have_ghostscript)
+        file_exists = ((numel (dir (arg_st.name)) == 1)
+                       && (! isdir (arg_st.name)));
+        if (! file_exists)
+          arg_st.append_to_file = false;
+        endif
+      else
+        arg_st.append_to_file = false;
+        warning ("print.m: appended output requires ghostscript to be installed");
+      endif
+    else
+      warning ("print.m: appended output is not supported for device '%s'",
+               arg_st.devopt);
+      arg_st.append_to_file = false;
+    endif
+  endif
+
+  if (! isempty (arg_st.printer) || isempty (arg_st.name))
+    arg_st.send_to_printer = true;
+  endif
+
+  if (any (strcmp (arg_st.devopt, {"ps", "ps2", "psc", "psc2", "pdf"})))
+    arg_st.formatted_for_printing = true;
+  endif
+
+  aliases = gs_aliases ();
+  if (any (strcmp (arg_st.devopt, fieldnames (aliases))))
+    arg_st.devopt = aliases.(arg_st.devopt);
+  endif
+
+  ## FIXME - eps2 & epsc2 needs to be handled
+  if (strcmp (arg_st.devopt, "pswrite"))
+    arg_st.ghostscript.level = 1;
+  elseif (strcmp (arg_st.devopt, "ps2write"))
+    arg_st.ghostscript.level = 2;
+  endif
+
+  if ((any (strcmp (arg_st.devopt, gs_device_list))
+       && ! arg_st.formatted_for_printing)
+      || any (strcmp (arg_st.devopt, {"pswrite", "ps2write", "pdfwrite"})))
+    ## Use ghostscript for graphic formats
+    arg_st.ghostscript.device = arg_st.devopt;
+    arg_st.ghostscript.output = arg_st.name;
+    arg_st.ghostscript.antialiasing = true;
+    if (arg_st.formatted_for_printing)
+      arg_st.ghostscript.epscrop = ! arg_st.loose;
+    else
+      ## pstoedit throws errors if the EPS file isn't cropped
+      arg_st.ghostscript.epscrop = true;
+    endif
+  elseif (all (! strcmp (arg_st.devopt, dev_list)))
+    ## Assume we are formating output for a printer
+    arg_st.formatted_for_printing = true;
+    arg_st.ghostscript.device = arg_st.devopt;
+    arg_st.ghostscript.output = arg_st.name;
+    arg_st.ghostscript.antialiasing = false;
+    arg_st.ghostscript.epscrop = ! arg_st.loose;
+  endif
+
+  if (arg_st.send_to_printer)
+    if (isempty (arg_st.name))
+      ## Pipe the ghostscript output 
+      arg_st.name = "-";
+    else
+      error ("print: a file name may not specified when spooling to a printer")
+    endif
+    if (! any (strcmp (arg_st.devopt, gs_device_list))
+      || ! any (strcmp (arg_st.devopt, {"pswrite", "ps2write"})))
+      ## Only postscript and supported ghostscript devices
+      error ("print: invalid format for spooling to a printer")
+    endif
+  elseif (isempty (arg_st.name))
+    error ("print: an output file name must be specified")
+  endif
+
+  if (isempty (arg_st.canvas_size))
+    if (isfigure (arg_st.figure))
+      [arg_st.ghostscript.papersize, paperposition] = ...
+                           gs_papersize (arg_st.figure, arg_st.orientation);
+    else
+      ## allows tests to be run
+      arg_st.ghostscript.papersize = "letter";
+      paperposition = [0.25, 2.50, 8.00, 6.00] * 72;
+    endif
+    arg_st.canvas_size = paperposition(3:4);
+    if (strcmp (__graphics_toolkit__, "gnuplot") && ! arg_st.ghostscript.epscrop)
+      arg_st.ghostscript.pageoffset = paperposition(1:2) - 50;
+    else
+      arg_st.ghostscript.pageoffset = paperposition(1:2);
+    endif
+  else
+    ## Convert canvas size to points from pixels.
+    if (! isempty (arg_st.fontsize))
+      ## Work around the eps bbox having whole numbers (both gnuplot & gl2ps).
+      arg_st.scalefontsize = arg_st.ghostscript.resolution / 72;
+    endif
+    arg_st.ghostscript.resolution = 72;
+    arg_st.ghostscript.papersize = arg_st.canvas_size;
+    arg_st.ghostscript.epscrop = true;
+    arg_st.ghostscript.pageoffset = [0, 0];
+  endif
+
+  if (arg_st.formatted_for_printing)
+    arg_st.ghostscript.resolution = [];
+  else
+    arg_st.ghostscript.papersize = "";
+    arg_st.ghostscript.pageoffset = [0, 0];
+  endif
+
+  if (warn_on_missing_binary)
+    if (isempty (arg_st.ghostscript.binary))
+      warning ("print:missing_gs", "print.m: Ghostscript binary is not available.\nOnly eps output is available.");
+    else
+      if (isempty (arg_st.epstool_binary))
+        warning ("print:missing_epstool", "print.m: epstool binary is not available.\nSome output formats are not available.");
+      endif
+      if (isempty (arg_st.fig2dev_binary))
+        warning ("print:missing_fig2dev", "print.m: fig2dev binary is not available.\nSome output formats are not available.");
+      endif
+      if (isempty (arg_st.pstoedit_binary))
+        warning ("print:missing_pstoedit", "print.m: pstoedit binary is not available.\nSome output formats are not available.");
+      endif
+    endif
+    warn_on_missing_binary = false;
+  endif
+
+endfunction
+
+## Test blocks are not allowed (and not needed) for private functions
+#%!test
+%! opts = __print_parse_opts__ ();
+%! assert (opts.devopt, "pswrite");
+%! assert (opts.use_color, 1);
+%! assert (opts.send_to_printer, true);
+%! assert (opts.canvas_size, [576, 432]);
+%! assert (opts.ghostscript.device, "pswrite");
+
+#%!test
+%! opts = __print_parse_opts__ ("test.pdf", "-S640,480");
+%! assert (opts.canvas_size, [307.2, 230.4], 0.1);
+
+#%!test
+%! opts = __print_parse_opts__ ("-dpsc", "-append", "-loose");
+%! assert (opts.devopt, "pswrite");
+%! assert (opts.send_to_printer, true);
+%! assert (opts.use_color, 1);
+%! assert (opts.append_to_file, false);
+%! assert (opts.ghostscript.device, "pswrite");
+%! assert (opts.ghostscript.epscrop, false);
+
+#%!test
+%! opts = __print_parse_opts__ ("-deps", "-tight");
+%! assert (opts.tight_flag, true);
+%! assert (opts.send_to_printer, true);
+%! assert (opts.use_color, -1);
+%! assert (opts.ghostscript.device, "");
+
+#%!test
+%! opts = __print_parse_opts__ ("-djpg", "foobar", "-mono", "-loose");
+%! assert (opts.devopt, "jpeg");
+%! assert (opts.name, "foobar.jpg");
+%! assert (opts.ghostscript.device, "jpeg");
+%! assert (opts.ghostscript.epscrop, true);
+%! assert (opts.ghostscript.papersize, "");
+%! assert (opts.ghostscript.pageoffset, [0, 0]);
+%! assert (opts.send_to_printer, false);
+%! assert (opts.printer, "");
+%! assert (opts.use_color, -1);
+
+#%!test
+%! opts = __print_parse_opts__ ("-ddeskjet", "foobar", "-mono", "-Pmyprinter");
+%! assert (opts.ghostscript.output, "foobar.deskjet");
+%! assert (opts.ghostscript.device, "deskjet");
+%! assert (opts.devopt, "deskjet");
+%! assert (opts.send_to_printer, true);
+%! assert (opts.printer, "-Pmyprinter");
+%! assert (opts.use_color, -1);
+
+#%!test
+%! opts = __print_parse_opts__ ("-f5", "-dljet3");
+%! assert (opts.ghostscript.device, "ljet3");
+%! assert (strfind (opts.ghostscript.output, ".ljet3"));
+%! assert (opts.devopt, "ljet3");
+%! assert (opts.send_to_printer, true);
+%! assert (opts.figure, 5);
+
+function cmd = __quote_path__ (cmd)
+  if (! isempty (cmd))
+    is_quoted = all (cmd([1, end]) == "'");
+    if (! is_quoted)
+      dos_shell = ! isunix () && ispc ();
+      if (dos_shell && any (cmd == "/"))
+        cmd = strrep (cmd, "/", "\\");
+      endif
+      if (any (cmd == " "))
+        cmd = strcat ('"', strrep (cmd, '"', '""') ,'"');
+      endif
+    endif
+  endif
+endfunction
+
+function gs = __ghostscript_binary__ ()
+
+  persistent ghostscript_binary = ""
+  persistent warn_on_no_ghostscript = true
+  persistent warn_on_bad_gsc = true
+
+  if (isempty (ghostscript_binary))
+    GSC = getenv ("GSC");
+    if (exist (GSC, "file")
+        || (! isempty (GSC) && file_in_path (getenv ("PATH"), GSC)))
+      gs_binaries = {GSC};
+    elseif (! isempty (GSC) && warn_on_bad_gsc)
+      warning ("print:badgscenv",
+               "print.m: GSC environment variable not set properly");
+      warn_on_bad_gsc = false;
+      gs_binaries = {};
+    else
+      gs_binaries = {};
+    endif
+    if (isunix ())
+      ## Unix - Includes Mac OSX and Cygwin.
+      gs_binaries = horzcat (gs_binaries, {"gs", "gs.exe"});
+    else
+      ## pc - Includes Win32 and mingw.
+      gs_binaries = horzcat (gs_binaries, {"gs.exe", "gswin32c.exe", "gswin64c.exe", "mgs.exe"});
+    endif
+    n = 0;
+    while (n < numel (gs_binaries) && isempty (ghostscript_binary))
+      n = n + 1;
+      ghostscript_binary = file_in_path (getenv ("PATH"), gs_binaries{n});
+    endwhile
+    if (warn_on_no_ghostscript && isempty (ghostscript_binary))
+      warning ("print:noghostscript",
+               "print.m: ghostscript not found in PATH");
+      warn_on_no_ghostscript = false;
+    endif
+  endif
+
+  gs = ghostscript_binary;
+
+endfunction
+
+function bin = __find_binary__ (binary)
+
+  persistent data = struct ()
+
+  if (! isfield (data, binary))
+    ## Reinitialize when 'user_binaries' is present.
+    data.(binary).bin = "";
+    data.(binary).warn_on_absence = false;
+  endif
+
+  if (isempty (data.(binary).bin))
+    if (isunix ())
+      ## Unix - Includes Mac OSX and Cygwin.
+      binaries = strcat (binary, {"", ".exe"});
+    else
+      ## pc - Includes Win32 and mingw.
+      binaries = strcat (binary, {".exe"});
+    endif
+    n = 0;
+    while (n < numel (binaries) && isempty (data.(binary).bin))
+      n = n + 1;
+      data.(binary).bin = file_in_path (getenv ("PATH"), binaries{n});
+    endwhile
+    if (isempty (data.(binary).bin) && data.(binary).warn_on_absence)
+      warning (sprintf ("print:no%s", binary),
+               "print.m: '%s' not found in PATH", binary);
+      data.(binary).warn_on_absence = false;
+    endif
+  endif
+
+  bin = data.(binary).bin;
+
+endfunction
+
+function [papersize, paperposition] = gs_papersize (hfig, paperorientation)
+  persistent papertypes papersizes
+
+  if (isempty (papertypes))
+    papertypes = {"usletter", "uslegal",     "a0",     "a1", ...
+                        "a2",      "a3",     "a4",     "a5", ...
+                        "b0",      "b1",     "b2",     "b3", ...
+                        "b4",      "b5", "arch-a", "arch-b", ...
+                    "arch-c",  "arch-d", "arch-e",      "a", ...
+                         "b",       "c",      "d",      "e", ...
+                   "tabloid"};
+    papersizes = [ 8.5, 11.0;  8.5, 14.0; 33.1, 46.8; 23.4, 33.1;
+                  16.5, 23.4; 11.7, 16.5;  8.3, 11.7;  5.8,  8.3;
+                  39.4, 55.7; 27.8, 39.4; 19.7, 27.8; 13.9, 19.7;
+                   9.8, 13.9;  6.9,  9.8;  9.0, 12.0; 12.0, 18.0;
+                  18.0, 24.0; 24.0, 36.0; 36.0, 48.0;  8.5, 11.0;
+                  11.0, 17.0; 18.0, 24.0; 24.0, 36.0; 36.0, 48.0;
+                  11.0, 17.0] * 72;
+  endif
+
+  papertype = get (hfig, "papertype");
+  paperunits = get (hfig, "paperunits");
+  paperposition = get (hfig, "paperposition");
+  if (strcmp (papertype, "<custom>"))
+    papersize = get (hfig, "papersize");
+    papersize = convert2points (papersize , paperunits);
+  else
+    papersize = papersizes (strcmp (papertypes, papertype), :);
+  endif
+
+  if (strcmp (paperunits, "normalized"))
+    paperposition = paperposition .* papersize([1,2,1,2]);
+  else
+    paperposition = convert2points (paperposition, paperunits);
+  endif
+
+  ## FIXME - This will be obsoleted by listeners for paper properties.
+  ##         Papersize is tall when portrait,and wide when landscape.
+  if ((papersize(1) > papersize(2) && strcmpi (paperorientation, "portrait"))
+      || (papersize(1) < papersize(2) && strcmpi (paperorientation, "landscape")))
+    papersize = papersize([2,1]);
+    paperposition = paperposition([2,1,4,3]);
+  endif
+
+  if ((! strcmp (papertype, "<custom>")) && (strcmp (paperorientation, "portrait")))
+    ## For portrait use the ghostscript name
+    papersize = papertype;
+    papersize(papersize=="-") = "";
+    papersize = strrep (papersize, "us", "");
+    switch (papersize)
+      case "a"
+        papersize = "letter";
+      case {"b", "tabloid"}
+        papersize = "11x17";
+      case {"c", "d", "e"}
+        papersize = strcat ("arch", papersize);
+    endswitch
+    if (strncmp (papersize, "arch", 4))
+      papersize(end) = upper (papersize(end));
+    endif
+  endif
+
+endfunction
+
+function value = convert2points (value, units)
+  switch (units)
+    case "inches"
+      value = value * 72;
+    case "centimeters"
+      value = value * 72 / 2.54;
+    case "normalized"
+      error ("print:customnormalized",
+             "print.m: papersize=='<custom>' and paperunits='normalized' may not be combined");
+  endswitch
+endfunction
+
+function device_list = gs_device_list ();
+  ## Graphics formats/languages, not priners.
+  device_list = {"bmp16"; "bmp16m"; "bmp256"; "bmp32b"; "bmpgray"; ...
+                 "epswrite"; "jpeg"; "jpegcymk"; "jpeggray"; "pbm"; ...
+                 "pbmraw"; "pcx16"; "pcx24b"; "pcx256"; "pcx2up"; ...
+                 "pcxcmyk"; "pcxgray"; "pcxmono"; "pdfwrite"; "pgm"; ...
+                 "pgmraw"; "pgnm"; "pgnmraw"; "png16"; "png16m"; ...
+                 "png256"; "png48"; "pngalpha"; "pnggray"; "pngmono"; ...
+                 "pnm"; "pnmraw"; "ppm"; "ppmraw"; "ps2write"; ...
+                 "pswrite"; "tiff12nc"; "tiff24nc"; "tiff32nc"; ...
+                 "tiffcrle"; "tiffg3"; "tiffg32d"; "tiffg4"; ...
+                 "tiffgray"; "tifflzw"; "tiffpack"; "tiffsep"};
+endfunction
+
+function aliases = gs_aliases ();
+  ## Aliases for other devices: "bmp", "png", "tiff", "tiffn", "pdf",
+  ##                            "ps", "ps2", "psc", "psc2"
+  ##
+  ## eps, epsc, eps2, epsc2 are not included here because those are
+  ## are generated by the graphics toolkit.
+  aliases.bmp = "bmp32b";
+  aliases.pdf = "pdfwrite";
+  aliases.png = "png16m";
+  aliases.ps = "pswrite";
+  aliases.ps2 = "ps2write";
+  aliases.psc = "pswrite";
+  aliases.psc2 = "ps2write";
+  aliases.tiff = "tiff24nc";
+  aliases.tiffn = "tiff24nc";
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__tight_eps_bbox__.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,124 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{bbox} =} __tight_eps_bbox__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-07-26
+
+function bb = __tight_eps_bbox__ (opts, eps_file_name)
+
+  box_string = "%%BoundingBox:";
+
+  cmd = sprintf ("\"%s\" \"%s\" 2>&1", "head", eps_file_name);
+  [status, output] = system (cmd);
+
+  if (status == 0)
+    orig_bbox_line = get_bbox (output);
+  else
+    error ("print:noboundingbox",
+           "print.m: no bounding box found in '%s'", eps_file_name);
+  endif
+
+  ghostscript_options = "-q -dBATCH -dSAFER -dNOPAUSE -dTextAlphaBits=4 -sDEVICE=bbox";
+  cmd = sprintf ("\"%s\" %s \"%s\" 2>&1", opts.ghostscript.binary,
+                 ghostscript_options, eps_file_name);
+  [status, output] = system (cmd);
+
+  if (status == 0)
+    tight_bbox_line = get_bbox (output);
+  else
+    warning ("print:nogsboundingbox",
+             "print.m: ghostscript failed to determine the bounding for '%s'",
+             eps_file_name);
+  endif
+
+  ## Attempt to fix the bbox in place.
+  fid = fopen (eps_file_name, "r+");
+  unwind_protect
+    bbox_replaced = false;
+    looking_for_bbox = true;
+    while (looking_for_bbox)
+      current_line = fgetl (fid);
+      if (strncmpi (current_line, box_string, length (box_string)))
+        line_length = numel (current_line);
+        num_spaces = line_length - numel (tight_bbox_line);
+        if (numel (current_line) >= numel (tight_bbox_line))
+          new_line = tight_bbox_line;
+          new_line(end+1:numel (current_line)) = " ";
+          bbox_replaced = true;
+          ## Back up to the beginning of the line (include EOL characters).
+          if (ispc ())
+            fseek (fid, -line_length-2, "cof");
+          else
+            fseek (fid, -line_length-1, "cof");
+          endif
+          count = fprintf (fid, "%s", new_line);
+        endif
+        looking_for_bbox = false;
+      elseif (! ischar (current_line))
+        looking_for_bbox = false;
+      endif
+    endwhile
+  unwind_protect_cleanup
+    fclose (fid);
+  end_unwind_protect
+
+  ## If necessary load the eps-file and replace the bbox (can be slow).
+  if (! bbox_replaced)
+    fid = fopen (eps_file_name, "r");
+    unwind_protect
+      data = char (fread (fid, Inf)).';
+    unwind_protect_cleanup
+      fclose (fid);
+    end_unwind_protect
+    n = strfind (data, box_string);
+    if (numel (n) > 1)
+      ## Only replace one instance.
+      n = n(1);
+    elseif (isempty (n))
+      error ("print:noboundingbox", ...
+             "print.m: no bounding box found in '%s'.", eps_file_name);
+    endif
+    m = numel (orig_bbox_line);
+    data = horzcat (data(1:(n-1)), tight_bbox_line, data((n+m):end));
+    fid = fopen (eps_file_name, "w");
+    unwind_protect
+      fprintf (fid, "%s", data);
+    unwind_protect_cleanup
+      fclose (fid);
+    end_unwind_protect
+  endif
+
+endfunction
+
+function bbox_line = get_bbox (lines)
+  box_string = "%%BoundingBox:";
+  pattern = strcat (box_string, "[^%]*");
+  pattern = pattern(1:find (double (pattern) > 32, 1, "last"));
+  bbox_line = regexp (lines, pattern, "match");
+  if (iscell (bbox_line))
+    bbox_line = bbox_line{1};
+  endif
+  ## Remove the EOL characters.
+  bbox_line(double (bbox_line) < 32) = "";
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/refresh.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,45 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} refresh ()
+## @deftypefnx {Function File} {} refresh (@var{h})
+## Refresh a figure, forcing it to be redrawn.
+##
+## When called without an argument the current figure is redrawn.  Otherwise,
+## the figure with graphic handle @var{h} is redrawn.
+## @seealso{drawnow}
+## @end deftypefn
+
+function refresh (h)
+
+  if (nargin > 1)
+    print_usage ();
+  elseif (nargin == 1)
+    if (! isfigure (h))
+      error ("refresh: H must be a valid figure handle");
+    endif
+  else
+    h = gcf ();
+  endif
+
+  set (h, "__modified__", "on");
+  drawnow ();
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/refreshdata.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,119 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} refreshdata ()
+## @deftypefnx {Function File} {} refreshdata (@var{h})
+## @deftypefnx {Function File} {} refreshdata (@var{h}, @var{workspace})
+## Evaluate any @samp{datasource} properties of the current figure and update
+## the plot if the corresponding data has changed.
+##
+## If the first argument @var{h} is a list of graphic handles, then operate
+## on these objects rather than the current figure returned by @code{gcf}.
+##
+## The optional second argument @var{workspace} can take the following values:
+##
+## @table @asis
+## @item @qcode{"base"}
+## Evaluate the datasource properties in the base workspace.  (default).
+##
+## @item @qcode{"caller"}
+## Evaluate the datasource properties in the workspace of the function
+## that called @code{refreshdata}.
+## @end table
+##
+## An example of the use of @code{refreshdata} is:
+##
+## @example
+## @group
+## x = 0:0.1:10;
+## y = sin (x);
+## plot (x, y, "ydatasource", "y");
+## for i = 1 : 100
+##   pause (0.1);
+##   y = sin (x + 0.1*i);
+##   refreshdata ();
+## endfor
+## @end group
+## @end example
+## @end deftypefn
+
+function refreshdata (h, workspace)
+
+  if (nargin == 0)
+    h = gcf ();
+    workspace = "base";
+  else
+    if (iscell (h))
+      h = [h{:}];
+    endif
+    if (! all (isfigure (h)))
+      error ("refreshdata: H must be a list of figure handles");
+    endif
+    if (nargin == 1)
+      workspace = "base";
+    elseif (nargin == 2)
+      if (! ischar (workspace)
+          || ! any (strcmpi (workspace, {"base", "caller"})))
+        error ('refreshdata: WORKSPACE must be "base" or "caller"');
+      endif
+      workspace = tolower (workspace);
+    else
+      print_usage ();
+    endif
+  endif
+
+  h = findall (h);
+  objs = [];
+  props = {};
+
+  for i = 1 : numel (h)
+    obj = get (h(i));
+    flds = fieldnames (obj);
+    ## regexp() is proper way to do searching, but is 3X slower.
+    ## Pretty unlikely that people are going to be adding datasource
+    ## properties that are not, in fact, datasources.
+    ## m = regexp (flds, '^.+datasource$');
+    m = strfind (flds, "datasource");
+    m = flds(!cellfun (@isempty, m));
+    for j = 1 : numel (m)
+      if (isempty (obj.(m{j})))
+        continue;  # datasource field doesn't point to anything
+      endif
+      expr = obj.(m{j});       # datasource field
+      val = evalin (workspace, expr);
+      pdname = m{j}(1:end-6);  # property data name without "source"
+      set (h(i), pdname, val); 
+    endfor
+  endfor
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! y = sin (x);
+%! plot (x, y, 'ydatasource', 'y');
+%! title ('refreshdata() showing moving sine curve');
+%! axis manual;
+%! for i = 1 : 100
+%!   pause (0);
+%!   y = sin (x + 0.1 * i);
+%!   refreshdata (gcf, 'caller');
+%! end
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/saveas.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,108 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} saveas (@var{h}, @var{filename})
+## @deftypefnx {Function File} {} saveas (@var{h}, @var{filename}, @var{fmt})
+## Save graphic object @var{h} to the file @var{filename} in graphic
+## format @var{fmt}.
+##
+## @var{fmt} should be one of the following formats:
+##
+## @table @code
+##   @item ps
+##     PostScript
+##
+##   @item eps
+##     Encapsulated PostScript
+##
+##   @item jpg
+##     JPEG Image
+##
+##   @item png
+##     PNG Image
+##
+##   @item emf
+##     Enhanced Meta File
+##
+##   @item pdf
+##     Portable Document Format
+## @end table
+##
+## All device formats specified in @code{print} may also be used.  If
+## @var{fmt} is omitted it is extracted from the extension of @var{filename}.
+## The default format is @qcode{"pdf"}.
+##
+## @example
+## @group
+## clf ();
+## surf (peaks);
+## saveas (1, "figure1.png");
+## @end group
+## @end example
+##
+## @seealso{print, orient}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function  saveas (h, filename, fmt = "pdf")
+
+  if ((nargin != 2) && (nargin != 3))
+    print_usage ();
+  endif
+
+  if (ishandle (h))
+    if (isfigure (h))
+      fig = h;
+    else
+      fig = ancestor (h, "figure");
+    endif
+  else
+    error ("saveas: first argument H must be a graphics handle");
+  endif
+
+  if (!ischar (filename))
+    error ("saveas: FILENAME must be a string");
+  endif
+
+  if (nargin == 2)
+    [~, ~, ext] = fileparts (filename);
+    if (!isempty (ext))
+      fmt = ext(2:end);
+    endif
+  endif
+
+  if (nargin == 3)
+    if (!ischar (filename))
+      error ("saveas: EXT must be a string");
+    endif
+
+    [~, ~, ext] = fileparts (filename);
+
+    if (isempty (ext))
+      filename = strcat (filename, ".", fmt);
+    endif
+  endif
+
+  prt_opt = strcat ("-d", tolower (fmt));
+
+  print (fig, filename, prt_opt);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/shg.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,38 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Command} {} shg
+## Show the graph window.
+##
+## Currently, this is the same as executing @code{drawnow}.
+## @seealso{drawnow, figure}
+## @end deftypefn
+
+## Author: jwe
+
+function shg ()
+
+  if (nargin != 0)
+    warning ("shg: ignoring extra arguments");
+  endif
+
+  drawnow ();
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/struct2hdl.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,645 @@
+## Copyright (C) 2012 pdiribarne
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} struct2hdl (@var{s})
+## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p})
+## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev})
+## Construct a graphics handle object @var{h} from the structure @var{s}.
+##
+## The structure must contain the fields @qcode{"handle"}, @qcode{"type"},
+## @qcode{"children"}, @qcode{"properties"}, and @qcode{"special"}.  If the
+## handle of an existing figure or axes is specified, @var{p}, the new object
+## will be created as a child of that object.  If no parent handle is provided
+## then a new figure and the necessary children will be constructed using the
+## default values from the root figure.
+##
+## A third boolean argument @var{hilev} can be passed to specify whether
+## the function should preserve listeners/callbacks, e.g., for legends or
+## hggroups.  The default is false.
+## @seealso{hdl2struct, findobj}
+## @end deftypefn
+
+## Author: pdiribarne <pdiribarne@new-host.home>
+## Created: 2012-03-04
+
+function [h, pout] = struct2hdl (s, p=[], hilev = false)
+
+  fields = {"handle", "type", "children", "properties", "special"};
+  partypes = {"root", "figure", "axes", "hggroup"};
+  othertypes = {"line", "patch", "surface", "image", "text"};
+  alltypes = [partypes othertypes];
+
+  if (nargin > 3 || ! isstruct (s))
+    print_usage ();
+  elseif (! all (isfield (s, fields)))
+    print_usage ();
+  elseif (isscalar (p))
+    if (! ishandle (p))
+      error ("struct2hdl: P is not a handle to a graphic object");
+    endif
+    if (any (strcmp (get (p).type, partypes)))
+      paridx = find (strcmp (get (p).type, alltypes));
+      kididx = find (strcmp (s.type, alltypes));
+      if (kididx <= paridx)
+        error ("struct2hdl: incompatible input handles");
+      endif
+    else
+      error ("struct2hdl: %s object can't be parent object", get (p).type);
+    endif
+    hpar = p;
+    p = [NaN; hpar];
+    ## create appropriate parent if needed
+    if (any (strcmp (s.type, othertypes)))
+      for ii = (paridx+1) : (numel (partypes)-1)
+        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
+        p = [p [NaN; hpar]];
+      endfor
+    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
+      for ii = (paridx+1) : (kididx-1)
+        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
+        p = [p [NaN; hpar]];
+      endfor
+    else
+      par = NaN;
+    endif
+  elseif (isempty (p))
+    if (any (strcmp (s.type, othertypes)))
+      par = axes ();
+    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
+      par = figure ();
+    else
+      par = NaN;
+    endif
+    p = [NaN; par];
+  endif
+  ## read parent (last column) in p and remove it if duplicate
+  par = p(2,end);
+  tst = find (p(2,:) == par);
+  if (numel (tst) > 1)
+    p = p(1:2, 1:(tst(end)-1));
+  endif
+
+  ## Place the "*mode" properties at the end to avoid having the updaters
+  ## change the mode to "manual" when the value is "auto".
+  names = fieldnames (s.properties);
+  n = strncmp (cellfun (@fliplr, names, "uniformoutput", false), "edom", 4);
+  n = (n | strcmp (names, "activepositionproperty"));
+  names = [names(!n); names(n)];
+  if (strcmp (s.type, "axes"))
+    n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition"));
+    if (strcmp (s.properties.activepositionproperty, "position"))
+      names{n_pos(1)} = "outerposition";
+      names{n_pos(2)} = "position";
+    else
+      names{n_pos(1)} = "position";
+      names{n_pos(2)} = "outerposition";
+    endif
+  endif
+  ## Reorder the properties with the mode properties coming last
+  s.properties = orderfields (s.properties, names);
+
+  ## create object
+  if (strcmp (s.type, "root"))
+    h = 0;
+    s.properties = rmfield (s.properties, ...
+                              {"callbackobject", "commandwindowsize", ...
+                               "screendepth", "screenpixelsperinch", ...
+                               "screensize"});
+  elseif (strcmp (s.type, "figure"))
+    h = figure ();
+  elseif (strcmp (s.type, "axes"))
+    ## legends and colorbars are "transformed" in normal axes
+    ## if hilev is not requested
+    if (! hilev)
+      if (strcmp (s.properties.tag, "legend"))
+        s.properties.tag = "";
+        s.properties.userdata = [];
+        par = gcf;
+      elseif (strcmp (s.properties.tag, "colorbar"))
+        s.properties.tag = "";
+        s.properties.userdata = [];
+        par = gcf;
+      endif
+    endif
+
+    [h, s] = createaxes (s, p, par);
+  elseif (strcmp (s.type, "line"))
+    h = createline (s, par);
+  elseif (strcmp (s.type, "patch"))
+    [h, s] = createpatch (s, par);
+  elseif (strcmp (s.type, "text"))
+    h = createtext (s, par);
+  elseif (strcmp (s.type, "image"))
+    h = createimage (s, par);
+  elseif (strcmp (s.type, "surface"))
+    h = createsurface (s, par);
+  elseif (strcmp (s.type, "hggroup"))
+    [h, s, p] = createhg (s, p, par, hilev);
+  else
+    error ("struct2hdl: %s objects are not implemented yet", s.type)
+  endif
+
+  ## children
+  p = [p [s.handle; h]];  # [original; new]
+  kids = s.children;
+  nkids = length (kids);
+  ii = 0;
+  while (nkids)
+    ii++;
+    if (! any (ii == s.special))
+      [h2, p] = struct2hdl (s.children(ii), [p [s.handle; h]], hilev);
+    endif
+    nkids--;
+  endwhile
+
+  ## paste properties
+  setprops (s, h, p, hilev);
+
+  pout = p;
+
+endfunction
+
+function [h, sout] = createaxes (s, p, par)
+  ## regular axes
+  if (strcmp (s.properties.tag, ""))
+    propval = {"position", s.properties.position};
+    hid = {"autopos_tag", "looseinset"};
+    for ii = 1:numel (hid)
+      prop = hid{ii};
+      if (isfield (s.properties, prop))
+        val = s.properties.(prop);
+        propval = [propval, prop, val];
+      endif
+    endfor
+    h = axes (propval{:}, "parent", par);
+
+    if (isfield (s.properties, "__plotyy_axes__"))
+      plty = s.properties.__plotyy_axes__;
+      addproperty ("__plotyy_axes__", h, "data");
+      tmp = [p [s.handle; h]];
+      tst = ismember (tmp(1:2:end), plty);
+      if (sum (tst) == numel (plty))
+        for ii = 1:numel (plty)
+          plty(ii) = tmp(find (tmp == plty(ii)) + 1);
+        endfor
+        for ii = 1:numel (plty)
+          set (plty(ii), "__plotyy_axes__", plty);
+        endfor
+      endif
+      s.properties = rmfield (s.properties, "__plotyy_axes__");
+    endif
+
+    ## delete non-default and already set properties
+    fields = fieldnames (s.properties);
+    tst = cellfun (@(x) isprop (h, x), fields);
+    s.properties = rmfield (s.properties, fields(find (tst == 0)));
+
+  elseif (strcmp (s.properties.tag, "legend"))
+    ## legends
+    oldax = s.properties.userdata.handle;
+    idx = find (p == oldax);
+    newax = p(idx+1);
+    strings = {};
+    kids = s.children;
+    kids(s.special) = [];
+    oldh = unique (arrayfun (@(x) x.properties.userdata(end), kids));
+    for ii = 1:length (oldh)
+      idx = find (p(1:2:end) == oldh(ii)) * 2;
+      if (! isempty (idx))
+        newh(ii) = p(idx);
+        if (! strcmp (get (newh(ii), "type"), "hggroup"))
+          str = get (newh(ii), "displayname");
+          strings = [strings str];
+        else
+          str = get (get (newh(ii), "children")(1), "displayname");
+          strings = [strings str];
+        endif
+      else
+        error ("struct2hdl: didn't find a legend item");
+      endif
+    endfor
+    location = s.properties.location;
+    orientation = s.properties.orientation;
+    textpos = s.properties.textposition;
+    box = s.properties.box;
+
+    h = legend (newax, newh, strings, "location", location, ...
+                "orientation", orientation);
+    set (h, "textposition", textpos); # bug makes "textposition"
+                                      # redefine the legend
+    h = legend (newax, newh, strings, "location", location, ...
+                "orientation", orientation);
+    ## box
+    if (strcmp (box, "on"))
+      legend ("boxon");
+    endif
+
+    ## visibility
+    tst = arrayfun (@(x) strcmp (x.properties.visible, "on"), kids);
+    if (! any (tst))
+      legend ("hide");
+    endif
+
+    ## remove all properties such as "textposition" that redefines
+    ## the entire legend. Also remove chidren
+    s.properties = rmfield (s.properties, ...
+                              {"userdata", "xlabel",...
+                               "ylabel", "zlabel", "location", ...
+                               "title", "string","orientation", ...
+                               "visible", "textposition"});
+
+    s.children = [];
+
+  elseif (strcmp (s.properties.tag, "colorbar"))
+    ## colorbar
+    oldax = s.properties.axes;
+    if (! isempty (idx = find (oldax == p)))
+      ax = p(idx+1);
+      location = s.properties.location;
+      h = colorbar ("peer", ax, location);
+      s.properties = rmfield (s.properties, ...
+                                {"userdata", "xlabel" ...
+                                 "ylabel", "zlabel", ...
+                                 "title", "axes"});
+      s.children= [];
+    else
+      error ("hdl2struct: didn't find an object");
+    endif
+  endif
+  sout = s;
+endfunction
+
+function h = createline (s, par)
+  h = line ("parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function [h, sout] = createpatch (s, par)
+  prp.faces = s.properties.faces;
+  prp.vertices = s.properties.vertices;
+  prp.facevertexcdata = s.properties.facevertexcdata;
+  h = patch (prp);
+  set (h, "parent", par);
+  s.properties = rmfield (s.properties,
+                            {"faces", "vertices", "facevertexcdata"});
+  addmissingprops (h, s.properties);
+  sout = s;
+endfunction
+
+function h = createtext (s, par)
+  h = text ("parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function h = createimage (s, par)
+  h = image (1, "parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function h = createsurface (s, par)
+  h = surface ("parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function [h, sout, pout] = createhg (s, p, par, hilev)
+  ## Here we infer from properties the type of hggroup we should build
+  ## an call corresponding high level functions
+  ## We manually set "hold on" to avoid next hggroup be deleted
+  ## the proper value of axes "nextplot" will finally be recovered
+
+  hold on;
+  if (hilev)
+    [h, s, p] = createhg_hilev (s, p, par);
+    if (numel (s.children) != numel (get (h).children))
+      warning (["struct2hdl: could not infer the hggroup type. ", ...
+                "Will build objects but listener/callback functions ", ...
+                "will be lost"]);
+      if (isfield (h, "bargroup"))
+        delete (get (h).bargroup);
+      else
+        delete (h);
+      endif
+      h = hggroup ("parent", par);
+      addmissingprops (h, s.properties);
+      s.special = [];
+    else
+      oldkids = s.children;
+      newkids = get (h).children;
+      nkids = numel (oldkids);
+      ii = 1;
+      while (nkids)
+        p = [p [oldkids(ii++).handle; newkids(nkids--)]];
+      endwhile
+    endif
+  else
+    h = hggroup ("parent", par);
+    addmissingprops (h, s.properties);
+    s.special = [];
+  endif
+  sout = s;
+  pout = p;
+endfunction
+
+function [h, sout, pout] = createhg_hilev (s, p, par)
+  fields = s.properties;
+  if (isfield (fields, "contourmatrix"))
+    ## contours
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    zdata = s.properties.zdata;
+    levellist = s.properties.levellist;
+    textlist = s.properties.textlist;
+
+    ## contour creation
+    if (isempty (s.children(1).properties.zdata))
+      if (strcmpi (s.properties.fill, "on"))
+        [cm2, h] = contourf (xdata, ydata, zdata, levellist);
+      else
+        [cm2, h] = contour (xdata, ydata, zdata, levellist);
+      endif
+
+      ## labels
+      if (strcmpi (s.properties.showtext, "on"))
+        clabel (cm2, h, textlist);
+      endif
+    else
+      [cm2, h] = contour3 (xdata, ydata, zdata, levellist);
+    endif
+
+    ## delete already set properties and children
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", "zdata", ...
+                               "contourmatrix", "levellist", ...
+                               "fill", "labelspacing", ...
+                               "levellistmode", "levelstep", ...
+                               "levelstepmode", "textlist"...
+                               "textlistmode" , "textstep", ...
+                               "textstepmode", "zlevel", ...
+                               "zlevelmode"});
+
+  elseif (isfield (fields, "udata") && isfield (fields, "vdata"))
+    ## quiver
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+
+    udata = s.properties.udata;
+    vdata = s.properties.vdata;
+
+    h = quiver (xdata, ydata, udata, vdata);
+
+    ## delete already set properties and children
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", "zdata", ...
+                               "xdatasource", "ydatasource", "zdatasource", ...
+                               "udata", "vdata", "wdata", ...
+                               "udatasource", "vdatasource", "wdatasource"});
+
+  elseif (isfield (fields, "format"))
+    ##errorbar
+    form = s.properties.format;
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    xldata = s.properties.xldata;
+    ldata = s.properties.ldata;
+    xudata = s.properties.xudata;
+    udata = s.properties.udata;
+
+    switch (form)
+      case "xerr"
+        h = errorbar (xdata, ydata, xldata, xudata, ">");
+      case "yerr"
+        h = errorbar (xdata, ydata, ldata, udata, "~");
+      case "xyerr"
+        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "~>");
+      case "box"
+        h = errorbar (xdata, ydata, xldata, xudata, "#");
+      case "boxy"
+        h = errorbar (xdata, ydata, ldata, udata, "#~");
+      case "boxxy"
+        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "#~>");
+      otherwise
+        error ("struct2hdl: couldn't guess the errorbar format");
+    endswitch
+    ## delete already set properties
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", ...
+                               "xldata", "ldata", ...
+                               "xudata", "udata", ...
+                               "xldatasource", "ldatasource", ...
+                               "xudatasource", "udatasource", ...
+                               "format"});
+
+  elseif (isfield (fields, "bargroup"))
+    ## bar plot
+    ## FIXME - here we don't have access to brothers so we first create all
+    ## the barseries of the bargroup (but the last), then retrieve information,
+    ## and rebuild the whole bargroup.
+    ## The duplicate are deleted after calling "setprops"
+
+    bargroup = s.properties.bargroup;
+    oldh = s.handle;
+
+    temp = ismember ([p(1:2:end) oldh], bargroup);
+
+    tst = sum (temp) == length (bargroup);
+
+    if (isscalar (bargroup) || !tst)
+      xdata = s.properties.xdata;
+      ydata = s.properties.ydata;
+
+      h = bar (xdata, ydata);
+
+      ## delete already set properties,
+      s.properties = rmfield (s.properties, ...
+                                {"xdata", "ydata", ...
+                                 "xdatasource", "ydatasource", ...
+                                 "bargroup", ...
+                                 "barwidth", "baseline"});
+    else
+      xdata = [];
+      ydata = [];
+
+      ##build x/y matrix
+      nbar = length (bargroup);
+      tmp = struct ("handle", NaN, "type", "", "children", [], "special", []);
+      for ii = 1:(nbar - 1)
+        idx = find (p(1:2:end) == bargroup(ii)) * 2;
+        hdl = p (idx);
+        xdata = [xdata get(hdl).xdata];
+        ydata = [ydata get(hdl).ydata];
+        tmp.children(ii) = hdl2struct (hdl);
+      endfor
+
+      xdata = [xdata s.properties.xdata];
+      ydata = [ydata s.properties.ydata];
+      width = s.properties.barwidth;
+      h = bar (ydata, width);
+
+      ## replace previous handles in "match", copy props and delete redundant
+      for ii = 1:(nbar - 1)
+        props = tmp.children(ii).properties;
+        bl = props.baseline;
+        tmp.children(ii).properties = rmfield (props, {"baseline", "bargroup"});
+        setprops (tmp.children(ii), h(ii), p, 1);
+        delete (tmp.children(ii).handle);
+        delete (bl);
+        idxpar = find (p == tmp.children(ii).handle);
+        p(idxpar) = h(ii);
+        idxkid = idxpar - 2;
+        p(idxkid) = get (h(ii), "children");
+      endfor
+      p(2,((end-nbar+2):end)) = h(1:(end-1));
+      h = h(end);
+
+      ## delete already set properties ,
+      s.properties = rmfield (s.properties, ...
+                                {"xdata", "ydata", "bargroup"...
+                                 "barwidth", "baseline"});
+    endif
+  elseif (isfield (fields, "baseline"))
+    ## stem plot
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+
+    h = stem (xdata, ydata);
+
+    ## delete already set properties,
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", ...
+                               "xdatasource", "ydatasource", ...
+                               "baseline"});
+  elseif (isfield (fields, "basevalue"))
+    ## area plot
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    level = s.properties.basevalue;
+
+    h = area (xdata, ydata, level);
+
+    ## delete already set properties,
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", ...
+                               "xdatasource", "ydatasource"});
+  else
+    warning ("struct2hdl: could not infer the hggroup type. Will build objects but listener/callback functions will be lost");
+    h = hggroup ("parent", par);
+    addmissingprops (h, s.properties);
+    s.special = [];           # children will be treated as normal children
+  endif
+  sout = s;
+  pout = p;
+endfunction
+
+function setprops (s, h, p, hilev)
+  more off;
+  if (strcmpi (s.properties.tag, ""))
+    specs = s.children(s.special);
+    if (isempty (specs))
+      hdls = [];
+    else
+      hdls = [specs.handle];
+    endif
+    nh = length (hdls);
+    msg = "";
+    if (! nh)
+      set (h, s.properties);
+    else
+      ## Specials are objects that where automatically constructed with
+      ## current object. Among them are "x(yz)labels", "title", high
+      ## level hggroup children
+      fields = fieldnames (s.properties);
+      vals = struct2cell (s.properties);
+      idx = find (cellfun (@(x) valcomp(x, hdls) , vals));
+      s.properties = rmfield (s.properties, fields(idx));
+
+      ## set all properties but special handles
+      set (h, s.properties);
+
+      ## find  props with val == (one of special handles)
+      nf = length (idx);
+      fields = fields(idx);
+      vals = vals(idx);
+      while (nf)
+        field = fields{nf};
+        idx = find (hdls == vals{nf});
+        spec = specs(idx);
+        if (isprop (h, field))
+           h2 = get (h , field);
+           set (h2, spec.properties);
+        endif
+        nf--;
+      endwhile
+
+      ## If hggroup children  were created by high level functions,
+      ## copy only usefull properties.
+      if (hilev)
+        if (strcmp (s.type, "hggroup"))
+          nold = numel (s.children);
+          nnew = numel (get (h).children);
+
+          if (nold == nnew)
+            hnew = get (h).children;
+            ii = 1;
+            while (ii <= nnew)
+              try
+                set (hnew (ii), "displayname", ...
+                     s.children(ii).properties.displayname);
+              catch
+                sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii);
+              end_try_catch
+              ii ++;
+            endwhile
+
+          else
+            error ("struct2hdl: non-conformant number of children in hgggroup");
+          endif
+        endif
+      endif
+    endif
+
+  elseif (strcmpi (s.properties.tag, "legend")
+          || strcmpi (s.properties.tag, "colorbar"))
+    set (h, s.properties);
+  endif
+
+endfunction
+
+function out = valcomp (x, hdls)
+  if (isfloat (x) && isscalar (x))
+    out = any (x == hdls);
+  else
+    out = 0;
+  endif
+endfunction
+
+function addmissingprops (h, props)
+  hid = {"autopos_tag", "looseinset"};
+  oldfields = fieldnames (props);
+  curfields = fieldnames (get (h));
+  missing = ! ismember (oldfields, curfields);
+  idx = find (missing);
+  for ii = 1:length (idx)
+    prop = oldfields{idx(ii)};
+    if (! any (strcmp (prop, hid)))
+      addproperty (prop, h, "any");
+    endif
+  endfor
+endfunction
+
+
+## FIXME: Need validation tests
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/subplot.m	Fri Oct 04 17:09:08 2013 -0700
@@ -0,0 +1,477 @@
+## Copyright (C) 1995-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} subplot (@var{rows}, @var{cols}, @var{index})
+## @deftypefnx {Function File} {} subplot (@var{rcn})
+## @deftypefnx {Function File} {} subplot (@var{hax})
+## @deftypefnx {Function File} {} subplot (@dots{}, "align")
+## @deftypefnx {Function File} {} subplot (@dots{}, "replace")
+## @deftypefnx {Function File} {} subplot (@dots{}, "position", @var{pos})
+## @deftypefnx {Function File} {} subplot (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{hax} =} subplot (@dots{})
+## Set up a plot grid with @var{rows} by @var{cols} subwindows and set the
+## current axes for plotting (@code{gca}) to the location given by @var{index}.
+##
+## If only one numeric argument is supplied, then it must be a three digit
+## value specifying the number of rows in digit 1, the number of
+## columns in digit 2, and the plot index in digit 3.
+##
+## The plot index runs row-wise; First, all columns in a row are numbered
+## and then the next row is filled.
+##
+## For example, a plot with 2x3 grid will have plot indices running as follows:
+## @tex
+## \vskip 10pt
+## \hfil\vbox{\offinterlineskip\hrule
+## \halign{\vrule#&&\qquad\hfil#\hfil\qquad\vrule\cr
+## height13pt&1&2&3\cr height12pt&&&\cr\noalign{\hrule}
+## height13pt&4&5&6\cr height12pt&&&\cr\noalign{\hrule}}}
+## \hfil
+## \vskip 10pt
+## @end tex
+## @ifnottex
+##
+## @example
+## @group
+## +-----+-----+-----+
+## |  1  |  2  |  3  |
+## +-----+-----+-----+
+## |  4  |  5  |  6  |
+## +-----+-----+-----+
+## @end group
+## @end example
+##
+## @end ifnottex
+##
+## @var{index} may also be a vector.  In this case, the new axis will enclose
+## the grid locations specified.  The first demo illustrates this:
+##
+## @example
+## demo ("subplot", 1)
+## @end example
+##
+## The index of the subplot to make active may also be specified by its axes
+## handle, @var{hax}, returned from a previous @code{subplot} command.
+##
+## If the option @qcode{"align"} is given then the plot boxes of the subwindows
+## will align, but this may leave no room for axis tick marks or labels.
+##
+## If the option @qcode{"replace"} is given then the subplot axis will be
+## reset, rather than just switching the current axis for plotting to the
+## requested subplot.
+##
+## The @qcode{"position"} property can be used to exactly position the subplot
+## axes within the current figure.  The option @var{pos} is a 4-element vector
+## [x, y, width, height] that determines the location and size of the axes.
+## The values in @var{pos} are normalized in the range [0,1].
+##
+## Any property/value pairs are passed directly to the underlying axes object.
+##
+## If the output @var{hax} is requested, subplot returns the axis handle for
+## the subplot.  This is useful for modifying the properties of a subplot
+## using @code{set}.
+## @seealso{axes, plot, gca, set}
+## @end deftypefn
+
+## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
+## Adapted-By: jwe
+
+function h = subplot (varargin)
+
+  align_axes = false;
+  replace_axes = false;
+  have_position = false;
+  initial_args_decoded = false;
+
+  if (nargin >= 3)
+    ## R, C, N?
+    arg1 = varargin{1};
+    arg2 = varargin{2};
+    arg3 = varargin{3};
+    if (   isnumeric (arg1) && isscalar (arg1)
+        && isnumeric (arg2) && isscalar (arg2)
+        && isnumeric (arg3))
+      rows = arg1;
+      cols = arg2;
+      index = arg3;
+      varargin(1:3) = [];
+      initial_args_decoded = true;
+    endif
+  endif
+
+  if (! initial_args_decoded && nargin > 1)
+    ## check for "position", pos, ...
+    if (strcmpi (varargin{1}, "position"))
+      arg = varargin{2};
+      if (isnumeric (arg) && numel (arg) == 4)
+        pos = arg;
+        varargin(1:2) = [];
+        have_position = true;
+        initial_args_decoded = true;
+      else
+        error ("subplot: POSITION must be a 4-element numeric array");
+      endif
+    endif
+  endif
+    
+  if (! initial_args_decoded && nargin > 0)
+    arg = varargin{1};
+    if (nargin == 1 && isaxes (arg))
+      ## Axes handle
+      axes (arg);
+      cf = get (0, "currentfigure");
+      set (cf, "nextplot", "add");
+      return;
+    elseif (isscalar (arg) && arg >= 0)
+      ## RCN?
+      index = rem (arg, 10);
+      arg = (arg - index) / 10;
+      cols = rem (arg, 10);
+      arg = (arg - cols) / 10;
+      rows = rem (arg, 10);
+      varargin(1) = [];
+      initial_args_decoded = true;
+    else
+      error ("subplot: expecting axes handle or RCN argument");
+    endif
+  endif
+
+  if (! initial_args_decoded)
+    print_usage ();
+  endif
+
+  if (! have_position)
+    cols = round (cols);
+    rows = round (rows);
+    index = round (index);
+
+    if (any (index < 1) || any (index > rows*cols))
+      error ("subplot: INDEX value must be >= 1 and <= ROWS*COLS");
+    endif
+
+    if (rows < 1 || cols < 1 || index < 1)
+      error ("subplot: ROWS, COLS, and INDEX must be be positive");
+    endif
+  endif
+
+  ## Process "align" and "replace" options
+  idx = strcmpi (varargin, "align");
+  if (any (idx))
+    align_axes = true;
+    varargin(idx) = [];
+  endif
+
+  idx = strcmpi (varargin, "replace");
+  if (any (idx))
+    replace_axes = true;
+    varargin(idx) = [];
+  endif
+
+  axesunits = get (0, "defaultaxesunits");
+  cf = gcf ();
+  figureunits = get (cf, "units");
+  unwind_protect
+    set (0, "defaultaxesunits", "normalized");
+    set (cf, "units", "pixels");
+
+    ## FIXME: At the moment we force gnuplot to use the aligned mode
+    ##        which will set "activepositionproperty" to "position".
+    ##        Τhis can yield to text overlap between labels and titles
+    ##        see bug #31610
+    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot"))
+      align_axes = true;
+    endif
+
+    if (! have_position)
+      pos = subplot_position (rows, cols, index, "position");
+      outerpos = subplot_position (rows, cols, index, "outerposition");
+      box = [pos(1:2), pos(1:2)+pos(3:4)];
+      outerbox = [outerpos(1:2), outerpos(1:2)+outerpos(3:4)];
+      looseinset = [box(1:2)-outerbox(1:2), outerbox(3:4)-box(3:4)];
+      if (align_axes)
+        activepositionproperty = "position";
+      else
+        activepositionproperty = "outerposition";
+      endif
+    endif
+
+    set (cf, "nextplot", "add");
+
+    found = false;
+    kids = get (cf, "children");
+    for child = kids(:)'
+      ## Check whether this child is still valid; this might not be the
+      ## case anymore due to the deletion of previous children (due to
+      ## "deletefcn" callback or for legends/colorbars that are deleted
+      ## with their corresponding axes).
+      if (! ishandle (child))
+        continue;
+      endif
+      if (strcmp (get (child, "type"), "axes"))
+        ## Skip legend and colorbar objects.
+        if (any (strcmp (get (child, "tag"), {"legend", "colorbar"})))
+          continue;
+        endif
+        objpos = get (child, "outerposition");
+        if (all (abs (objpos - outerpos) < eps) && ! replace_axes)
+          ## If the new axes are in exactly the same position
+          ## as an existing axes object, use the existing axes.
+          found = true;
+          hsubplot = child;
+        else
+          ## If the new axes overlap an old axes object, delete the old axes.
+          if (align_axes)
+            objpos = get (child, "position");
+          endif
+          x0 = pos(1);
+          x1 = x0 + pos(3);
+          y0 = pos(2);
+          y1 = y0 + pos(4);
+          objx0 = objpos(1);
+          objx1 = objx0 + objpos(3);
+          objy0 = objpos(2);
+          objy1 = objy0 + objpos(4);
+          if (! (x0 >= objx1 || x1 <= objx0 || y0 >= objy1 || y1 <= objy0))
+            delete (child);
+          endif
+        endif
+      endif
+    endfor
+
+    if (found)
+      ## Switch to existing subplot
+      set (cf, "currentaxes", hsubplot);
+    else
+      hsubplot = axes ("box", "off",
+                       "position", pos,
+                       "looseinset", looseinset,
+                       "activepositionproperty", activepositionproperty,
+                       varargin{:});
+      addproperty ("subplot_align", hsubplot, "boolean", true);
+      addlistener (hsubplot, "position", @subplot_align);
+      if (! align_axes)
+        set (hsubplot, "subplot_align", false)
+        subplot_align (hsubplot)
+      endif
+    endif
+
+  unwind_protect_cleanup
+    set (0, "defaultaxesunits", axesunits);
+    set (cf, "units", figureunits);
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hsubplot;
+  endif
+
+endfunction
+
+function pos = subplot_position (rows, cols, index, position_property)
+
+  if (rows == 1 && cols == 1)
+    ## Trivial result for subplot (1,1,1)
+    if (strcmpi (position_property, "position"))
+      pos = get (0, "defaultaxesposition");
+    else
+      pos = get (0, "defaultaxesouterposition");
+    endif
+    return;
+  endif
+
+  if (strcmp (position_property, "outerposition"))
+    margins.left   = 0.05;
+    margins.bottom = 0.05;
+    margins.right  = 0.05;
+    margins.top    = 0.05;
+    margins.column = 0.04 / cols;
+    margins.row    = 0.04 / rows;
+    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
+    width = width / cols;
+    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
+    height = height / rows;
+  else
+    defaultaxesposition = get (0, "defaultaxesposition");
+
+    ## The outer margins surrounding all subplot "positions" are independent
+    ## of the number of rows and/or columns
+    margins.left   = defaultaxesposition(1);
+    margins.bottom = defaultaxesposition(2);
+    margins.right  = 1.0 - margins.left - defaultaxesposition(3);
+    margins.top    = 1.0 - margins.bottom - defaultaxesposition(4);
+
+    ## Fit from Matlab experiments
+    pc = 1 ./ [0.1860, (margins.left + margins.right - 1)];
+    margins.column = 1 ./ polyval (pc , cols);
+    pr = 1 ./ [0.2282, (margins.top + margins.bottom - 1)];
+    margins.row    = 1 ./ polyval (pr , rows);
+
+    ## Calculate the width/height of the subplot axes "position".
+    ## This is also consistent with Matlab
+    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
+    width = width / cols;
+    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
+    height = height / rows;
+  endif
+
+  ## Index offsets from the lower left subplot
+  yi = fix ((index(:)-1)/cols);
+  xi = index(:) - yi*cols - 1;
+  yi = (rows - 1) - yi;
+
+  ## Lower left corner of the subplot, i.e., position(1:2)
+  x0 = xi .* (width + margins.column) + margins.left;
+  y0 = yi .* (height + margins.row) + margins.bottom;
+
+  if (numel (x0) > 1)
+    ## subplot (row, col, m:n)
+    x1 = max (x0(:)) + width;
+    y1 = max (y0(:)) + height;
+    x0 = min (x0(:));
+    y0 = min (y0(:));
+    pos = [x0, y0, x1-x0, y1-y0];
+  else
+    ## subplot (row, col, num)
+    pos = [x0, y0, width, height];
+  endif
+
+endfunction
+
+function subplot_align (h, varargin)
+  persistent updating = false;
+
+  if (! updating)
+    unwind_protect
+      updating = true;
+      hfig = ancestor (h, "figure");
+      hsubplots = findall (hfig, "type", "axes", "subplot_align", "off");
+      if (! isempty (hsubplots))
+        tightinset = get (hsubplots, "tightinset");
+        if (iscell (tightinset))
+          tightinset = max (cell2mat (tightinset));
+        endif
+        looseinset = get (hsubplots, "looseinset");
+        if (iscell (looseinset))
+          looseinset = max (cell2mat (looseinset));
+        endif
+        looseinset = max (tightinset, looseinset);
+        set (hsubplots, "looseinset", looseinset);
+      endif
+    unwind_protect_cleanup
+      updating = false;
+    end_unwind_protect
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! r = 3;
+%! c = 3;
+%! fmt = {'horizontalalignment', 'center', 'verticalalignment', 'middle'};
+%! for n = 1 : r*c
+%!   subplot (r, c, n);
+%!   xlabel (sprintf ('xlabel #%d', n));
+%!   ylabel (sprintf ('ylabel #%d', n));
+%!   title (sprintf ('title #%d', n));
+%!   text (0.5, 0.5, sprintf ('subplot(%d,%d,%d)', r, c, n), fmt{:});
+%!   axis ([0 1 0 1]);
+%! end
+%! subplot (r, c, 1:3);
+%! xlabel (sprintf ('xlabel #%d:%d', 1, 3));
+%! ylabel (sprintf ('ylabel #%d:%d', 1, 3));
+%! title (sprintf ('title #%d:%d', 1, 3));
+%! text (0.5, 0.5, sprintf ('subplot(%d,%d,%d:%d)', r, c, 1, 3), fmt{:});
+%! axis ([0 1 0 1]);
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! for n = 1:4
+%!   subplot (2,2,n, 'align');
+%!   plot (x, x);
+%!   xlabel (sprintf ('xlabel (2,2,%d)', n));
+%!   ylabel (sprintf ('ylabel (2,2,%d)', n));
+%!   title (sprintf ('title (2,2,%d)', n));
+%! end
+%! subplot (1,2,1, 'align');
+%! plot (x, x);
+%! xlabel ('xlabel (1,2,1)');
+%! ylabel ('ylabel (1,2,1)');
+%! title ('title (1,2,1)');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! ax(1) = subplot (221);
+%! set (ax(1), 'tag', '1');
+%! plot (x, rand (3, 11))
+%! title ('x & y labels & ticklabels');
+%! xlabel xlabel
+%! ylabel ylabel
+%! ax(2) = subplot (222);
+%! set (ax(2), 'tag', '2');
+%! plot (x, rand (3, 11))
+%! title ('no labels');
+%! axis ('nolabel','tic')
+%! ax(3) = subplot (223);
+%! set (ax(3), 'tag', '3');
+%! plot (x, rand (3, 11))
+%! title ('no labels');
+%! axis ('nolabel','tic')
+%! ax(4) = subplot (224);
+%! set (ax(4), 'tag', '4');
+%! plot (x, rand (3, 11))
+%! title ('x & y labels & ticklabels');
+%! xlabel xlabel
+%! ylabel ylabel
+
+%!demo
+%! x = 0:10;
+%! subplot (221);
+%! plot (x, rand (3, 11))
+%! ylim ([0, 1]);
+%! text (0.5, 0.5, '{x,y}labels & {x,y}ticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+%! xlabel xlabel
+%! ylabel ylabel
+%! title title
+%! subplot (222);
+%! plot (x, rand (3, 11))
+%! axis ('labely');
+%! ylabel ylabel
+%! text (0.5, 0.5, 'no xlabels, xticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+%! subplot (223);
+%! plot (x, rand (3, 11))
+%! axis ('labelx');
+%! text (0.5, 0.5, 'no ylabels, yticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+%! xlabel xlabel
+%! title title
+%! subplot (224);
+%! plot (x, rand (3, 11))
+%! axis ('nolabel','tic');
+%! text (0.5, 0.5, 'no {x,y}labels, {x,y}ticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+
--- a/scripts/plot/view.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} view (@var{azimuth}, @var{elevation})
-## @deftypefnx {Function File} {} view ([@var{azimuth} @var{elevation}])
-## @deftypefnx {Function File} {} view ([@var{x} @var{y} @var{z}])
-## @deftypefnx {Function File} {} view (2)
-## @deftypefnx {Function File} {} view (3)
-## @deftypefnx {Function File} {} view (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{azimuth}, @var{elevation}] =} view ()
-## Query or set the viewpoint for the current axes.
-##
-## The parameters @var{azimuth} and @var{elevation} can be given as two
-## arguments or as 2-element vector.  The viewpoint can also be specified with
-## Cartesian coordinates @var{x}, @var{y}, and @var{z}.
-##
-## The call @code{view (2)} sets the viewpoint to @w{@var{azimuth} = 0}
-## and @w{@var{elevation} = 90}, which is the default for 2-D graphs.
-##
-## The call @code{view (3)} sets the viewpoint to @w{@var{azimuth} = -37.5}
-## and @w{@var{elevation} = 30}, which is the default for 3-D graphs.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-##
-## If no inputs are given, return the current @var{azimuth} and @var{elevation}.
-## @end deftypefn
-
-## Author: jwe
-
-function [azimuth, elevation] = view (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("view", varargin{:});
-  if (isempty (hax))
-    hax = gca ();
-  endif
-
-  if (nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin == 0)
-    x = get (hax, "view");
-    az = x(1);
-    el = x(2);
-  elseif (length (varargin) == 1)
-    x = varargin{1};
-    if (length (x) == 2)
-      az = x(1);
-      el = x(2);
-    elseif (length (x) == 3)
-      [az, el] = cart2sph (x(1), x(2), x(3));
-      az *= 180/pi;
-      az += 90;
-      el *= 180/pi;
-    elseif (x == 2)
-      az = 0;
-      el = 90;
-    elseif (x == 3)
-      az = -37.5;
-      el = 30;
-    else
-      print_usage ();
-    endif
-  elseif (length (varargin) == 2)
-    az = varargin{1};
-    el = varargin{2};
-  endif
-
-  if (nargin > 0)
-    set (hax, "view", [az, el]);
-  else
-    if (nargout == 1)
-      azimuth = [az, el];
-    elseif (nargout == 2)
-      azimuth = az;
-      elevation = el;
-    endif
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   [az, el] = view;
-%!   assert ([az, el], [-37.5, 30], eps);
-%!   view (2);
-%!   [az, el] = view;
-%!   assert ([az, el], [0, 90], eps);
-%!   view ([1 1 0]);
-%!   [az, el] = view;
-%!   assert ([az, el], [135, 0], eps);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   line;
-%!   [az, el] = view;
-%!   assert ([az, el], [0, 90], eps);
-%!   view (3);
-%!   [az, el] = view;
-%!   assert ([az, el], [-37.5, 30], eps);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/waitbar.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-## Copyright (C) 2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} waitbar (@var{frac})
-## @deftypefnx {Function File} {@var{h} =} waitbar (@var{frac}, @var{msg})
-## @deftypefnx {Function File} {@var{h} =} waitbar (@dots{}, "FigureProperty", "Value", @dots{})
-## @deftypefnx {Function File} {} waitbar (@var{frac})
-## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar})
-## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar}, @var{msg})
-## Return a handle @var{h} to a new waitbar object.
-##
-## The waitbar is filled to fraction @var{frac} which must be in the range
-## [0, 1].  The optional message @var{msg} is centered and displayed above the
-## waitbar.  The appearance of the waitbar figure window can be configured by
-## passing property/value pairs to the function.
-## 
-## When called with a single input the current waitbar, if it exists, is
-## updated to the new value @var{frac}.  If there are multiple outstanding
-## waitbars they can be updated individually by passing the handle @var{hwbar}
-## of the specific waitbar to modify.
-## @end deftypefn
-
-## Author: jwe
-
-function h = waitbar (varargin)
-
-  persistent curr_waitbar;
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  frac = varargin{1};
-  varargin(1) = [];
-
-  if (! (isnumeric (frac) && isscalar (frac) && frac >= 0 && frac <= 1))
-    error ("waitbar: FRAC must be between 0 and 1");
-  endif
-
-  ## Use existing waitbar if it still points to a valid graphics handle.
-  if (nargin == 1 && ishandle (curr_waitbar))
-    hf = curr_waitbar;
-  else
-    hf = false;
-  endif
-
-  if (! isempty (varargin) && isnumeric (varargin{1}))
-    hf = varargin{1};
-    varargin(1) = [];
-    if (! isfigure (hf) || ! strcmp (get (hf, "tag"), "waitbar"))
-      error ("waitbar: H must be a handle to a waitbar object");
-    endif
-  endif
-
-  msg = false;
-
-  if (! isempty (varargin))
-    msg = varargin{1};
-    varargin(1) = [];
-    if (! (ischar (msg) || iscellstr (msg)))
-      error ("waitbar: MSG must be a character string or cell array of strings");
-    endif
-  endif
-
-  if (rem (numel (varargin), 2) != 0)
-    error ("waitbar: invalid number of property/value pairs");
-  endif
-
-  if (hf)
-    gd = get (hf, "__guidata__");
-    ## Get the cached handles.
-    ax = gd(1);
-    hp = gd(2);
-
-    set (hp, "xdata", [0; frac; frac; 0]);
-
-    if (ischar (msg) || iscellstr (msg))
-      th = get (ax, "title");
-      curr_msg = get (th, "string");
-      ## graphics handles always store data as column vectors
-      if (iscellstr (msg))
-        msg = msg(:);  
-      endif
-      cmp = strcmp (msg, curr_msg);
-      if (! all (cmp(:)))
-        set (th, "string", msg);
-      endif
-    endif
-  else
-    ## Save and restore current figure
-    cf = get (0, "currentfigure");
-
-    hf = figure ("position", [250, 500, 400, 100],
-                 "numbertitle", "off",
-                 "menubar", "none", "toolbar", "none",
-                 "integerhandle", "off",
-                 "handlevisibility", "callback",
-                 "tag", "waitbar",
-                 varargin{:});
-
-    ax = axes ("parent", hf,
-               "xtick", [], "ytick", [],
-               "xlim", [0, 1], "ylim", [0, 1],
-               "position", [0.1, 0.3, 0.8, 0.2]);
-
-    hp = patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]);
-
-    ## Cache the axes and patch handles.
-    set (hf, "__guidata__", [ax hp]);
-
-    if (! (ischar (msg) || iscellstr (msg)))
-      msg = "Please wait...";
-    endif
-    title (ax, msg);
-
-    if (! isempty (cf))
-      set (0, "currentfigure", cf);
-    endif
-  endif
-
-  drawnow ();
-
-  if (nargout > 0)
-    h = hf;
-  endif
-
-  ## If there were no errors, update current waitbar.
-  curr_waitbar = hf;
-
-endfunction
-
-
-%!demo
-%! h = waitbar (0, '0.00%');
-%! for i = 0:0.01:1
-%!   waitbar (i, h, sprintf ('%.2f%%', 100*i));
-%! end
-%! close (h);
-
-%!demo
-%! h = waitbar (0, 'please wait...');
-%! for i = 0:0.01:0.6
-%!   waitbar (i);
-%! end
-%! i = 0.3;
-%! waitbar (i, h, 'don''t you hate taking a step backward?');
-%! pause (0.5);
-%! for i = i:0.005:0.7
-%!   waitbar (i, h);
-%! end
-%! waitbar (i, h, 'or stalling?');
-%! pause (1);
-%! for i = i:0.003:0.8
-%!   waitbar (i, h, 'just a little longer now');
-%! end
-%! for i = i:0.001:1
-%!   waitbar (i, h, 'please don''t be impatient');
-%! end
-%! close (h);
-
-%!demo
-%! h1 = waitbar (0, 'Waitbar #1');
-%! h2 = waitbar (0, 'Waitbar #2');
-%! h2pos = get (h2, 'position');
-%! h2pos(1) = h2pos(1) + (h2pos(3) + 50);
-%! set (h2, 'position', h2pos);
-%! pause (0.5);
-%! for i = 1:4
-%!   waitbar (i/4, h1);
-%!   pause (0.5);
-%!   waitbar (i/4, h2);
-%!   pause (0.5);
-%! end
-%! pause (0.5);
-%! close (h1);
-%! close (h2);
-
-%% Test input validation
-%!error <FRAC must be between 0 and 1> waitbar (-0.5)
-%!error <FRAC must be between 0 and 1> waitbar (1.5)
-%!error <MSG must be a character string> waitbar (0.5, struct ())
-%!error <invalid number of property/value pairs> waitbar (0.5, "msg", "Name")
-
--- a/scripts/plot/waitforbuttonpress.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-## Copyright (C) 2004-2012 Petr Mikulik
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} waitforbuttonpress ()
-## @deftypefnx {Function File} {@var{a} =} waitforbuttonpress ()
-## Wait for mouse click or key press over the current figure window.
-##
-## The return value of @var{b} is 0 if a mouse button was pressed or 1 if a
-## key was pressed.
-## @seealso{waitfor, ginput, kbhit}
-## @end deftypefn
-
-## The original version of this code bore the copyright
-## Author: Petr Mikulik
-## License: public domain
-
-function b = waitforbuttonpress ()
-
-  if (nargin != 0 || nargout > 1)
-    print_usage ();
-  endif
-
-  [x, y, k] = ginput (1);
-
-  if (nargout == 1)
-    if (k <= 5)
-      b = 0;
-    else
-      b = 1;
-    endif
-  endif
-
-endfunction
-
-
-%% Test input validation
-%!error waitforbuttonpress (1)
-%!error [a,b,c] = waitforbuttonpress ()
-
--- a/scripts/plot/waterfall.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-## Copyright (C) 2013 Mike Miller
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} waterfall (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} waterfall (@var{z})
-## @deftypefnx {Function File} {} waterfall (@dots{}, @var{c})
-## @deftypefnx {Function File} {} waterfall (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} waterfall (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} waterfall (@dots{})
-## Plot a 3-D waterfall plot.
-##
-## A waterfall plot is similar to a @code{meshz} plot except only
-## mesh lines for the rows of @var{z} (x-values) are shown.
-##
-## The wireframe mesh is plotted using rectangles.  The vertices of the
-## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
-## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
-## height above the plane of each vertex.  If only a single @var{z} matrix is
-## given, then it is plotted over the meshgrid
-## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
-## Thus, columns of @var{z} correspond to different @var{x} values and rows
-## of @var{z} correspond to different @var{y} values.
-##
-## The color of the mesh is computed by linearly scaling the @var{z} values
-## to fit the range of the current colormap.  Use @code{caxis} and/or
-## change the colormap to control the appearance.
-##
-## Optionally the color of the mesh can be specified independently of @var{z}
-## by supplying a color matrix, @var{c}.
-##
-## Any property/value pairs are passed directly to the underlying surface
-## object.
-##
-## If the first argument @var{hax} is an axes handle, then plot into this axis,
-## rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## @seealso{meshz, mesh, meshc, contour, surf, surface, ribbon, meshgrid, hidden, shading, colormap, caxis}
-## @end deftypefn
-
-## Author: Mike Miller <mtmiller@ieee.org>
-
-function h = waterfall (varargin)
-
-  htmp = meshz (varargin{:});
-
-  set (htmp, "meshstyle", "row");
-
-  ## The gnuplot toolkit does nothing with the meshstyle property currently.
-  toolkit = get (ancestor (htmp, "figure"), "__graphics_toolkit__");
-  if (strcmp (toolkit, "gnuplot"))
-    warning ("waterfall: may not render correctly using toolkit '%s'", toolkit);
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = peaks ();
-%! waterfall (Z);
-%! title ('waterfall() plot of peaks() function');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! Z = peaks ();
-%! subplot (1,2,1)
-%!  meshz (Z);
-%!  daspect ([2.5, 2.5, 1]);
-%!  title ('meshz() plot');
-%! subplot (1,2,2)
-%!  waterfall (Z);
-%!  daspect ([2.5, 2.5, 1]);
-%!  title ('waterfall() plot');
-
--- a/scripts/plot/whitebg.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} whitebg ()
-## @deftypefnx {Function File} {} whitebg (@var{color})
-## @deftypefnx {Function File} {} whitebg ("none")
-## @deftypefnx {Function File} {} whitebg (@var{hfig}, @dots{})
-## Invert the colors in the current color scheme.
-##
-## The root properties are also inverted such that all subsequent plot use the
-## new color scheme.
-##
-## If the optional argument @var{color} is present then the background color
-## is set to @var{color} rather than inverted.  @var{color} may be a string
-## representing one of the eight known colors or an RGB triplet.  The special
-## string argument @qcode{"none"} restores the plot to the default colors.
-##
-## If the first argument @var{hfig} is a figure handle, then operate on
-## this figure rather than the current figure returned by @code{gcf}.  The
-## root properties will not be changed.
-## @seealso{reset, get, set}
-## @end deftypefn
-
-function whitebg (varargin)
-  h = 0;
-  color = NaN;
-
-  if (nargin > 0 && nargin < 3)
-    if (ishandle (varargin{1}))
-      h = varargin{1};
-      if (nargin == 2)
-        color = varargin{2};
-      endif
-    elseif (nargin == 1)
-      color = varargin{1};
-    else
-      print_usage ();
-    endif
-  elseif (nargin != 0)
-    print_usage ();
-  endif
-
-  typ = get (h, "type");
-
-  if (strcmp (typ, "root"))
-    isroot = true;
-    fig = gcf ();
-  elseif (strcmp (typ, "figure"))
-    isroot = false;
-    fig = h;
-  else
-    error ("expecting a figure handle");
-  endif
-
-  axes = findall (fig, "type", "axes");
-  if (isnan (color))
-    ## Root figure. Set the default axes and figure properties so that
-    ## subsequent plots have the new color scheme
-    if (isroot)
-      fac = get (0, "factory");
-      fields = fieldnames (fac);
-      fieldindex = intersect (find (!cellfun ("isempty", regexp (fields, 'color'))), union (find (!cellfun ("isempty", regexp (fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp (fields, 'factoryfigure.*')))));
-
-      ## Check whether the factory value has been replaced
-      for nf = 1 : numel (fieldindex);
-        defaultfield = strrep (fields {fieldindex (nf)}, "factory", "default");
-        try
-          defaultvalue = 1 - get (0, defaultfield {n});
-        catch
-          field = fields {fieldindex (nf)};
-          defaultvalue = 1 - subsref (fac, struct ("type", ".", "subs", field));
-        end_try_catch
-        set (0, defaultfield, defaultvalue);
-      endfor
-    endif
-
-    ## Load all objects which qualify for being searched.
-    handles = fig;
-    h = fig;
-    while (numel (handles))
-      children = [];
-      for n = 1 : numel (handles)
-        children = union (children, get (handles(n), "children"));
-      endfor
-      handles = children;
-      h = union (h, children);
-    endwhile
-
-    for nh = 1 : numel (h)
-      p = get (h (nh));
-      fields = fieldnames (p);
-      fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
-      if (numel (fieldindex))
-        for nf = 1 : numel (fieldindex);
-          field = fields {fieldindex (nf)};
-          c = subsref (p, struct ("type", ".", "subs", field));
-          if (! ischar (c) && columns (c) == 3)
-            set (h (nh), field, 1 - c);
-          endif
-        endfor
-      endif
-
-      ## If h(nh) is a figure or axes invert default color properties
-      typ = subsref (p, struct ("type", ".", "subs", "type"));
-      if (strcmp (typ, "axes") || strcmp (typ, "figure"))
-        def = get (h (nh), "default");
-        fields = fieldnames (def);
-        if (! isempty (fields))
-          fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
-          for nf = 1 : numel (fieldindex)
-            defaultfield = fields {fieldindex (nf)};
-            defaultvalue = 1 - subsref (def, struct ("type", ".", "subs", defaultfield));
-            set (h (nh), defaultfield, defaultvalue);
-          endfor
-        endif
-      endif
-    endfor
-  else
-    ## FIXME
-    ## Is this the right thing to do in this case?
-    set (findall (fig, "type", "axes"), "color", color);
-    if (isroot)
-      defs = get (0, "default");
-      if (isfield (defs, "defaultaxescolor")
-          && strcmp (defs.defaultaxescolor, "none"))
-        set (0, "defaultaxescolor", color);
-      endif
-    endif
-  endif
-endfunction
-
-
-%!test
-%! dac = get (0, "defaultaxescolor");
-%! dfc = get (0, "defaultfigurecolor");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   assert (get (hf, "color"), dfc);
-%!   assert (get (gca, "color"), dac);
-%!   whitebg (hf);
-%!   assert (get (hf, "color"), 1 - dfc);
-%!   assert (get (gca, "color"), 1 - dac);
-%!   c = [0.2 0.2 0.2];
-%!   whitebg (hf, c);
-%!   assert (get (hf, "color"), 1 - dfc);
-%!   assert (get (gca, "color"), c);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/xlabel.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} xlabel (@var{string})
-## @deftypefnx {Function File} {} xlabel (@var{string}, @var{property}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} xlabel (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} xlabel (@dots{})
-## Specify the string used to label the x-axis of the current axis.
-##
-## An optional list of @var{property}/@var{value} pairs can be used to change
-## the properties of the created text label.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created text
-## object.
-## @seealso{ylabel, zlabel, datetick, title, text}
-## @end deftypefn
-
-## Author: jwe
-
-function h = xlabel (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("xlabel", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  htmp = __axis_label__ (hax, "xlabel", varargin{1},
-                         "color", get (hax, "xcolor"), varargin{2:end});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   x = xlabel ("xlabel_string", "color", "r");
-%!   assert (get (gca, "xlabel"), x);
-%!   assert (get (x, "type"), "text");
-%!   assert (get (x, "visible"), "on");
-%!   assert (get (x, "string"), "xlabel_string");
-%!   assert (get (x, "color"), [1 0 0]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/xlim.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{xlimits} =} xlim ()
-## @deftypefnx {Function File} {@var{xmode} =} xlim ("mode")
-## @deftypefnx {Function File} {} xlim ([@var{x_lo} @var{x_hi}])
-## @deftypefnx {Function File} {} xlim ("auto")
-## @deftypefnx {Function File} {} xlim ("manual")
-## @deftypefnx {Function File} {} xlim (@var{hax}, @dots{})
-## Query or set the limits of the x-axis for the current plot.
-##
-## Called without arguments @code{xlim} returns the x-axis limits of the
-## current plot.  With the input query @qcode{"mode"}, return the current
-## x-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
-##
-## If passed a 2-element vector [@var{x_lo} @var{x_hi}], the limits of the
-## x-axis are set to these values and the mode is set to @qcode{"manual"}.
-##
-## The current plotting mode can be changed by using either @qcode{"auto"}
-## or @qcode{"manual"} as the argument.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-## @seealso{ylim, zlim, axis, set, get, gca}
-## @end deftypefn
-
-function retval = xlim (varargin)
-  ret = __axes_limits__ ("xlim", varargin{:});
-
-  if (! isempty (ret))
-    retval = ret;
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! line ();
-%! xlim ([0.2, 0.8]);
-%! title ('xlim is [0.2, 0.8]');
-%! assert (xlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! line ();
-%! xlim ('auto');
-%! title ('xlim is auto');
-%! assert (xlim ('mode'), 'auto');
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! xlim ([0.2, 0.8]);
-%! title ('xlim is [0.2, 0.8]');
-%! assert (xlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! xlim ('auto');
-%! title ('xlim is auto');
-%! assert (xlim ('mode'), 'auto');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   xlim ([0, 1.1]);
-%!   assert (get (gca, "xlim"), [0, 1.1], eps);
-%!   assert (xlim ("mode"), "manual");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = plot3 ([0,1.1], [0,1], [0, 1]);
-%!   assert (get (gca, "xlim"), [0, 1.4], eps);
-%!   assert (xlim ("mode"), "auto");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ylabel.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ylabel (@var{string})
-## @deftypefnx {Function File} {} ylabel (@var{string}, @var{property}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} ylabel (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ylabel (@dots{})
-## Specify the string used to label the y-axis of the current axis.
-##
-## If @var{hax} is specified then label the axis defined by @var{hax}.
-##
-## An optional list of @var{property}/@var{value} pairs can be used to change
-## the properties of the created text label.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created text
-## object.
-## @seealso{xlabel, zlabel, datetick, title, text}
-## @end deftypefn
-
-## Author: jwe
-
-function h = ylabel (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ylabel", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  htmp = __axis_label__ (hax, "ylabel", varargin{1},
-                         "color", get (hax, "ycolor"), varargin{2:end});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   y = ylabel ("ylabel_string", "color", "r");
-%!   assert (get (gca, "ylabel"), y);
-%!   assert (get (y, "type"), "text");
-%!   assert (get (y, "visible"), "on");
-%!   assert (get (y, "string"), "ylabel_string");
-%!   assert (get (y, "color"), [1 0 0]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ylim.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{ylimits} =} ylim ()
-## @deftypefnx {Function File} {@var{xmode} =} ylim ("mode")
-## @deftypefnx {Function File} {} ylim ([@var{y_lo} @var{y_hi}])
-## @deftypefnx {Function File} {} ylim ("auto")
-## @deftypefnx {Function File} {} ylim ("manual")
-## @deftypefnx {Function File} {} ylim (@var{hax}, @dots{})
-## Query or set the limits of the y-axis for the current plot.
-##
-## Called without arguments @code{ylim} returns the y-axis limits of the
-## current plot.  With the input query @qcode{"mode"}, return the current
-## y-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
-##
-## If passed a 2-element vector [@var{y_lo} @var{y_hi}], the limits of the
-## y-axis are set to these values and the mode is set to @qcode{"manual"}.
-##
-## The current plotting mode can be changed by using either @qcode{"auto"}
-## or @qcode{"manual"} as the argument.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-## @seealso{xlim, zlim, axis, set, get, gca}
-## @end deftypefn
-
-function retval = ylim (varargin)
-  ret = __axes_limits__ ("ylim", varargin{:});
-
-  if (! isempty (ret))
-    retval = ret;
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! line ();
-%! ylim ([0.2, 0.8]);
-%! title ('ylim is [0.2, 0.8]');
-%! assert (ylim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! line ();
-%! ylim ('auto');
-%! title ('ylim is auto');
-%! assert (ylim ('mode'), 'auto');
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! ylim ([0.2, 0.8]);
-%! title ('ylim is [0.2, 0.8]');
-%! assert (ylim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! ylim ('auto');
-%! title ('ylim is auto');
-%! assert (ylim ('mode'), 'auto');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   limy = [0, 1.1];
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   ylim (limy);
-%!   assert (get (gca, "ylim"), limy, eps);
-%!   assert (ylim ("mode"), "manual");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1.1], [0, 1]);
-%!   assert (get (gca, "ylim"), [0, 1.4], eps);
-%!   assert (ylim ("mode"), "auto");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/zlabel.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-## Copyright (C) 1995-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} zlabel (@var{string})
-## @deftypefnx {Function File} {} zlabel (@var{string}, @var{property}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} zlabel (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} zlabel (@dots{})
-## Specify the string used to label the z-axis of the current axis.
-##
-## An optional list of @var{property}/@var{value} pairs can be used to change
-## the properties of the created text label.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created text
-## object.
-## @seealso{xlabel, ylabel, datetick, title, text}
-## @end deftypefn
-## Author: jwe
-
-function h = zlabel (varargin)
-
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("zlabel", varargin{:});
-
-  if (isempty (hax))
-    hax = gca ();
-  endif
-  
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  htmp = __axis_label__ (hax, "zlabel", varargin{1},
-                         "color", get (hax, "zcolor"), varargin{2:end});
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   z = zlabel ("zlabel_string", "color", "r");
-%!   assert (get (gca, "zlabel"), z);
-%!   assert (get (z, "type"), "text");
-%!   assert (get (z, "visible"), "off");
-%!   assert (get (z, "string"), "zlabel_string");
-%!   assert (get (z, "color"), [1 0 0]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! plot3 (0, 0, 0);
-%! unwind_protect
-%!   z = zlabel ("zlabel_string");
-%!   assert (get (gca, "zlabel"), z);
-%!   assert (get (z, "type"), "text");
-%!   assert (get (z, "string"), "zlabel_string");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/zlim.m	Fri Oct 04 16:56:42 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{zlimits} =} zlim ()
-## @deftypefnx {Function File} {@var{xmode} =} zlim ("mode")
-## @deftypefnx {Function File} {} zlim ([@var{z_lo} @var{z_hi}])
-## @deftypefnx {Function File} {} zlim ("auto")
-## @deftypefnx {Function File} {} zlim ("manual")
-## @deftypefnx {Function File} {} zlim (@var{hax}, @dots{})
-## Query or set the limits of the z-axis for the current plot.
-##
-## Called without arguments @code{zlim} returns the z-axis limits of the
-## current plot.  With the input query @qcode{"mode"}, return the current
-## z-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
-##
-## If passed a 2-element vector [@var{z_lo} @var{z_hi}], the limits of the
-## x-axis are set to these values and the mode is set to @qcode{"manual"}.
-##
-## The current plotting mode can be changed by using either @qcode{"auto"}
-## or @qcode{"manual"} as the argument.
-##
-## If the first argument @var{hax} is an axes handle, then operate on
-## this axis rather than the current axes returned by @code{gca}.
-## @seealso{xlim, ylim, axis, set, get, gca}
-## @end deftypefn
-
-function retval = zlim (varargin)
-  ret = __axes_limits__ ("zlim", varargin{:});
-
-  if (! isempty (ret))
-    retval = ret;
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! line ();
-%! zlim ([0.2, 0.8]);
-%! title ('zlim is [0.2, 0.8]');
-%! assert (zlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! line ();
-%! zlim ('auto');
-%! title ('zlim is auto');
-%! assert (zlim ('mode'), 'auto');
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! zlim ([0.2, 0.8]);
-%! title ('zlim is [0.2, 0.8]');
-%! assert (zlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! zlim ('auto');
-%! title ('zlim is auto');
-%! assert (zlim ('mode'), 'auto');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   limz = [0, 1.1];
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   zlim (limz);
-%!   assert (get (gca, "zlim"), limz, eps);
-%!   assert (zlim ("mode"), "manual");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0, 1.1]);
-%!   assert (get (gca, "zlim"), [0, 1.4], eps);
-%!   assert (zlim ("mode"), "auto");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-