Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51820 - in sandbox/SOC/2007/visualization: boost/svg_plot boost/svg_plot/detail libs/svg_plot/doc libs/svg_plot/doc/html libs/svg_plot/example
From: pbristow_at_[hidden]
Date: 2009-03-17 14:01:30


Author: pbristow
Date: 2009-03-17 14:01:29 EDT (Tue, 17 Mar 2009)
New Revision: 51820
URL: http://svn.boost.org/trac/boost/changeset/51820

Log:
Added unc_ellipse but need a new group for ellipse color, and values run outside the box.
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 32 ++++++++++++++++++++++++++++----
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_style_detail.hpp | 2 ++
   sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp | 6 +++---
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 14 +++++++-------
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 11 ++++++-----
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp | 4 ++--
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 1 +
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/doxywarn.log | 2 ++
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/html/index.html | 7 ++-----
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_annotation.cpp | 14 +++++++-------
   10 files changed, 60 insertions(+), 33 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 2009-03-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -808,7 +808,7 @@
                   legend_x_pos,
                   legend_y_pos,
                   *g_inner_ptr,
- derived().serieses_[i].point_style_);
+ derived().serieses_[i].point_style_, 0, 0);
                 legend_x_pos += 1.5 * spacing;
               }
 
@@ -917,8 +917,10 @@
           } // void adjust_limits
 
           void draw_plot_point(double x, double y, // SVG coordinates.
+ //void draw_plot_point(unc x, unc y, // SVG coordinates.
             g_element& g_ptr,
- plot_point_style& sty)
+ plot_point_style& sty,
+ unc ux, unc uy) // Default unc ux = 0.? and uy = 0.
           { //! Draw a plot data point marker shape whose size and stroke and fill colors are specified in plot_point_style.
             /*
               For 1-D plots, the points do not *need* to be centered on the X-axis,
@@ -934,8 +936,6 @@
             */
             int size = sty.size_;
             double half_size = size / 2.;
-
-
             //cout << "point style() "<< sty.style() << endl;
             // Whatever shape, text or line, want to use the point style.
             g_ptr.style().stroke_color(sty.stroke_color_);
@@ -955,6 +955,30 @@
               g_ptr.ellipse(x, y, half_size, size * 2.); // Tall thin egg!
               break;
 
+ case unc_ellipse:
+ {
+ double xu = ux.uncertainty() + ux.value(); //
+ transform_x(xu);
+ double x_radius = abs(xu - x);
+ if (x_radius <= 0.)
+ {
+ x_radius = 1.; // Or size?
+ }
+
+ double yu = uy.uncertainty() + uy.value();
+ transform_y(yu);
+ double y_radius = abs(yu - y);
+ if (y_radius <= 0.)
+ {
+ y_radius = 1.;
+ }
+ g_ptr.ellipse(x, y, x_radius, y_radius); // Radii are uncertainty.
+ // g_ptr.style().stroke_color(blue); would need a new group element to hold a different color.
+ // stroke color of outer and center X Y marker must be same stroke_color at present.
+ g_ptr.circle(x, y, 1); // Show x and y values at center.
+ }
+ break;
+
              // Offset from center is not an issue with vertical or horizontal ticks.
 
             case vertical_tick: // Especially neat for 1-D points.

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_style_detail.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_style_detail.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_style_detail.hpp 2009-03-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -52,6 +52,7 @@
     PLOT_Y_LABEL, //! Y axis text labels "length (cm)".
     PLOT_X_LABEL, //! X axis text labels "height (m)".
     PLOT_DATA_LINES, //! Lines joining data points.
+ PLOT_DATA_UNC, //! Uncertainty zone of data points.
     PLOT_DATA_POINTS, //! Normal data point markers.
     PLOT_LIMIT_POINTS, //! 'At limit or NaN' data point markers.
     PLOT_LEGEND_BACKGROUND, //! Legend box.
@@ -83,6 +84,7 @@
     "yLabel",
     "xLabel", // axis text labels "length (cm)"
     "plotLines", // normal data point markers.
+ "plotUnc", // uncertainty zone of data points.
     "plotPoints", // normal data point markers.
     "limitPoints", // at limit or NaN data point markers
     "legendBackground", // legend box.

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-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -86,12 +86,12 @@
 
   SVG provides very high quality images that display well on small screens like handheld devices,
   conventional monitors of all sizes,
- and on big screens (like when projected on lecture theatre screens),
+ and on big screens (for example, projected on lecture theatre screens),
   and especially when printed, but files are tiny
   (compared to images produced by spreadsheets like Microsoft Excel).
 
   SVG files are microscopic when compressed using a zip program
- to convert to type .zip, or the specific compressed SVG file type (.svgz).
+ to convert to types like .zip, or the specific compressed SVG file type (.svgz).
 
   \section plot_types_sec 1D, 2D and Boxplot
 
@@ -107,7 +107,7 @@
 
   This page generated from file svg.hpp.
 
- */
+*/
 // Copyright Jacob Voytko 2007
 // Copyright Paul A Bristow 2007, 2009
 

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-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -479,8 +479,8 @@
   void calculate_plot_window()
   { //! Calculate the size and position of the plot window,
     //! taking account of the length and font size of axes labels, axis ticks, title and legend box.
- // This version is only for 1-D.
- // All calculation use svg units, pixels by default.
+ //! This version is only for 1-D.
+ //! All calculations use SVG units, pixels by default.
 
     // Start by assuming we can use all the svg image,
     // but reduce by the width of any image border.
@@ -515,7 +515,7 @@
     place_legend_box();
 
     // Because there may be several datasets,
- // and the scaling can be done by anyone or all of them.
+ // and the scaling can be done by any one or all of them.
     // my_plot.autoscale(my_data1) // for 1 dataset.
     // or my_plot.autoscale(my_datas) // for a vector of several datasets.
     // calculates the min & max, increments & ticks.
@@ -688,7 +688,7 @@
       g_ptr.style().fill_color(serieses_[i].point_style_.fill_color_);
 
       for(unsigned int j = 0; j < serieses_[i].series_.size(); ++j)
- { // Draw jth point for ith series.
+ { // Draw jth point for ith serieses.
         unc ux = serieses_[i].series_[j];
         double x = ux.value();
         // TODO symbols are offset downwards because
@@ -698,7 +698,7 @@
         if((x >= plot_left_) && (x <= plot_right_)) // Check point is inside plot_window.
         // May need a margin here to avoid points just over the window not being shown.
         {
- draw_plot_point(x, y, g_ptr, serieses_[i].point_style_); // Marker.
+ draw_plot_point(x, y, g_ptr, serieses_[i].point_style_, ux, unc(0)); // Marker. (y uncertainty is zero)
           if (x_values_on_)
           { // Show the value (& perhaps uncertainty) of the data point too.
             g_element& g_ptr_v = image.g(detail::PLOT_X_POINT_VALUES).g();
@@ -734,7 +734,7 @@
             x = plot_right_;
           }
           //else X axis includes zero, so x is OK.
- draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_);
+ draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_, 0, 0);
         }
         else
         { // Not NaN
@@ -749,7 +749,7 @@
           }
           // else is inside plot window, so draw a limit point marker.
           // draw_plot_point(x, y, g_ptr, plot_point_style(lightgray, whitesmoke, s, cone)); default.
- draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_);
+ draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_, 0, 0);
         }
       } // for j
     } // for i limits point

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-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -1529,10 +1529,11 @@
             uy = j->second;
             y = uy.value(); // Just the Y value
             //double vy = y; // Note the true Y value.
- transform_point(x, y);
+ transform_point(x, y); // Note x and y are now SVG coordinates.
             if((x > plot_left_) && (x < plot_right_) && (y > plot_top_) && (y < plot_bottom_))
- { // Is inside plot window, so draw a point.
- draw_plot_point(x, y, g_ptr, serieses_[i].point_style_);
+ { // Is inside plot window, so draw a point.
+ draw_plot_point(x, y, g_ptr, serieses_[i].point_style_, ux, uy); // Add the unc to allow access to uncertainty.
+ // TODO might refactor so that only pass ux, and uy.
               g_element& g_ptr_vx = image.g(detail::PLOT_X_POINT_VALUES).g();
               if (x_values_on_)
               { // Show the value of the X data point too.
@@ -1622,12 +1623,12 @@
               // draw_plot_point(x, y, g_ptr, plot_point_style(lightgray, whitesmoke, s, cone)); default.
             }
 
- draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_);
+ draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_, 0, 0); // No uncertainty info for values at limit infinity & NaN.
 
             if((x > plot_left_) && (x < plot_right_) && (y > plot_top_) && (y < plot_bottom_))
             { // Is inside plot window, so draw a point.
               // draw_plot_point(x, y, g_ptr, plot_point_style(blank, blank, s, cone)); default.
- draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_);
+ draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_, 0, 0);
             }
           }
         } // limits point

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-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -1725,7 +1725,7 @@
       { // Inside plot window so want to show.
         y = value;
         transform_y(y); // to SVG.
- draw_plot_point(x, y, g_mild_ptr, const_cast<plot_point_style&>(mild_style)); // Kludge!
+ draw_plot_point(x, y, g_mild_ptr, const_cast<plot_point_style&>(mild_style), unc(0), unc(0)); // Kludge!
         if (outlier_values_on_)
         { // Show the value of the data point too.
           draw_plot_point_value(x, y, image.g(boxplot::DATA_VALUE_LABELS).g(), const_cast<value_style&>(values_style), mild_outlier_, value);
@@ -1743,7 +1743,7 @@
       { // Inside plot window so want to show.
         y = value;
         transform_y(y); // to SVG.
- draw_plot_point(x, y, g_ext_ptr, const_cast<plot_point_style&>(extreme_style)); // Kludge!
+ draw_plot_point(x, y, g_ext_ptr, const_cast<plot_point_style&>(extreme_style), 0, 0); // Kludge!
         if (extreme_outlier_values_on_) // This isn't a series setting - but might be.
         { // Show the value of the data point too.
           draw_plot_point_value(x, y, image.g(boxplot::DATA_VALUE_LABELS).g(), const_cast<value_style&>(values_style), ext_outlier_, value);

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp 2009-03-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -611,6 +611,7 @@
   square, //!< Square.
   point, //!< Small solid point.
   egg, //!< Ellipse.
+ unc_ellipse, //!< Ellipse sized using uncertainty estimate of x and y, typically about twice standard deviation or 95% confidence interval.
   vertical_line, //!< Vertical line up & down from axis.
   horizontal_line, //!< Horizontal line left & right from axis.
   vertical_tick, //!< Vertical tick up from axis.

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/doxywarn.log
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/doxywarn.log (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/doxywarn.log 2009-03-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -0,0 +1,2 @@
+I:/boost-sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_lines.cpp:1: Warning: the name `demo_notes.cpp' supplied as the second argument in the \file statement is not an input file
+I:/boost-sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_annotation.cpp:1: Warning: the name `demo_notes.cpp' supplied as the second argument in the \file statement is not an input file

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 2009-03-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -33,7 +33,7 @@
 </div></div>
 <div><p class="copyright">Copyright © 2007 to 2009 Jake Voytko and Paul A. Bristow</p></div>
 <div><div class="legalnotice">
-<a name="id694527"></a><p>
+<a name="id800477"></a><p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>
@@ -147,9 +147,6 @@
 <dt><span class="section">Index</span></dt>
 </dl>
 </div>
-<p>
- [/ I expect this to be <a class="link" href="">svg_plot.todo</a>
- </p>
 <div class="important"><table border="0" summary="Important">
 <tr>
 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../../../../boost_trunk/doc/html/images/important.png"></td>
@@ -174,7 +171,7 @@
 </table></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: March 11, 2009 at 14:19:00 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 17, 2009 at 16:51:52 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_annotation.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_annotation.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_annotation.cpp 2009-03-17 14:01:29 EDT (Tue, 17 Mar 2009)
@@ -1,6 +1,6 @@
-/*! \file demo_notes.cpp
+/*! \file demo_annotation.cpp
     \brief Demonstration of 2D 'note' annotation.
- \details Adding an annotation to a plot.
+ \details Adding a text annotation to a plot, changing color, font and orientation.
     \author Paul A. Bristow
     \date Mar 2009
 */
@@ -78,7 +78,7 @@
   Defaults are provided for size, text style = no_style, center alignment and rotation horizontal.
   */
   my_plot.draw_note(40, 10, "top left (0, 0)");
- my_plot.draw_note(my_plot.image_x_size()-10, my_plot.image_y_size()- 10, "bottom right(380, 280)", no_style, right_align);
+ my_plot.draw_note(my_plot.image_x_size()-10, my_plot.image_y_size()- 10, "bottom right(380, 280)");
 
 /*`Using center_align is strongly recommended because it will ensure that note will center correctly
  (even if note string is made much longer because it contains Unicode,
@@ -93,19 +93,19 @@
   
 /*`and you can change the alignment and rotation using enums align_style and rotate_style.
 */
- my_plot.draw_note(350, 70, "My 2nd Note", my_note_style, right_align, slopeup);
+ my_plot.draw_note(350, 70, "My 2nd Note", slopeup, right_align, black, my_note_style);
 
 /*`To change the color to red (and text style, alignment and rotation too, just for fun)
 */
   text_style my_red_note_style(16, "arial", "italic", "bold");
- my_plot.draw_note(350, 170, "Red Note", my_red_note_style, left_align, upsidedown, red);
- my_plot.draw_note(300, 220, "Blue Note");
+ my_plot.draw_note(350, 170, "Red Note", upsidedown,left_align, red, my_red_note_style);
+ my_plot.draw_note(300, 210, "Blue Note", steepup, center_align, blue);
 
   my_plot.write("./demo_2d_annotation");
 
   //show_2d_plot_settings(my_plot);
 
- //] [/demo_1d_uncertainty_2]
+ //] [/demo_2d_annotation_2]
   
   }
   catch (char* message)


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