Boost logo

Boost-Commit :

From: pbristow_at_[hidden]
Date: 2008-01-28 06:04:32


Author: pbristow
Date: 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
New Revision: 42996
URL: http://svn.boost.org/trac/boost/changeset/42996

Log:
Tests suggest axis labels now OK for most combinations, but legend placing left & bottom still wrong. Warnings in SVG still.
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 303 ++++++++++++++++++-------------
   sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp | 10
   sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp | 7
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 23 +
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 382 +++++++++++++++++++++++++++------------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp | 19 -
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 27 +-
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/index.html | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_2d_plot_interface.html | 67 +++++-
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_boxplot_interface.html | 40 ++--
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/interface.qbk | 14
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/rationale.qbk | 11
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_interface.qbk | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/1d_full_layout.cpp | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp | 4
   sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_bezier.cpp | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_full.cpp | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_limit.cpp | 4
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_plot.cpp | 92 ++++++--
   sandbox/SOC/2007/visualization/libs/svg_plot/example/math_special_functions.cpp | 4
   sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp | 6
   sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_tests.cpp | 21 +
   22 files changed, 666 insertions(+), 378 deletions(-)

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 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -113,10 +113,10 @@
         void draw_x_minor_ticks(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 x1(value);
- transform_x(x1);
- double y1(0.); // Start on the horizontal X-axis line.
- double y2(derived().image.y_size());
+ double x(value); // Tick position and 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.
 
           // Draw the minor grid, if wanted.
           if(derived().x_ticks_.minor_grid_on_)
@@ -126,92 +126,82 @@
               // Make space for title and X-axis labels.
               if(derived().title_on_)
               { // Allow text_margin_ * font_size around text (pixels).
- y1 += derived().title_info_.style().font_size() * derived().text_margin_;
+ y_bottom += derived().title_info_.style().font_size() * derived().text_margin_;
               }
               if(derived().x_axis_.label_on_)
               {
- y2 -= derived().x_label_info_.style().font_size() * derived().text_margin_;
+ y_top -= derived().x_label_info_.style().font_size() * derived().text_margin_;
               }
             }
             else
             { // plot_window_on_ == true.
- y1 = derived().plot_top_ + 1; // Top. Why +1 and -1?
- y2 = derived().plot_bottom_ - 1; // Bottom. Ensure *inside* window?
+ y_bottom = derived().plot_top_ + derived().plot_window_border_.width_; // Top.
+ y_top = derived().plot_bottom_ - derived().plot_window_border_.width_; // Bottom. Ensure *inside* window.
             }
             // Make sure that we are drawing inside the allowed window.
- if((x1 >= derived().plot_left_) && (x1 <= derived().plot_right_)) // allow = too?
+ if((x >= derived().plot_left_) && (x <= derived().plot_right_)) // allow = too?
             {
- //std::cerr << "Writing draw_x_minor_ticks grid inside plot window: x1 = "
- // << x1 << ", plot_left_ = " << derived().plot_left_ << ", plot_right_ = " << derived().plot_right_ << std::endl;
- grid_path.M(x1, y1).L(x1, y2);
+ //std::cerr << "Writing draw_x_minor_ticks grid inside plot window: x = "
+ // << x << ", plot_left_ = " << derived().plot_left_ << ", plot_right_ = " << derived().plot_right_ << std::endl;
+ grid_path.M(x, y_bottom).L(x, y_top); // Draw grid line.
             }
             else
             { // This will happen but is designed to be ignored!
- // TODO check this is best. See comment in draw_x_axis
- //std::cerr << "Writing draw_x_minor_ticks grid OUTside plot window: x1 = "
- // << x1 << ", plot_left_ = " << derived().plot_left_ << ", plot_right_ = " << derived().plot_right_ << std::endl;
+ // See comment in draw_x_axis
+ // std::cerr << "Writing draw_x_minor_ticks grid OUTside plot window: x = "
+ // << x << ", plot_left_ = " << derived().plot_left_ << ", plot_right_ = " << derived().plot_right_ << std::endl;
             }
- } // use_x_minor_grid
+ } // x_minor_grid
 
- double x_tick_length = derived().x_ticks_.minor_tick_length_;
- if (derived().x_ticks_.ticks_on_plot_window_on_ < 0)
+ // Draw x minor ticks.
+ if (derived().x_ticks_.ticks_on_window_or_axis_ < 0)
           { // Put minor ticks on the plot window border bottom.
- y1 = derived().plot_bottom_; // on the window line.
- y2 = derived().plot_bottom_; // y1 = upper, y2 = lower end of tick.
- if(derived().x_ticks_.up_ticks_on_)
- { //
- y1 -= x_tick_length; // up.
- }
- if (derived().x_ticks_.down_ticks_on_)
- {
- y2 += x_tick_length; // down.
- }
+ 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_plot_window_on_ < 0)
+ else if (derived().x_ticks_.ticks_on_window_or_axis_ > 0)
           { // Put minor ticks on the plot window border top.
- y1 = derived().plot_top_; // on the window line.
- y2 = derived().plot_top_; // y1 = upper, y2 = lower end of tick.
- if(derived().x_ticks_.up_ticks_on_)
- { //
- y1 -= x_tick_length; // up.
- }
- if (derived().x_ticks_.down_ticks_on_)
- {
- y2 += x_tick_length; // down.
- }
+ y_bottom = derived().plot_top_; // on the window line.
+ y_top = derived().plot_top_; // y_bottom = upper, y_top = lower end of tick.
           }
- else
+ else // derived().x_ticks_.ticks_on_window_or_axis_ == 0
           { // Internal style, draw tick up and/or down from the X-axis line.
- y1 = derived().x_axis_.axis_; // X-axis horizontal line.
- y2 = derived().x_axis_.axis_;
- if(derived().x_ticks_.up_ticks_on_)
- {
- y1 -= x_tick_length; // up
- }
- if (derived().x_ticks_.down_ticks_on_)
- {
- y2 += x_tick_length; // down.
- }
+ y_bottom = derived().x_axis_.axis_; // ON X-axis horizontal line.
+ y_top = derived().x_axis_.axis_;
           }
- // Make sure that we are drawing inside the allowed window.
- if((x1 >= derived().plot_left_) && (x1 <= derived().plot_right_)) // TODO allow < or <=
+ if(derived().x_ticks_.up_ticks_on_)
           {
- tick_path.M(x1, y1).L(x1, y2);
+ y_bottom -= derived().x_ticks_.minor_tick_length_; // up
+ }
+ if (derived().x_ticks_.down_ticks_on_)
+ {
+ y_top += derived().x_ticks_.minor_tick_length_; // down.
+ }
+ // Make sure that we are drawing inside the allowed window.
+ if((x >= derived().plot_left_) && (x <= derived().plot_right_)) // TODO allow < or <=
+ {
+ tick_path.M(x, y_bottom).L(x, y_top);
             // No value labels on minor ticks, at present.
           }
           else
           { // This will happen but is designed to be ignored!
- // TODO check this is best. See comment in draw_x_axis
- //std::cerr << "Writing draw_x_minor_ticks OUTside plot window: x1 = "
- // << x1 << ", plot_left_ = " << derived().plot_left_ << ", plot_right_ = " << derived().plot_right_ << std::endl;
+ // See comment in draw_x_axis
+ //std::cerr << "Writing draw_x_minor_ticks OUTside plot window: x = "
+ // << x << ", plot_left_ = " << derived().plot_left_ << ", plot_right_ = " << derived().plot_right_ << std::endl;
           }
         } // void draw_x_minor_ticks
 
         void draw_x_major_ticks(double value, path_element& tick_path, path_element& grid_path)
         { // draw ticks - and grid too if wanted.
- // If major_value_labels_on then value shown beside the major tick.
+ // If major_value_labels_side then value shown beside the major tick.
           double x(value); //
           transform_x(x); // x value in svg.
+ if((x < derived().plot_left_ - 0.01) || (x > derived().plot_right_ + 0.01))
+ // Allow a bit extra to allow for round-off errors.
+ { // tick value is way outside plot window, so nothing to do.
+ std::cout << derived().plot_left_ << ' '<< x << std::endl;
+ return;
+ }
           double y_up(0.); // upper end of tick.
           double y_down(derived().image.x_size()); // y_down = lower end of tick.
           if(derived().x_ticks_.major_grid_on_)
@@ -222,8 +212,8 @@
               {
                 y_up += derived().title_info_.style().font_size() * derived().text_margin_;
               }
- if(derived().x_ticks_.major_value_labels_on_ != 0)
- { // If use_x_major_labels then value may be shown beside the major tick.
+ if(derived().x_ticks_.major_value_labels_side_ != 0)
+ { // Value may be shown either side the major tick.
                 y_down -= derived().x_label_info_.style().font_size() * derived().text_margin_;
               }
             }
@@ -232,18 +222,18 @@
               y_up = derived().plot_top_; // Bottom of plot window.
               y_down = derived().plot_bottom_; // Top of plot window.
             }
- if((y_down <= derived().plot_bottom_) && (y_up >= derived().plot_top_) && (x >= derived().plot_left_) && (x <= derived().plot_right_))
- { // Make sure that we are drawing inside the allowed window.
+ //if((y_down <= derived().plot_bottom_) && (y_up >= derived().plot_top_) && (x >= derived().plot_left_) && (x <= derived().plot_right_))
+ //{ // Make sure that we are drawing inside the allowed window.
               grid_path.M(x, y_up).L(x, y_down); // Vertical grid line.
- }
+ //}
           } // use_x_major_grid
 
           // Draw major tick (perhaps as well as grid - ticks might be wider than grid).
           // Make sure that we are drawing inside the allowed plot window.
- if((x >= derived().plot_left_) && (x <= derived().plot_right_)) // now <=
- {
+ //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_plot_window_on_ < 0)
+ if(derived().x_ticks_.ticks_on_window_or_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.
@@ -256,7 +246,7 @@
                 y_down += x_tick_length; // down.
               }
             }
- else if(derived().x_ticks_.ticks_on_plot_window_on_ > 0)
+ else if(derived().x_ticks_.ticks_on_window_or_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.
@@ -284,69 +274,133 @@
             }
             tick_path.M(x, y_up).L(x, y_down);
             // Leaving current position at the bottom end of the tick.
+ // y_up and y-down are the ends of the tick.
+ // These may be on the axis line, or the plot window.
 
- if(derived().x_ticks_.major_value_labels_on_ != 0)
- { // Show value by the tick as "1.2" or "3.4e+000"...
+ 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"...
               if (derived().x_ticks_.strip_e0s_)
- { // remove unecessary e, +, leadings 0s
+ { // Remove unecessary e, +, leadings 0s.
                 std::string v = strip_e0s(label.str());
                 label.str(v);
               }
- double y = (derived().x_ticks_.major_value_labels_on_ < 0) ? y_down : y_up; // bottom or top end of the tick.
+
+ double y = 0; // Where to start writing from, at end of bottom or top tick, if any.
+ // = 0 is only to avoid unitialised warning.
               align_style alignment = center_align;
- if(derived().x_ticks_.down_ticks_on_)
- { // No need to shift if derived().up_ticks_on_ as labels are below the X-axis.
- // y += derived().x_label_value_.font_size();
- }
- if (derived().x_ticks_.label_rotation_ == upward)
- { //
- alignment = right_align;
- x -= derived().x_label_info_.style().font_size() * 0.3; // To centre digit and minus (or plus) sign - on tick.
- //y += label.str().size() * derived().x_label_info_.font_size() * 0.5; // Part digit space.
- // so the last digit will be by the tick.
- }
- else if((derived().x_ticks_.label_rotation_ == downward)
- || (derived().x_ticks_.label_rotation_ == downhill))
- { // start from tick and write down.
- y += derived().x_label_value_.style().font_size() * 0.5; // Part digit space.
- x -= derived().x_label_info_.style().font_size() * 0.3; // To centre digit and - on tick.
- alignment = left_align;
+ // rotate_style rot = derived().x_ticks_.label_rotation_; // TODO for debug only.
+ // Adjustments to provide space from end of tick before or after writing label.
+ if (derived().x_ticks_.label_rotation_ == upward) // vertical writing up.
+ { // Shift to center value digits and minus sign on tick.
+ x += derived().x_value_label_style_.font_size() * 0.2;
+ if (derived().x_ticks_.major_value_labels_side_ < 0)
+ { // labels to bottom, so start a little below y_down.
+ y = y_down + derived().x_value_label_style_.font_size() * 0.6;
+ alignment = right_align;
+ }
+ else if(derived().x_ticks_.major_value_labels_side_ > 0)
+ { // labels to top, so start a little above y_up.
+ y = y_up - derived().x_value_label_style_.font_size() * 0.5;
+ alignment = left_align;
+ }
               }
- else if(derived().x_ticks_.label_rotation_ == horizontal)
+ else if (derived().x_ticks_.label_rotation_ == downward)
               {
- y += derived().x_label_value_.style().font_size() * 1.5;
- alignment = center_align; // center on the tick.
+ x -= derived().x_value_label_style_.font_size() * 0.3;
+ if (derived().x_ticks_.major_value_labels_side_ < 0)
+ { // labels to bottom, so start a little below y_down.
+ y = y_down + derived().x_value_label_style_.font_size() * 0.5;
+ alignment = left_align;
+ }
+ else if(derived().x_ticks_.major_value_labels_side_ > 0)
+ { // labels to top, so start a little above y_up.
+ y = y_up - derived().x_value_label_style_.font_size() * 0.5;
+ alignment = right_align;
+ }
+ }
+ else if (derived().x_ticks_.label_rotation_ == uphill)
+ { // Assume some 45 slope, so need about sqrt(2) less space.
+ x += derived().x_value_label_style_.font_size() * 0.5;
+ if (derived().x_ticks_.major_value_labels_side_ < 0)
+ { // labels to bottom, so start a little to bottom of y_bottom.
+ y = y_down + derived().x_value_label_style_.font_size() * 0.7;
+ // Seems to need a bit more space for top than bottom if rotated.
+ alignment = right_align;
+ }
+ else if(derived().x_ticks_.major_value_labels_side_ > 0)
+ { // labels to top, so start a little to top of y_top.
+ y = y_up - derived().x_value_label_style_.font_size() * 0.2;
+ alignment = left_align;
+ }
+ }
+ else if (derived().x_ticks_.label_rotation_ == downhill)
+ { // Assume some 45 slope, so need about sqrt(2) less space.
+ x -= derived().x_value_label_style_.font_size() * 0.3;
+ 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() * 0.7;
+ // Seems to need a bit more space for top than bottom if rotated.
+ alignment = left_align;
+ }
+ else if(derived().x_ticks_.major_value_labels_side_ > 0)
+ { // labels to top, so start a little to top of y_up.
+ y = y_up - derived().x_value_label_style_.font_size() * 0.3;
+ alignment = right_align;
+ }
               }
- else if(derived().x_ticks_.label_rotation_ == uphill)
- { // 45 slope up,
- alignment = left_align; // Uphill to end at tick.
- y += label.str().size() * derived().x_label_info_.style().font_size() * 0.7;
- // sloping up so need about sin(45) = 0.707 less space,
- // so the last digit is by the tick.
+ else if (derived().x_ticks_.label_rotation_ == horizontal)
+ { // Tick value label on x axis.
+ 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;
+ alignment = center_align; // on the tick.
+ }
+ else if(derived().x_ticks_.major_value_labels_side_ > 0)
+ { // labels to top, so start a little to top of y_up.
+ y = y_up - derived().x_value_label_style_.font_size() * 0.7;
+ alignment = center_align;
+ }
               }
               else
- { // 45 slope down.
- alignment = left_align; // Assume downhill from tick,
- // so no need for y adjustment.
+ { // upsidedown, backup... - can't see any conceivable use for these.
+ return; // Others not yet implemented.
+ } // rotations
+ if (x <= 0)
+ { // Sanity checks on svg coordinates.
+ throw std::runtime_error("X-tick X value wrong!");
               }
+ if (y <= 0)
+ {
+ throw std::runtime_error("X-tick Y value wrong!");
+ }
+
 
- { // ! use_x_ticks_on_plot_window_ = Internal - value labels just below horizontal X-axis.
- if ((derived().x_ticks_.ticks_on_plot_window_on_ != 0) || ((value != 0) && derived().x_axis_.axis_line_on_))
+ if(derived().x_ticks_.ticks_on_window_or_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
+ derived().image.g(detail::PLOT_VALUE_LABELS).text(
+ x,
+ y,
+ label.str(), derived().x_value_label_style_, alignment, derived().x_ticks_.label_rotation_);
+ }
+ else
+ {
+ if ((value != 0) && derived().x_axis_.axis_line_on_)
                 { // Avoid a "0" below the X-axis if it would be cut through by any internal vertical Y-axis line.
                   derived().image.g(detail::PLOT_VALUE_LABELS).text(
- x, // to centre on tick
+ x,
                     y,
                     label.str(),
- derived().x_label_value_.style(),
- alignment, // center label on the tick.
+ derived().x_value_label_style_,
+ alignment,
                     derived().x_ticks_.label_rotation_);
                 }
- }
- } // use_x_major_labels
+ } // on plot window or 'on axis'.
           }
           else
           { // Outside plot window - so do nothing? Warning?
@@ -364,17 +418,17 @@
             if (derived().x_axis_position_ == x_intersects_y)
             { // Draw the horizontal X-axis line the full width of the plot window,
               // perhaps including an addition in lieu of a major tick.
- if (derived().y_ticks_.left_ticks_on_ && (derived().x_ticks_.ticks_on_plot_window_on_ != 0))
+ if (derived().y_ticks_.left_ticks_on_ && (derived().x_ticks_.ticks_on_window_or_axis_ != 0))
               { // 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_);
               }
               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_plot_window_on_ < 0)
+ if (derived().x_ticks_.ticks_on_window_or_axis_ < 0)
               { // 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_plot_window_on_ > 0)
+ else if (derived().x_ticks_.ticks_on_window_or_axis_ > 0)
               {// 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_);
               }
@@ -418,7 +472,7 @@
               // TODO this seems ugly - as does the negative ones below.
               draw_x_minor_ticks(j, minor_tick_path, minor_grid_path);
             } // for j
- if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_plot_window_on_ != 0))
+ if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_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_ticks(x, major_tick_path, major_grid_path);
@@ -426,24 +480,24 @@
           }
 
           // Draw the ticks on the negative side (left of zero).
- for(double x = 0.; x >= derived().x_axis_.min_; x -= derived().x_ticks_.major_interval_)
+ for(double x = 0.; x >= derived().x_axis_.min_; // ?? * (1. + 2 * std::numeric_limits<double>::epsilon());
+ x -= derived().x_ticks_.major_interval_) // Want a close to test here?
           {
             // Draw minor ticks.
             for(double j = x - x_minor_jump;
               j > (x - derived().x_ticks_.major_interval_ + x_minor_jump) * (1. + 2 * std::numeric_limits<double>::epsilon());
               // Increase test value by a few bits to avoid accumulated rounding error
               // 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_plot_window_on_ != 0))
+ if ((j != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_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_ticks(j, minor_tick_path, minor_grid_path);
               }
             }
- if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_plot_window_on_ != 0))
+ if ((x != 0. || !derived().y_axis_.axis_line_on_) || (derived().x_ticks_.ticks_on_window_or_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.
@@ -1047,7 +1101,7 @@
           // std::string x_label()
           // bool x_label_units_on() //
           // std::string x_label_units() // Show X-axis units text.
- // int x_major_labels_on()
+ // int x_major_labels_side()
           // svg_color x_label_color()
           // bool axes_on()
           // svg_color x_axis_color()
@@ -1087,7 +1141,7 @@
           //Derived& x_ticks_down_on(bool cmd)
           //Derived& x_label_on(bool cmd)
           //Derived& x_label_units_on(bool cmd)
- //Derived& x_major_labels_on(int cmd)
+ //Derived& x_major_labels_side(int cmd)
           //Derived& title_on(bool cmd)
           //Derived& x_major_grid_on(bool is)
           //Derived& x_minor_grid_on(bool is)
@@ -1805,15 +1859,15 @@
             return derived().image.g(detail::PLOT_VALUE_LABELS).style().stroke_color();
           }
 
- Derived& x_ticks_on_plot_window_on(int cmd)
+ Derived& x_ticks_on_window_or_axis(int cmd)
           { // External style, top = +1, bottom = -1 (default).
- derived().x_ticks_.ticks_on_plot_window_on_ = cmd;
+ derived().x_ticks_.ticks_on_window_or_axis_ = cmd;
             return derived();
           }
 
- int x_ticks_on_plot_window_on()
+ int x_ticks_on_window_or_axis()
           { // External style = true.
- return derived().x_ticks_.ticks_on_plot_window_on_;
+ return derived().x_ticks_.ticks_on_window_or_axis_;
           }
 
           Derived& x_label_units_on(bool cmd)
@@ -1827,15 +1881,15 @@
             return derived().x_axis_.label_units_on_;
           }
 
- Derived& x_major_labels_on(int cmd)
+ Derived& x_major_value_labels_side(int cmd)
           {
- derived().x_ticks_.major_value_labels_on_ = cmd;
+ derived().x_ticks_.major_value_labels_side_ = cmd;
             return derived();
           }
 
- int x_major_labels_on()
+ int x_major_value_labels_side()
           {
- return derived().x_ticks_.major_value_labels_on_;
+ return derived().x_ticks_.major_value_labels_side_;
           }
 
           Derived& x_major_label_rotation(rotate_style rot)
@@ -2059,7 +2113,6 @@
 
           double x_label_width()
           {
- //return x_label_width_;
             return derived().image.g(PLOT_X_LABEL).style().stroke_width();
           }
 

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -227,7 +227,6 @@
   cout << "x_axis_label_color " << plot.x_axis_label_color() << endl;
   cout << "x_axis_value_color " << plot.x_axis_value_color() << endl;
   cout << "x_axis_width " << plot.x_axis_width() << endl;
-
   cout << "x_label_on " << plot.x_label_on() << endl;
   cout << "x_label " << plot.x_label() << endl;
   cout << "x_label_color " << plot.x_label_color() << endl;
@@ -236,7 +235,7 @@
   cout << "x_label_units " << plot.x_label_units() << endl;
   cout << "x_label_units_on " << plot.x_label_units_on() << endl;
   cout << "x_label_width " << plot.x_label_width() << endl;
- cout << "x_major_labels_on " << l_or_r(plot.x_major_labels_on()) << endl;
+ cout << "x_major_value_labels_side " << l_or_r(plot.x_major_value_labels_side()) << endl;
   cout << "x_major_label_rotation " << plot.x_major_label_rotation() << endl;
   cout << "x_major_grid_color " << plot.x_major_grid_color() << endl;
   cout << "x_major_grid_on " << plot.x_major_grid_on() << endl;
@@ -257,8 +256,7 @@
   cout << "x_num_minor_ticks " << plot.x_num_minor_ticks() << endl;
   cout << "x_ticks_down_on " << plot.x_ticks_down_on() << endl;
   cout << "x_ticks_up_on " << plot.x_ticks_up_on() << endl;
- cout << "x_ticks_on_plot_window_on " << plot.x_ticks_on_plot_window_on() << endl;
- cout << "y_ticks_on_plot_window_on " << plot.y_ticks_on_plot_window_on() << endl;
+ cout << "x_ticks_on_window_or_axis " << t_or_b(plot.x_ticks_on_window_or_axis()) << endl;
   cout << "y_axis_position " << plot.y_axis_position() << endl;
   cout << "x_axis_position " << plot.x_axis_position() << endl;
   cout << "y_label_on " << plot.y_label_on() << endl;
@@ -281,7 +279,7 @@
   cout << "y_major_grid_color " << plot.y_major_grid_color() << endl;
   cout << "y_major_grid_width " << plot.y_major_grid_width() << endl;
   cout << "y_major_interval " << plot.y_major_interval() << endl;
- cout << "y_major_labels_on " << t_or_b(plot.y_major_labels_on()) << endl;
+ cout << "y_major_value_labels_side " << t_or_b(plot.y_major_value_labels_side()) << endl;
   cout << "y_major_label_rotation " << plot.y_major_label_rotation() << endl;
   cout << "y_major_tick_color " << plot.y_major_tick_color() << endl;
   cout << "y_major_tick_length " << plot.y_major_tick_length() << endl;
@@ -298,7 +296,7 @@
   cout << "y_num_minor_ticks " << endl;
   cout << "y_ticks_left_on " << plot.y_ticks_left_on() << endl;
   cout << "y_ticks_right_on " << plot.y_ticks_right_on() << endl;
- cout << "y_ticks_on_plot_window_on " << plot.y_ticks_on_plot_window_on() << endl;
+ cout << "y_ticks_on_window_or_axis " << l_or_r(plot.y_ticks_on_window_or_axis()) << endl;
   cout << "y_max " << plot.y_max() << endl;
   cout << "y_min " << plot.y_min() << endl;
   cout << "data lines width " << plot.data_lines_width() << endl;

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -288,8 +288,13 @@
   // recommends MUST have correct Content-Encoding headers.
   // --------------------------------------------------------------------------------
 
- void write(const std::string& file)
+ void write(const std::string& filename)
   {// Write whole .svg 'file' contents to file.
+ std::string file(filename); // Copy to avoid problems with const if need to append.
+ if (file.find('.') == std::string::npos)
+ { // No file type suffix, so provide the default .svg.
+ file.append(".svg");
+ }
     std::ofstream f_out(file.c_str());
     if(f_out.fail())
     {

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 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -406,22 +406,22 @@
           x_label_length_+= x_ticks_.label_max_width_ * x_value_label_style_.font_size() * wh * sin45; // SVG 'chars'.
       }
 
- if (x_ticks_.major_value_labels_on_ != 0)
+ if (x_ticks_.major_value_labels_side_ != 0)
       { // Some value labels.
- if ((x_ticks_.ticks_on_plot_window_on_ < 0) // on bottom of plot window.
- && (x_ticks_.major_value_labels_on_ < 0) ) // & labels on bottom.
+ 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_label_length_; // Move up.
         }
- else if ((x_ticks_.ticks_on_plot_window_on_ > 0) //
- && (x_ticks_.major_value_labels_on_ > 0) ) // & x labels to top.
+ 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_label_length_; // Move down.
         }
         else
         { // no labels on plot window (may be on mid-plot X-axis).
         }
- } // x_ticks_. major_value_labels_on
+ } // x_ticks_. major_value_labels_side
 
       // Make space for any ticks.
       if(x_ticks_.down_ticks_on_)
@@ -433,13 +433,13 @@
         // 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_plot_window_on_ < 0) ) // & not already at bottom.
+ && !(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.
           plot_bottom_ -= x_label_length_; // Move up for the value labels.
           x_axis_.axis_ = plot_bottom_; // Put X-axis on bottom.
         }
         else if ((x_axis_position_ == top) // definitely < zero.
- && !(x_ticks_.ticks_on_plot_window_on_ > 0) ) // & not already at top.
+ && !(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.
            plot_top_ += x_label_length_; // Move down for labels.
            x_axis_.axis_ = plot_top_; // Put X-axis on top.
@@ -565,8 +565,13 @@
   // document node, which calls all other nodes through the Visitor pattern.
   // ------------------------------------------------------------------------
 
- svg_1d_plot& write(const std::string& filename)
+ svg_1d_plot& write(std::string& file)
   {
+ std::string filename(file); // Copy to avoid problems with const if need to append.
+ if (filename.find(".svg") == std::string::npos)
+ { // No file type suffix, so provide the default .svg.
+ filename.append(".svg");
+ }
     std::ofstream fout(filename.c_str());
     if(fout.fail())
     {

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 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -182,7 +182,7 @@
       text_style y_value_label_style_;
       text_style point_symbols_style_; // Used for data point marking.
 
- double x_label_width_;
+ //double x_label_width_;
 
       text_element title_info_; // Plot title.
       text_element legend_header_; // legend box header or title (if any).
@@ -216,7 +216,7 @@
       double legend_bottom_; // bottom of legend box.
       size_t legend_longest_; // longest (both header & data) string in legend box,
 
- axis_line_style x_axis_;
+ axis_line_style x_axis_;
       axis_line_style y_axis_;
 
       ticks_labels_style x_ticks_;
@@ -259,7 +259,6 @@
         y_axis_label_style_(14, "Verdana", "", ""),
         y_value_label_style_(12, "Verdana", "", ""),
         point_symbols_style_(12, "Lucida Sans Unicode"), // Used for data point marking.
- x_label_width_(5),
         title_info_(0, 0, "Plot of data", title_style_, center_align, horizontal),
         x_label_info_(0, 0, "X Axis", x_axis_label_style_, center_align, horizontal),
         x_units_info_(0, 0, " (units)", x_value_label_style_, center_align, horizontal),
@@ -267,6 +266,7 @@
         x_axis_(X, -10., +10., black, 1, 0, true, false, true),
         y_axis_(Y, -10., +10., black, 1, 0, true, false, true),
         // Might fill in all values, but there are rather many for ticks_labels_style,
+ // And this would separate any changes in styles defaults from plot default. TODO?
         x_ticks_(X, x_value_label_style_),// so for other defaults see ticks_labels_style.
         y_ticks_(Y, y_value_label_style_),
         y_label_info_(0, 0, "Y Axis", y_axis_label_style_, center_align, upward),
@@ -394,11 +394,11 @@
        // Assume that axis labels are always at bottom and left.
        if(x_axis_.label_on_)
        { // Leave space at bottom for X axis label.
- plot_bottom_ -= x_axis_label_style_.font_size() * (text_margin_);
+ 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_ - 0.5);
+ plot_left_ += x_axis_label_style_.font_size() * text_margin_;
         }
         if(plot_window_on_)
         { // Needed to allow any plot window border rectangle to show OK.
@@ -419,28 +419,31 @@
         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_plot_window_on_ = -1; // bottom = true;
+ x_ticks_.ticks_on_window_or_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_plot_window_on_ = +1; // top = true;
+ x_ticks_.ticks_on_window_or_axis_ = +1; // top = true;
         }
         // 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_plot_window_on_ = -1; // left true; // because floating off 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.
         }
         else if (x_axis_.max_ < -std::numeric_limits<double>::min()) // Y all definitely < zero.
         { // Y-axis < 0, so will not intersect X-axis.
           y_axis_position_ = right;
- y_ticks_.ticks_on_plot_window_on_ = +1; // right = true;
+ y_ticks_.ticks_on_window_or_axis_ = +1; // right = true;
         }
 
- // Ensure both axis and ticks have the same range.
+ // Ensure both axis and ticks have the *same* range.
+ // (To use the separation, made to give the potential for different ranges,
+ // one would have to *not* do this,
+ // but to make sure they are both assigned correctly).
         x_ticks_.max_ = x_axis_.max_;
         x_ticks_.min_ = x_axis_.min_;
         y_ticks_.max_ = y_axis_.max_;
@@ -468,29 +471,29 @@
           y_label_length_ = y_ticks_.label_max_width_ * sin45;
         }
 
- if (y_ticks_.major_value_labels_on_ != 0)
- { // Some value labels.
- if ((y_ticks_.ticks_on_plot_window_on_ < 0) // On left of plot window.
- && (y_ticks_.major_value_labels_on_ < 0) ) // & labels on left.
+ 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.
+ && (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_label_length_;
           }
- else if ((y_ticks_.ticks_on_plot_window_on_ > 0) // On right of plot window.
- && (y_ticks_.major_value_labels_on_ > 0) ) // & labels to right.
+ else if ((y_ticks_.ticks_on_window_or_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_label_length_;
           }
           else
- { // y_ticks_.ticks_on_plot_window_on_ == 0
- // no labels on plot window (may be on mid-plot Y-axis line).
+ { // y_ticks_.ticks_on_window_or_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
             // and collide with the axis label!
             // User must change to put value label downward, or on other side of the axis line.
- // using major_value_labels_on(int d)
+ // using major_value_labels_side(int d)
             // to set tick value labels to left (<0), none (==0) or right (>0).
           }
- } // y_ticks_. major_value_labels_on
+ } // y_ticks_. major_value_labels_side
 
         double x_label_length_ = 0; // Work out the longest value label for X-Axis.
         if (x_ticks_.label_rotation_ == horizontal)
@@ -506,15 +509,15 @@
             x_label_length_+= x_ticks_.label_max_width_ * sin45; // SVG 'chars'.
         }
 
- if (x_ticks_.major_value_labels_on_ != 0)
+ if (x_ticks_.major_value_labels_side_ != 0)
         { // Some value labels.
- if ((x_ticks_.ticks_on_plot_window_on_ < 0) // on bottom of plot window.
- && (x_ticks_.major_value_labels_on_ < 0) ) // & labels on bottom.
+ 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_label_length_; // Move up.
           }
- else if ((x_ticks_.ticks_on_plot_window_on_ > 0) //
- && (x_ticks_.major_value_labels_on_ > 0) ) // & x labels to top.
+ 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_label_length_; // Move down.
           }
@@ -522,7 +525,7 @@
           { // no labels on plot window (may be on mid-plot X-axis).
             // See also notes above on case where labels can overwrite axis.
           }
- } // x_ticks_. major_value_labels_on
+ } // x_ticks_. major_value_labels_side
 
         // Make space for any ticks.
         if(y_ticks_.left_ticks_on_)
@@ -539,13 +542,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_plot_window_on_ < 0) ) // & not already at bottom.
+ && !(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.
             plot_bottom_ -= x_label_length_; // 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_plot_window_on_ > 0) ) // & not already at top.
+ && !(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.
              plot_top_ += x_label_length_; // Move down for labels.
              x_axis_.axis_ = plot_top_; // Put X-axis on top.
@@ -560,16 +563,18 @@
         { // Want a Y-axis line, so check if range includes zero, so axes intersect,
           // and y_axis_ is svg coordinate of X-axis (usually x = 0).
           // If not fix axis to left (or right) of the plot window.
-// TODO more logic here as X???
- if (y_axis_position_ == left) // All X values definitely > zero.
+ if ((y_axis_position_ == left) // All X values definitely > zero.
+ //&& !(y_ticks_.ticks_on_window_or_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.
+ else if ((y_axis_position_ == right) // All X values definitely < zero.
+ //&& !(y_ticks_.ticks_on_window_or_axis_ > 0) // & not already at right.
+ )
           {
             y_axis_.axis_ = plot_right_; // Y-axis to right of plot window,
- //plot_right_ -= 2 * y_label_info_.font_size(); // with a space.
           }
           else
           { // x_axis_position_ == x_intersects_y
@@ -634,13 +639,13 @@
           if (y_axis_position_ == y_intersects_x)
           { // Draw the vertical Y-axis line at cartesian x = 0).
             double ybottom = plot_bottom_;
- if (x_ticks_.down_ticks_on_ && (y_ticks_.ticks_on_plot_window_on_ != 0) && (x_axis_position_ == x_intersects_y) )
+ if (x_ticks_.down_ticks_on_ && (y_ticks_.ticks_on_window_or_axis_ != 0) && (x_axis_position_ == x_intersects_y) )
             { // 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!
             }
             image.g(detail::PLOT_Y_AXIS).line(x, plot_top_, 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_plot_window_on_ < 0) //(y_axis_position_ == left)
+ if (y_ticks_.ticks_on_window_or_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_);
             }
@@ -680,7 +685,7 @@
           for(double j = y + y_minor_jump;
             j < (y + y_ticks_.major_interval_) * (1. - 2 * std::numeric_limits<double>::epsilon());
             j += y_minor_jump)
- { // Draw minor ticks.
+ { // Draw minor tick.
             // This will output 'orphaned' minor ticks that are beyond the plot window,
             // if the last major tick does not coincide with the plot window.
             // These are just ignored in draw_x_minor_ticks.
@@ -693,11 +698,17 @@
               draw_y_minor_tick(j, minor_tick_path, minor_grid_path);
             }
           }
- if ((y != 0. || ! x_axis_.axis_line_on_) || (y_ticks_.ticks_on_plot_window_on_ != 0))
+ // 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.
           { // 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);
           }
+ else
+ {
+ // std::cout << "Missed y " << y << std::endl; // Only miss 0s
+ }
         }
 
         // Draw the ticks on the negative side.
@@ -705,13 +716,16 @@
         {
           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_plot_window_on_ != 0))
+ if ( (j != 0. || ! y_axis_.axis_line_on_)
+ || (y_ticks_.ticks_on_window_or_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_minor_tick(j, minor_tick_path, minor_grid_path);
             }
           }
- if ((y != 0. || ! x_axis_.axis_line_on_) || (y_ticks_.ticks_on_plot_window_on_ != 0))
+ if ((y != 0. || ! x_axis_.axis_line_on_)
+ || (y_ticks_.ticks_on_window_or_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);
@@ -742,17 +756,19 @@
       { // Draw a Y axis major tick, tick value labels & grids.
         double y(value); // for tick and/or grid.
         transform_y(y); // Cartesian to SVG coordinates.
- if((y < plot_top_) || (y > plot_bottom_))
- { // tick value is outside plot window, so nothing to do.
+ if((y < plot_top_ - 0.01) || (y > plot_bottom_ + 0.01))
+ // Allow a bit extra to allow for round-off errors.
+ { // tick value is way outside plot window, so nothing to do.
+ // std::cout << y << std::endl;
           return;
         }
         double x_left(0.); // Left end of tick.
- double x_right(image.y_size());
+ double x_right(image.y_size()); // Right end of tick.
         if(y_ticks_.major_grid_on_)
         { // Draw horizontal major grid line.
           if(!plot_window_on_ != 0)
- {
- if(y_ticks_.major_value_labels_on_ < 0)
+ {
+ if(y_ticks_.major_value_labels_side_ < 0)
             { // Start further right to give space for y axis value label.
               y -= y_value_label_style_.font_size() * text_margin_;
             }
@@ -768,104 +784,195 @@
             x_right = plot_right_ - plot_window_border_.width_;
             grid_path.M(x_left, y).L(x_right, y); // Horizontal grid line.
           }
- } // use_y_major_grid_
+ } // y_major_grid_on
 
- if ((y <= plot_bottom_) && (y >= plot_top_))
- { // Make sure that we are drawing inside the allowed window.
- double y_tick_length = y_ticks_.major_tick_length_;
- if (y_ticks_.ticks_on_plot_window_on_ < 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_plot_window_on_ > 0)
- { // Start ticks on the plot window border right.
- x_left = plot_right_;
- x_right = plot_right_;
- }
- else
- { // Internal style ticks on vertical Y-axis.
- x_left = y_axis_.axis_; // Y-axis line.
- x_right = y_axis_.axis_;
- }
- if(y_ticks_.left_ticks_on_)
- {
- x_left -= y_tick_length; // left
- }
- if (y_ticks_.right_ticks_on_)
- {
- x_right += y_tick_length; // right.
- }
- tick_path.M(x_left, y).L(x_right, y); // Draw the major tick.
- // leaving x_left at the left most end of any tick.
+ // 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)
+ { // 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)
+ { // 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
+ { // Internal style ticks on vertical Y-axis.
+ x_left = y_axis_.axis_; // Y-axis line.
+ x_right = y_axis_.axis_;
+ }
+ if(y_ticks_.left_ticks_on_)
+ {
+ x_left -= y_tick_length; // left
+ }
+ if (y_ticks_.right_ticks_on_)
+ {
+ x_right += y_tick_length; // right.
+ }
+ //if ((y <= (plot_bottom_ - 0.01)) && (y >= (plot_top_ + 0.01)))
+ //{ // Make sure that we are drawing inside the allowed window.
+ // TODO remove this completely. Should not be necessary.
+ tick_path.M(x_left, y).L(x_right, y); // Draw the major tick.
+ // leaving x_left at the left most end of any tick,
+ // and x_right at the rightmost end of any tick.
+ // These may be on the axis line.
+ // y is the vertical tick position.
+ //} // in plot window
 
- if(y_ticks_.major_value_labels_on_ != 0)
- { // Label the tick with value, for example "1.2"
+ if(y_ticks_.major_value_labels_side_ != 0)
+ { // Label the tick with a value, for example "1.2"
           std::stringstream label;
           label.precision(y_ticks_.value_precision_);
           label.flags(y_ticks_.value_ioflags_); // set ALL IOflags.
           label << value; // Example: label.str() == "20" or "0.25" or "1.2e+015"
- if(y_ticks_.left_ticks_on_)
- {
- // In case some joker has made the minor ticks longer than the major,
- // we might need to move left more for the longer tick.
- x_left -= (std::max)(y_ticks_.major_tick_length_, y_ticks_.minor_tick_length_);// Avoid macro max trap!
- // x_left -= y_value_label_style_.font_size() * wh; // move left by a font width.
+ if (y_ticks_.strip_e0s_)
+ { // Remove unecessary e, +, leadings 0s.
+ std::string v = strip_e0s(label.str());
+ label.str(v);
+ }
+
+ double x = 0; // Where to start writing from, at end of left or right tick, if any.
+ // = 0 is only to avoid unitialised warning.
+ align_style alignment = center_align;
+ // Adjustments to provide space from end of tick before or after writing label.
+ if (y_ticks_.label_rotation_ == horizontal)
+ { // Just shift up to center value digits on tick.
+ if (y_ticks_.major_value_labels_side_ < 0)
+ { // labels to left, so start a little to left of x_left.
+ y += y_value_label_style_.font_size() * 0.2;
+ x = x_left - y_value_label_style_.font_size() * 0.5;
+ alignment = right_align;
+ }
+ else if(y_ticks_.major_value_labels_side_ > 0)
+ { // labels to right, so start a little to right of x_right.
+ y += y_value_label_style_.font_size() * 0.2;
+ x = x_right + y_value_label_style_.font_size() * 0.5;
+ alignment = left_align;
+ }
           }
- else
- { // No need to move if right tick, or none.
+ else if (y_ticks_.label_rotation_ == upsidedown)
+ { // Just shift up to center value digits on tick.
+ if (y_ticks_.major_value_labels_side_ < 0)
+ { // labels to left, so start a little to left of x_left.
+ y -= y_value_label_style_.font_size() * 0.1;
+ x = x_left - y_value_label_style_.font_size() * 0.5;
+ alignment = left_align;
+ }
+ else if(y_ticks_.major_value_labels_side_ > 0)
+ { // labels to right, so start a little to right of x_right.
+ y -= y_value_label_style_.font_size() * 0.1;
+ x = x_right + y_value_label_style_.font_size() * 0.5;
+ alignment = right_align;
+ }
           }
- // Need to work out how much space value labels will need.
- align_style alignment = center_align;
- if(y_ticks_.ticks_on_plot_window_on_ != 0)
- { // External to plot window style left or right.
- if(y_ticks_.label_rotation_ == horizontal)
- { // Just shift down third a digit to center value digits on tick.
+ else if (y_ticks_.label_rotation_ == uphill)
+ { // Assume some 45 slope, so need about sqrt(2) less space.
+ if (y_ticks_.major_value_labels_side_ < 0)
+ { // labels to left, so start a little to left of x_left.
+ y -= y_value_label_style_.font_size() * 0.2;
+ x = x_left - y_value_label_style_.font_size() * 0.2;
+ // Seems to need a bit more space for right than left if rotated.
               alignment = right_align;
+ }
+ else if(y_ticks_.major_value_labels_side_ > 0)
+ { // labels to right, so start a little to right of x_right.
+ y += y_value_label_style_.font_size() * 0.2;
+ x = x_right + y_value_label_style_.font_size() * 0.7;
+ alignment = left_align;
+ }
+ }
+ else if (y_ticks_.label_rotation_ == downhill)
+ { // Assume some 45 slope, so need about sqrt(2) less space.
+ if (y_ticks_.major_value_labels_side_ < 0)
+ { // labels to left, so start a little to left of x_left.
               y += y_value_label_style_.font_size() * 0.3;
+ x = x_left - y_value_label_style_.font_size() * 0.7;
+ // Seems to need a bit more space for right than left if rotated.
+ alignment = right_align;
+ }
+ else if(y_ticks_.major_value_labels_side_ > 0)
+ { // labels to right, so start a little to right of x_right.
+ y -= y_value_label_style_.font_size() * 0.3;
+ x = x_right + y_value_label_style_.font_size() * 0.1;
+ alignment = left_align;
             }
- else if ((y_ticks_.label_rotation_ == upward) || (y_ticks_.label_rotation_ == downward))
- {// Tick value label straight up or down vertically on y axis.
- // No shift y down to center.
+ }
+ else if (y_ticks_.label_rotation_ == upward)
+ { // Tick value label straight up vertically on Y-axis.
+ y -= y_value_label_style_.font_size() * 0.1;
+ if (y_ticks_.major_value_labels_side_ < 0)
+ { // labels to left, so start a little to left of x_left.
+ x = x_left - y_value_label_style_.font_size() * 0.7;
+ // Seems to need a bit more space for right than left if rotated.
               alignment = center_align;
             }
- else
- { // Assume some 45 slope, so need about sqrt(2) less space?
- x_left += y_value_label_style_.font_size() * 0.5; // move left by half a font width.
- // no y shift needed.
- alignment = right_align;
+ else if(y_ticks_.major_value_labels_side_ > 0)
+ { // labels to right, so start a little to right of x_right.
+ x = x_right + y_value_label_style_.font_size() * 1.5;
+ alignment = center_align;
+ }
+ }
+ else if (y_ticks_.label_rotation_ == downward)
+ { // Tick value label straight down vertically on Y-axis.
+ y -= y_value_label_style_.font_size() * 0.1;
+ if (y_ticks_.major_value_labels_side_ < 0)
+ { // labels to left, so start a little to left of x_left.
+ x = x_left - y_value_label_style_.font_size() * 1.2;
+ // Seems to need a bit more space for right than left if rotated.
+ alignment = center_align;
             }
+ else if(y_ticks_.major_value_labels_side_ > 0)
+ { // labels to right, so start a little to right of x_right.
+ x = x_right + y_value_label_style_.font_size() * 0.7;
+ alignment = center_align;
+ }
+ }
+ else
+ { // Others not yet implemented.
+ return; // Without any value label.
+ } // All rotations.
+
+ if (x <= 0)
+ { // Sanity checks on svg coordinates.
+ throw std::runtime_error("Y-tick X value wrong!");
+ }
+ if (y <= 0)
+ {
+ throw std::runtime_error("Y-tick Y value wrong!");
+ }
+ if(y_ticks_.ticks_on_window_or_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_plot_window_on_ == true != 0
+ // y_ticks_.ticks_on_window_or_axis_ == true != 0
             image.g(detail::PLOT_VALUE_LABELS).text(
- x_left,
+ x,
               y,
               label.str(), y_value_label_style_, alignment, y_ticks_.label_rotation_);
           }
           else
- { // ! y_ticks_.y_ticks_on_plot_window_ == 0 Internal - value labels close to left of vertical Y-axis.
+ { // ! y_ticks_.y_ticks_on_plot_window_ == 0 'Internal' - value labels either side of vertical Y-axis.
             if ((value != 0) && y_axis_.axis_line_on_)
             { // Avoid a zero ON the Y-axis if it would be cut through by any horizontal X-axis line.
- y += y_value_label_style_.font_size() / 2;
               image.g(detail::PLOT_VALUE_LABELS).text(
- x_left ,
- y, // Just shift down half a digit to center value digits on tick.
+ x,
+ y,
                 label.str(),
                 y_value_label_style_,
- alignment, // on the tick ???
+ alignment,
                 y_ticks_.label_rotation_);
             }
- }
- } // if(use_y_major_labels)
+ } // either on plot window or 'on axis'.
+ } // want value label on tick
       } // draw_y_major_tick
 
       void draw_y_minor_tick(double value, path_element& tick_path, path_element& grid_path)
       { // Draw a Y-axis minor tick and optional grid.
- double x_left(0.);
- double y(value); // tick position and value label.
- transform_y(y); // to svg.
+ double x_left(0.); // Start on vertical Y axis line.
         double x_right(image.y_size()); // right edge of image.
+ double y(value); // Tick position and value label,
+ transform_y(y); // convert to svg.
 
         if(y_ticks_.minor_grid_on_)
         { // Draw the minor grid, if wanted.
@@ -888,20 +995,21 @@
             grid_path.M(x_left, y).L(x_right, y); // Draw grid line.
           }
           // TODO else just ignore outside plot window?
- }
+ } // y_minor_grid
 
- if(y_ticks_.ticks_on_plot_window_on_ < 0)
+ // Draw y minor ticks.
+ if(y_ticks_.ticks_on_window_or_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_plot_window_on_ > 0)
+ else if (y_ticks_.ticks_on_window_or_axis_ > 0)
         { // Put y minor ticks on the plot window border left.
           x_left = plot_right_;
           x_right = plot_right_;
         }
         else
- { // Internal style,
+ { // Internal style, y_ticks_.ticks_on_window_or_axis_ == 0
           x_left = y_axis_.axis_; // On the Y-axis line itself.
           x_right = y_axis_.axis_;
         }
@@ -1180,8 +1288,14 @@
       // document node, which calls all other nodes through the Visitor pattern.
       // -----------------------------------------------------------------
 
- svg_2d_plot& write(const std::string& filename)
+ svg_2d_plot& write(const std::string& file)
       { // Write the plot image to a named file.
+ std::string filename(file); // Copy to avoid problem with const if try to append.
+ if (filename.find(".svg") == std::string::npos)
+ { // No file type suffix, so provide the default .svg.
+ filename.append(".svg");
+ }
+
         std::ofstream fout(filename.c_str());
         if(fout.fail())
         {
@@ -1249,13 +1363,13 @@
 
       svg_2d_plot& y_major_labels_on(int cmd)
       { //< 0 means to left or down (default), 0 (false) means none, > 0 means to right (or top).
- y_ticks_.major_value_labels_on_ = cmd;
+ y_ticks_.major_value_labels_side_ = cmd;
         return *this;
       }
 
       int y_major_labels_on()
       {
- return y_ticks_.major_value_labels_on_;
+ return y_ticks_.major_value_labels_side_;
       }
 
       svg_2d_plot& y_major_label_rotation(rotate_style rot)
@@ -1540,26 +1654,48 @@
         return y_ticks_.minor_tick_width_;
       }
 
- svg_2d_plot& x_ticks_on_plot_window_on(int is)
+ svg_2d_plot& x_ticks_on_window_or_axis(int is)
       {
- x_ticks_.ticks_on_plot_window_on_ = is;
+ x_ticks_.ticks_on_window_or_axis_ = is;
         return *this;
       }
 
- bool x_ticks_on_plot_window_on()
+ int x_ticks_on_window_or_axis()
       {
- return x_ticks_.ticks_on_plot_window_on_;
+ return x_ticks_.ticks_on_window_or_axis_;
+ }
+
+ svg_2d_plot& x_major_value_labels_side(int is)
+ { // Label values side for major ticks left -1, (right +1 or none 0).
+ x_ticks_.major_value_labels_side_ = is;
+ return *this;
+ }
+
+ int x_major_value_labels_side()
+ { // Label values side for major ticks left -1, (right +1 or none 0).
+ return x_ticks_.major_value_labels_side_;
       }
 
- svg_2d_plot& y_ticks_on_plot_window_on(int is)
+ svg_2d_plot& y_ticks_on_window_or_axis(int is)
       {
- y_ticks_.ticks_on_plot_window_on_ = is;
+ y_ticks_.ticks_on_window_or_axis_ = is;
         return *this;
       }
 
- bool y_ticks_on_plot_window_on()
+ int y_ticks_on_window_or_axis()
       {
- return y_ticks_.ticks_on_plot_window_on_;
+ return y_ticks_.ticks_on_window_or_axis_;
+ }
+
+ svg_2d_plot& y_major_value_labels_side(int is)
+ { // Label values side for major ticks left -1, (right +1 or none 0).
+ y_ticks_.major_value_labels_side_ = is;
+ return *this;
+ }
+
+ int y_major_value_labels_side()
+ { // Label values side for major ticks left -1, (right +1 or none 0).
+ return y_ticks_.major_value_labels_side_;
       }
 
       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 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -646,26 +646,25 @@
     return *this;
 }
 
-svg_boxplot& write(const std::string& str)
+svg_boxplot& write(std::string& file)
 {
- std::ofstream fout(str.c_str());
-
+ std::string filename(file); // Copy to avoid problems with const if need to append.
+ if (filename.find(".svg") == std::string::npos)
+ { // No file type suffix, so provide the default .svg.
+ filename.append(".svg");
+ }
+ std::ofstream fout(filename.c_str());
     if(fout.fail())
     {
- throw std::runtime_error("Unable to open "+str);
+ throw std::runtime_error("Unable to open "+ filename);
     }
-
- write(fout);
-
     return *this;
 }
 
 svg_boxplot& write(std::ostream& s_out)
 {
     update_image();
-
     image.write(s_out);
-
     return *this;
 }
 
@@ -687,7 +686,7 @@
     return *this;
 }
 
-svg_boxplot& y_major_labels_on(int cmd)
+svg_boxplot& y_major_value_labels_side(int cmd)
 {
     use_y_major_labels = cmd;
     return *this;

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 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -733,7 +733,7 @@
     bool right_ticks_on_; // Draw ticks right from vertical Y-axis line.
     // Simplest to have all of these although only one pair like up or down is used.
     // Unused are always false.
- int major_value_labels_on_; // Label values for major ticks.
+ int major_value_labels_side_; // Label values for major ticks, and direction.
     // < 0 means to left or down (default), 0 (false) means none, > 0 means to right (or top)/
     rotate_style label_rotation_; // Direction axis value labels written.
     bool major_grid_on_; // Draw X grid at major ticks.
@@ -742,10 +742,10 @@
     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_width_; // width (in SVG units) of longest label on axis.
- int ticks_on_plot_window_on_; // Value labels & ticks on the plot window border
+ int ticks_on_window_or_axis_; // Value labels & ticks on the plot window border
     // (rather than on X or Y-axis).
- // For X-axis -1 = left, 0 = false, +1 = right. Default -1 left of plot window.
- // For Y-axis -1 = bottom, 0 = false, +1 = top. Default -1 bottom of plot window.
+ // For X-axis -1 = left, 0 = false, +1 = right. Default -1 to left of plot window.
+ // For Y-axis -1 = bottom, 0 = false, +1 = top. Default -1 below bottom of plot window.
     const text_style& value_label_style_;
 
     ticks_labels_style(dim d = X,
@@ -783,7 +783,7 @@
     right_ticks_on_(false), // Draw ticks right from vertical Y-axis line.
     // Simplest to have all of these although only one pair like up or down is used.
     // Unused are always false.
- major_value_labels_on_(-1), // Label values side for major ticks left (right or none).
+ major_value_labels_side_(-1), // Label values side for major ticks left (right or none).
     label_rotation_(horizontal), // Direction axis value labels written.
     major_grid_on_(false), // Draw grid at major ticks.
     minor_grid_on_(false),// Draw grid at minor ticks.
@@ -792,7 +792,8 @@
     // Note that ALL the flags are set, overwriting any defaults, so std::dec is wise.
     strip_e0s_(true), // strip superflous zeros and signs.
     label_max_width_(0.), // width (estimated in SVG units) of longest label on axis.
- ticks_on_plot_window_on_(-1) // Value labels & ticks on the plot window rather than on X or Y-axis.
+ ticks_on_window_or_axis_(-1) // Value labels & ticks on the plot window
+ // rather than on X or Y-axis.
     // Default -1 means left or bottom.
   {
       if(max_ <= min_)
@@ -829,7 +830,7 @@
   double longest_label()
   { // Update label_max_width_ with the longest value label as pixels,
     // return the count of digits etc.
- if(major_value_labels_on_ != 0) // ! none
+ if(major_value_labels_side_ != 0) // ! none
     { // Show values by the tick as "1.2" or "3.4e+000"...
       double longest = 0;
       
@@ -842,7 +843,7 @@
       // 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_plot_window_on_)
+ if (v != 0. || ticks_on_window_or_axis_)
         { // 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,
@@ -857,7 +858,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_plot_window_on_)
+ if (v != 0. || ticks_on_window_or_axis_)
         { // 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.
@@ -901,14 +902,14 @@
     return *this; // Make chainable.
   }
 
- int major_value_labels_on() const
+ int major_value_labels_side() const
   { // Get tick value labels to left (<0), none (==0) or right (>0).
- return major_value_labels_on_;
+ return major_value_labels_side_;
   }
 
- ticks_labels_style& major_value_labels_on(int is)
+ ticks_labels_style& major_value_labels_side(int is)
   { // Set tick value labels to left (<0), none (==0) or right (>0).
- major_value_labels_on_ = is;
+ major_value_labels_side_ = is;
     return *this; // Make chainable.
   }
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/index.html
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/index.html (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/index.html 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -96,7 +96,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: January 23, 2008 at 19:43:00 GMT</small></p></td>
+<td align="left"><p><small>Last revised: January 24, 2008 at 13:17:20 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_2d_plot_interface.html
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_2d_plot_interface.html (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_2d_plot_interface.html 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -359,12 +359,12 @@
 <td>
             <p>
               <code class="computeroutput"><span class="identifier">svg_2d_plot</span><span class="special">&amp;</span>
- <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>x_major_label_rotation
+ <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>y_major_label_rotation
             </p>
             </td>
 <td>
             <p>
- Determines the direction of writing of value labels from the y axis
+ Determines the direction of writing of value labels from the Y axis
               ticks. <code class="computeroutput"><span class="keyword">enum</span> <span class="identifier">rotate_style</span></code>
               provides control is 45 degree steps. The default is horizontal.
             </p>
@@ -385,14 +385,55 @@
 <td>
             <p>
               <code class="computeroutput"><span class="identifier">svg_2d_plot</span><span class="special">&amp;</span>
- <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>x_major_label_rotation
+ <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>x_major_value_labels<span class="underline">on</span>
             </p>
             </td>
 <td>
             <p>
- Determines the direction of writing of value labels from the X axis
- ticks. <code class="computeroutput"><span class="keyword">enum</span> <span class="identifier">rotate_style</span></code>
- provides control is 45 degree steps. The default is horizontal.
+ Determines if label values for X major ticks, and direction.: -1 =
+ bottom, 0 = no value labels, +1 = top. Default -1, bottom of plot window.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">svg_2d_plot</span><span class="special">&amp;</span>
+ <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>y_major_value_labels<span class="underline">on</span>
+ </p>
+ </td>
+<td>
+ <p>
+ Determines if label values for Y major ticks, and direction.: -1 =
+ left, 0 = no value labels, +1 = right. Default -1, left of plot window.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">svg_2d_plot</span><span class="special">&amp;</span>
+ <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>x_ticks_on_plot_window_on
+ </p>
+ </td>
+<td>
+ <p>
+ Determines the side of Y axis of value labels &amp; ticks: -1 = left,
+ 0 = on Y-axis, +1 = right. Default -1, left of plot window.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">svg_2d_plot</span><span class="special">&amp;</span>
+ <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>y_ticks_on_plot_window_on
+ </p>
+ </td>
+<td>
+ <p>
+ Determines the side or X axis of value labels &amp; ticks: -1 = bottom,
+ 0 = on X-axis, +1 = top. Default -1, bottom of plot window.
             </p>
             </td>
 </tr>
@@ -432,7 +473,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id703322"></a><p class="title"><b>Table 17. 2D_plot Colors</b></p>
+<a name="id703487"></a><p class="title"><b>Table 17. 2D_plot Colors</b></p>
 <div class="table-contents"><table class="table" summary="2D_plot Colors">
 <colgroup>
 <col>
@@ -683,7 +724,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id704611"></a><p class="title"><b>Table 18. 2D_plot Axis Information</b></p>
+<a name="id704776"></a><p class="title"><b>Table 18. 2D_plot Axis Information</b></p>
 <div class="table-contents"><table class="table" summary="2D_plot Axis Information">
 <colgroup>
 <col>
@@ -973,7 +1014,7 @@
         preceeding code).
       </p>
 <a name="svg_plot.interface.svg_2d_plot_interface.the__code__phrase_role__identifier__plot__phrase__phrase_role__special______phrase___code__method"></a><h5>
-<a name="id706014"></a>
+<a name="id706181"></a>
         <a href="svg_2d_plot_interface.html#svg_plot.interface.svg_2d_plot_interface.the__code__phrase_role__identifier__plot__phrase__phrase_role__special______phrase___code__method">The
         <code class="computeroutput"><span class="identifier">plot</span><span class="special">()</span></code>
         Method</a>
@@ -984,7 +1025,7 @@
         named parameters, as well as a deduced parameter.
       </p>
 <div class="table">
-<a name="id706074"></a><p class="title"><b>Table 19. 2D_plot Required parameter</b></p>
+<a name="id706241"></a><p class="title"><b>Table 19. 2D_plot Required parameter</b></p>
 <div class="table-contents"><table class="table" summary="2D_plot Required parameter">
 <colgroup>
 <col>
@@ -1047,7 +1088,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id706195"></a><p class="title"><b>Table 20. 2D_plot Deduced parameter</b></p>
+<a name="id706362"></a><p class="title"><b>Table 20. 2D_plot Deduced parameter</b></p>
 <div class="table-contents"><table class="table" summary="2D_plot Deduced parameter">
 <colgroup>
 <col>
@@ -1102,7 +1143,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id706295"></a><p class="title"><b>Table 21. 2D_plot Optional Parameters</b></p>
+<a name="id706460"></a><p class="title"><b>Table 21. 2D_plot Optional Parameters</b></p>
 <div class="table-contents"><table class="table" summary="2D_plot Optional Parameters">
 <colgroup>
 <col>
@@ -1337,7 +1378,7 @@
         Here are some examples of correct uses:
       </p>
 <a name="svg_plot.interface.svg_2d_plot_interface.using_fill_and_stroke_colors"></a><h4>
-<a name="id707100"></a>
+<a name="id707265"></a>
         <a href="svg_2d_plot_interface.html#svg_plot.interface.svg_2d_plot_interface.using_fill_and_stroke_colors">Using
         fill and stroke colors</a>
       </h4>

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_boxplot_interface.html
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_boxplot_interface.html (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/svg_plot/interface/svg_boxplot_interface.html 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -27,7 +27,7 @@
 <a name="svg_plot.interface.svg_boxplot_interface"></a> svg_boxplot Public Interface
 </h3></div></div></div>
 <div class="table">
-<a name="id707244"></a><p class="title"><b>Table 22. Boxplot Miscellaneous</b></p>
+<a name="id707409"></a><p class="title"><b>Table 22. Boxplot Miscellaneous</b></p>
 <div class="table-contents"><table class="table" summary="Boxplot Miscellaneous">
 <colgroup>
 <col>
@@ -102,7 +102,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id707538"></a><p class="title"><b>Table 23. Boxplot Commands</b></p>
+<a name="id707704"></a><p class="title"><b>Table 23. Boxplot Commands</b></p>
 <div class="table-contents"><table class="table" summary="Boxplot Commands">
 <colgroup>
 <col>
@@ -190,7 +190,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id707868"></a><p class="title"><b>Table 24. Boxplot Colors</b></p>
+<a name="id708033"></a><p class="title"><b>Table 24. Boxplot Colors</b></p>
 <div class="table-contents"><table class="table" summary="Boxplot Colors">
 <colgroup>
 <col>
@@ -341,7 +341,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id708600"></a><p class="title"><b>Table 25. Boxplot Axis Information</b></p>
+<a name="id708765"></a><p class="title"><b>Table 25. Boxplot Axis Information</b></p>
 <div class="table-contents"><table class="table" summary="Boxplot Axis Information">
 <colgroup>
 <col>
@@ -528,7 +528,7 @@
         preceeding code).
       </p>
 <a name="svg_plot.interface.svg_boxplot_interface.the__code__phrase_role__identifier__plot__phrase__phrase_role__special______phrase___code__function"></a><h5>
-<a name="id709504"></a>
+<a name="id709669"></a>
         <a href="svg_boxplot_interface.html#svg_plot.interface.svg_boxplot_interface.the__code__phrase_role__identifier__plot__phrase__phrase_role__special______phrase___code__function">The
         <code class="computeroutput"><span class="identifier">plot</span><span class="special">()</span></code>
         Function</a>
@@ -539,7 +539,7 @@
         control their display.
       </p>
 <div class="table">
-<a name="id709564"></a><p class="title"><b>Table 26. Required parameters</b></p>
+<a name="id709729"></a><p class="title"><b>Table 26. Required parameters</b></p>
 <div class="table-contents"><table class="table" summary="Required parameters">
 <colgroup>
 <col>
@@ -602,7 +602,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id709685"></a><p class="title"><b>Table 27. Optional Functions</b></p>
+<a name="id709851"></a><p class="title"><b>Table 27. Optional Functions</b></p>
 <div class="table-contents"><table class="table" summary="Optional Functions">
 <colgroup>
 <col>
@@ -895,7 +895,7 @@
 </table></div>
 </div>
 <br class="table-break"><a name="svg_plot.interface.svg_boxplot_interface.styles_providing_addition_control"></a><h5>
-<a name="id710830"></a>
+<a name="id710995"></a>
         <a href="svg_boxplot_interface.html#svg_plot.interface.svg_boxplot_interface.styles_providing_addition_control">Styles
         providing addition control</a>
       </h5>
@@ -913,7 +913,7 @@
 </span><span class="keyword">class</span> <span class="identifier">ticks_labels_style</span><span class="special">;</span> <span class="comment">// Parameters of the axis, grids, &amp; ticks and their value labels.
 </span></pre>
 <a name="svg_plot.interface.svg_boxplot_interface.box_style_defines_a_rectangular_box_"></a><h4>
-<a name="id711011"></a>
+<a name="id711176"></a>
         <a href="svg_boxplot_interface.html#svg_plot.interface.svg_boxplot_interface.box_style_defines_a_rectangular_box_">Box
         Style defines a rectangular box.</a>
       </h4>
@@ -948,7 +948,7 @@
 <span class="special">};</span> <span class="comment">// class box_style
 </span></pre>
 <div class="table">
-<a name="id711647"></a><p class="title"><b>Table 28. Box Style Constructor</b></p>
+<a name="id711812"></a><p class="title"><b>Table 28. Box Style Constructor</b></p>
 <div class="table-contents"><table class="table" summary="Box Style Constructor">
 <colgroup>
 <col>
@@ -1116,7 +1116,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id711898"></a><p class="title"><b>Table 29. Box Style Accessor functions (all are chainable).</b></p>
+<a name="id712063"></a><p class="title"><b>Table 29. Box Style Accessor functions (all are chainable).</b></p>
 <div class="table-contents"><table class="table" summary="Box Style Accessor functions (all are chainable).">
 <colgroup>
 <col>
@@ -1319,7 +1319,7 @@
 </table></div>
 </div>
 <br class="table-break"><a name="svg_plot.interface.svg_boxplot_interface.text_style_defines_text_font__size_etc_"></a><h4>
-<a name="id712213"></a>
+<a name="id712378"></a>
         <a href="svg_boxplot_interface.html#svg_plot.interface.svg_boxplot_interface.text_style_defines_text_font__size_etc_">Text
         Style defines text Font, Size etc.</a>
       </h4>
@@ -1344,7 +1344,7 @@
 </span><span class="special">}</span>
 </pre>
 <div class="table">
-<a name="id712711"></a><p class="title"><b>Table 30. Text Style Constructor</b></p>
+<a name="id712876"></a><p class="title"><b>Table 30. Text Style Constructor</b></p>
 <div class="table-contents"><table class="table" summary="Text Style Constructor">
 <colgroup>
 <col>
@@ -1534,7 +1534,7 @@
         produces a Lucida Sans Unicode font of size of 14 svg units (usually pixels).
       </p>
 <div class="table">
-<a name="id713047"></a><p class="title"><b>Table 31. Text Style Accessor functions</b></p>
+<a name="id713212"></a><p class="title"><b>Table 31. Text Style Accessor functions</b></p>
 <div class="table-contents"><table class="table" summary="Text Style Accessor functions">
 <colgroup>
 <col>
@@ -1748,7 +1748,7 @@
 </table></div>
 </div>
 <br class="table-break"><a name="svg_plot.interface.svg_boxplot_interface.plot_point_style_defines_how_data_points_are_marked_"></a><h4>
-<a name="id713373"></a>
+<a name="id713538"></a>
         <a href="svg_boxplot_interface.html#svg_plot.interface.svg_boxplot_interface.plot_point_style_defines_how_data_points_are_marked_">plot_point_style
         defines how data points are marked.</a>
       </h4>
@@ -1775,7 +1775,7 @@
   <span class="special">}</span>
 </pre>
 <div class="table">
-<a name="id714005"></a><p class="title"><b>Table 32. Plot Point Style Constructor</b></p>
+<a name="id714170"></a><p class="title"><b>Table 32. Plot Point Style Constructor</b></p>
 <div class="table-contents"><table class="table" summary="Plot Point Style Constructor">
 <colgroup>
 <col>
@@ -1982,7 +1982,7 @@
 </span><span class="special">};</span>
 </pre>
 <div class="table">
-<a name="id714878"></a><p class="title"><b>Table 33. Plot Point Style Accessor functions</b></p>
+<a name="id715043"></a><p class="title"><b>Table 33. Plot Point Style Accessor functions</b></p>
 <div class="table-contents"><table class="table" summary="Plot Point Style Accessor functions">
 <colgroup>
 <col>
@@ -2185,7 +2185,7 @@
 </table></div>
 </div>
 <br class="table-break"><a name="svg_plot.interface.svg_boxplot_interface.plot_line_style_defines_how_data_points_are_joined_"></a><h4>
-<a name="id715195"></a>
+<a name="id715359"></a>
         <a href="svg_boxplot_interface.html#svg_plot.interface.svg_boxplot_interface.plot_line_style_defines_how_data_points_are_joined_">plot_line_style
         defines how data points are joined.</a>
       </h4>
@@ -2206,7 +2206,7 @@
 </span> <span class="special">}</span>
 </pre>
 <div class="table">
-<a name="id715705"></a><p class="title"><b>Table 34. Plot line Style Constructor</b></p>
+<a name="id715870"></a><p class="title"><b>Table 34. Plot line Style Constructor</b></p>
 <div class="table-contents"><table class="table" summary="Plot line Style Constructor">
 <colgroup>
 <col>
@@ -2383,7 +2383,7 @@
 <span class="identifier">my_plot</span><span class="special">.</span><span class="identifier">plot</span><span class="special">(</span><span class="identifier">data3</span><span class="special">,</span> <span class="string">"-1 + 2x"</span><span class="special">).</span><span class="identifier">bezier_on</span><span class="special">(</span><span class="keyword">true</span><span class="special">).</span><span class="identifier">line_color</span><span class="special">(</span><span class="identifier">blue</span><span class="special">);</span>
 </pre>
 <div class="table">
-<a name="id716109"></a><p class="title"><b>Table 35. Plot Line Style Accessor functions</b></p>
+<a name="id716273"></a><p class="title"><b>Table 35. Plot Line Style Accessor functions</b></p>
 <div class="table-contents"><table class="table" summary="Plot Line Style Accessor functions">
 <colgroup>
 <col>

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/interface.qbk
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/interface.qbk (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/interface.qbk 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -147,9 +147,9 @@
   [[`svg_2d_plot& x_value_ioflags(int)`] [Determines the iostream flags for value labels on the X axis major ticks will be displayed. Default is std::ios::dec. This allows fine control of the value labels using, for example (ios::dec | ios::scientific), or (ios::dec | ios::fixed), particularly in conjunction with precision.]]
   [[`svg_2d_plot& y_value_precision(int)`] [Determines the iostream precison for value labels on the Y axis major ticks will be displayed. Default is 3 (rather than the iostream default of 6).]]
   [[`svg_2d_plot& y_value_ioflags(int)`] [Determines the iostream flags for value labels on the Y axis major ticks will be displayed. Default is std::ios::dec. This allows fine control of the value labels using, for example (ios::dec | ios::scientific), or (ios::dec | ios::fixed), particularly in conjunction with precision.]]
- [[`svg_2d_plot& (int)`x_major_label_rotation] [Determines the direction of writing of value labels from the y axis ticks. `enum rotate_style` provides control is 45 degree steps. The default is horizontal.
+ [[`svg_2d_plot& `y_major_label_rotation(int)] [Determines the direction of writing of value labels from the Y axis ticks. `enum rotate_style` provides control is 45 degree steps. The default is horizontal.
   
- `enum rotate_style { // Rotation in degrees from horizontal. horizontal = 0, // normal left to right.
+ ``enum rotate_style { // Rotation in degrees from horizontal. horizontal = 0, // normal left to right.
       uphill = -45, // slope up.
       upward = -90, // vertical writing up.
       backup = -135, // slope up backwards.
@@ -158,11 +158,15 @@
       backdown = 135, // slope down backwards.
       upsidedown = 180 // == -180
     };
+ ``
     
   ]]
- [[`svg_2d_plot& (int)`x_major_label_rotation] [Determines the direction of writing of value labels from the X axis ticks. `enum rotate_style` provides control is 45 degree steps. The default is horizontal.]]
- [[`svg_2d_plot& x_label_strip_e0s(bool)`] [Determines whether or not the X axis value labels for major ticks are stripped of redundant zero, e or E,, and + sign. This can markedly reduce visual clutter, for example, reducing "1.2e+000" to "1.2".]]
- [[`svg_2d_plot& y_label_strip_e0s(bool)`] [Determines whether or not the Y axis value labels for major ticks are stripped of redundant zero, e or E,, and + sign. This can markedly reduce visual clutter, for example, reducing "1.2e+000" to "1.2".]]
+ [[`svg_2d_plot& `x_major_value_labels_on(int)`] [Determines if label values for X major ticks, and direction: -1 = bottom, 0 = *no* value labels, +1 = top. Default -1, bottom of plot window.]]
+ [[`svg_2d_plot& `y_major_value_labels_on(int)`] [Determines if label values for Y major ticks, and direction: -1 = left, 0 = *no* value labels, +1 = right. Default -1, left of plot window.]]
+ [[`svg_2d_plot& `x_ticks_on_plot_window_on(int)`] [Determines the position of Y axis of value labels & ticks: -1 = left, 0 = on Y-axis, +1 = right. Default -1, left of plot window.]]
+ [[`svg_2d_plot& `y_ticks_on_plot_window_on(int)`] [Determines the position of X axis of value labels & ticks: -1 = bottom, 0 = on X-axis, +1 = top. Default -1, bottom of plot window.]]
+ [[`svg_2d_plot& `x_label_strip_e0s(bool)`] [Determines whether or not the X axis value labels for major ticks are stripped of redundant zero(s), e or E, and + sign. This can markedly reduce visual clutter, for example, reducing "1.2e+000" to "1.2".]]
+ [[`svg_2d_plot& `y_label_strip_e0s(bool)`] [Determines whether or not the Y axis value labels for major ticks are stripped of redundant zero(s), e or E, and + sign. This can markedly reduce visual clutter, for example, reducing "1.2e+000" to "1.2".]]
   
 ] [/ table 2D_plot Commands]
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/rationale.qbk
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/rationale.qbk (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/rationale.qbk 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -20,10 +20,8 @@
  1 if major are even, major 0, minor 1, major 2 ...
  4 if major on 0, minor on 1,2,3,4, major on 5 ...
  9 if major on 0, minor on 1,2,3,4,5,6,7,8,9, major on 10
-
-
- [/h4 Minor ticks]
 
+ [/h4 Minor ticks]
 
 This section provide more information about this implementation
 and some of the rationale for desing decisions.
@@ -46,7 +44,8 @@
 
 If each element has its own style (fill, stroke etc)
 then the .svg file size would be increased.
-(This style is used by other packages that output svg).
+(This style is used by other packages that output svg
+and often leads to larger file sizes).
 
 So the [@http://www.w3.org/TR/SVG/struct.html#GElement group element]
 is used with each type given an id to allow reference back to it.
@@ -70,10 +69,6 @@
 and have the change reflected on every point in the series. It seems
 this is the most logical way to represent the data in memory.
 
-
-
-
-
 [h4 Economising on .svg File Size]
 
 Some of the factors affecting the file size are:

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_interface.qbk
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_interface.qbk (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_interface.qbk 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -124,7 +124,7 @@
 
   [[`void y_size(unsigned int)`] [Sets the height of the image (pixels).] []]
 
- [[`void write(const std::string&)`] [Writes the document to the file represented by the argument.][Opens the file stream itself and tries to call `write(std::ostream&)`. Throws `std::runtime_exception` if it can not open the file.]]
+ [[`void write(const std::string&)`] [Writes the document to the file represented by the argument. (If not file type sufix is provided, the default file suffix `".svg"` is appended.][Opens the file stream itself and tries to call `write(std::ostream&)`. Throws `std::runtime_exception` if it can not open the file.]]
 
   [[`void write(std::ostream&)`] [Writes the document to the stream represented by the argument.][]]
 ] [/table `svg` document settings and writing]

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/1d_full_layout.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/1d_full_layout.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/1d_full_layout.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -63,7 +63,7 @@
         my_plot.legend_on(true)
                .plot_window_on(true)
                .x_label_on(true)
- .x_major_labels_on(true);
+ .x_major_value_labels_side(true);
         
         // Color settings.
         my_plot.background_color(svg_color(67, 111, 69))

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -39,13 +39,13 @@
         my_plot.title("Plot of 50 * sin(x)")
                .title_font_size(29)
                .x_label("X Axis Units")
- .y_major_labels_on(true)
+ .y_major_value_labels_side(true)
            .y_major_grid_on(true);
         
         // Commands.
         my_plot.plot_window_on(true)
                .x_label_on(true)
- .x_major_labels_on(true);
+ .x_major_value_labels_side(true);
         
         // Color settings.
         my_plot.background_color(svg_color(67, 111, 69))

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_bezier.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_bezier.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_bezier.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -45,7 +45,7 @@
         my_plot.title("Plot of trig functions")
                .title_font_size(29)
                .x_label("X Axis Units")
- .y_major_labels_on(true)
+ .y_major_value_labels_side(true)
            .y_major_grid_on(true);
         
         // Commands.

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_full.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_full.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_full.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -53,7 +53,7 @@
         my_plot.legend_on(true)
                .plot_window_on(true)
                .x_label_on(true)
- .x_major_labels_on(true);
+ .x_major_value_labels_side(true);
         
         // Color settings.
         my_plot.background_color(svg_color(67, 111, 69))

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_limit.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_limit.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_limit.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -38,12 +38,12 @@
         // Text settings.
         my_plot.title("Plot of 1 / x")
                .x_label("X Axis Units")
- .y_major_labels_on(true)
+ .y_major_value_labels_side(true)
            .y_major_grid_on(true);
         
         // Commands.
         my_plot.plot_window_on(true)
- .x_major_labels_on(true);
+ .x_major_value_labels_side(true);
 
         //X axis settings.
         my_plot.x_major_interval(2)

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_plot.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_plot.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_plot.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -56,7 +56,18 @@
 // and very many named colors in this namespace.
 
   // Use map with both x and y double.
- map<double, double> data1, data2, data3;
+ map<double, double> data1;
+ map<double, double> data2;
+ map<double, double> data3;
+
+ enum side
+ {
+ left_side = -1,
+ on_axis = 0,
+ right_side = +1,
+ bottom_side = -1,
+ top_side = +1,
+ };
 
 // Several simple math functions to demonstrate:
 double f(double x)
@@ -88,7 +99,9 @@
     const std::string& x_label = std::string(), // default is ""
     double xmin = 0., double xmax = 0.,
     const std::string& y_label = std::string(),
- double ymin = 0., double ymax = 0.)
+ double ymin = 0., double ymax = 0.,
+ int x_major_label = -1, int y_major_label = -1,
+ int x_rotation = horizontal, int y_rotation = horizontal) //
 {
     using namespace boost::svg;
 
@@ -110,8 +123,8 @@
           .plot_border_color(magenta)
           .x_label_on(true)
           .y_label_on(true)
- .y_major_labels_on(-1)
- .x_major_labels_on(-1)
+ .y_major_value_labels_side(left_side)
+ .x_major_value_labels_side(left_side)
           //.legend_title("Function")
           .legend_title("Unicode &#x3A9;&#x3A6;")
           .legend_title_font_size(16);
@@ -137,19 +150,19 @@
 
   // X axis settings.
   my_plot.x_range(xmin, xmax)
- .x_major_interval(1)
+ .x_major_interval(2.)
           .x_major_tick_length(10) // pixels
           .x_major_tick_width(2) // pixels
           .x_minor_tick_length(5) // pixels
           .x_minor_tick_width(1) // pixels
- .x_num_minor_ticks(4) // plus 1 major = 5 ticks per major step.
+ .x_num_minor_ticks(2) // plus 1 major = 5 ticks per major step.
           ;
 
   // Y-axis settings.
  my_plot
     .y_range(ymin, ymax)
- .y_major_interval(1.)
- .y_num_minor_ticks(4) // plus 1 major = 5 ticks per major step.
+ .y_major_interval(2.)
+ .y_num_minor_ticks(2) // plus 1 major = 5 ticks per major step.
     .y_major_tick_length(10) // pixels
     .y_major_tick_width(2) // pixels
     .y_minor_tick_length(5) // pixels
@@ -163,35 +176,59 @@
          .y_minor_grid_color(svg_color(240, 240, 255))
          .y_major_grid_width(2)
          .y_minor_grid_width(1)
- .x_major_grid_on(true) // But nothing shows - until you make .major_grid_on(true)!
+ // But nothing shows - until you make .major_grid_on(true)!
+ .x_major_grid_on(true)
          .x_minor_grid_on(true)
          .y_major_grid_on(true)
          .y_minor_grid_on(true);
 
   my_plot.x_ticks_down_on(true); // X-axis.
   my_plot.y_ticks_left_on(true); // Y-axis.
- my_plot.x_ticks_on_plot_window_on(0); // default on axes, if possible.
- my_plot.y_ticks_on_plot_window_on(0);
+
+ // Where the ticks (and labels if any) go, left/right, on axis, or bottom/top.
+ // Default x_ticks_on_window_or_axis == -1 left or bottom, +1 right to top, 0 = on axis.
+ // my_plot.x_ticks_on_window_or_axis(+1); //
+ // my_plot.y_ticks_on_window_or_axis(+1);
+ // my_plot.x_ticks_on_window_or_axis(-1); // right or top.
+ // my_plot.y_ticks_on_window_or_axis(-1);
+ // x_ticks_on_window_or_axis == 0 : on axes, if possible.
+ my_plot.x_ticks_on_window_or_axis(0); // ticks on axes.
+ my_plot.y_ticks_on_window_or_axis(0); // ticks on axes.
+
+ // Which side of axis line or plot window the value labels go.
+ //my_plot.x_major_value_labels_side(0); // NO value labels.
+ //my_plot.y_major_value_labels_side(0); // NO value labels.
+
+ //my_plot.x_major_value_labels_side(top_side); // Top side value labels.
+ //my_plot.x_major_value_labels_side(bottom_side); // Bottom side value labels (default).
+ //my_plot.y_major_value_labels_side(no_labels); // NO value labels.
+ //my_plot.y_major_value_labels_side(right_side); // Right side of axis value labels.
+ //my_plot.y_major_value_labels_side(left_side); // Left side value labels (default).
+
+
+ //my_plot.y_major_label_rotation(downhill); // sloping.
+ //my_plot.y_major_label_rotation(uphill);
+ //my_plot.y_major_label_rotation(horizontal); // Default.
+ //my_plot.y_major_label_rotation(downward);
+
+ //my_plot.x_major_label_rotation(upward);
+ //my_plot.x_major_label_rotation(downward);
+ //my_plot.x_major_label_rotation(uphill);
+ //my_plot.x_major_label_rotation(downhill);
 
   my_plot.y_value_ioflags(ios::dec | ios::fixed).y_value_precision(1);
   my_plot.x_value_ioflags(ios::dec | ios::scientific).x_value_precision(2);
   // my_plot.x_value_ioflags(ios::dec).x_value_precision(2);
 
- my_plot.y_major_label_rotation(uphill);
- my_plot.x_major_label_rotation(downward); // sloping.
- //my_plot.y_major_label_rotation(horizontal); // defaults.
- //my_plot.x_major_label_rotation(horizontal);
-
   //my_plot.data_lines_width(4); // A bit gross!
         my_plot.plot(data1, "Sqrt(x)").fill_color(red);
- my_plot.plot(data2, "-2 + x^2").fill_color(orange).size(5);
- my_plot.plot(data3, "-1 + 2x").fill_color(yellow).bezier_on(true).line_color(blue).shape(square);
+ my_plot.plot(data2, "-2 + x^2").fill_color(orange).size(5).bezier_on(true);
+ my_plot.plot(data3, "-1 + 2x").fill_color(yellow).line_color(blue).shape(square);
 
   cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << file << endl;
   my_plot.write(file);
   show_plot_settings(my_plot);
 
-
   } // plot
 
 int main()
@@ -200,14 +237,15 @@
   {
   // boost::array or anything in boost such that pair_type has
   // std and boost as associated namespaces.
- typedef ::std::pair< ::boost::array<int, 1>, int> pair_type;
- pair_type p1; pair_type p2;
+ //typedef ::std::pair< ::boost::array<int, 1>, int> pair_type;
+ //pair_type p1;
+ //pair_type p2;
 
- p1.first[0] = p1.second = 0;
- p2.first[0] = p2.second = 1;
+ //p1.first[0] = p1.second = 0;
+ //p2.first[0] = p2.second = 1;
 
- array<pair<double, double>, 10> ddpairs;
- ddpairs[0].first = 1.; ddpairs[0].second = 2.;
+ //array<pair<double, double>, 10> ddpairs;
+ //ddpairs[0].first = 1.; ddpairs[0].second = 2.;
   
   for(double i = -10; i <= 10.; i += 1.)
   {
@@ -219,7 +257,7 @@
    // Demonstrate/test plots with various range of x and y, some *not* including zero.
 
    plot("Plot of Mathematical Functions", "./demo_2d_plot_XYPM.svg", "X-axis", -10., +10., "Y-axis", -10., +10.); // Both X & Y include zero.
- plot("Plot of Mathematical Functions", "./demo_2d_plot_XP.svg", "X-axis", +1., +10., "Y-axis", -10., 10.); // X all > 0
+ plot("Plot of Mathematical Functions", "./demo_2d_plot_XP.svg", "X-axis", +1., +10., "Y-axis", -10., 10.); // X all > 0
    plot("Plot of Mathematical Functions", "./demo_2d_plot_XN.svg", "X-axis", -10., -1., "Y-axis", -10., 10.); // x all < 0
    plot("Plot of Mathematical Functions", "./demo_2d_plot_YP.svg", "X-axis", -1., +10., "Y-axis", +1., +10.); // Y all > 0
    plot("Plot of Mathematical Functions", "./demo_2d_plot_YN.svg", "X-axis", -1., +10., "Y-axis", -10., -1.); // y all < 0
@@ -232,6 +270,8 @@
   {
     cout << message << endl;
   }
+
+
   return 0;
 } // int main()
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/math_special_functions.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/math_special_functions.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/math_special_functions.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -140,7 +140,7 @@
       //plot.legend_place(outside_right);
 
       plot
- .x_major_labels_on(-1).y_major_labels_on(-1) // left and bottom
+ .x_major_value_labels_side(-1).y_major_value_labels_side(-1) // left and bottom
         .x_label_units_on(false).y_label_units_on(false);
       double x_delta = (m_max_x - m_min_x) / 50;
       double y_delta = (m_max_y - m_min_y) / 50;
@@ -415,7 +415,7 @@
    surface.legend_title_font_size(15);
    surface.title("Circle");
    surface.legend_on(false).title_on(true);
- surface.x_major_labels_on(true).y_major_labels_on(true);
+ surface.x_major_value_labels_side(true).y_major_value_labels_side(true);
    surface.x_range(-2.2, 2.2)
       .y_range(-2.2, 2.2);
    surface.x_label_on(true).x_label("x");

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -229,9 +229,9 @@
  // my_plot.x_label_units_on(true); // Set
  // BOOST_CHECK_EQUAL(my_plot.x_label_units_on(), true); // & check.
 
- // BOOST_CHECK_EQUAL(my_plot.x_major_labels_on(), true); // Check default.
- // my_plot.x_major_labels_on(false); // Set
- // BOOST_CHECK_EQUAL(my_plot.x_major_labels_on(), false); // & check.
+ // BOOST_CHECK_EQUAL(my_plot.x_major_value_labels_side(), true); // Check default.
+ // my_plot.x_major_value_labels_side(false); // Set
+ // BOOST_CHECK_EQUAL(my_plot.x_major_value_labels_side(), false); // & check.
 
  // BOOST_CHECK_EQUAL(my_plot.title_on(), true); // Check default.
  // my_plot.title_on(false); // Set

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_tests.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_tests.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_tests.cpp 2008-01-28 06:04:29 EST (Mon, 28 Jan 2008)
@@ -37,6 +37,17 @@
 #include <string>
   using std::string;
 
+ enum side
+ {
+ left_side = -1,
+ on_axis = 0,
+ right_side = +1,
+ bottom_side = -1,
+ top_side = +1,
+ };
+
+
+
 BOOST_AUTO_TEST_CASE( test1 )
 {
   // Check on default values and all set and get functions.
@@ -235,11 +246,11 @@
   my_plot.x_label_units_on(true); // Set
          BOOST_CHECK_EQUAL(my_plot.x_label_units_on(), true); // & check.
 
- BOOST_CHECK_EQUAL(my_plot.x_major_labels_on(), -1); // Check default.
- my_plot.x_major_labels_on(0); // Set
- BOOST_CHECK_EQUAL(my_plot.x_major_labels_on(), 0); // & check.
- my_plot.x_major_labels_on(+1); // Set
- BOOST_CHECK_EQUAL(my_plot.x_major_labels_on(), +1); // & check.
+ BOOST_CHECK_EQUAL(my_plot.x_major_value_labels_side(), left_side); // Check default.
+ my_plot.x_major_value_labels_side(0); // Set
+ BOOST_CHECK_EQUAL(my_plot.x_major_value_labels_side(), none); // & check.
+ my_plot.x_major_value_labels_side(+1); // Set
+ BOOST_CHECK_EQUAL(my_plot.x_major_value_labels_side(), right_side); // & check.
 
          BOOST_CHECK_EQUAL(my_plot.title_on(), true); // Check default.
   my_plot.title_on(false); // Set


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