Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55180 - in sandbox/SOC/2007/visualization: boost/svg_plot boost/svg_plot/detail libs/svg_plot/doc libs/svg_plot/example
From: pbristow_at_[hidden]
Date: 2009-07-30 14:42:37


Author: pbristow
Date: 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
New Revision: 55180
URL: http://svn.boost.org/trac/boost/changeset/55180

Log:
Space calculation improved but space for labels isn't quite right when changing fonts, especially for small fonts.
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp | 26 ++--
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 142 +++++++++++++++----------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 121 ++++++++++++--------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 223 +++++++++++++++++++++++++++------------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp | 42 +++---
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 46 ++++---
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/1d_tutorial.qbk | 15 +-
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/2d_tutorial.qbk | 24 ++++
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk | 1
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp | 6
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp | 25 +--
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_limits.cpp | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_simple.cpp | 11 +
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_values.cpp | 21 ++-
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_x_external.cpp | 4
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_autoscaling.cpp | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_limits.cpp | 17 +-
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_simple.cpp | 1
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp | 24 ++--
   20 files changed, 468 insertions(+), 287 deletions(-)

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -2,7 +2,7 @@
 // derived from Copyright Gennadiy Rozental 2001-2007.
 
 // Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
 // See http://www.boost.org/libs/test for the library home page.
@@ -27,7 +27,7 @@
   // equations in Dougles E. Knuth, Seminumerical algorithms (3rd Ed) section 4.2.4, Vol II,
   // pp 213-225, Addison-Wesley, 1997, ISBN: 0201896842.
   // Strong requires closeness relative to BOTH values begin compared,
- // Weak only requires only closeness to EITHER ONE value.
+ // Weak only requires only closeness to EITHER ONE value.
 };
 
 // GNU int gsl_fcmp (double x, double y, double epsilon) provides similar function.
@@ -42,7 +42,7 @@
 // www.boost.org/libs/test/doc/components/test_tools/floating_point_comparison.html
 // Comparison of Floating Point Numbers, Matthias Ruppwww.mrupp.info/Data/2007floatingcomp.pdf, July 2007.
 // The pitfalls of verifying floating-point computations, David Monniaux
-// CNRS Ecole normale sup´erieure, 1 Feb 2008, http://arxiv.org/abs/cs/0701192v4
+// CNRS Ecole normale superieure, 1 Feb 2008, http://arxiv.org/abs/cs/0701192v4
 // submitted to ACM TOPLAS.
 
 // FPT is Floating-Point Type: float, double, long double, or User-Defined like NTL quad_float or RR.
@@ -52,7 +52,7 @@
 template <class T> T epsilon(T);
 
 template<typename FPT> FPT
-fpt_abs(FPT arg)
+fpt_abs(FPT arg)
 { // abs function (just in case abs is not defined for FPT).
   return arg <static_cast<FPT>(0) ? -arg : arg;
 }
@@ -61,7 +61,7 @@
 safe_fpt_division(FPT f1, FPT f2)
 { // Safe from under and overflow.
   // Both f1 and f2 must be unsigned here.
-
+
   if( (f2 < static_cast<FPT>(1)) && (f1 > f2 * boost::math::tools::max_value<FPT>()) )
   { // Avoid overflow.
     return boost::math::tools::max_value<FPT>();
@@ -85,13 +85,13 @@
 
   // One constructor for fraction tolerance only.
   template<typename FPT>
- explicit close_to(FPT tolerance,
- floating_point_comparison_type fpc_type = FPC_STRONG)
+ explicit close_to(FPT tolerance,
+ floating_point_comparison_type fpc_type = FPC_STRONG)
   :
     fraction_tolerance_(tolerance),
       strong_or_weak_(fpc_type)
   { // Fraction.
- // Check that tolerance isn't negative - which doesn't make sense,
+ // Check that tolerance isn't negative - which does not make sense,
     // and can be assumed to be a programmer error?
     BOOST_ASSERT(tolerance >= static_cast<FPT>(0));
   }
@@ -110,7 +110,7 @@
     FPT d1 = safe_fpt_division(diff, fpt_abs(right));
     FPT d2 = safe_fpt_division(diff, fpt_abs(left));
 
- return strong_or_weak_
+ return strong_or_weak_
       ? ((d1 <= fraction_tolerance_) && (d2 <= fraction_tolerance_)) // Strong.
       : ((d1 <= fraction_tolerance_) || (d2 <= fraction_tolerance_)); // Weak.
   }
@@ -141,7 +141,7 @@
 // that will most probably result in overflows later.
 // Another objection, which few programmers know about and that we wish to draw attention
 // to, is that it may actually fail to work, depending on what the compiler
-// does — that is, the program may actually test that x 6= 0, then, further down,
+// does - that is, the program may actually test that x 6= 0, then, further down,
 // find that x = 0 without any apparent change to x!
 
 template<typename FPT = double>
@@ -149,13 +149,13 @@
 {
 public:
   template<typename FPT>
- explicit smallest(FPT s)
+ explicit smallest(FPT s)
   :
   smallest_(s)
   { // Constructor.
   }
 
- smallest()
+ smallest()
   :
   smallest_(2 * boost::math::tools::min_value<FPT>())
   { // Default Constructor.
@@ -182,7 +182,7 @@
   template<typename FPT>
   bool operator()(FPT fp_value)
   {
-
+
     if (fpt_abs(fp_value) == static_cast<FPT>(0))
     { // Test for zero first in case FPT is actually an integer type,
       // when the comparison < below would fail because

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -92,9 +92,9 @@
 
         // Protected Member Functions Declarations (defined below):
 
- // void transform_point(double &x, double &y);
- // void transform_x(double &x);
- // void transform_y(double &y);
+ // void transform_point(double &x, double &y); // Scale & shift both X & Y to graph Cartesian coordinates.
+ // void transform_x(double &x); // Scale & shift both X to graph Cartesian coordinates.
+ // void transform_y(double &y); // Scale & shift both Y to graph Cartesian coordinates.
         // void draw_x_minor_tick(double j, path_element& tick_path, path_element& grid_path); // (& grid).
         // void draw_x_major_tick(double i, path_element& tick_path, path_element& grid_path); // (& grid).
         // void draw_x_axis();
@@ -140,7 +140,7 @@
 
         void draw_x_minor_tick(double value, path_element& tick_path, path_element& grid_path)
         { //! Draw X-axis minor ticks, and optional grid. (Value is NOT (yet) shown beside the minor tick).
- double x(value); // Tick position and value label,
+ double x(value); // Tick position and tick value label,
           transform_x(x); // Convert to svg.
           double y_bottom(0.); // Start on the horizontal X-axis line.
           double y_top(derived().image.y_size()); // Image top.
@@ -181,17 +181,17 @@
           } // x_minor_grid
 
           // Draw x minor ticks.
- if (derived().x_ticks_.ticks_on_window_or_axis_ < 0)
+ if (derived().x_ticks_.ticks_on_window_or_on_axis_ < 0)
           { // Put minor ticks on the plot window border bottom.
             y_bottom = derived().plot_bottom_; // on the window line.
             y_top = derived().plot_bottom_; // y_bottom = upper, y_top = lower end of tick.
           }
- else if (derived().x_ticks_.ticks_on_window_or_axis_ > 0)
+ else if (derived().x_ticks_.ticks_on_window_or_on_axis_ > 0)
           { // Put minor ticks on the plot window border top.
             y_bottom = derived().plot_top_; // on the window line.
             y_top = derived().plot_top_; // y_bottom = upper, y_top = lower end of tick.
           }
- else // derived().x_ticks_.ticks_on_window_or_axis_ == 0
+ else // derived().x_ticks_.ticks_on_window_or_on_axis_ == 0
           { // Internal style, draw tick up and/or down from the X-axis line.
             y_bottom = derived().x_axis_.axis_; // ON X-axis horizontal line.
             y_top = derived().x_axis_.axis_;
@@ -261,7 +261,7 @@
           //if((x >= derived().plot_left_) && (x <= derived().plot_right_)) // now <=
           //{ Removed these checks as round off causes trouble.
             double x_tick_length = derived().x_ticks_.major_tick_length_;
- if(derived().x_ticks_.ticks_on_window_or_axis_ < 0)
+ if(derived().x_ticks_.ticks_on_window_or_on_axis_ < 0)
             { // Put the ticks on the plot window border (was external).
               y_up = derived().plot_bottom_; // on the window line.
               y_down = derived().plot_bottom_; // y_up = upper, y_down = lower.
@@ -274,7 +274,7 @@
                 y_down += x_tick_length; // down.
               }
             }
- else if(derived().x_ticks_.ticks_on_window_or_axis_ > 0)
+ else if(derived().x_ticks_.ticks_on_window_or_on_axis_ > 0)
             { // Put the ticks on the plot window border (was external).
               y_up = derived().plot_top_; // on the window line.
               y_down = derived().plot_top_; // y_up = upper, y_down = lower.
@@ -307,14 +307,14 @@
 
             if(derived().x_ticks_.major_value_labels_side_ != 0)
             { // Show a value by the horizontal X-axis tick as "1.2" or "3.4e+000"...
- std::stringstream label;
- label.precision(derived().x_ticks_.value_precision_);
- label.flags(derived().x_ticks_.value_ioflags_);
- label << value; // "1.2" or "3.4e+000"...
+ std::stringstream tick_value_label;
+ tick_value_label.precision(derived().x_ticks_.value_precision_);
+ tick_value_label.flags(derived().x_ticks_.value_ioflags_);
+ tick_value_label << value; // for tick "4", "1.2" or "3.4e+000"...
               if (derived().x_ticks_.strip_e0s_)
               { // Remove unecessary e, +, leadings 0s.
- std::string v = strip_e0s(label.str());
- label.str(v);
+ std::string v = strip_e0s(tick_value_label.str());
+ tick_value_label.str(v);
               }
 
               double y = 0; // Where to start writing from, at end of bottom or top tick, if any.
@@ -381,7 +381,7 @@
                 }
               }
               else if (derived().x_ticks_.label_rotation_ == horizontal)
- { // Tick value label on x axis.
+ { // Tick value label on X axis is normal default horizontal.
                 if (derived().x_ticks_.major_value_labels_side_ < 0)
                 { // labels to bottom, so start a little to bottom of y_down.
                   y = y_down + derived().x_value_label_style_.font_size() * 1.2;
@@ -406,16 +406,16 @@
                 throw std::runtime_error("X-tick Y value wrong!");
               }
               // Draw the X ticks value labels, "1", "2" "3" ...
- if(derived().x_ticks_.ticks_on_window_or_axis_ != 0)
+ if(derived().x_ticks_.ticks_on_window_or_on_axis_ != 0)
               { // External to plot window style bottom or top.
                 // Always want all values including "0", if labeling external to plot window.
- // x_ticks_.ticks_on_window_or_axis_ == true != 0
+ // x_ticks_.ticks_on_window_or_on_axis_ == true != 0
                 derived().image.g(detail::PLOT_X_TICKS_VALUES).text(
                   x,
                   y,
- label.str(),
- //derived().x_value_label_style_, alignment, derived().x_ticks_.label_rotation_); doesn't work!
- derived().x_value_label_info_.textstyle(), alignment, derived().x_ticks_.label_rotation_);
+ tick_value_label.str(),
+ derived().x_value_label_info_.textstyle(), // font, size etc
+ alignment, derived().x_ticks_.label_rotation_);
               }
               else
               {
@@ -424,9 +424,8 @@
                   derived().image.g(detail::PLOT_X_TICKS_VALUES).text(
                     x,
                     y,
- label.str(),
- //derived().x_value_label_style_, doesn't work!
- derived().x_value_label_info_.textstyle(),
+ tick_value_label.str(),
+ derived().x_value_label_info_.textstyle(), // font, size etc
                     alignment,
                     derived().x_ticks_.label_rotation_);
                 }
@@ -450,25 +449,25 @@
               // perhaps including an addition in lieu of a major tick.
               if (derived().y_ticks_.left_ticks_on_)
               {
- if (derived().y_ticks_.ticks_on_window_or_axis_ < 0) // left
+ if (derived().y_ticks_.ticks_on_window_or_on_axis_ < 0) // left
                 { // Extend the horizontal line left in lieu of longest tick.
                   xleft -= (std::max)(derived().y_ticks_.minor_tick_length_, derived().y_ticks_.major_tick_length_);
                 }
               }
               else if (derived().y_ticks_.right_ticks_on_)
               {
- if (derived().y_ticks_.ticks_on_window_or_axis_ > 0) // right
+ if (derived().y_ticks_.ticks_on_window_or_on_axis_ > 0) // right
                 { // Extend the horizontal line right in lieu of longest tick.
                   xright += (std::max)(derived().y_ticks_.minor_tick_length_, derived().y_ticks_.major_tick_length_);
                 }
               }
               double y = derived().x_axis_.axis_; // y = 0, (provided y range includes zero).
               derived().image.g(PLOT_X_AXIS).line(xleft, y, xright, y);
- if (derived().x_ticks_.ticks_on_window_or_axis_ < 0) // bottom
+ if (derived().x_ticks_.ticks_on_window_or_on_axis_ < 0) // bottom
               { // Draw a vertical line holding the ticks on the top of plot window.
                 derived().image.g(PLOT_X_AXIS).line(xleft, derived().plot_bottom_, xright, derived().plot_bottom_);
               }
- else if (derived().x_ticks_.ticks_on_window_or_axis_ > 0) // top
+ else if (derived().x_ticks_.ticks_on_window_or_on_axis_ > 0) // top
               {// Draw a vertical line holding the ticks on the bottom of plot window.
                 derived().image.g(PLOT_X_AXIS).line(xleft, derived().plot_top_, xright, derived().plot_top_);
               }
@@ -512,7 +511,7 @@
               // TODO this seems ugly - as does the negative ones below.
               draw_x_minor_tick(j, minor_tick_path, minor_grid_path);
             } // for j
- if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_axis_ != 0))
+ if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_on_axis_ != 0))
             { // Avoid a major tick at x == 0 where there *is* a vertical Y-axis line.
               // (won't be Y-axis line for 1-D where the zero tick is always wanted).
               draw_x_major_tick(x, major_tick_path, major_grid_path);
@@ -530,14 +529,14 @@
               // that intermittently puts minor ticks *at same value as* major ticks.
               j -= x_minor_jump)
             {
- if ((j != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_axis_ != 0))
+ if ((j != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_on_axis_ != 0))
               { // Avoid a minor tick at x == 0 where there *is* a vertical Y-axis line.
                 // (won't be Y-axis line for 1-D where the zero tick is always wanted).
                 // But no tick means no value label 0 either unless on_plot_window.
                 draw_x_minor_tick(j, minor_tick_path, minor_grid_path);
               }
             }
- if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_axis_ != 0))
+ if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_on_axis_ != 0))
             { // Avoid a major tick at x == 0 where there *is* a vertical Y-axis line.
               // (won't be Y-axis line for 1-D where the zero tick is always wanted).
               // But no tick means no value label 0 either unless on_plot_window.
@@ -550,10 +549,11 @@
         { /*! Draw title (for the whole plot).
             Update title_info_ with position.
             Assumes align = center_align
- Using center_align will ensure that will title center correctly
- (even if original string is made much longer because it contains Unicode,
- for example Greek, taking about 6 characters per symbol)
+ Using center_align will ensure that title will center correctly
             because the render engine does the centering.
+ (Even if the original string is made much longer because it contains Unicode,
+ Greek, math symbols etc, taking about 8 characters per symbol.
+ For example, the Unicode symbol for square root is "&#x221A;" but takes only about one character width).
           */
           derived().title_info_.x(derived().image.x_size() / 2.); // Center of image.
           double y;
@@ -562,7 +562,6 @@
           derived().image.g(PLOT_TITLE).push_back(new text_element(derived().title_info_));
         } // void draw_title()
 
-
         void size_legend_box()
         { //! Calculate how big the legend box needs to be.
           if(derived().legend_on_ == false)
@@ -753,7 +752,7 @@
           void draw_legend()
           { //! Draw the legend border, text header (if any) and marker lines and/or shapes.
             // size_t num_points = derived().series.size();
- //cout << derived().legend_box_.width() << ' ' << derived().legend_box_.margin() << endl;
+ // cout << derived().legend_box_.width() << ' ' << derived().legend_box_.margin() << endl;
 
             int font_size = derived().legend_header_.textstyle().font_size();
             int point_size = derived().serieses_[0].point_style_.size();
@@ -851,47 +850,74 @@
 
           void draw_x_label()
           { //! Draw the X-axis label text (for example, length),
- //! and append any required units (for example. km).
- // X-label color is set in constructor thus:
+ //! and append any optional units (for example, km).
+ // X-label color default is set in constructor thus:
             // image.g(detail::PLOT_X_LABEL).style().stroke_color(black);
             // and changed using x_label_color(color);
+ // Similarly for font family and size.
 
- std::string label = derived().x_label_info_.text(); // x_axis_ label, and optional units.
+ std::string x_label = derived().x_label_info_.text(); // x_axis_ label, and optional units.
             if (derived().x_axis_.label_units_on_ && (derived().x_units_info_.text() != ""))
- { // Append the units, if any, user providing brackets () if required.
- label += derived().x_units_info_.text();
+ { // Append the units, if any, user providing brackets () if required.
+ x_label += derived().x_units_info_.text(); // for example: "time (sec)".
             }
 
             double y = derived().plot_bottom_;
- y += derived().x_ticks_.value_label_style_.font_size() * 2.; // Shift down to suit.
- if (derived().x_ticks_.ticks_on_window_or_axis_ < 0) // bottom
- { // Ticks & value labels below X-axis.
+ // Glyphs for western characters are aligned with the left bottom of capital letter,
+ // so need to allow for any descenders.
+
+ // cout << "derived().x_ticks_.ticks_on_window_or_on_axis_ " << derived().x_ticks_.ticks_on_window_or_on_axis_ << endl;
+ // using derived(0 means debugging doesn't work! So resort to old-fashioned print statements.
+ if (derived().x_ticks_.ticks_on_window_or_on_axis_ < 0) // -1 means bottom
+ { // Ticks value labels below plot window.
               if (derived().x_ticks_.major_value_labels_side_ < 0) // bottom
               { // Shift down to allow for any tick value labels.
- // SHould handle other directions too.
- if (derived().x_ticks_.label_rotation_ == downward)
- { // tick value label direction down .
+ if ((derived().x_ticks_.label_rotation_ == downward) || (derived().x_ticks_.label_rotation_ == upward)
+ || (derived().x_ticks_.label_rotation_ == steepdown) || (derived().x_ticks_.label_rotation_ == steepup))
+ { // downward tick value label direction 90 up or down, or 60 steep degrees (might handle 60 separately).
                   y += derived().x_ticks_.label_max_space_;
                 }
- else if (derived().x_ticks_.label_rotation_ == uphill)
- { // sloping
+ else if ((derived().x_ticks_.label_rotation_ == uphill) || (derived().x_ticks_.label_rotation_ == downhill)
+ || (derived().x_ticks_.label_rotation_ == slopeup) || (derived().x_ticks_.label_rotation_ == slopedownhill))
+ { // sloping 45 or 30 degrees (might handle 30 separately).
                   y += derived().x_ticks_.label_max_space_ * sin45;
                 }
- else
+ else if (derived().x_ticks_.label_rotation_ == horizontal)
                 { // horizontal
+ if (derived().x_ticks_.major_value_labels_side_ < 0)
+ { // Allow space for tick value labels below X-axis font size.
+ y += derived().x_value_label_info_.textstyle().font_size();
+ }
+ if (derived().x_ticks_.down_ticks_on_ == true)
+ { // Allow for the downward ticks.
+ y += (std::max)(derived().x_ticks_.major_tick_length_, derived().x_ticks_.minor_tick_length_);// And avoid macro max trap!
+ }
+ y += derived().x_label_info_.textstyle().font_size() * 0.8; // Allow for the X-axis label font.
+ }
+ else
+ {
+ std::cout << " Rotation of X label rotation" << derived().x_ticks_.label_rotation_ << "not yet implemented!" << std::endl;
                 }
               }
               if (derived().x_ticks_.down_ticks_on_)
               { // Shift down for biggest of any ticks.
                 y += (std::max)(derived().x_ticks_.minor_tick_length_, derived().x_ticks_.major_tick_length_);
+ // y += derived().x_ticks_.value_label_style_.font_size() * 1.; // Shift down to suit tick labels.
               }
             }
+ if (derived().x_ticks_.ticks_on_window_or_on_axis_ == 0)
+ { // ticks ON the X-axis line, so X label is just below the plot bottom.
+ //y += derived().x_label_info_.textstyle().font_size() * 0.8; // Shift down to suit X labels.
+ // Character starts at bottom of capital letter, so allow for descenders.
+ y = derived().image.y_size() - derived().image_border_width(); // Place X Label just above the image bottom.
+ y -= derived().image_border_.margin_;
+ }
 
             derived().image.g(PLOT_X_LABEL).push_back(new text_element(
               ( // x position relative to the x-axis which is middle of plot window.
               derived().plot_right_ + derived().plot_left_) / 2, // x coordinate - middle.
               y, // Down from plot window.
- label, // for the X-axis.
+ x_label,
               derived().x_label_info_.textstyle(),
               center_align, horizontal)
               );
@@ -2769,9 +2795,8 @@
           template <class Derived>
           Derived& axis_plot_frame<Derived>::x_ticks_values_font_size(unsigned int i)
           { //! Set X ticks value label font size (svg units, default pixels).
- derived().x_ticks_.value_label_style_.font_size(i);
- // derived().image.g(detail::PLOT_X_TICKS_VALUES).style().fill_color(col);
-
+ //derived().x_ticks_.value_label_style_.font_size(i);
+ derived().x_value_label_info_.textstyle().font_size(i);
             return derived();
           }
 
@@ -2779,7 +2804,9 @@
           unsigned int axis_plot_frame<Derived>::x_ticks_values_font_size()
           { //! \return X ticks value label font size (svg units, default pixels).
             // return derived().x_ticks_.value_label_style_.font_size();
- return derived().x_value_label_info_.textstyle().font_size();
+ return derived().x_value_label_info_.textstyle().font_size();
+
+ //return derived().x_ticks_.value_label_info_.font_size();
           }
 
           template <class Derived>
@@ -2787,7 +2814,6 @@
           { //! Set X ticks value label font family.
             //derived().x_ticks_.value_label_style_.font_family(family); // is effect same as:
             derived().x_value_label_info_.textstyle().font_family(family);
-
             return derived();
           }
 
@@ -2804,7 +2830,7 @@
               \arg cmd 0 on X axis.
               \arg cmd +1 top of plot window.
             */
- derived().x_ticks_.ticks_on_window_or_axis_ = cmd;
+ derived().x_ticks_.ticks_on_window_or_on_axis_ = cmd;
             return derived();
           }
 
@@ -2812,7 +2838,7 @@
           int axis_plot_frame<Derived>::x_ticks_on_window_or_axis()
           { //! \return true if X axis ticks wanted on the window (rather than on axis).\n
             //! -1 bottom of plot window, 0 on X axis, +1 top of plot window.
- return derived().x_ticks_.ticks_on_window_or_axis_;
+ return derived().x_ticks_.ticks_on_window_or_on_axis_;
           }
 
           template <class Derived>

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -388,7 +388,7 @@
     x_ticks_(X, x_value_label_style_),// so for defaults see ticks_labels_style.
     text_margin_(2.), // for text as a multiplier of the font size.
     image_border_(yellow, white, 1, 10, true, true), // margin should be about axis label font size.
- plot_window_border_(yellow, svg_color(255, 255, 255), 1, 3, true, false),
+ plot_window_border_(lightgoldenrodyellow, svg_color(255, 255, 255), 1, 3, true, false),
     legend_box_(yellow, white, 1, 2, true, true),
     legend_header_(0, 0, "", legend_style_, center_align, horizontal),
     legend_width_(200), // width of legend box (pixels) // TODO isn't this calculated?
@@ -422,7 +422,7 @@
     size(500, 200); // Default image size.
     // Only needs to be quite shallow (y_size) for a 1-D plot.
     // (But may need more height if long value labels are used, for example: "[time = 1.23 +-0.02 sec]").
- // 200 barely leaves enough room for five data series in the legend).
+ // 200 barely leaves enough room for five data series in any legend box).
     // (2-D usually needs to be much more rectangular).
 
     using namespace boost::svg::detail; // Avoid detail:: specification.
@@ -473,7 +473,21 @@
 
     x_ticks_on_ = x_ticks_.up_ticks_on_ || x_ticks_.down_ticks_on_;
     // Only 2D has left and right y ticks.
- x_ticks_.ticks_on_window_or_axis_ = 0; // Make ticks (and value labels) on axis the default.
+ x_ticks_.ticks_on_window_or_on_axis_ = 0; // Make ticks (and ticks value labels) on X-axis line the default.
+ // This will place the labels just under the horizontal X-axis line,
+ // rather than below the plot window border.
+ // This over-rides the default in class ticks_labels_style.
+ //
+
+ if (title_info_.text() == "")
+ { // Avoid leaving unnecessary space etc for a title.
+ title_on_ = false;
+ }
+ else
+ {
+ title_on_ = true; // Can be switched off later with `my_1d_plot.title_on(true);`
+ }
+
   } // svg_1d_plot() Default constructor.
 
   void set_ids()
@@ -497,28 +511,29 @@
     plot_right_ = image.x_size() - image_border_width(); // Bottom right of image.
     plot_bottom_ = image.y_size() - image_border_width();
 
- if(title_on_)
+ if(title_on_ && title_info_.text() != "")
     { // Leave space at top for title.
- // TODO what if want to put title at bottom?
+ // Title at bottom (or sides even) option not implemented.
       plot_top_ += title_font_size() * (text_margin_ + 0.5);
     }
 
     // Assume that X-axis labels are always at bottom for 1D plot.
- if(x_axis_.label_on_)
- { // Leave space at bottom for X axis label.
+ if(x_axis_.label_on_ == true && x_label_info_.text() != "")
+ { // Leave space below plot window at bottom for X axis label (unless empty string).
        plot_bottom_ -= x_axis_label_style_.font_size() * text_margin_;
     }
- if(plot_window_on_)
+ if(plot_window_on_ == true)
     { // Needed to allow any plot window border rectangle to show OK.
       // A small margin is to prevent it overlapping the image border.
       // Also allows for axis value labels that mark the min and max
- // that must extend half a font width beyond the plot window border.
+ // that must extend about half a font width beyond the plot window border.
       plot_left_ += image_border_.margin_;
       plot_right_ -= image_border_.margin_;
       plot_top_ += image_border_.margin_;
       plot_bottom_ -= image_border_.margin_;
     }
 
+ // Size if necessary - else (re-)initialise to zero.
     size_legend_box(); // depending on its contents.
     place_legend_box();
 
@@ -535,26 +550,29 @@
       x_axis_.min_ = x_auto_min_value_;
       x_axis_.max_ = x_auto_max_value_;
       x_ticks_.major_interval_ = x_auto_tick_interval_;
- // else ignore auto values, even if have been calculated.
     }
- // Copy min & max to ticks.
+ else
+ { // Ignore auto values, even if they have been calculated.
+ }
+ // Copy X-axis min & max to ticks.
     x_ticks_.min_ = x_axis_.min_;
     x_ticks_.max_ = x_axis_.max_;
-
- x_axis_.axis_ = (plot_bottom_ + plot_top_) / 2.; // Put X-axis halfway up plot window.
     // Ensure both axis and ticks have the *same* range.
- // (To use the separation, made to give the potential for different ranges,
+ // (To use them separately (designed to give the potential for different ranges)
     // one would have to *not* do this,
     // but to make sure they are both assigned correctly).
 
- if(plot_window_on_) //
- {
- // Calculate the number of chars of the longest value label.
+ x_axis_.axis_ = (plot_bottom_ + plot_top_) / 2.; // Put X-axis halfway up plot window.
+
+ if(plot_window_on_ == true)
+ { // Using a plot window and NOT using all image.
+ // Calculate the number of chars of the longest tick value label.
       x_ticks_.longest_label(); // Updates label_max_length_
- x_ticks_.label_max_space_ = 0; // Work out the longest value label for X-Axis.
+ x_ticks_.label_max_space_ = 0; // Work out the longest tick value label for X-Axis.
       if (x_ticks_.label_rotation_ == horizontal)
       { // Only 1 char height & 1 space needed if labels are horizontal.
- x_ticks_.label_max_space_ = 2 * x_value_label_style_.font_size() * wh; // SVG chars
+ x_ticks_.label_max_space_ = 2 * x_value_label_style_.font_size() * wh; // SVG chars.
+ // Should this be just 2 * font_size
       }
       else if ((x_ticks_.label_rotation_ == upward) || (x_ticks_.label_rotation_ == downward))
       { // ! horizontal so will need more than 2 chars worth.
@@ -565,43 +583,27 @@
           x_ticks_.label_max_space_+= x_ticks_.label_max_length_ * x_value_label_style_.font_size() * wh * sin45; // SVG 'chars'.
       }
 
- if (x_ticks_.major_value_labels_side_ != 0)
- { // Some value labels.
- if ((x_ticks_.ticks_on_window_or_axis_ < 0) // on bottom of plot window.
- && (x_ticks_.major_value_labels_side_ < 0) ) // & labels on bottom.
- { // Contract plot window bottom edge up to make space for x value labels on bottom.
- plot_bottom_ -= x_ticks_.label_max_space_; // Move up.
- }
- else if ((x_ticks_.ticks_on_window_or_axis_ > 0) //
- && (x_ticks_.major_value_labels_side_ > 0) ) // & x labels to top.
- { // Move top of plot window down to give space for x value labels.
- plot_top_ += x_ticks_.label_max_space_; // Move down.
- }
- else
- { // no labels on plot window (may be on mid-plot X-axis).
- }
- } // x_ticks_. major_value_labels_side
-
- // Make space for any ticks.
+ // Make space for any ticks pointing below the plot window.
       if(x_ticks_.down_ticks_on_)
       { // Start bottom of plot higher to give space for any external down ticks.
- plot_bottom_ -= (std::max)(x_ticks_.major_tick_length_, x_ticks_.minor_tick_length_);// Avoid macro max trap!
+ plot_bottom_ -= (std::max)(x_ticks_.major_tick_length_, x_ticks_.minor_tick_length_);// And avoid macro max trap!
       }
+
       if (x_axis_.axis_line_on_)
- { // Want a X-axis line, so check if range includes zero, so axes intersect,
+ { // Want a X-axis line, so check if range includes zero, meaning that X and Y axes intersect,
         // and x_axis_ is svg coordinate of Y-axis (usually y = 0).
         // If not fix axis to bottom of the plot window.
- if ((x_axis_position_ == bottom) // All definitely > zero.
- && !(x_ticks_.ticks_on_window_or_axis_ < 0) ) // & not already at bottom.
- { // y_min_ > 0 so X-axis will not intersect Y-axis, so use plot window.
+ if ((x_axis_position_ == bottom) // All X data values definitely > zero.
+ && !(x_ticks_.ticks_on_window_or_on_axis_ < 0) ) // & not already on bottom of plot window.
+ { // y_min_ > 0 so X-axis will not intersect Y-axis, so use plot window border.
           plot_bottom_ -= x_ticks_.label_max_space_; // Move up for the value labels.
- x_axis_.axis_ = plot_bottom_; // Put X-axis on bottom.
+ x_axis_.axis_ = plot_bottom_; // Put X-axis on bottom on plot window.
         }
- else if ((x_axis_position_ == top) // definitely < zero.
- && !(x_ticks_.ticks_on_window_or_axis_ > 0) ) // & not already at top.
- { // // y_max_ < 0 so X-axis will not intersect Y-axis, so use plot window.
+ else if ((x_axis_position_ == top) // All x data values definitely < zero.
+ && !(x_ticks_.ticks_on_window_or_on_axis_ > 0) ) // & not already on top of plot window.
+ { // // y_max_ < 0 so X-axis will not intersect Y-axis, so use plot window border.
            plot_top_ += x_ticks_.label_max_space_; // Move down for labels.
- x_axis_.axis_ = plot_top_; // Put X-axis on top.
+ x_axis_.axis_ = plot_top_; // Put X-axis on top of plot window border.
         }
         else
         { // y_axis_position_ == y_intersects_x
@@ -609,10 +611,31 @@
         }
       } // if (use_x_axis_line_)
 
+ // Make space for any tick value labels.
+ if (x_ticks_.major_value_labels_side_ != 0)
+ { // There are some tick value labels.
+ // If ticks and value labels are on plot window border, the need to allow space for them.
+ if ((x_ticks_.ticks_on_window_or_on_axis_ < 0) // ticks on bottom of plot window.
+ && (x_ticks_.major_value_labels_side_ < 0) ) // & tick value labels below axis line too.
+ { // Contract plot window bottom edge up to make space for X tick value labels on bottom.
+ plot_bottom_ -= x_ticks_.label_max_space_; // Move up.
+ }
+ else if ((x_ticks_.ticks_on_window_or_on_axis_ > 0) //
+ && (x_ticks_.major_value_labels_side_ > 0) ) // & X tick value labels to top of plot window.
+ { // Move top of plot window down to give space for X tick value labels.
+ plot_top_ += x_ticks_.label_max_space_; // Move window top down.
+ }
+ else // (x_ticks_.major_value_labels_side_ == 0)
+ { // X-ticks on the X-axis line (not on plot window border).
+ // Don't need to allow any extra space.
+ // (But if X axis is near plot window border, may overlap it, and any X axis labels!)
+ }
+ } // x_ticks_. major_value_labels_side
+
     } // plot_window_on_
 
- if(plot_window_on_)
- { // Draw plot window rectangle box.
+ if(plot_window_on_ == true)
+ { // Draw plot window border as a rectangular box.
       image.g(detail::PLOT_WINDOW_BACKGROUND).push_back(
         new rect_element(plot_left_, plot_top_, (plot_right_ - plot_left_), plot_bottom_ - plot_top_));
     } // plot_window_on_

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -48,6 +48,8 @@
 #include <iterator>
 #include <exception>
 #include <iostream> // for debug.
+using std::cout;
+using std::endl;
 
 namespace boost
 {
@@ -509,6 +511,7 @@
         y_units_info_(0, 0, "", y_axis_label_style_, center_align, upward),
         y_value_label_info_(0, 0, "", y_value_label_style_, center_align, upward), //
         text_margin_(2.), // for axis label text, as a multiplier of the font size.
+ // Should allow a 'half line space' above and below the label text.
         image_border_(yellow, white, 2, 10, true, true), // margin should be about axis label font size.
         plot_window_border_(lightslategray, svg_color(255, 255, 255), 2, 3, true, false),
         legend_box_(yellow, white, 1, 2, true, true),
@@ -612,7 +615,33 @@
 
         x_ticks_on_ = x_ticks_.up_ticks_on_ || x_ticks_.down_ticks_on_;
         y_ticks_on_ = y_ticks_.left_ticks_on_ || y_ticks_.right_ticks_on_;
+
+ if (title_info_.text() == "")
+ { // Avoid leaving unnecessary space etc for a title.
+ title_on_ = false;
+ }
+ else
+ { // Assume if title is provided, then want to use it.
+ title_on_ = true; // Can be switched off later with `my_1d_plot.title_on(false);`
+ }
 
+ if(x_label_info_.text() != "")
+ { // No label provided, so avoid making space for it.
+ x_axis_.label_on_ = false;
+ }
+ else
+ { // Assume if label is provided, then want to use it.
+ x_axis_.label_on_ = true; // Can be switched off later with `my_1d_plot.label_on(false);
+ }
+
+ if(y_label_info_.text() != "")
+ { // No label provided, so avoid making space for it.
+ y_axis_.label_on_ = false;
+ }
+ else
+ { // Assume if label is provided, then want to use it.
+ y_axis_.label_on_ = true; // Can be switched off later with `my_1d_plot.label_on(false);
+ }
       } // svg_2d_plot() default constructor.
 
     private:
@@ -652,15 +681,17 @@
           plot_top_ += title_font_size() * (text_margin_ + 0.5);
         }
 
- // Assume that axis labels are always at bottom and left.
- if(x_axis_.label_on_)
- { // Leave space at bottom for X axis label.
+ // Assume that X-axis labels are always at bottom.
+ if(x_axis_.label_on_ == true == true && x_label_info_.text() != "")
+ { // Leave space at bottom for X-axis label.
           plot_bottom_ -= x_axis_label_style_.font_size() * text_margin_;
- }
- if(y_axis_.label_on_)
- { // Leave space at left for Y axis label.
- plot_left_ += x_axis_label_style_.font_size() * text_margin_;
         }
+ // Assume that Y- axis labels are always at left.
+ if(y_axis_.label_on_ == true == true && y_label_info_.text() != "")
+ { // Leave space at left for Y-axis label.
+ plot_left_ += y_axis_label_style_.font_size() * text_margin_;
+ }
+
         if(plot_window_on_)
         { // Needed to allow any plot window border rectangle to show OK.
           // A small margin is to prevent it overlapping the image border.
@@ -704,28 +735,28 @@
         // Check if the axes will intersect.
         // X axis position is determined by the range of Y min and max label values.
         x_axis_position_ = x_intersects_y; // Assume X-axis will intersect Y-axis (range of Y values includes zero).
- if (y_axis_.min_ > std::numeric_limits<double>::min()) // all Y values definitely > zero.
- { // y_min_ > 0, so X-axis will not intersect Y-axis, so use bottom plot window.
- x_axis_position_ = bottom; // X-axis to bottom of plot window.
- x_ticks_.ticks_on_window_or_axis_ = -1; // bottom = true;
+ if (y_axis_.min_ > std::numeric_limits<double>::min()) // All Y values definitely > zero.
+ { // y_min_ > 0, so X-axis will not intersect Y-axis, so put X axis line on bottom plot window.
+ x_axis_position_ = bottom; // X-axis to bottom.
+ x_ticks_.ticks_on_window_or_on_axis_ = -1; // X-axis ticks to bottom of plot window.
         }
         else if(y_axis_.max_ < -std::numeric_limits<double>::min()) // all Y values definitely < zero.
- { // // y_max_ < 0, so X-axis will not intersect Y-axis, so use top plot window.
+ { // // y_max_ < 0, so X-axis will not intersect Y-axis, so put X axis line on top plot window.
           x_axis_position_ = top; // X-axis to top of plot window.
- x_ticks_.ticks_on_window_or_axis_ = +1; // top = true;
+ x_ticks_.ticks_on_window_or_on_axis_ = +1; // X-axis ticks to top of plot window.
         }
         // Y axis position is determined by the range of X values.
         y_axis_position_ = y_intersects_x; // Assume Y-axis will intersect X-axis (X range includes zero).
         if (x_axis_.min_ > std::numeric_limits<double>::min()) // X values all definitely > zero.
         { // Y-axis > 0, so will not intersect X-axis.
           y_axis_position_ = left; // Y-axis free to left of end of X-axis.
- y_ticks_.ticks_on_window_or_axis_ = -1; // left true; // because floating off end of X-axis.
- // so need to put the labels on the plot window instead of the X-axis.
+ // Need to put the labels on the plot window instead of the X-axis.
+ y_ticks_.ticks_on_window_or_on_axis_ = -1; // Y axis ticks to left of window (because floating off end of X-axis).
         }
         else if (x_axis_.max_ < -std::numeric_limits<double>::min()) // X all definitely < zero.
         { // Y-axis < 0, so will not intersect X-axis.
- y_axis_position_ = right;
- y_ticks_.ticks_on_window_or_axis_ = +1; // right = true;
+ y_axis_position_ = right; // Y-axis to right of plot window.
+ y_ticks_.ticks_on_window_or_on_axis_ = +1; // Y-axis ticks to right of plot window.
         }
 
         // Ensure both axis and ticks have the *same* range.
@@ -741,13 +772,13 @@
         x_ticks_.longest_label(); // Updates label_max_length_
         y_ticks_.longest_label();
 
- // Check that labels won't collide and advise if they will.
+ // Check that labels won't collide and advise if they will?
         // Change rotation to avoid collision?
 
- y_ticks_.label_max_space_ = 0.; // Space for y labels, depending on orientation.
+ y_ticks_.label_max_space_ = 0.; // Work out space for y labels, depending on orientation.
         if (y_ticks_.label_rotation_ == horizontal)
         { // Move plot left edge right to give space for y_value_precision_ digits.
- y_ticks_.label_max_space_ += y_ticks_.label_max_length_; // SVG units.
+ y_ticks_.label_max_space_ += y_ticks_.label_max_length_; // SVG units (default pixels).
         }
         else if((y_ticks_.label_rotation_ == upward) || (y_ticks_.label_rotation_ == downward))
         { // Only need one char & 1 space width from Y-axis label.
@@ -761,18 +792,18 @@
 
         if (y_ticks_.major_value_labels_side_ != 0)
         { // Some major tick value labels wanted.
- if ((y_ticks_.ticks_on_window_or_axis_ < 0) // On left of plot window.
+ if ((y_ticks_.ticks_on_window_or_on_axis_ < 0) // On left of plot window.
             && (y_ticks_.major_value_labels_side_ < 0) ) // & labels on left.
           { // Contract plot window left edge to right to make space for value labels on left.
             plot_left_ += y_ticks_.label_max_space_;
           }
- else if ((y_ticks_.ticks_on_window_or_axis_ > 0) // On right of plot window.
+ else if ((y_ticks_.ticks_on_window_or_on_axis_ > 0) // On right of plot window.
             && (y_ticks_.major_value_labels_side_ > 0) ) // & labels to right.
           { // Contract plot window right to left to make space for value labels on right.
            plot_right_ -= y_ticks_.label_max_space_;
           }
           else
- { // y_ticks_.ticks_on_window_or_axis_ == 0
+ { // y_ticks_.ticks_on_window_or_on_axis_ == 0
             // no value labels on plot window (may be on mid-plot Y-axis line).
             // Ignore the unusual case of Y-axis line too close to the axis label.
             // In this case the value labels may overflow the plot window
@@ -783,14 +814,14 @@
           }
         } // y_ticks_. major_value_labels_side
 
- x_ticks_.label_max_space_ = 0; // Work out the longest value label for X-Axis.
+ x_ticks_.label_max_space_ = 0; // Work out the longest ticks values label for X-Axis.
         if (x_ticks_.label_rotation_ == horizontal)
         { // Only 1 char height & 1 space needed if labels are horizontal.
- x_ticks_.label_max_space_ = 2 * x_value_label_style_.font_size() * wh; // 2 SVG chars
+ x_ticks_.label_max_space_ += 2. * x_value_label_style_.font_size(); // 2 SVG chars
         }
         else if ((x_ticks_.label_rotation_ == upward) || (x_ticks_.label_rotation_ == downward))
- { // ! horizontal so will need more than 2 chars worth.
- x_ticks_.label_max_space_ += x_ticks_.label_max_length_ ; // SVG chars.
+ { // ! X_axis ticks labels vertical so will need enough for all the characters in the label.
+ x_ticks_.label_max_space_ += x_ticks_.label_max_length_ ; // in SVG units pixels.
         }
         else
         { // Assume label is sloping, say 45, so * sin(45) = 0.707.
@@ -799,12 +830,12 @@
 
         if (x_ticks_.major_value_labels_side_ != 0)
         { // Some tick value labels.
- if ((x_ticks_.ticks_on_window_or_axis_ < 0) // on bottom of plot window.
+ if ((x_ticks_.ticks_on_window_or_on_axis_ < 0) // on bottom of plot window.
              && (x_ticks_.major_value_labels_side_ < 0) ) // & labels on bottom.
           { // Contract plot window bottom edge up to make space for x value labels on bottom.
             plot_bottom_ -= x_ticks_.label_max_space_; // Move up.
           }
- else if ((x_ticks_.ticks_on_window_or_axis_ > 0) //
+ else if ((x_ticks_.ticks_on_window_or_on_axis_ > 0) //
              && (x_ticks_.major_value_labels_side_ > 0) ) // & x labels to top.
           { // Move top of plot window down to give space for x value labels.
             plot_top_ += x_ticks_.label_max_space_; // Move down.
@@ -815,11 +846,12 @@
           }
         } // x_ticks_. major_value_labels_side
 
- // Make space for any ticks.
+ // Make space for any Y ticks.
         if(y_ticks_.left_ticks_on_)
         { // Start left of plot to right to give space for biggest of any external left ticks.
           plot_left_ += (std::max)(y_ticks_.major_tick_length_, y_ticks_.minor_tick_length_); // Avoid macro max trap!
         }
+ // Make space for any X ticks.
         if(x_ticks_.down_ticks_on_)
         { // Start bottom of plot higher to give space for any external down ticks.
           plot_bottom_ -= (std::max)(x_ticks_.major_tick_length_, x_ticks_.minor_tick_length_);// Avoid macro max trap!
@@ -830,13 +862,13 @@
           // and x_axis_ is svg coordinate of Y-axis (usually y = 0).
           // If not fix axis to bottom (or top) of the plot window.
           if ((x_axis_position_ == bottom) // All Y values definitely > zero.
- && !(x_ticks_.ticks_on_window_or_axis_ < 0) ) // & not already at bottom.
+ && !(x_ticks_.ticks_on_window_or_on_axis_ < 0) ) // & not already at bottom.
           { // y_min_ > 0 so X-axis will not intersect Y-axis, so use plot window.
             plot_bottom_ -= x_ticks_.label_max_space_; // Move up for the value labels.
             x_axis_.axis_ = plot_bottom_; // Put X-axis on bottom.
           }
           else if ((x_axis_position_ == top) // All Y values definitely < zero.
- && !(x_ticks_.ticks_on_window_or_axis_ > 0) ) // & not already at top.
+ && !(x_ticks_.ticks_on_window_or_on_axis_ > 0) ) // & not already at top.
           { // // y_max_ < 0 so X-axis will not intersect Y-axis, so use plot window.
              plot_top_ += x_ticks_.label_max_space_; // Move down for labels.
              x_axis_.axis_ = plot_top_; // Put X-axis on top.
@@ -852,14 +884,14 @@
           // and y_axis_ is svg coordinate of X-axis (usually x = 0).
           // If not fix axis to left (or right) of the plot window.
           if ((y_axis_position_ == left) // All X values definitely > zero.
- //&& !(y_ticks_.ticks_on_window_or_axis_ < 0) // & not already at left.
+ //&& !(y_ticks_.ticks_on_window_or_on_axis_ < 0) // & not already at left.
              )
           { // Y-axis will not intersect X -axis, so put Y-axis line on plot window.
             y_axis_.axis_ = plot_left_; // Y-axis to left,
             //plot_left_ += 2 * y_label_info_.font_size(); // with a space.
           }
           else if ((y_axis_position_ == right) // All X values definitely < zero.
- //&& !(y_ticks_.ticks_on_window_or_axis_ > 0) // & not already at right.
+ //&& !(y_ticks_.ticks_on_window_or_on_axis_ > 0) // & not already at right.
             )
           {
             y_axis_.axis_ = plot_right_; // Y-axis to right of plot window,
@@ -932,14 +964,14 @@
             {
               if (x_ticks_.down_ticks_on_)
               {
- if (x_ticks_.ticks_on_window_or_axis_ < 0) // at bottom
+ if (x_ticks_.ticks_on_window_or_on_axis_ < 0) // at bottom
                 { // Extend the vertical line down in lieu of longest tick.
                   ybottom += (std::max)(x_ticks_.minor_tick_length_, x_ticks_.major_tick_length_);// Avoid macro max trap!
                 }
               }
               else if (x_ticks_.up_ticks_on_)
               {
- if (x_ticks_.ticks_on_window_or_axis_ > 0) // at top
+ if (x_ticks_.ticks_on_window_or_on_axis_ > 0) // at top
                 { // Extend the vertical line up in lieu of longest tick.
                   ytop += (std::max)(x_ticks_.minor_tick_length_, x_ticks_.major_tick_length_);// Avoid macro max trap!
                 }
@@ -947,7 +979,7 @@
             }
             image.g(detail::PLOT_Y_AXIS).line(x, ytop, x, ybottom);
             // <g id="yAxis" stroke="rgb(0,0,0)"><line x1="70.5" y1="53" x2="70.5" y2="357"/>
- if (y_ticks_.ticks_on_window_or_axis_ < 0) //(y_axis_position_ == left)
+ if (y_ticks_.ticks_on_window_or_on_axis_ < 0) //(y_axis_position_ == left)
             { // Draw vertical line holding the ticks on the left of plot window.
               image.g(detail::PLOT_Y_AXIS).line(plot_left_, plot_top_, plot_left_, plot_bottom_);
             }
@@ -1002,7 +1034,7 @@
           }
           // Draw major tick.
           if ((y != 0. || ! x_axis_.axis_line_on_) // axis line requested.
- || (y_ticks_.ticks_on_window_or_axis_ != 0)) // ticks & labels on plot window.
+ || (y_ticks_.ticks_on_window_or_on_axis_ != 0)) // ticks & labels on plot window.
           { // Avoid a major tick at y == 0 where there *is* a horizontal X-axis line.
             // (won't be X-axis line for 1-D where the zero tick is always wanted).
             draw_y_major_tick(y, major_tick_path, major_grid_path);
@@ -1019,7 +1051,7 @@
           for(double j = y; j > y - y_ticks_.major_interval_; j-= y_ticks_.major_interval_ / (y_ticks_.num_minor_ticks_ + 1))
           { // Draw minor ticks.
             if ( (j != 0. || ! y_axis_.axis_line_on_)
- || (y_ticks_.ticks_on_window_or_axis_ != 0) // ticks & labels on plot window.
+ || (y_ticks_.ticks_on_window_or_on_axis_ != 0) // ticks & labels on plot window.
               )
             { // Avoid a major tick at y == 0 where there *is* a horizontal X-axis line.
               // (won't be X-axis line for 1-D where the zero tick is always wanted).
@@ -1027,7 +1059,7 @@
             }
           }
           if ((y != 0. || ! x_axis_.axis_line_on_)
- || (y_ticks_.ticks_on_window_or_axis_ != 0) ) // ticks & labels on plot window.
+ || (y_ticks_.ticks_on_window_or_on_axis_ != 0) ) // ticks & labels on plot window.
           { // Avoid a major tick at y == 0 where there *is* a horizontal X-axis line.
             // (won't be X-axis line for 1-D where the zero tick is always wanted).
             draw_y_major_tick(y, major_tick_path, major_grid_path);
@@ -1036,38 +1068,91 @@
       } // draw_y_axis
 
       void draw_y_label()
- { //! Draw a vertical Y axis label, and optional y units.
+ { //! Draw a vertical Y-axis label, and optional y units.
         // Y-label color is set in constructor thus:
         // image.g(detail::PLOT_Y_LABEL).style().stroke_color(black);
         // and changed using y_label_color(color);
+ // Similarly for font family and size.
 
         std::string label = y_label_info_.text();
- if (y_axis_.label_units_on_ && (y_units_info_.text() != ""))
+ if ((y_axis_.label_units_on_) && (y_units_info_.text() != ""))
         { // Append the units, user must provide any enclosing ()s, if wanted.
- label += y_units_info_.text() ;
+ label += y_units_info_.text(); // for example: "distance (km)".
         }
 
- double x = plot_left_;
- x -= y_axis_label_style_.font_size() * 0.7; // Shift left to suit.
- if (y_ticks_.ticks_on_window_or_axis_ < 0)
- { // Ticks & value labels to left of Y-axis.
- if (y_ticks_.down_ticks_on_)
- { // Shift left for biggest of any ticks.
- x -= (std::max)(y_ticks_.minor_tick_length_, y_ticks_.major_tick_length_);
- }
- if (y_ticks_.major_value_labels_side_ < 0)
- { // Shift left to allow for any value labels.
- x -= y_ticks_.label_max_space_;
+ // Glyphs for western characters are aligned with the left bottom of capital letter,
+ // so need to allow for any descenders.
+ double x = plot_left_; // left edge of plot window.
+ double y = (plot_bottom_ + plot_top_) / 2.; // center on the plot window.
+ if (y_ticks_.ticks_on_window_or_on_axis_ < 0) // -1 means left
+ { // Ticks value labels left of plot window.
+ if (y_ticks_.major_value_labels_side_ < 0) // -1 means left
+ { // tick values labels are to left of Y axis.
+ // Shift right to allow for any tick value labels.
+ if ((y_ticks_.label_rotation_ == downward) || (y_ticks_.label_rotation_ == upward)
+ || (y_ticks_.label_rotation_ == steepdown) || (y_ticks_.label_rotation_ == steepup))
+ { // downward tick value label direction 90 up or down, or 60 steep degrees (might handle 60 separately).
+ if (y_ticks_.major_value_labels_side_ < 0) // left of plot window
+ { // Allow space for tick value labels font size to left of Y-axis or plot window.
+ x += y_value_label_info_.textstyle().font_size() * 1.1;
+ }
+ if (y_ticks_.left_ticks_on_ == true)
+ { // Allow for any leftward ticks.
+ x += (std::max)(y_ticks_.major_tick_length_, y_ticks_.minor_tick_length_);// And avoid macro max trap!
+ }
+ }
+ else if ((y_ticks_.label_rotation_ == uphill) || (y_ticks_.label_rotation_ == downhill)
+ || (y_ticks_.label_rotation_ == slopeup) || (y_ticks_.label_rotation_ == slopedownhill))
+ { // sloping 45 or 30 degrees (might handle 30 separately).
+ // x -= y_ticks_.label_may_space_ * sin45;
+ // x -= y_ticks_.label_max_space_;
+ }
+ else if (y_ticks_.label_rotation_ == horizontal)
+ { // horizontal
+ // x -= y_value_label_info_.textstyle().font_size() * y_ticks_.label_max_space_; // Might be zero?
+ x -= y_ticks_.label_max_space_; // Might be zero?
+ if (y_ticks_.left_ticks_on_ == true)
+ { // Allow for any leftward ticks.
+ x -= (std::max)(y_ticks_.major_tick_length_, y_ticks_.minor_tick_length_);// And avoid macro max trap!
+ }
+ x -= y_label_info_.textstyle().font_size() * 1.2; // Shift left to suit Y labels possible descenders.
+
+ }
+ else
+ {
+ cout << " Rotation of Y label rotation" << y_ticks_.label_rotation_ << "not yet implemented" << endl;
+ }
           }
+ if (y_ticks_.left_ticks_on_)
+ { // Shift right for biggest of any leftward ticks.
+ x += (std::max)(y_ticks_.minor_tick_length_, y_ticks_.major_tick_length_);
+ }
+ }
+ else if (y_ticks_.ticks_on_window_or_on_axis_ > 0)
+ { // tick values labels are to right of Y axis.
+ //
+ x = 0. + image_border_width(); // Start Y Label just right of the image left side.
+ x += image_border_.margin_;
+ x += y_label_info_.textstyle().font_size() * 1.; // Shift right to suit Y labels.
+ }
+ else if (y_ticks_.ticks_on_window_or_on_axis_ == 0)
+ { // Ticks are ON the Y-axis line,
+ // so Y label is just right the plot left.
+ // Character starts at bottom of capital letter, so allow for descenders.
+ x = 0. + image_border_width(); // Start Y Label just right of the image left side.
+ x += image_border_.margin_;
+ x += y_label_info_.textstyle().font_size() * 1.; // Shift right to suit Y labels.
         }
+ // Glyph is at bottom left of western characters.
 
         image.g(detail::PLOT_Y_LABEL).push_back(new
- text_element(x,
- (plot_bottom_ + plot_top_) / 2., // center on the plot window.
+ text_element(x, // distance from left side of image.
+ y, // center on the plot window.
           label, // "Y-Axis" for example.
           y_axis_label_style_, // font and size
           center_align, // One might want it to left or right_align?
- upward)); // Y label must be drawn vertically.
+ upward) // Y label must be drawn vertically.
+ );
 
       } // draw_y_label
 
@@ -1106,17 +1191,17 @@
 
         // Draw major ticks & value label, if necessary.
         double y_tick_length = y_ticks_.major_tick_length_;
- if (y_ticks_.ticks_on_window_or_axis_ < 0)
+ if (y_ticks_.ticks_on_window_or_on_axis_ < 0)
         { // Start ticks on the plot window border left.
           x_left = plot_left_; // x_left = left,
           x_right = plot_left_; // x_right = right.
         }
- else if (y_ticks_.ticks_on_window_or_axis_ > 0)
+ else if (y_ticks_.ticks_on_window_or_on_axis_ > 0)
         { // Start ticks on the plot window border right.
           x_left = plot_right_;
           x_right = plot_right_;
         }
- else // y_ticks_.ticks_on_window_or_axis_== 0
+ else // y_ticks_.ticks_on_window_or_on_axis_== 0
         { // Internal style ticks on vertical Y-axis.
           x_left = y_axis_.axis_; // Y-axis line.
           x_right = y_axis_.axis_;
@@ -1261,10 +1346,10 @@
           throw std::runtime_error("Y-tick Y value wrong!");
         }
 
- if(y_ticks_.ticks_on_window_or_axis_ != 0)
+ if(y_ticks_.ticks_on_window_or_on_axis_ != 0)
           { // External to plot window style left or right.
             // Always want all values including "0", if labeling external to plot window.
- // y_ticks_.ticks_on_window_or_axis_ == true != 0
+ // y_ticks_.ticks_on_window_or_on_axis_ == true != 0
             image.g(detail::PLOT_Y_TICKS_VALUES).text(
               x,
               y,
@@ -1322,18 +1407,18 @@
         } // y_minor_grid
 
         // Draw y minor ticks.
- if(y_ticks_.ticks_on_window_or_axis_ < 0)
+ if(y_ticks_.ticks_on_window_or_on_axis_ < 0)
         { // Put y minor ticks on the plot window border left.
           x_left = plot_left_;
           x_right = plot_left_;
         }
- else if (y_ticks_.ticks_on_window_or_axis_ > 0)
+ else if (y_ticks_.ticks_on_window_or_on_axis_ > 0)
         { // Put y minor ticks on the plot window border left.
           x_left = plot_right_;
           x_right = plot_right_;
         }
         else
- { // Internal style, y_ticks_.ticks_on_window_or_axis_ == 0
+ { // Internal style, y_ticks_.ticks_on_window_or_on_axis_ == 0
           x_left = y_axis_.axis_; // On the Y-axis line itself.
           x_right = y_axis_.axis_;
         }
@@ -2574,13 +2659,13 @@
         //! \param side -1 ticks downward.
         //! \param side 0 no ticks.
         //! \param side +1 ticks upward.
- x_ticks_.ticks_on_window_or_axis_ = side;
+ x_ticks_.ticks_on_window_or_on_axis_ = side;
         return *this; //! \return reference to svg_2d_plot to make chainable.
       }
 
       int svg_2d_plot::x_ticks_on_window_or_axis()
       { //! \return if ticks on the plot window or on the X axis.
- return x_ticks_.ticks_on_window_or_axis_;
+ return x_ticks_.ticks_on_window_or_on_axis_;
       }
 
       svg_2d_plot& svg_2d_plot::x_major_labels_side(int side)
@@ -2604,14 +2689,14 @@
               \arg cmd 0 on Y axis.
               \arg cmd +1 right of plot window.
             */
- y_ticks_.ticks_on_window_or_axis_ = cmd;
+ y_ticks_.ticks_on_window_or_on_axis_ = cmd;
         return *this; //! \return reference to svg_2d_plot to make chainable.
       }
 
       int svg_2d_plot::y_ticks_on_window_or_axis()
       { //! \return true if Y axis ticks wanted on the window (rather than on axis).\n
         //! -1 left of plot window, 0 on Y axis, +1 right of plot window.
- return y_ticks_.ticks_on_window_or_axis_;
+ return y_ticks_.ticks_on_window_or_on_axis_;
       }
 
       svg_2d_plot& svg_2d_plot::y_ticks_left_on(bool cmd)

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -944,12 +944,12 @@
     if (y_axis_.min_ > std::numeric_limits<double>::min()) // all Y values definitely > zero.
     { // y_min_ > 0, so X-axis will not intersect Y-axis, so use bottom plot window.
       x_axis_position_ = bottom; // X-axis to bottom of plot window.
- x_ticks_.ticks_on_window_or_axis_ = -1; // bottom = true;
+ x_ticks_.ticks_on_window_or_on_axis_ = -1; // bottom = true;
     }
     else if(y_axis_.max_ < -std::numeric_limits<double>::min()) // all Y values definitely < zero.
     { // // y_max_ < 0, so X-axis will not intersect Y-axis, so use top plot window.
       x_axis_position_ = top; // X-axis to top of plot window.
- x_ticks_.ticks_on_window_or_axis_ = +1; // top = true;
+ x_ticks_.ticks_on_window_or_on_axis_ = +1; // top = true;
     }
     // Y axis position is NOT determined by the range of X values.
     //x_axis_position_ = bottom; // Assume X-axis will intersect Y-axis (X range includes zero).
@@ -1007,18 +1007,18 @@
 
     if (y_ticks_.major_value_labels_side_ != 0) // != none
     { // Major tick value labels wanted left or right.
- if ((y_ticks_.ticks_on_window_or_axis_ < 0) // On left of plot window.
+ if ((y_ticks_.ticks_on_window_or_on_axis_ < 0) // On left of plot window.
         && (y_ticks_.major_value_labels_side_ < 0) ) // & labels on left.
       { // Contract plot window left edge to right to make space for value labels on left.
         plot_left_ += y_ticks_.label_max_space_;
       }
- else if ((y_ticks_.ticks_on_window_or_axis_ > 0) // On right of plot window.
+ else if ((y_ticks_.ticks_on_window_or_on_axis_ > 0) // On right of plot window.
         && (y_ticks_.major_value_labels_side_ > 0) ) // & labels to right.
       { // Contract plot window right to left to make space for value labels on right.
        plot_right_ -= y_ticks_.label_max_space_;
       }
       else
- { // y_ticks_.ticks_on_window_or_axis_ == 0
+ { // y_ticks_.ticks_on_window_or_on_axis_ == 0
         // no value labels on plot window (may be on mid-plot Y-axis line).
         // Ignore the unusual case of Y-axis line too close to the axis label.
         // In this case the value labels may overflow the plot window
@@ -1045,12 +1045,12 @@
 
     if (x_ticks_.major_value_labels_side_ != 0)
     { // Some tick value labels.
- if ((x_ticks_.ticks_on_window_or_axis_ < 0) // on bottom of plot window.
+ if ((x_ticks_.ticks_on_window_or_on_axis_ < 0) // on bottom of plot window.
          && (x_ticks_.major_value_labels_side_ < 0) ) // & labels on bottom.
       { // Contract plot window bottom edge up to make space for x value labels on bottom.
         plot_bottom_ -= x_ticks_.label_max_space_; // Move up.
       }
- else if ((x_ticks_.ticks_on_window_or_axis_ > 0) //
+ else if ((x_ticks_.ticks_on_window_or_on_axis_ > 0) //
          && (x_ticks_.major_value_labels_side_ > 0) ) // & x labels to top.
       { // Move top of plot window down to give space for x value labels.
         plot_top_ += x_ticks_.label_max_space_; // Move down.
@@ -1076,12 +1076,12 @@
       // and x_axis_ is svg coordinate of Y-axis (usually y = 0).
       // If not fix axis to bottom (or top) of the plot window.
       if ((x_axis_position_ == bottom) // All Y values definitely > zero.
- )// && !(x_ticks_.ticks_on_window_or_axis_ < 0) ) // & not already at bottom.
+ )// && !(x_ticks_.ticks_on_window_or_on_axis_ < 0) ) // & not already at bottom.
       { // y_min_ > 0 so X-axis will not intersect Y-axis, so use plot window.
         x_axis_.axis_ = plot_bottom_; // Put X-axis on bottom.
       }
       else if ((x_axis_position_ == top) // All Y values definitely < zero.
- && !(x_ticks_.ticks_on_window_or_axis_ > 0) ) // & not already at top.
+ && !(x_ticks_.ticks_on_window_or_on_axis_ > 0) ) // & not already at top.
       { // // y_max_ < 0 so X-axis will not intersect Y-axis, so use plot window.
          x_axis_.axis_ = plot_top_; // Put X-axis on top.
       }
@@ -1097,14 +1097,14 @@
       // and y_axis_ is svg coordinate of X-axis (usually x = 0).
       // Instead fix axis to left (or right) of the plot window.
       if ((y_axis_position_ == left) // All X values definitely > zero.
- //&& !(y_ticks_.ticks_on_window_or_axis_ < 0) // & not already at left.
+ //&& !(y_ticks_.ticks_on_window_or_on_axis_ < 0) // & not already at left.
          )
       { // Y-axis will not intersect X -axis, so put Y-axis line on plot window.
         y_axis_.axis_ = plot_left_; // Y-axis to left,
         //plot_left_ += 2 * y_label_info_.font_size(); // with a space.
       }
       else if ((y_axis_position_ == right) // All X values definitely < zero.
- //&& !(y_ticks_.ticks_on_window_or_axis_ > 0) // & not already at right.
+ //&& !(y_ticks_.ticks_on_window_or_on_axis_ > 0) // & not already at right.
         )
       {
         y_axis_.axis_ = plot_right_; // Y-axis to right of plot window,
@@ -1314,17 +1314,17 @@
 
     // Draw major ticks & tick value label, if necessary.
     double y_tick_length = y_ticks_.major_tick_length_;
- if (y_ticks_.ticks_on_window_or_axis_ < 0)
+ if (y_ticks_.ticks_on_window_or_on_axis_ < 0)
     { // Start ticks on the plot window border left.
       x_left = plot_left_; // x_left = left,
       x_right = plot_left_; // x_right = right.
     }
- else if (y_ticks_.ticks_on_window_or_axis_ > 0)
+ else if (y_ticks_.ticks_on_window_or_on_axis_ > 0)
     { // Start ticks on the plot window border right.
       x_left = plot_right_;
       x_right = plot_right_;
     }
- else // y_ticks_.ticks_on_window_or_axis_== 0
+ else // y_ticks_.ticks_on_window_or_on_axis_== 0
     { // Internal style ticks on vertical Y-axis.
       x_left = y_axis_.axis_; // Y-axis line.
       x_right = y_axis_.axis_;
@@ -1463,10 +1463,10 @@
     { // Sanity checks on svg coordinate.
       throw std::runtime_error("Y-tick Y value wrong!");
     }
- if(y_ticks_.ticks_on_window_or_axis_ != 0)
+ if(y_ticks_.ticks_on_window_or_on_axis_ != 0)
       { // External to plot window style left or right.
         // Always want all values including "0", if labeling external to plot window.
- // y_ticks_.ticks_on_window_or_axis_ == true != 0
+ // y_ticks_.ticks_on_window_or_on_axis_ == true != 0
         image.g(boxplot::VALUE_LABELS).text(
           x,
           y,
@@ -1522,18 +1522,18 @@
     } // y_minor_grid
 
     // Draw y minor ticks.
- if(y_ticks_.ticks_on_window_or_axis_ < 0)
+ if(y_ticks_.ticks_on_window_or_on_axis_ < 0)
     { // Put y minor ticks on the plot window border left.
       x_left = plot_left_;
       x_right = plot_left_;
     }
- else if (y_ticks_.ticks_on_window_or_axis_ > 0)
+ else if (y_ticks_.ticks_on_window_or_on_axis_ > 0)
     { // Put y minor ticks on the plot window border left.
       x_left = plot_right_;
       x_right = plot_right_;
     }
     else
- { // Internal style, y_ticks_.ticks_on_window_or_axis_ == 0
+ { // Internal style, y_ticks_.ticks_on_window_or_on_axis_ == 0
       x_left = y_axis_.axis_; // On the Y-axis line itself.
       x_right = y_axis_.axis_;
     }
@@ -1571,7 +1571,7 @@
 
     double y = plot_bottom_;
     y += x_ticks_.value_label_style_.font_size() * 2.; // Shift down to suit ticks?
- if (x_ticks_.ticks_on_window_or_axis_ < 0) // bottom == -1
+ if (x_ticks_.ticks_on_window_or_on_axis_ < 0) // bottom == -1
     { // Ticks & value labels below X-axis.
       if (x_ticks_.major_value_labels_side_ < 0) // - is bottom.
       { // Shift down to allow for any value labels.
@@ -1607,7 +1607,7 @@
 
     double x = plot_left_;
     x -= y_axis_label_style_.font_size() * 0.7; // Shift left to suit.
- if (y_ticks_.ticks_on_window_or_axis_ < 0)
+ if (y_ticks_.ticks_on_window_or_on_axis_ < 0)
     { // Ticks & value labels to left of Y-axis.
       if (y_ticks_.down_ticks_on_)
       { // Shift left for biggest of any ticks.

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -47,7 +47,7 @@
 class plot_point_style; // Shape, color, (optional value & uncertainty) of data point markers.
 class plot_line_style; // Style of line joining data series values.
 class axis_line_style; // Style of the x and/or y axes lines. But NOT the ticks and value labels.
-class ticks_labels_style; // Style of the x and y axes ticks, grids and their value labels..
+class ticks_labels_style; // Style of the x and y axes ticks, grids and tick value labels.
 class box_style; // Box colors, size and border switches.
 class histogram_style; // Options for histograms.
 class bar_style; // Style of bars.
@@ -1107,7 +1107,9 @@
     // Simplest to have all of these although only one pair (up or down) or (left or right) is used.
     // Unused are always false.
     int major_value_labels_side_; //!< Which side of axis for label values for major ticks.
- // < 0 means to left or down (default), 0 (false) means none, > 0 means to right (or top)/
+ // < 0 means to left (for Y) or down (for X) (default),
+ // 0 (false) means no ticks value labels (just ticks),
+ // > 0 means to right (for Y) or top(for X).
     rotate_style label_rotation_; //!< Direction axis value labels written.
     bool major_grid_on_; //!< Draw X grid at major ticks.
     bool minor_grid_on_; //!< Draw X grid at minor ticks.
@@ -1115,14 +1117,16 @@
     // (just fill_color for now (stroke makes characters fuzzy.)
     int value_precision_; //!< Precision for tick value labels, usually 3 will suffice.
     std::ios_base::fmtflags value_ioflags_; //!< IO formatting flags for the axis default std::ios::dec.
- bool strip_e0s_; //!< If redundant zero, + and e are to be stripped.
- double label_max_length_; //!< width (in SVG units) of longest value label text on axis.
- double label_max_space_; //!< Space needed for value label adjusted for rotation.
- int ticks_on_window_or_axis_; //!< Value labels & ticks on the plot window border
- //! (rather than on X or Y-axis).
- // For Y-axis -1 = left, 0 = false, +1 = right. Default -1 to left of plot window.
- // For X-axis -1 = bottom, 0 = false, +1 = top. Default -1 below bottom of plot window.
- //const text_style& value_label_style_; //!< text style (font, size...) for value labels.
+ bool strip_e0s_; //!< If redundant zero, + and e are to be stripped, for example "+1.000e3" to "1e3".
+ double label_max_length_; //!< width (in SVG units, pixels) of longest value label text on axis.
+ double label_max_space_; //!< Space (SVG units, pixels) needed for value label adjusted for rotation.
+ int ticks_on_window_or_on_axis_; //!< Value labels & ticks on a plot window border (rather than on X or Y-axis).
+ //! For Y-axis -1 = left, 0 = false = on X-axis, +1 = right. Default -1 to left of plot window.
+ //! For X-axis -1 = bottom, 0 = false = on Y-axis, +1 = top. Default -1 below bottom of plot window.
+ //! 0 = false puts the ticks and their labels on the X or Y axis line which may be in the middle of the plot.
+ //! For 1D the default overrides the constructor default of -1 below, to tick and value label the X-axis.
+ //! For 2D the default is left at -1, to use bottom and left of plot window to ticka nd value label X and Y-axis.
+
     text_style value_label_style_; //!< text style (font, size...) for value labels.
 
     ticks_labels_style( //! Constructor, providing defaults values for all member data.
@@ -1176,9 +1180,10 @@
     label_max_length_(0.), // length (estimated in SVG units) of longest label on axis.
     label_max_space_(0.), // Space (estimated in SVG units) of longest label on axis
     // adjusted for rotation.
- ticks_on_window_or_axis_(-1) // Value labels & ticks on the plot window
+ ticks_on_window_or_on_axis_(-1) // Value labels & ticks on the plot window,
     // rather than on X or Y-axis.
- // Default -1 means left or bottom.
+ // Default -1 means left or bottom of plot window.
+
   {
       if(max_ <= min_)
       { // max_ <= min_.
@@ -1226,11 +1231,10 @@
       // Check length of label for the ticks on the positive side (right or above zero).
       for(double v = 0.; v <= max_; v += major_interval_)
       {
- if (v != 0. || ticks_on_window_or_axis_)
+ if (v != 0. || ticks_on_window_or_on_axis_ != 0)
         { // Avoid a major tick at x == 0 where there *is* a vertical Y-axis line,
           // or avoid a major tick at y == 0 where there *is* a horizontal X-axis line.
- // (won't be a Y-axis line for 1-D,
- // where both the zero tick & value label is always wanted).
+ // (won't be a Y-axis line for 1-D, where both the zero tick & value label is always wanted).
           double l = label_length(v);
           if (l > longest)
           {
@@ -1241,7 +1245,7 @@
       // Check length of label of the ticks on the negative side (left of zero).
       for(double v = 0.; v >= min_; v -= major_interval_)
       {
- if (v != 0. || ticks_on_window_or_axis_)
+ if (v != 0. || ticks_on_window_or_on_axis_ != 0)
         { // Avoid a major tick at x == 0 where there *is* a vertical Y-axis line.
           // (won't be Y-axis line for 1-D where the zero tick is always wanted).
           // But no tick means no value label 0 either unless on_plot_window.
@@ -1611,9 +1615,13 @@
 } // const std::string strip(double d)
 
  static const double wh = 0.7; //!< font text width/height ratio.
- /*! \details Even after reading http://www.w3.org/TR/SVG/fonts.html,\n
- unclear how to determine the exact width of digits, so an
- arbitrary average width height ratio wh = 0.7 is used as a good approximation.
+ /*! \details
+ http://www.w3.org/TR/SVG/text.html#FontSizeProperty
+ Font size is the height of the text's font, so width = wh * font_size.
+
+ Even after reading http://www.w3.org/TR/SVG/fonts.html,\n
+ unclear how to determine the exact width of digits, so an
+ arbitrary average width height ratio wh = 0.7 is used as a good approximation.
   */
 
 double string_svg_length(const std::string& s, const text_style& style)

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/1d_tutorial.qbk
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/1d_tutorial.qbk (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/1d_tutorial.qbk 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -198,7 +198,6 @@
 
 [demo_1d_x_external_1]
 
-
 [h4 X-Axis Grid Lines]
 
 If you would like vertical grid lines that go on the graph,
@@ -215,14 +214,18 @@
 This will produce the following image:
 [$images/1d_x_grid.svg]
 
-[h4 X-Axis ticks and tick value label position]
+[h4 X-Axis Tick value labels precision, iosflags, font family and size]
 
-[demo_1d_x_external_1]
-producing this plot
-[$images/demo_1d_x_external.svg]
+[import ..\example\demo_2d_tick_values.cpp]
+
+[demo_2d_tick_values_1]
+[demo_2d_tick_values_2]
 
-See [@../../example/demo_1d_x_external.cpp demo_1d_x_external.cpp]
+producing this plot [$images/demo_2d_tick_values.svg]
+
+See [@../../example/demo_2d_x_external.cpp demo_2d_tick_values.cpp]
 for full source code.
+
 [endsect] [/section:1d_special Tutorial: 1D Gridlines & Axes]
 
 [/include demo_1d_axis_scaling.qbk]

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/2d_tutorial.qbk
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/2d_tutorial.qbk (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/2d_tutorial.qbk 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -192,6 +192,30 @@
 [/include 2d_special_tutorial.qbk]
 [section:2d_special Tutorial: 2D Special Features]
 
+[h4 Y-Axis ticks and tick value label position]
+
+[demo_2d_x_external_1]
+producing this plot
+[$images/demo_2d_x_external.svg]
+
+See [@../../example/demo_1d_x_external.cpp demo_1d_x_external.cpp]
+for full source code.
+
+[h4 X-Axis Tick value labels precision, iosflags, font family and size]
+
+[import ..\example\demo_1d_tick_values.cpp]
+
+[demo_1d_tick_values_1]
+[demo_1d_tick_values_2]
+
+producing this plot [$images/demo_1d_tick_values_1.svg]
+
+See [@../../example/demo_1d_x_external.cpp demo_1d_tick_values.cpp]
+for full source code.
+
+
+
+
 [h4 Y-Axis Grid Lines]
 
 If you would like horizontal Y grid lines that go across the graph,

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -107,6 +107,7 @@
 
 [include how_to_use.qbk]
 [include colors.qbk]
+[include fonts.qbk]
 [include 1d_tutorial.qbk] [/ All 1d examples]
 [include 2d_tutorial.qbk] [/ All 2d examples]
 [include boxplot_tutorial.qbk] [/ All boxplot examples]

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -88,14 +88,14 @@
   /*`Construct a plot , and add some data to the plot. */
 
   svg_1d_plot my_1d_plot; // Construct a plot with all the default constructor values.
-
+ my_1d_plot.title("Demo 1D autoscaling").x_label("X values"); // Add a title and X axis label.
   my_1d_plot.plot(my_data, "Auto 1D my_data"); // Add whole data series from my_data.
 
   /*`Use x_autoscale to scale the axis, in this most common and simplest case, using all the values.*/
   my_1d_plot.x_autoscale(my_data);
 
   /*` and finally write the SVG to a file.*/
- my_1d_plot.write("demo_1d_autoscaling.svg"); // Write the plot to file.
+ my_1d_plot.write("demo_1d_autoscaling_1.svg"); // Write the plot to file.
 
 //] [/demo_1d_autoscaling_2]
 
@@ -156,7 +156,7 @@
   */
    my_1d_plot.plot(++my_set.begin(),--my_set.end(), "Auto 1D my_set"); // Add 'top and tailed' data series from my_set.
  //my_1d_plot.plot(my_set, "Auto 1D my_set"); // Add whole data series from my_set.
- my_1d_plot.write("demo_1d_autoscaling.svg"); // Write the plot to file.
+ my_1d_plot.write("demo_1d_autoscaling_2.svg"); // Write the plot to file.
   
   /*`If we want, we can check the autoscale range used, noting that zero *is* included because we demanded it.*/
   cout << "x_range() " << my_1d_plot.x_range() << endl; // x_range() 0, 8

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -260,9 +260,9 @@
   my_1d_plot.plot(&my_data[1], &my_data[4], "Auto 1D"); // Add part (1,2 3 but *not* 4) of the one data series.
   //my_1d_plot.plot(&my_set[1], &my_set[4], "Auto 1D"); // operator[] is not defined for set container!
 
- my_1d_plot.write("auto_1d_plot.svg"); // Write the plot to file.
+ my_1d_plot.write("demo_1d_axis_scaling.svg"); // Write the plot to file.
 
- using boost::svg::detail::operator<<;
+ using boost::svg::detail::operator<<; // Needed for output a pair.
   cout << "x_range() " << my_1d_plot.x_range() << endl; // x_range() 1, 5.5
 
   //show_1d_plot_settings(my_1d_plot);
@@ -283,9 +283,9 @@
 
 //[demo_1d_axis_scaling_output
 
-Autorun "j:\Cpp\SVG\debug\demo_1d_axis_scaling.exe"
-6 values in container: 0.2 1.1 4.2 3.3 5.4 6.5
-8 values in container: 1.2 2.3 3.4 4.5 5.6 6.7 7.8 8.9
+Autorun "j:\Cpp\SVG\Debug\demo_1d_axis_scaling.exe"
+6 values in container: 0.2 1.1 4.2 3.3 5.4 6.5
+8 values in container: 1.2 2.3 3.4 4.5 5.6 6.7 7.8 8.9
 0.2 1.1 4.2 3.3 5.4 : 5 values used.
 1.1 4.2 3.3 5.4 : 4 values used.
 0.2 1.1 4.2 3.3 5.4 6.5 : 6 values used.
@@ -294,21 +294,18 @@
 1.1 4.2 3.3 5.4 : 4 values used.
 The smallest element is 0.2
 The largest element is 6.5
-axis_scaling min 0.2, max = 6.5
-Axis_scaled min 0, max = 7, increment 1
-Axis_scaled min 0, max = 7, increment 1
-Axis_scaled min 0, max = 7, increment 1
-Axis_scaled min 1, max = 6, increment 1
-Axis_scaled min 0, max = 7, increment 1
+axis_scaling 1 min 0.2, max = 6.5
+Axis_scaled 2 min 0, max = 7, increment 1
+Axis_scaled 3 min 0, max = 7, increment 1
+Axis_scaled 4 min 0, max = 7, increment 1
+Axis_scaled 5 min 0, max = 6, increment 1
+Axis_scaled 6 min 0, max = 7, increment 1
 not x_with_zero, 10 x_min_ticks, 0 x_steps, 0.001 tightness.
 Axis_scaled min 0, max 6.5, interval 0.5
 Axis_scaled min 0, max 6.5, interval 0.5
 Axis_scaled min 1, max 5.5, interval 0.5
 Axis_scaled min 1, max 5.5, interval 0.5
 x_range() 1, 5.5
-Build Time 0:03
-
-
 
 //] [/demo_1d_axis_scaling_output]
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -132,6 +132,8 @@
   svg_1d_plot my_plot;
   my_plot.title("deque&lt;double&gt; example");
   my_plot.plot(values);
+ my_plot.x_label("X values as doubles");
+
   my_plot.write("./demo_1d_deque_double.svg");
 //] [/demo_1d_containers_6]
   }

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_limits.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_limits.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_limits.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -81,7 +81,7 @@
     my_1d_plot.write("demo_1d_limits.svg");
 
 /*`
-[note the +infinity point is marked on the far right of the plot, the -infinity on the far left, but the NaN (Not A Number is at zero).]
+[note the +infinity point is marked on the far right of the plot, the -infinity on the far left, but the NaN (Not A Number) is at zero.]
 
 To echo the new marker colors chosen:
 */

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_simple.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_simple.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_simple.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -1,6 +1,6 @@
 /*! \file demo_1d_simple.cpp
     \brief Example of a simple 1D plot of two vectors of data.
- \details Creates file 1d_simple.svg
+ \details Creates file demo_1d_simple.svg
     \author Jacob Voytko and Paul A. Bristow
     \date 2007
   */
@@ -11,7 +11,7 @@
 // Distributed under the Boost Software License, Version 1.0.
 // For more information, see http://www.boost.org
 
-// An example to demonstrate simplest 1D *default* settings.
+// An example to demonstrate very simple 1D settings.
 // See also demo_1d_plot.cpp for a wider range of use.
 
 // This file is written to be included from a Quickbook .qbk document.
@@ -45,15 +45,18 @@
 
   svg_1d_plot my_plot; // Construct a plot.
 
- my_plot.legend_on(true) // Set title and legend, and X axis range.
+ my_plot.legend_on(true) // Set title and legend, and X-axis range and label.
          .title("Race Times")
- .x_range(-1, 11); // There are hundreds of other options here!
+ .x_label("time (sec)")
+ .x_range(-1, 11);
+ // There are hundreds of other possible options here!
 
   // Add the two containers of data to the plot, choosing two different colors.
   my_plot.plot(dan_times, "Dan").stroke_color(blue);
   my_plot.plot(elaine_times, "Elaine").stroke_color(orange);
 
   my_plot.write("./demo_1d_simple.svg"); // Finally write the plot to a file.
+
   return 0;
 } // int main()
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_values.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_values.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_values.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -1,6 +1,12 @@
 /*! \file demo_1d_values.cpp
- \brief Demonstration of some simple 1D value formatting.
- \details Quickbook markup to include in documentation.
+ \brief Demonstration of showing the 1D values.
+ \details Showing the 1D values of items from the data set.
+
+ Some of the many possible formatting options are demonstrated,
+ including controlling the precision and iosflags,
+ and prefix and suffix also useful for giving units.
+
+ Quickbook markup to include in documentation.
     \date 19 Jul 2009
     \author Paul A. Bristow
 */
@@ -13,8 +19,7 @@
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-// An example to demonstrate simplest 1D *default* settings.
-// See also demo_1d_plot.cpp for a wider range of use.
+// An example to demonstrate labelling data values
 
 // This file is written to be included from a Quickbook .qbk document.
 // It can be compiled by the C++ compiler, and run. Any output can
@@ -25,7 +30,10 @@
 
 //[demo_1d_values_1
 
-/*`As ever, we need a few includes to use Boost.Plot
+/*` Showing the 1D values of items from the data set.
+ Some of the many possible formatting options are demonstrated.
+
+ As ever, we need a few includes to use Boost.Plot
 */
 
 #include <boost/svg_plot/svg_1d_plot.hpp>
@@ -124,7 +132,7 @@
 */
     my_1d_plot.write("demo_1d_values.svg");
 
-/*`If chosen settings do not have the effect that you expect, it may be helpful to display them.
+/*`If chosen settings do not have the effect that you expect, it may be helpful to display them!
 
 (All the myriad settings can be displayed with `show_1d_plot_settings(my_1d_plot)`.)
 */
@@ -133,7 +141,6 @@
     cout << "my_1d_plot.image_size() " << my_1d_plot.image_size() << endl;
     cout << "my_1d_plot.image_x_size() " << my_1d_plot.image_x_size() << endl;
     cout << "my_1d_plot.image_y_size() " << my_1d_plot.image_y_size() << endl;
- //cout << "my_1d_plot.image_size() " << my_1d_plot.image_size() << endl;
     cout << "my_1d_plot.x_values_font_size() " << my_1d_plot.x_values_font_size() << endl;
     cout << "my_1d_plot.x_values_font_family() " << my_1d_plot.x_values_font_family() << endl;
     cout << "my_1d_plot.x_values_color() " << my_1d_plot.x_values_color() << endl;

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_x_external.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_x_external.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_x_external.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -47,8 +47,8 @@
          .title("Race Times")
          .x_range(-1, 10);
 
-/*`We add tastelessly colored grids for bother major and minor ticks, and switch both grids on.
-*/ // Styling grid.
+/*`We add tastelessly color the grids for both major and minor ticks, and switch both grids on.
+*/
   my_plot.x_major_grid_color(pink)
          .x_minor_grid_color(lightgray);
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_autoscaling.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_autoscaling.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_autoscaling.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -74,7 +74,7 @@
 it would make sense to use the reference 'as new' data to scale the plot for the 'aged' product samples).
 
 The add the (one but could be more) data series, `my_data` and a description, and how the data points are to be marked,
-here a circle with a diameter of 5 pixels, without a line joining the points.
+here a circle with a diameter of 5 pixels, without a line joining the points (also the default).
 */
     my_2d_plot.plot(my_data, "2d Values").shape(round).size(6).line_on(false);
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_limits.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_limits.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_limits.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -12,7 +12,7 @@
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-// An example to demonstrate 2D values including NaN and + and - infinity.
+// An example to demonstrate plotting 2D 'at limts' values including NaN and + and - infinity.
 
 // This file is written to be included from a Quickbook .qbk document.
 // It can be compiled by the C++ compiler, and run. Any output can
@@ -23,13 +23,17 @@
 
 //[demo_2d_limits_1
 
-/*`As ever, we need a few includes to use Boost.Plot
+/*`An example to demonstrate plotting 2D 'at limts' values
+including NaN and + and - infinity.
+
+As ever, we need the usuall includes to use Boost.Plot.
+
 */
+//] [demo_2d_limits_1]
 
 #include <boost/svg_plot/svg_2d_plot.hpp>
   using namespace boost::svg;
   using boost::svg::svg_2d_plot;
-
 #include <iostream>
   using std::cout;
   using std::endl;
@@ -43,7 +47,6 @@
 #include <utility>
   using std::make_pair;
 
-//] [demo_2d_limits_1]
 
 int main()
 {
@@ -78,7 +81,7 @@
   my_data[-numeric_limits<double>::infinity()] = -numeric_limits<double>::infinity(); // Bottom left.
 
 /*`
- [caution using map (rather than multimap that allows duplicates) some assignments values overwrite,
+ [caution Using map (rather than multimap that allows duplicates) some assignments values overwrite,
   and so not all display as they do individually.
   In particular, an X value of quiet_NaN() causes a overwrite of the lowerest value (because NaNs never compare equal).
   So avoid NaN as an X value.]
@@ -102,8 +105,8 @@
 /*`
 We can also keep note of the plot series and use this to interrogate how many normal and how many 'at limit' values.
 */
- cout << my_series.values_count() << " Normal data values in series." << endl;
- cout << my_series.limits_count() << " 'At limits' data values in series."<< endl;
+ cout << my_series.values_count() << " normal data values in series." << endl;
+ cout << my_series.limits_count() << " 'at limits' data values in series."<< endl;
 
 /*`To put a value label against each data point, switch on the option:
 */

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_simple.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_simple.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_simple.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -84,7 +84,6 @@
 
     // Add the data series to the plot:
     my_plot.title("demo_2d_simple");
- my_plot.title(" title");
     cout << " my_plot.title() " << my_plot.title() << endl;
     my_plot.x_label("X-axis").y_label("Y-axis"); // Note chaining.
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp 2009-07-26 13:57:54 EDT (Sun, 26 Jul 2009)
@@ -100,7 +100,7 @@
 
   map<unc, unc> data1; // Container for XY points.
   data1.insert(mp1); // u1, u2 = 1.23+-0.056 (7), 2.345+-0.067 (9)
- data1.insert(make_pair(unc(4.1, 0.4F, 7), unc(3.1, 0.3F, 18))); //
+ data1.insert(make_pair(unc(4.1, 0.4F, 7), unc(3.1, 0.3F, 18))); //
   data1.insert(make_pair(unc(-2.234, 0.03F, 7), unc(-8.76, 0.9F, 9)));
 
   /*`Make very sure you don't forget either unc() like this
@@ -115,23 +115,21 @@
   cout << endl;
 
   svg_2d_plot my_plot;
- /*`if you can be confident taht the data set only contains normal, valid data,
- so none are 'at limits' too big or too small to be meaningful, infinite or NaN (NotANumber)
+ /*`If you can be confident that the data set(s) only contains normal, valid data,
+ so none are 'at limits' - too big or too small to be meaningful, infinite or NaN (NotANumber),
   then these checks can be skipped (for speed).
- An instrument or operator input might provide only normal data.
+ An instrument or operator input might be known to provide only normal data.
   For this example, we know this is true, so override the default autoscale_check_limits(true).
   */
   //my_plot.autoscale_check_limits(false);
   /*`The default is autoscale_plusminus(3.) so that confidence ellipses
   at 1, 2 and 3 (uncertainty nominally standard deviations)
- are all within the plot window,
+ are all within the plot window,
   but if you are less interested in seeing the 2 and 3 ellipses,
   you could risk the outer edges spilling over the borders
   by reducing autoscale_plusminus, for example, to 1.5, down to zero.*/
   my_plot.autoscale_plusminus(1.5); // default is 3.
 
- my_plot.autoscale(true);
-
   /*`Use data set `data` to autoscale (you can use a different data set to scale from the one you chose to plot).
   */
   my_plot.xy_autoscale(data1);
@@ -150,19 +148,21 @@
     .x_plusminus_color(cyan)
     .x_df_on(true)
     .x_df_color(magenta)
+ .x_values_font_family("Times New Roman")
 
+ .y_label("distance (km)")
     .y_values_rotation(uphill)
- .x_values_font_family("sans")
+ .y_values_font_family("Arial") // Different from X just to show effect.
     .y_plusminus_on(true)
     .y_plusminus_color(red)
     .y_df_on(true)
     .y_df_color(green)
- /*`The default uncertainty ellipse colors (that apply to both x and y axes)
+ /*`The default uncertainty ellipse colors (that apply to both X and Y axes)
   can be changed thus:
   */
     .one_sd_color(lightblue)
- .two_sd_color(svg_color(200, 230, 255))// rgb(176, 224, 230)
- .three_sd_color(svg_color(230, 255, 255)) // rgb(240, 255, 255)
+ .two_sd_color(svg_color(200, 230, 255))
+ .three_sd_color(svg_color(230, 255, 255))
    ;
 
   my_plot.plot(data1, "data1").shape(unc_ellipse);
@@ -172,7 +172,7 @@
   //show_2d_plot_settings(my_plot);
 
   //] [/demo_2d_uncertainty_2]
-
+
   }
   catch (const std::exception& e)
   {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk