Boost logo

Boost-Commit :

From: JakeVoytko_at_[hidden]
Date: 2007-08-13 22:13:35


Author: jakevoytko
Date: 2007-08-13 22:13:25 EDT (Mon, 13 Aug 2007)
New Revision: 38641
URL: http://svn.boost.org/trac/boost/changeset/38641

Log:
Small modifications to boxplot.hpp
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp | 24 ++++++++++++++++++++++++
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_test.cpp | 18 +++++++++++++-----
   2 files changed, 37 insertions(+), 5 deletions(-)

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 2007-08-13 22:13:25 EDT (Mon, 13 Aug 2007)
@@ -650,12 +650,30 @@
     return *this;
 }
 
+svg_boxplot& title_on(bool _cmd)
+{
+ use_title = _cmd;
+ return *this;
+}
+
 svg_boxplot& y_label_on(bool _cmd)
 {
     use_y_label = _cmd;
     return *this;
 }
 
+svg_boxplot& x_label_on(bool _cmd)
+{
+ use_x_label = _cmd;
+ return *this;
+}
+
+svg_boxplot& y_major_labels_on(bool _cmd)
+{
+ use_y_major_labels = _cmd;
+ return *this;
+}
+
 svg_boxplot& y_major_labels_on(bool _cmd)
 {
     use_y_major_labels = _cmd;
@@ -729,6 +747,12 @@
     return *this;
 }
 
+svg_boxplot& image_size(unsigned int x, unsigned int y)
+{
+ image.image_size(x, y);
+ return *this;
+}
+
 svg_boxplot& y_label_size(unsigned int _size)
 {
     y_label_info.font_size(_size);

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_test.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_test.cpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_test.cpp 2007-08-13 22:13:25 EDT (Mon, 13 Aug 2007)
@@ -11,25 +11,33 @@
     return 50 / (x);
 }
 
+double f(double x)
+{
+ return 40 + 25 * sin(x * 50);
+}
+
 int main()
 {
     using namespace boost::svg;
- std::vector<double> data;
+ std::vector<double> data1, data2;
 
     svg_boxplot my_plot;
 
     my_plot.background_border_color(black)
            .y_range(0, 150)
- .y_major_interval(20);
+ .y_major_interval(20)
+ .title("Boxplots of Common Functions");
     
     for(double i=.1; i < 10; i+=.1)
     {
- data.push_back(h(i));
+ data1.push_back(h(i));
+ data2.push_back(f(i));
     }
 
- my_plot.plot(data, "50 / (x)");
+ my_plot.plot(data1, "[50 / x]");
+ my_plot.plot(data2, "[40 + 25 * sin(50x)]");
 
- my_plot.write("D:\\test2d.svg");
+ my_plot.write("D:\\boxplot_test.svg");
 
     return 0;
 }


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