Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51541 - in sandbox/SOC/2007/visualization: boost/svg_plot boost/svg_plot/detail libs/svg_plot/example libs/svg_plot/test
From: pbristow_at_[hidden]
Date: 2009-03-02 13:50:22


Author: pbristow
Date: 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
New Revision: 51541
URL: http://svn.boost.org/trac/boost/changeset/51541

Log:
Fixed bugs in area_fill and line in legend.

Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 88 +++++++++++++++++++++++----------------
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp | 4
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 8 +-
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 3
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 7 ++
   sandbox/SOC/2007/visualization/libs/svg_plot/example/1d_full_layout.cpp | 21 +++++----
   sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp | 50 +++++++++++++---------
   sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_bezier.cpp | 33 +++++++++-----
   sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_y_grid.cpp | 21 +++++----
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_plot.cpp | 2
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_vector.cpp | 7 ++
   sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp | 2
   12 files changed, 144 insertions(+), 102 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-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -30,7 +30,9 @@
 // using std::string;
 
 #include <iostream> // for testing only.
-// using std::cerr and std::endl
+ using std::cerr;
+ using std::cout;
+ using std::endl;
 
 #include <utility>
 // using std::pair
@@ -534,16 +536,13 @@
           }
         } // void draw_x_axis()
 
- // --------------------------------------------------------------------
- // Draw legend & title (if wanted).
- // --------------------------------------------------------------------
-
         void draw_title()
         { /*! Draw title (for the whole plot).
             Update title_info_ with position.
- Assumes align = center_align.
- and center_align will ensure that will center correctly
- (even if original string is made much longer because it contains Unicode)
+ Assumes align = center_align
+ Using center_align will ensure that will title center correctly
+ (even if original string is made much longer because it contains Unicode,
+ for example Greek, taking about 6 characters per symbol)
             because the render engine does the centering.
           */
           derived().title_info_.x(derived().image.x_size() / 2.); // Center of image.
@@ -599,6 +598,7 @@
               derived().legend_width_ += spacing * 2.5;
 
             // & trailing space before box margin.
+ // if (derived().serieses_[i].line_style_.line_on_) // line joining points.
             if (derived().legend_lines_)
             { // Add for colored line marker in legend.
               derived().legend_width_ += spacing * 1.5;
@@ -740,7 +740,7 @@
           } // void calculate_legend_box()
 
           void draw_legend()
- { //! Draw the legend border, text and marker lines and/or shapes.
+ { //! Draw the legend border, text header (if any) and marker lines and/or shapes.
             // size_t num_points = derived().series.size();
             //cout << derived().legend_box_.width() << ' ' << derived().legend_box_.margin() << endl;
 
@@ -751,7 +751,7 @@
             // std::cerr << spacing << ' ' << font_size << ' ' << point_size << endl;
             bool is_header = (derived().legend_header_.text() != "");
 
- // Assume legend box position has already been sized by calculate_legend_box.
+ // Assume legend box position has already been sized and positioned by function calculate_legend_box.
             double legend_x_start = derived().legend_left_; // Saved box location.
             double legend_width = derived().legend_width_;
             double legend_y_start = derived().legend_top_;
@@ -767,9 +767,9 @@
             if (is_header)
             { // Draw the legend header text for example: "My Plot Legend".
               derived().legend_header_.x(legend_x_start + legend_width / 2.); // / 2. to center in legend box.
+ // Might be better to use center_align here because will fail if legend contains symbols in Unicode.
               derived().legend_header_.y(legend_y_pos);
- derived().image.g(PLOT_LEGEND_TEXT).push_back(new
- text_element(derived().legend_header_));
+ derived().image.g(PLOT_LEGEND_TEXT).push_back(new text_element(derived().legend_header_));
               legend_y_pos += 2 * spacing; // Might be 1.5? - useful if many series makes the box too tall.
             }
 
@@ -779,17 +779,24 @@
 
             for(unsigned int i = 0; i < derived().serieses_.size(); ++i)
             { // Show point marker, perhaps line, & text info for all the data series.
+
+ //cout << "Series " << i << endl;
+ //cout << derived().serieses_[i].point_style_ << endl;
+ cout << derived().serieses_[i].line_style_ << endl;
+
               double legend_x_pos = legend_x_start;
               legend_x_pos += spacing; // space before point marker and/or line & text.
               g_inner_ptr = &(g_ptr->g());
- // Use both stroke & fill colors from the point's style.
+ // Use both stroke & fill colors from the points' style.
+ // Applies to both shape AND line.
               g_inner_ptr->style().stroke_color(derived().serieses_[i].point_style_.stroke_color_);
               g_inner_ptr->style().fill_color(derived().serieses_[i].point_style_.fill_color_);
- g_inner_ptr->style().stroke_width(derived().serieses_[i].line_style_.width_); // Applies to shape AND line.
+ g_inner_ptr->style().stroke_width(derived().serieses_[i].line_style_.width_);
 
+ //cout << "g_inner_ptr.style().stroke_color() " << g_inner_ptr->style() << endl;
               if(derived().serieses_[i].point_style_.shape_ != none)
- { // Is a data marker shape to show.
- draw_plot_point( // Plot point like circle, square...
+ { // Is some data marker shape to show.
+ draw_plot_point( // Plot point like circle, square, vertical bar...
                   legend_x_pos,
                   legend_y_pos,
                   *g_inner_ptr,
@@ -797,20 +804,26 @@
                 legend_x_pos += 1.5 * spacing;
               }
 
- // Line markers - only really applicable to 2-D sets plot_line_style,
+ // Line markers are only really useful for 2-D lines and curves showing functions.
               if (derived().legend_lines_)
               { // Need to draw a short line to show color for that data series.
- g_inner_ptr->style() // Use stroke colors from line style.
- .stroke_color(derived().serieses_[i].line_style_.stroke_color_);
- // Use stroke colors from line style.
- // == image.g(PLOT_DATA_LINES).style().stroke_width(width);
- // but this sets width for BOTH point and line :-(
- g_inner_ptr->push_back(new line_element(
- legend_x_pos,
- legend_y_pos,
- legend_x_pos + spacing, // line sample is one char long.
- legend_y_pos));
- legend_x_pos += 1.5 * spacing; // short line & a space.
+ // Line joining points option is true.
+ if (derived().serieses_[i].line_style_.line_on_ || derived().serieses_[i].line_style_.bezier_on_)
+ { // Use stroke color from line style.
+ g_inner_ptr->style().stroke_color(derived().serieses_[i].line_style_.stroke_color_);
+ }
+ else
+ { // Use point stroke color instead.
+ g_inner_ptr->style() .stroke_color(derived().serieses_[i].point_style_.stroke_color_); // OK with 1D
+ }
+ //std::cout << "line g_inner_ptr->style().stroke_color() " << g_inner_ptr->style().stroke_color() << std::endl;
+
+ g_inner_ptr->push_back(new line_element( // Draw horizontal lines with appropriate color.
+ legend_x_pos,
+ legend_y_pos,
+ legend_x_pos + spacing, // Line sample is one char long.
+ legend_y_pos));
+ legend_x_pos += 1.5 * spacing; // Total is short line & a space.
               } // legend_lines_
 
               // Legend text for each Data Series added to the plot.
@@ -898,7 +911,7 @@
           void draw_plot_point(double x, double y, // SVG coordinates.
             g_element& g_ptr,
             plot_point_style& sty)
- { //! Draw a plot data point marker shape whose size and color are specified in plot_point_style.
+ { //! 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,
               and putting them just above, or sitting on, the X-axis is much clearer.
@@ -914,6 +927,14 @@
             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_);
+ g_ptr.style().fill_color(sty.fill_color_);
+
+ //cout << "g_ptr.style() " << g_ptr.style() << endl;
+
             switch(sty.shape_) // from enum point_shape none, round, square, point, egg
             {
             case round:
@@ -926,12 +947,7 @@
               g_ptr.ellipse(x, y, half_size, size * 2.); // Tall thin egg!
               break;
 
- // Offset from center is not an issue with vertical or horizontal ticks.
- // TODO stroke color of line seems to be FILL color, not the stroke color.
- // This is OK-ish, but I'm not sure why.
-
- //svg_color sc = sty.stroke_color;
- //svg_color fc = sty.fill_color;
+ // Offset from center is not an issue with vertical or horizontal ticks.
 
             case vertical_tick: // Especially neat for 1-D points.
               g_ptr.line(x, y, x , y - size); // tick up from axis.
@@ -996,7 +1012,7 @@
               // Last point puts the bottom tip of the triangle on the X-axis (may not be wanted for 2-D).
               }
               break;
- case cross:
+ case cross: // Not X.
               g_ptr.line(x, y + size, x , y - size); // line up & down from axis,
               g_ptr.line(x, y - size, x + size, y ); // & line left & right from axis.
               // Cross is pretty useless for 1-D because the horizontal line is on the X-axis.

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-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -48,14 +48,14 @@
 
 inline bool limit_max(double a)
 { //! At (or near) max value or +infinity, most positive values.
- return ((a > std::numeric_limits<double>::max() / margin) // Avoid macro max trap!
+ return ((a > (std::numeric_limits<double>::max)() / margin) // Avoid macro max trap!
          || (a == std::numeric_limits<double>::infinity()));
 }
 
 inline bool limit_min(double a)
 { //! At (or near) -max or -infinity, most negative values.
   return (
- (a < -(std::numeric_limits<double>::max() /margin)) // Avoid macro max trap!
+ (a < -(std::numeric_limits<double>::max)() /margin) // Avoid macro max trap!
     || (a == -std::numeric_limits<double>::infinity())
     );
 }

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-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -123,8 +123,7 @@
 point_style_(black, blank, 5, vertical_line), // Default point style.
 limit_point_style_(lightgrey, red, 10, cone), // Default limit (inf or NaN) point style.
 //limit_point_style_(lightgrey, whitesmoke, 10, cone), // Default limit (inf or NaN) point style.
-line_style_(black, blank, 2, true, false) // Default line style, black, no fill, width, line_on, bezier_on false
-// Meaning of line style for 1-D as yet undefined?
+line_style_(black, blank, 2, false, false) // Default line style, black, no fill, width, line_on, bezier_on false
 {
   for(T i = begin; i != end; ++i)
   { // No defaults for begin and end?
@@ -322,7 +321,7 @@
   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_; // get/set by legend_lines(bool); data colored line type in legend box.
+ bool legend_lines_; // 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.
@@ -391,6 +390,7 @@
     legend_on_(false),
     legend_longest_(0),
     outside_legend_on_(true),
+ legend_lines_(false), // Not very useful for 1 D as already showing data point marker shapes.
     plot_window_clip_("plot_window"), // for <clipPath id="plot_window" ...
     title_on_(true),
     plot_window_on_(true),
@@ -462,7 +462,7 @@
   } // svg_1d_plot() Default constructor.
 
   void set_ids()
- { // document ids for use in <g id = "PLOT_TITLE".../>
+ { //! Document ids for use in identifying group elements, for example: <g id = "PLOT_TITLE".../g>
     for(int i = 0; i < detail::SVG_PLOT_DOC_CHILDREN; ++i)
     {
       image.g(i).id(detail::document_ids_[i]);

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-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -35,7 +35,6 @@
 #include "detail/numeric_limits_handling.hpp"
 using boost::svg::detail::limit_NaN;
 
-
 #include "svg.hpp"
 
 #include <map> // for map & multimap
@@ -133,7 +132,7 @@
     title_(title), //!< Title of a series of data values.
     // plot_point_style(const svg_color& fill = blank, const svg_color& stroke = black,
     // int size = 10, point_shape shape = round, const std::string& symbols = "X")
- point_style_(black, blank, 10, round), // Default point style.
+ point_style_(black, white, 10, round), // Default point style (default fill white).
     limit_point_style_(grey, blank, 10, cone), // Default limit (infinity or NaN) point style.
     line_style_(black, blank, 2, false, false), // Default line style, no fill, width 2, no line_on, no bezier.
     bar_style_(black, blank, 3, no_bar), // Default black, no fill, stick width 3, no bar.

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-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -776,7 +776,10 @@
      << p.stroke_color_ << ", "
      << p.fill_color_ << ", "
      << p.size_ << ", "
- << p.symbols_
+ << p.symbols_ << ", "
+ << p.symbols_style_ << ", "
+ << p.show_x_value_ << ", "
+ << p.show_y_value_
 // << ", symbols style: " << p.symbols_style_ // TODO check this works and alter example.
      << ")";
 /*! \details Example: plot_point_style p; cout << p << endl;
@@ -789,7 +792,7 @@
 
 class plot_line_style
 { //! \class boost::svg::plot_line_style Style of line joining data series values.
- // TODO dotted and dashed line style would be useful for B&W.
+ // TODO dotted and dashed line style would be useful for monochrome plots.
 public:
   svg_color stroke_color_; //!< Stroke color of line. (no fill color for lines)
   svg_color area_fill_; //!< Fill color from line to axis. == false means color.is_blank = true, or = blank.

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 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -16,7 +16,6 @@
 using namespace boost::svg;
 #include <boost/array.hpp>
   using boost::array;
-
 #include <vector>
   using std::vector;
 #include <deque>
@@ -57,18 +56,18 @@
 
   // Size/scale settings.
   my_plot.size(500, 350)
- .x_range(-3, 10);
+ .x_range(-3, 10);
 
   // Text settings.
- my_plot.title("Oh My!")
- .title_font_size(29)
- .x_label("Time in Months");
+ my_plot.title("Animal Lives")
+ .title_font_size(29)
+ .x_label("Time in Months");
 
   // Commands.
   my_plot.legend_on(true)
- .plot_window_on(true)
- .x_label_on(true)
- .x_major_labels_side(true);
+ .plot_window_on(true)
+ .x_label_on(true)
+ .x_major_labels_side(true);
 
   // Color settings.
   my_plot.background_color(svg_color(67, 111, 69))
@@ -86,7 +85,11 @@
          .x_num_minor_ticks(3);
 
   // Legend settings.
- my_plot.legend_title_font_size(15);
+ my_plot.legend_title("Animals")
+ .legend_title_font_size(15)
+ ;
+
+
 
   my_plot.plot(data1, "Lions").stroke_color(blue);
   my_plot.plot(data2, "Tigers").stroke_color(orange);

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 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -1,14 +1,16 @@
 /*! \file 2d_area_fill.cpp
- \brief Demo of area fill below a curve.
+ \brief Demonstration of area fill below curves.
   \date 2007
- \author Jacob Voytko
+ \author Jacob Voytko and Paul A. Bristow
 */
 
 // Copyright Jacob Voytko 2007
-// Copyright Paul A. Bristow 2008
+// Copyright Paul A. Bristow 2009
 
-// Distributed under the Boost Software License, Version 1.0.
-// For more information, see http://www.boost.org
+// Use, modification and distribution are subject to 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)
 
 #include <boost/svg_plot/svg_2d_plot.hpp>
   using namespace boost::svg; // Needed to get svg colors and others.
@@ -17,9 +19,9 @@
 #include <map>
   using std::map;
 #include <cmath>
- using ::sin;
- using ::cos;
- using ::tan;
+ using std::sin;
+ using std::cos;
+ using std::tan;
 
 double my_sin(double x)
 {
@@ -31,7 +33,6 @@
         return 50. * cos(x);
 }
 
-
 double my_tan(double x)
 {
   return 50. * tan(x);
@@ -95,21 +96,27 @@
                .y_major_interval(25)
                .y_num_minor_ticks(5);
         
- svg_2d_plot_series& s_sin = my_plot.plot(data_sin, "sin(x)").area_fill(red);
- std::cout << "s_sin.area_fill() " << s_sin.area_fill() << std::endl;
- //svg_2d_plot_series& s_cos = my_plot.plot(data_cos, "cos(x)").area_fill(blue).shape(square);
- svg_2d_plot_series& s_cos = my_plot.plot(data_cos, "cos(x)").area_fill(blue).shape(square);
+ svg_2d_plot_series& s_sin = my_plot.plot(data_sin, "sin(x)").line_on(true).area_fill(red);
+ std::cout << "s_sin.area_fill() " << s_sin.area_fill() << std::endl; // s_sin.area_fill() RGB(255,0,0)
+
+ svg_2d_plot_series& s_cos = my_plot.plot(data_cos, "cos(x)").line_on(true).area_fill(blue).shape(square);
+ std::cout << "s_cos.area_fill() " << s_cos.area_fill() << std::endl; // s_cos.area_fill() RGB(0,0,255)
+
+ svg_2d_plot_series& s_tan = my_plot.plot(data_tan, "tan(x)").shape(cone).line_on(true).area_fill(blank);
   // Note that svg_color(blank) or svg_color(false) returns a non-color blank, so no fill.
- std::cout << "s_cos.area_fill() " << s_cos.area_fill() << std::endl;
- svg_2d_plot_series& s_tan = my_plot.plot(data_tan, "tan(x)").shape(cone).line_on(false);
- std::cout << "s_tan.area_fill() " << s_tan.area_fill() << std::endl;
- std::cout << my_plot.title() << std::endl;
+ std::cout << "s_tan.area_fill() " << s_tan.area_fill() << std::endl; // s_tan.area_fill() blank
+
+ std::cout << my_plot.title() << std::endl; // "Plot of 50 * sin(x), cos(x) and tan(x)"
 
   my_plot.write("./2d_area_fill_1.svg");
- std::cout << my_plot.title() << std::endl;
 
- //my_plot.title("Plot 2 of 50 * sin(x), cos(x) and tan(x)");
- my_plot.plot(data_cos, "cos(x)").area_fill(green).shape(square).fill_color(red);
+ my_plot.plot(data_sin, "sin(x)").line_on(true).area_fill(green).shape(square).fill_color(red);
+ // Note how this overwrites the previously cos fill and tan line.
+ // (It also needs a new title).
+
+ my_plot.title("sin overwriting cos and tan");
+ std::cout << my_plot.title() << std::endl; // "sin overwriting cos and tan"
+
   my_plot.write("./2d_area_fill_2.svg");
 
    return 0;
@@ -124,7 +131,8 @@
 Embedding manifest...
 Autorun "j:\Cpp\SVG\debug\2d_area_fill.exe"
 s_sin.area_fill() RGB(255,0,0)
-s_cos.area_fill() blank
+s_cos.area_fill() RGB(0,0,255)
 s_tan.area_fill() blank
+Plot of 50 * sin(x), cos(x) and tan(x)
 
 */

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 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -1,19 +1,25 @@
 /*! \file 2d_bezier.cpp
   \brief Simple 2D plot using bezier curves.
- \author Jacob Voytko
+ \author Jacob Voytko and Paul A. Bristow
   \date 2007
 */
 
 // Copyright (C) Jacob Voytko 2007
-// Distributed under the Boost Software License, Version 1.0.
-// For more information, see http://www.boost.org
+// Copyright Paul A. Bristow 2009
+
+// Use, modification and distribution are subject to 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)
 
 #include <boost/svg_plot/svg_2d_plot.hpp>
 using namespace boost::svg;
 
 #include <map>
+ using std::map;
 #include <cmath>
-using std::map;
+ using std::sin;
+ using std::cos;
 
 double f(double x)
 {
@@ -44,9 +50,8 @@
     .x_range(-.5, 10.5)
     .y_range(-1.1, 1.1);
 
-
   // Text settings.
- my_plot.title("Plot of trig functions")
+ my_plot.title("Plot of sin and cos functions")
     .title_font_size(29)
     .x_label("X Axis Units")
     .y_major_labels_side(-1)
@@ -73,18 +78,22 @@
     .x_minor_tick_width(1)
     .x_num_minor_ticks(3)
 
- // Y axis settings.
+ // Y axis settings.
     .y_major_interval(25)
     .y_num_minor_ticks(5);
 
- // legend settings
+ // legend settings.
   my_plot.legend_title_font_size(15);
 
- my_plot.plot(data1, "Sin(x)").shape(round)
- .bezier_on(true).size(5).fill_color(yellow);
+ my_plot.plot(data1, "Sin(x)").line_on(true)
+ .shape(round).size(5).fill_color(yellow);
+
+ my_plot.plot(data2, "Cos(x)")
+ .line_color(blue)
+ .bezier_on(true)
+ .shape(square).size(5).fill_color(red);
 
- my_plot.plot(data2, "Cos(x)").shape(square)
- .bezier_on(true).size(5).fill_color(red);
+ // Note the slightly smoother curve for the bezier_on comapred to the line_on options.
 
   my_plot.write("./2d_bezier.svg");
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_y_grid.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_y_grid.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_y_grid.cpp 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -1,14 +1,17 @@
 /*! \file 2d_y_grid.cpp
   \brief 2D plot with Y axis grids.
   \details Shows an example of adding a Y horizontal grid to a 2D plot.
- \author Jacob Voytko
+ \author Jacob Voytko and Paul A. Bristow
   \date 2007
 */
 
 // Copyright Jacob Voytko 2007
+// Copyright Paul A. Bristow 2009
 
-// Distributed under the Boost Software License, Version 1.0.
-// For more information, see http://www.boost.org
+// Use, modification and distribution are subject to 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)
 
 #include <boost/svg_plot/svg_2d_plot.hpp>
 #include <vector>
@@ -35,17 +38,15 @@
          .legend_on(true)
          .x_range(-1, 11)
          .background_border_color(black)
- .plot_window_on(true);
+ .plot_window_on(true);
 
     my_plot.y_major_grid_on(true)
- .y_minor_grid_on(true);
-
- my_plot.y_major_grid_color(black)
+ .y_minor_grid_on(true)
+ .y_major_grid_color(blue)
        .y_minor_grid_color(lightgray);
 
-
- my_plot.plot(map1, "Series 1").stroke_color(blue);
- my_plot.plot(map2, "Series 2").stroke_color(orange);
+ my_plot.plot(map1, "Series 1").stroke_color(blue).fill_color(red);
+ my_plot.plot(map2, "Series 2").stroke_color(orange); // Fill white by default.
 
     my_plot.write("./2d_y_grid.svg");
   return 0;

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_plot.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_plot.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_plot.cpp 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -134,7 +134,7 @@
   .legend_font_family("arial") // "arial", "impact", "courier", "lucida console", "Lucida sans unicode", "verdana"
   .legend_font_weight("bold")
   .legend_color(darkgreen)
- .legend_lines(false) // Horizontal sample color line not needed if showing values with colored shapes?
+ .legend_lines(false) // Horizontal sample color line not useful if already showing values with colored shapes.
   .x_label_on(true) // show x-axis text label.
   .x_label("volume") // Care: this doesn't show unless .x_label_on() == true!
   .x_axis_color(blue)

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_vector.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_vector.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_vector.cpp 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -63,6 +63,8 @@
     .title("Race Times")
     .x_range(-1, 11);
 
+ my_plot.legend_lines(true);
+
 /*`The syntax `my_plot.title("Hello").legend_on(true)...` may appear unfamiliar,
 but is a convenient way of specifying many parameters in any order. It is equivalent to:
 ``
@@ -84,8 +86,9 @@
 if we want them to show on the legend.
 */
 
- my_plot.plot(dan_times, "Dan").shape(round).stroke_color(red).fill_color(red);
- my_plot.plot(elaine_times, "Elaine").shape(cross).stroke_color(blue).fill_color(blue);
+ my_plot.plot(dan_times, "Dan").shape(round).size(10).stroke_color(red).fill_color(green);
+ my_plot.plot(elaine_times, "Elaine").shape(vertical_line).stroke_color(blue);
+
 
 /*`Finally, we can write the SVG to a file of our choice.
 */

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 2009-03-02 13:50:20 EST (Mon, 02 Mar 2009)
@@ -71,7 +71,7 @@
   text.text("X");
   BOOST_CHECK_EQUAL(text.text(), "X");
 
- BOOST_CHECK_EQUAL(text.textstyle().font_size(), 20);
+ BOOST_CHECK_EQUAL(text.textstyle().font_size(), 12);
   text.textstyle().font_size(10);
   BOOST_CHECK_EQUAL(text.textstyle().font_size(), 10);
 


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