Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51948 - in sandbox/SOC/2007/visualization: boost/svg_plot boost/svg_plot/detail libs/svg_plot/example
From: pbristow_at_[hidden]
Date: 2009-03-23 15:36:28


Author: pbristow
Date: 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
New Revision: 51948
URL: http://svn.boost.org/trac/boost/changeset/51948

Log:
Added autoscale_plusminus to control margin for 1,2 or 3 sd ellipses.
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp | 58 ++++++++++++++++++++++++---------------
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 31 ++++++++++++++++----
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp | 10 ++++++
   sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp | 19 ++++++------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 33 +++++++++++++---------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 29 ++++++++++++-------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp | 14 ++++++--
   sandbox/SOC/2007/visualization/boost/svg_plot/uncertain.hpp | 32 +++++++++++++++++++--
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp | 9 +++--
   9 files changed, 159 insertions(+), 76 deletions(-)

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -175,6 +175,7 @@
    double max_value, //! Maximum value.
    double* axis_min_value, double* axis_max_value, double* axis_tick_increment, int* auto_ticks, //! All 4 updated.
    bool check_limits, //! Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus, // Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
    bool origin, //! If true, ensures that zero is a tick value.
    double tight, //! Allows user to avoid a small fraction over a tick using another tick.
    int min_ticks, //! Minimum number of ticks.
@@ -194,6 +195,7 @@
    // (not necessarily ordered, so will find min and max).
    double* axis_min_value, double* axis_max_value, double* axis_tick_increment, int* auto_ticks, // All 4 updated.
    bool check_limits, // Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus, // Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
    bool origin = false, // do not include the origin unless the range min_value <= 0 <= max_value.
    double tight = 0., // tightest - fraction of 'overrun' allowed before another tick used.
    // for visual effect up to about 0.001 might suit a 1000 pixel wide image,
@@ -239,6 +241,7 @@
                // (not necessarily ordered, so will find min and max).
                double* axis_min_value, double* axis_max_value, double* axis_tick_increment, int* auto_ticks, // All 4 updated.
                bool check_limits, // Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus = 3., // Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
                bool origin = false, // do not include the origin unless the range min_value <= 0 <= max_value.
                double tight = 0., // tightest - fraction of 'overrun' allowed before another tick used.
                // for visual effect up to about 0.001 might suit a 1000 pixel wide image,
@@ -276,7 +279,7 @@
 } // template <class T> int scale_axis T an STL container: array, vector ...
 
 template <class T>
-void scale_axis( //! Scale X and Y axis using T a 2D STL container: array, vector ...
+void scale_axis( //! Scale X and Y axis using T a 2D STL container: array, vector, list ...
   const T& container, //! Container Data series to plot - entire 2D container.
   //! (not necessarily ordered, so will find min and max).
   //! \tparam T STL container of pairs of X and Y.
@@ -284,6 +287,7 @@
   double* y_axis_min_value, double* y_axis_max_value, double* y_axis_tick_increment, int* y_auto_ticks,
   // All 8 updated.
   bool check_limits = true, // Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus = 3., // Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
   bool x_origin = false, // do not include the origin unless the range min_value <= 0 <= max_value.
   double x_tight = 0., // tightest - fraction of 'overrun' allowed before another tick used.
   // for visual effect up to about 0.001 might suit a 1000 pixel wide image,
@@ -302,18 +306,19 @@
   double y_max = std::numeric_limits<double>::quiet_NaN();
   double y_min = std::numeric_limits<double>::quiet_NaN();
 
- if (!check_limits)
+ if (!check_limits) // TODO my_plot.autoscale_check_limits(false); This path bombs - I fear it will never work?
   { // BUT only if it can be assumed that no values are 'at limits',
     // infinity, NaN, max_value, min_value, denorm_min.
     // minmax_element is efficient for maps because it can use knowledge of all maps being sorted,
     std::pair<T::const_iterator, T::const_iterator> result = boost::minmax_element(container.begin(), container.end());
- //std::pair<const double, double> px = *result.first; // x min & max
+ //originally std::pair<const double, double> px = *result.first; // x min & max
+
     std::pair<const double, double> px = values_of(*result.first); // x min & max
- //std::pair<const double, double> py = *result.second; // y min & max
+ //originally std::pair<const double, double> py = *result.second; // y min & max
     std::pair<const double, double> py = values_of(*result.second); // y min & max
     x_min = px.first;
- x_max = py.first;
- y_min = px.second;
+ x_max = px.second;
+ y_min = py.first;
     y_max = py.second;
   }
   else
@@ -325,7 +330,6 @@
 
     // Work out min and max, ignoring non-finite (+-infinity & NaNs).
     using boost::svg::detail::pair_is_limit; // Either x and/or y is not a proper data value.
-
     int goods = 0; // Count of values where both X and Y are normal (within limits).
     int limits = 0;// Count of values where both X and Y are at limits (not normal).
     T::const_iterator pos = container.begin();
@@ -342,12 +346,14 @@
     else
     {
       double x = value_of(pos->first);
- x_max = x;
- x_min = x;
+ double xu = unc_of(pos->first) * autoscale_plusminus;
+ x_max = x + xu;
+ x_min = x - xu;
       double y = value_of(pos->second);
- y_max = y;
- y_min = y;
- //cout << "Initial min & max " << x << ' ' << y << endl;
+ double yu = unc_of(pos->second) * autoscale_plusminus;
+ y_max = y + yu;
+ y_min = y - yu;
+ cout << "Initial min & max " << x << "+-" << xu << " = " << x_min << " to " << x_max << ", " << y << "+-" << yu << "=" <<y_min << " to " << y_max << endl;
       pos++;
       goods++;
       while(pos != container.end())
@@ -355,23 +361,28 @@
         if (!pair_is_limit(*pos))
         { // Either x and/or y are finite.
           x = value_of(pos->first);
- if (x > x_max)
+ xu = unc_of(pos->first) * autoscale_plusminus;
+
+ if (x + xu > x_max)
           {
- x_max = x;
+ x_max = x + xu;
           }
- if (x < x_min)
+ if (x - xu < x_min)
           {
- x_min = x;
+ x_min = x - xu;
           }
           y = value_of(pos->second);
- if (y > y_max)
+ yu = unc_of(pos->second) * autoscale_plusminus;
+ if (y + yu > y_max)
           {
- y_max = y;
+ y_max = y + yu;
           }
- if (y < y_min)
+ if (y - yu < y_min)
           {
- y_min = y;
+ y_min = y - yu;
           }
+ cout << "min & max " << x << "+-" << xu << " = " << x_min << " to " << x_max << ", " << y << "+-" << yu << "=" <<y_min << " to " << y_max << endl;
+
           goods++;
           // cout << goods << " goods, " << x << ' ' << y << endl;
        } // if finite
@@ -384,9 +395,10 @@
         }
         ++pos;
       } // while
- //cout << "x_min " << x_min << ", x_max " << x_max << endl; // x_min 1, x_max 7.3
- //cout << "y_min " << y_min << ", y_max " << y_max << endl; // y_min 3.2, y_max 9.1
- //cout << "limits " << limits << endl;
+
+ cout << "x_min " << x_min << ", x_max " << x_max << endl; // x_min 1, x_max 7.3
+ cout << "y_min " << y_min << ", y_max " << y_max << endl; // y_min 3.2, y_max 9.1
+ cout << "limits " << limits << endl;
     }
   }
   scale_axis(x_min, x_max,

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -48,9 +48,7 @@
     // when they are in svg_2d_plot.hpp
 
     static const double sin45 = 0.707; //!< Use to calculate 'length' if axis value labels are sloping.
- static const double reducer = 0.9; //!< To make uncertainty and degrees of freedom testimates a bit smaller to distinguish from value.
- // (0.8 reduced from value 12, to 9 which is a bit too small).
- //static const double plusminus = 2.; //! Number of standard deviations used for plusminus display. Nominal factor of 2 (strictly 1.96) corresponds to 95% confidence limit.
+ static const double reducer = 0.9; //!< To make uncertainty and degrees of freedom estimates a bit smaller font to help distinguish from value.
 
     // x_axis_position_ and y_axis_position_ use x_axis_intersect & y_axis_intersect
     enum x_axis_intersect
@@ -1766,6 +1764,9 @@
           double x_max();
           // Set & get autoscale parameters,
           // Note: all these *MUST* preceed x_autoscale(data) call.
+ double autoscale_plusminus();
+ Derived& autoscale_plusminus(double);
+
           bool autoscale_check_limits();
           Derived& autoscale_check_limits(bool b);
           bool x_autoscale();
@@ -1843,7 +1844,7 @@
           { //! Data series (range accessed using iterators) to use to calculate autoscaled X-axis values.
               scale_axis(begin, end,
               &derived().x_auto_min_value_, &derived().x_auto_max_value_, &derived().x_auto_tick_interval_, &derived().x_auto_ticks_,
- derived().autoscale_check_limits_,
+ derived().autoscale_check_limits_, derived().autoscale_plusminus_,
               derived().x_include_zero_, derived().x_tight_, derived().x_min_ticks_, derived().x_steps_);
 
             derived().x_autoscale_ = true; //! Default to use calculated values.
@@ -1857,7 +1858,7 @@
               //scale_axis(container.begin(), container.end(), // All the container.
               scale_axis(container, // All the container.
               &derived().x_auto_min_value_, &derived().x_auto_max_value_, &derived().x_auto_tick_interval_, &derived().x_auto_ticks_,
- derived().autoscale_check_limits_,
+ derived().autoscale_check_limits_, derived().autoscale_plusminus_,
               derived().x_include_zero_, derived().x_tight_, derived().x_min_ticks_, derived().x_steps_);
 
             derived().x_autoscale_ = true; // Default to use calculated values.
@@ -3599,7 +3600,7 @@
             return derived().autoscale_check_limits_;
           }
 
- template <class Derived>
+ template <class Derived>
           bool axis_plot_frame<Derived>::x_autoscale()
           { //! \return true if to use autoscale value for X-axis.
            return derived().x_autoscale_;
@@ -3635,12 +3636,28 @@
             return derived();
           }
 
+
+ template <class Derived>
+ Derived& axis_plot_frame<Derived>::autoscale_plusminus(double pm)
+ { //! Set how many uncertainty or standard deviation to allow for ellipse when autoscaling.
+ //! Default is 3 for 99% confidence.
+ derived().autoscale_plusminus_ = pm;
+ return derived();
+ }
+
+ template <class Derived>
+ double axis_plot_frame<Derived>::autoscale_plusminus()
+ { //! \return how many uncertainty or standard deviation to allow for ellipse when autoscaling.
+ //! Default is 3 for 99% confidence.
+ return derived().autoscale_plusminus_;
+ }
+
           template <class Derived>
           Derived& axis_plot_frame<Derived>::x_autoscale(std::pair<double, double> p)
           { // Set to use X min & max pair values to autoscale X-axis.
             scale_axis(p.first, p.second, // double min and max from pair.
               &derived().x_auto_min_value_, &derived().x_auto_max_value_, &derived().x_auto_tick_interval_, &derived().x_auto_ticks_,
- derived().autoscale_check_limits_,
+ derived().autoscale_check_limits_, autoscale_plusminus_,
               derived().x_include_zero_, derived().x_tight_, derived().x_min_ticks_, derived().x_steps_);
             derived().x_autoscale_ = true; // Default to use any calculated values?
             return derived();

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -20,6 +20,8 @@
 #define BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP
 
 #include <boost/math/special_functions/fpclassify.hpp>
+#include <boost/svg_plot/uncertain.hpp>
+// using boost::svg::unc;
 
 // TODO use the boost version instead to be more portable?
 
@@ -77,6 +79,12 @@
     return limit_max(a) || limit_min(a) || limit_NaN(a);
 }
 
+inline bool pair_is_limit(std::pair<const double, double> a)
+{ //! Check on both x and y double data points. Return false if either or both are at limit.
+ return limit_max(a.first) || limit_min(a.first) || limit_NaN(a.first)
+ || limit_max(a.second) || limit_min(a.second) || limit_NaN(a.second);
+}
+
 inline bool pair_is_limit(std::pair<double, double> a)
 { //! Check on both x and y double data points. Return false if either or both are at limit.
   return limit_max(a.first) || limit_min(a.first) || limit_NaN(a.first)
@@ -100,5 +108,7 @@
 bool boost::svg::detail::limit_NaN(double); // true if NaN.
 bool boost::svg::detail::is_limit(double); // max, min, infinity or NaN - not a 'proper' data value.
 bool boost::svg::detail::pair_is_limit(std::pair<double, double>); // x and/or y not a proper data value.
+bool boost::svg::detail::pair_is_limit(std::pair<const double, double>); // x and/or y not a proper data value.
+bool boost::svg::detail::pair_is_limit(std::pair<const unc, unc>); // x and/or y not a proper data value.
 
 #endif // BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP

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 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -128,7 +128,7 @@
 //#include "stylesheet.hpp" // TODO better to be called svg_stylesheet.hpp?
 #include "detail/svg_tag.hpp" // element class definitions.
 #include "svg_style.hpp"
-//#include "svg_fwd.hpp"
+//#include "svg_fwd.hpp" // Could be used to check declarations and definitions match correctly.
 
 // SVG stands for Scalable Vector Graphics,
 // an XML grammar for stylable graphics, usable as an XML namespace.
@@ -158,7 +158,7 @@
 
   /*! Inserted as a SVG comment, for example
    "<!-- Demo of 1D plot features. --> \n"
- and also as a \verbatim <desc />
+ and also as a \verbatim <desc>
    http://www.w3.org/TR/SVG/struct.html#DescriptionAndTitleElements
    5.4 The 'desc' and 'title' elements
    \endverbatim
@@ -170,13 +170,14 @@
       "<!-- (See accompanying file LICENSE_1_0.txt --> \n"
       "<!-- or copy at http://www.boost.org/LICENSE_1_0.txt) --> \n";
 
- /* \verbatim
- Copyright notice to be inserted into plot image produced by this program.
- Note: can have more than one copyright date, or a range.
- produces a copyright notice as an SVG comment like this:
- "<!-- Copyright Paul A. Bristow, 2007 --> \n"
- and as a meta item:
- <meta name="copyright" content="Paul A. Bristow" />
+ /*
+ \verbatim
+ Copyright notice to be inserted into plot image produced by this program.
+ Note: can have more than one copyright date, or a range.
+ Produces a copyright notice as an SVG comment like this:
+ "<!-- Copyright Paul A. Bristow, 2007 --> \n"
+ and as a meta item:
+ <meta name="copyright" content="Paul A. Bristow" />
    \endverbatim
    */
 

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -253,7 +253,7 @@
     */
 
   friend void show_1d_plot_settings(svg_1d_plot&);
- friend void show_2d_plot_settings(svg_1d_plot&);
+ //friend void show_2d_plot_settings(svg_1d_plot&); // Surely not needed?
   friend class detail::axis_plot_frame<svg_1d_plot>;
 
  protected:
@@ -324,20 +324,23 @@
   ticks_labels_style x_ticks_;
   ticks_labels_style y_ticks_; // Added to permit shared code!
 
- bool title_on_; // Provide a title for the whole plot.
- bool legend_on_; // Provide a legend box.
- bool outside_legend_on_; // Legend box outside the plot window.
- bool legend_lines_; // Data colored line type in legend box.
- bool plot_window_on_; // Use a separate plot window (not whole image).
+ bool title_on_; //!< If true include a title for the whole plot.
+ bool legend_on_; //!< If true include a legend box.
+ bool outside_legend_on_; //!< If true, place legend box outside the plot window.
+ bool legend_lines_; //!< If true, include data colored line type in legend box.
+ bool plot_window_on_; //!< Use a separate plot window (not whole image).
   bool x_ticks_on_; // TODO check these are really useful.
- bool x_values_on_; // values of data are shown by markers.
- int x_axis_position_;
- bool autoscale_check_limits_; // Whether to check autoscale values for infinity, NaN, max, min.
- bool x_autoscale_; // Whether to use any autoscale values.
- bool x_include_zero_; // If autoscaled, include zero.
- int x_min_ticks_; // If autoscaled, set a minimum number of ticks.
- double x_tight_;
- int x_steps_; // If autoscaled, set any prescaling to decimal 1, 2, 5, 10 etc.
+ bool x_values_on_; //!< values of data are shown by markers.
+ int x_axis_position_; //!< enum #x_axis_intersect
+ bool autoscale_check_limits_; //!< If true, then check autoscale values for infinity, NaN, max, min.
+ bool x_autoscale_; //!< If true, use any autoscale values for scaling the X axis.
+ double autoscale_plusminus_; //!< For uncertain values, allow for plusminus ellipses showing 67%, 95% and 99% confidence limits.\n
+ //!< For example, if a max value is 1.2 +or- 0.02, then 1.4 will be used for autoscaling the maximum.\n
+ //!< Similarly, if a min value is 1.2 +or- 0.02, then 1.0 will be used for autoscaling the minimum.
+ bool x_include_zero_; //!< If autoscaled, include zero.
+ int x_min_ticks_; //!< If autoscaled, set a minimum number of ticks.
+ double x_tight_; //!< How much a value can go beyond the tick value before another tick is required.
+ int x_steps_; //!< If autoscaled, set any prescaling to decimal 1, 2, 5, 10 etc.
 
   // Values calculated by scale_axis, and is used only if x_autoscale == true.
   double x_auto_min_value_;
@@ -404,6 +407,8 @@
     x_values_style_(horizontal, 3, std::ios::dec, true, value_style_, black, black, false, false),
     // Autoscaling.
     autoscale_check_limits_(true), // Do check all value for limits, infinity, max, min, NaN.
+ autoscale_plusminus_(3.), // Allow 3 uncertainty (standard deviation) for 99% confidence ellipse.
+
     x_autoscale_(false),
     x_include_zero_(false), // If autoscaled, include zero.
     x_min_ticks_(6), // If autoscaled, set a minimum number of ticks, default 6.

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -426,6 +426,10 @@
 
       bool autoscale_check_limits_; //!< true if to check autoscale values for infinity, NaN, max, min.
       bool x_autoscale_; //!< true if to use any X-axis autoscale values.
+ double autoscale_plusminus_; //!< For uncertain values, allow for plusminus ellipses showing 67%, 95% and 99% confidence limits.\n
+ //!< For example, if a max value is 1.2 +or- 0.02, then 1.4 will be used for autoscaling the maximum.\n
+ //!< Similarly, if a min value is 1.2 +or- 0.02, then 1.0 will be used for autoscaling the minimum.
+
       bool x_include_zero_; //!< true if autoscaled, to include zero.
       int x_min_ticks_; //!< If autoscaled, set a minimum number of X ticks.
       double x_tight_; //!< Tolerance used by autoscale to avoid extra ticks.
@@ -525,11 +529,14 @@
 
         // Autoscaling defaults.
         autoscale_check_limits_(true), // Do check all value for limits, infinity, max, min, NaN.
+ autoscale_plusminus_(3.), // Allow 3 uncertainty (standard deviation) for 99% confidence ellipse.
+
         x_autoscale_(false),
         x_include_zero_(false), // If autoscaled, include zero on X-axis.
         x_min_ticks_(6), // If autoscaled, set a minimum number of ticks, default 6.
         x_steps_(0), // If autoscaled, set any prescaling to decimal 1, 2, 5, 10 etc, default none.
         x_tight_(1e-6), // margin that point can lie outside top and bottom tick.
+
         y_autoscale_(false),
         y_include_zero_(false), // If autoscaled, include zero on Y-axis.
         y_min_ticks_(6), // If autoscaled, set a minimum number of ticks, default 6.
@@ -2403,13 +2410,13 @@
       }
 
       svg_2d_plot& svg_2d_plot::y_autoscale(double minimum, double maximum)
- { //! Set Y min & max values to use to autoscale.
+ { //! Set minimum & maximum Y values to use to autoscale Y axis.
         // Does this assume first is min and second is max?
         scale_axis(minimum, maximum, // double min and max from two doubles.
         &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_,
         y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
- y_autoscale_ = true; // Default to use calculated values.
+ y_autoscale_ = true; // Default becomes to use these calculated values.
         return *this; //! \return reference to svg_2d_plot to make chainable.
       } // autoscale(pair<double, double> p)
 
@@ -2417,7 +2424,7 @@
       { //! Set Y min & max values as a \b pair to use to autoscale.
         scale_axis(p.first, p.second, // double min and max from pair.
         &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_,
         y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
         y_autoscale_ = true; // Default to use calculated values.
         return *this; //! \return reference to svg_2d_plot to make chainable.
@@ -2428,7 +2435,7 @@
       { //! Data series using iterator's range to use to calculate autoscaled values.
         scale_axis(begin, end,
         &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_
         y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
         y_autoscale_ = true; // Default to use calculated values.
         return *this; //! \return reference to svg_2d_plot to make chainable.
@@ -2439,7 +2446,7 @@
       { //! Whole data series to use to calculate autoscaled values.
         scale_axis(container.begin(), container.end(), // All the container.
         &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_,
         y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
         y_autoscale_ = true; // Default to use calculated values.
         return *this;
@@ -2451,11 +2458,11 @@
         scale_axis(container, // All the container.
           &x_auto_min_value_, &x_auto_max_value_, &x_auto_tick_interval_, &x_auto_ticks_,
           &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
- x_include_zero_, x_tight_, x_min_ticks_, x_steps_,
+ autoscale_check_limits_, autoscale_plusminus_,
+ x_include_zero_, x_tight_, x_min_ticks_, x_steps_,
           y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
- x_autoscale_ = true; // Default to use calculated values.
- y_autoscale_ = true; // Can be switch off with autoscale(false);
+ x_autoscale_ = true; // Default to use calculated values.
+ y_autoscale_ = true; // Can be switch off with autoscale(false);
         return *this; //! \return reference to svg_2d_plot to make chainable.
       } // xy_autoscale
 
@@ -2785,7 +2792,7 @@
   template <class T> //! \tparam T Type of data in series (must be convertible to unc double).
   svg_2d_plot_series& svg_2d_plot::plot(const T& container, const std::string& title)
   { /*! Add a container of a data series to the plot.
- This version assumes that *ALL* the data value in the container is used.
+ This version assumes that \b ALL the data values in the container are used.
       \code
 my_plot.plot(data1, "Sqrt(x)");
       \endcode

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -694,6 +694,10 @@
   int x_auto_ticks_; // Number of ticks.
 
   bool y_autoscale_; // Whether to use any y_axis autoscale values.
+ double autoscale_plusminus_; //!< For uncertain values, allow for plusminus ellipses showing 67%, 95% and 99% confidence limits.\n
+ //!< For example, if a max value is 1.2 +or- 0.02, then 1.4 will be used for autoscaling the maximum.\n
+ //!< Similarly, if a min value is 1.2 +or- 0.02, then 1.0 will be used for autoscaling the minimum.
+
   bool y_include_zero_; // If autoscaled, include zero.
   int y_min_ticks_; // If autoscaled, set a minimum number of Y ticks.
   double y_tight_;
@@ -762,6 +766,8 @@
 
   autoscale_check_limits_(true), // Do check all value for limits, infinity, max, min, NaN.
   x_autoscale_(false),
+ autoscale_plusminus_(3.), // Allow 3 uncertainty (standard deviation) for 99% confidence ellipse.
+
   x_include_zero_(false), // If autoscaled, include zero.
   x_min_ticks_(6), // If autoscaled, set a minimum number of ticks, default 6.
   x_steps_(0), // If autoscaled, set any prescaling to decimal 1, 2, 5, 10 etc, default none (0).
@@ -2618,7 +2624,7 @@
   { //! Set Y min & max pair values to use for autoscale.
     scale_axis(p.first, p.second, // double min and max from pair.
     &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_,
     y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
     y_autoscale_ = true; // Change (from default false) to use calculated values.
     return *this; //! \return reference to svg_boxplot to make chainable.
@@ -2628,7 +2634,7 @@
   { //! Set Y min & max pair values to use for autoscale.
     scale_axis(first, second, // double min and max from two doubles.
     &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_,
     y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
     y_autoscale_ = true; // Change (from default false) to use calculated values.
     return *this; //! \return reference to svg_boxplot to make chainable.
@@ -2639,7 +2645,7 @@
   { //! Set container and iterator range to use to calculate autoscaled values.
     scale_axis(begin, end,
     &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_,
     y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
     y_autoscale_ = true; // Change (from default false) to use calculated values.
     return *this; //! \return reference to svg_boxplot to make chainable.
@@ -2650,7 +2656,7 @@
   { //! Set whole data container to use to calculate autoscaled values.
     scale_axis(container.begin(), container.end(), // All the container.
     &y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_,
+ autoscale_check_limits_, autoscale_plusminus_,
     y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
     y_autoscale_ = true; // Change (from default false) to use calculated values.
     return *this; //! \return reference to svg_boxplot to make chainable.

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/uncertain.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/uncertain.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/uncertain.hpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -36,7 +36,7 @@
 {
 namespace svg
 {
- static const double plusminus = 2.; //! Number of standard deviations used for plusminus display. Nominal factor of 2 (strictly 1.96) corresponds to 95% confidence limit.
+ static const double plusminus = 2.; //! Number of standard deviations used for plusminus text display. Nominal factor of 2 (strictly 1.96) corresponds to 95% confidence limit.\n
 
 // template <bool correlated = false>
 class unc
@@ -242,24 +242,48 @@
 }
 
 // Two helper functions to provide values and uncertainties as pairs.
+// Note names plural valueS_of
 
 template <class T>
-std::pair<const double, double> values_of(std::pair<const T, T> vp)
+std::pair<double, double> values_of(T);
+
+template <class T>
+std::pair<double, double> values_of(std::pair<const T, T> vp)
+{
+ return std::make_pair(value_of(vp.first), value_of(vp.second));
+}
+
+template <class T>
+std::pair<double, double> values_of(std::pair<unc, unc> up)
 { //! \return value (part) as a pair of doubles.
   // so can write
   // std::pair<const double, double> minmax = value_of(*result.first); // x min & max
   // whether T is double or unc.
- std::pair<const double, double> minmax = make_pair(vp.first.value(), vp.second.value());
+
+ double vp1 = up.first.value();
+ double vp2 = up.second.value();
+ std::pair<double, double> minmax = std::make_pair(up.first.value(), up.second.value());
   return minmax;
 }
 
+//template <class T>
+//std::pair<double, double> values_of(std::pair<T, T> vp)
+//{ //! \return value (part) as a pair of doubles.
+// // so can write
+// // std::pair<double, double> minmax = value_of(*result.first); // x min & max
+// // whether T is double or unc.
+// std::pair<double, double> minmax = std::make_pair(vp.first.value(), vp.second.value());
+// return minmax;
+//}
+
+
 template <class T>
 std::pair<const float, float> uncs_of(std::pair<const T, T> vp)
 { //! \return uncertainty parts (if any) as a pair of floats.
   // so can write
   // std::pair<const float, float> minmax = value_of(*result.first); // min unc & max unc for example/
   // whether T is built-in or unc.
- std::pair<const double, double> minmax = make_pair(vp.first.value(), vp.second.value());
+ std::pair<const double, double> minmax = std::make_pair(vp.first.value(), vp.second.value());
   return minmax;
 }
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp 2009-03-23 15:36:24 EDT (Mon, 23 Mar 2009)
@@ -175,9 +175,10 @@
 
   // axis_scaling using two begin & end iterators into STL container,
   // scale_axis does finding min and max.
- scale_axis(my_data.begin(), my_data.end(),
- &axis_min_value, &axis_max_value, &axis_tick_increment, &axis_ticks,
+ scale_axis(my_data.begin(), my_data.end(), // Input range
+ &axis_min_value, &axis_max_value, &axis_tick_increment, &axis_ticks, // to update.
     true, // check for non-finite
+ 3., // autoscale_plusminus = 3 sd
     false, // Do not include origin
     tol100eps, // tight
     6, // steps at default.
@@ -188,13 +189,13 @@
   // scale_axis does finding min and max.
   scale_axis(my_data[1], my_data[4], // Only middle part of the container used, ignoring 1st and last values.
     &axis_min_value, &axis_max_value, &axis_tick_increment, &axis_ticks,
- false, tol100eps, 6); // Display range.
+ true, tol100eps, 6); // Display range.
   cout << "Axis_scaled 5 min " << axis_min_value << ", max = " << axis_max_value << ", increment " << axis_tick_increment << endl;
 
   // axis_scaling using whole STL container,
   // scale_axis does finding min and max.
   scale_axis(my_data, &axis_min_value, &axis_max_value, &axis_tick_increment, &axis_ticks,
- true, false, tol100eps, 6); // Display range.
+ true, 3., false, tol100eps, 6); // Display range.
   cout << "Axis_scaled 6 min " << axis_min_value << ", max = " << axis_max_value << ", increment " << axis_tick_increment << endl;
 
   svg_1d_plot my_1d_plot; // Construct a plot with all the default constructor values.


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