Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80843 - in sandbox/SOC/2007/visualization/libs/svg_plot: doc example
From: pbristow_at_[hidden]
Date: 2012-10-04 12:21:41


Author: pbristow
Date: 2012-10-04 12:21:40 EDT (Thu, 04 Oct 2012)
New Revision: 80843
URL: http://svn.boost.org/trac/boost/changeset/80843

Log:
Working on Netbeans gcc 4.3.3 on Cygwin.
Text files modified:
   sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk | 1 +
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp | 19 +++++++++----------
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_axis_scaling.cpp | 4 ++--
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp | 35 ++++++++++++++++++-----------------
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_uncertainty.cpp | 19 ++++++++++---------
   sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp | 21 +++++++++------------
   6 files changed, 49 insertions(+), 50 deletions(-)

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk 2012-10-04 12:21:40 EDT (Thu, 04 Oct 2012)
@@ -116,6 +116,7 @@
 the standard.
 * Compliance with the
 [@http://www.w3.org/TR/SVG11/ W3C Scalable Vector Graph standard].
+* Validation using [@http://validator.w3.org/#validate_by_upload W3C Markup Validation Service].
 
 [endsect] [/section:preface Preface]
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_autoscaling.cpp 2012-10-04 12:21:40 EDT (Thu, 04 Oct 2012)
@@ -4,10 +4,10 @@
       See auto_1d_containers.cpp for an example autoscaling with multiple data series.
       See also demo_1d_plot.cpp for a wider range of use.
     \author Paul A Bristow
- \date Feb 2009
+ \date Feb 2009, 2012
 */
 // Copyright Jacob Voytko 2007
-// Copyright Paul A Bristow 2008, 2009
+// Copyright Paul A Bristow 2008, 2009, 2012
 
 // Use, modification and distribution are subject to the
 // Boost Software License, Version 1.0.
@@ -57,13 +57,13 @@
   using std::pair;
 
 #include <boost/svg_plot/detail/auto_axes.hpp>
- using boost::svg::show; // A single STL container.
- using boost::svg::show_all; // Multiple STL containers.
- using boost::svg::range; // Find min and max of a STL container.
- using boost::svg::range_all;// Find min and max of multipler STL containers.
+ using boost::svg::show; //! A single STL container.
+ using boost::svg::show_all; //! Multiple STL containers.
+ using boost::svg::range_mx; //! Find min and max of a single STL container.
+ using boost::svg::range_all; //! Find min and max of multiple STL containers.
 //] [/demo_1d_autoscaling_1]
 
-double tol100eps = 1000 * numeric_limits<double>::epsilon(); // suitable tight value.
+double tol100eps = 1000 * numeric_limits<double>::epsilon(); // A suitable value for tight.
 
 int main()
 {
@@ -73,7 +73,7 @@
   First we create a container and fill with some fictional data, and display the values.
   */
 
- vector<double> my_data;
+ std::vector<double> my_data;
   // Initialize my_data with some entirely fictional data.
   my_data.push_back(0.2);
   my_data.push_back(1.1); // [1]
@@ -104,7 +104,7 @@
 //[demo_1d_autoscaling_3
   /*`In a second example, we use a different type of container, a set,
   and use autoscale in a more advanced way.*/
- multiset<double> my_set;
+ std::multiset<double> my_set;
   // Initialize my_set with some entirely fictional data.
   my_set.insert(1.2);
   my_set.insert(2.3);
@@ -190,4 +190,3 @@
 //] [/demo_1d_autoscaling_output]
 
 */
-

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 2012-10-04 12:21:40 EDT (Thu, 04 Oct 2012)
@@ -136,7 +136,7 @@
 //[demo_1d_axis_scaling_4
 
   /*`Is is possible to find the minimum and maximum values in a container using the STL functions min & max
- or more conveiniently and efficiently with boost::minmax_element:
+ or more conveniently and efficiently with boost::minmax_element:
   */
 
   typedef vector<double>::const_iterator vector_iterator;
@@ -155,7 +155,7 @@
   double axis_max_value;
   double axis_tick_increment;
   int axis_ticks;
-
+
   scale_axis(min_value, max_value,
     &axis_min_value, &axis_max_value, &axis_tick_increment, &axis_ticks,
     false, tol100eps, 6); // Display range.

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_containers.cpp 2012-10-04 12:21:40 EDT (Thu, 04 Oct 2012)
@@ -5,7 +5,7 @@
 */
 
 // Copyright Jacob Voytko 2007
-// Copyright Paul A Bristow 2008
+// Copyright Paul A Bristow 2008, 2012
 
 // Use, modification and distribution are subject to the
 // Boost Software License, Version 1.0.
@@ -23,15 +23,15 @@
 /*`First a few includes to use Boost.Plot and various STL containers:
 */
 #include <boost/svg_plot/svg_1d_plot.hpp>
- using namespace boost::svg;
+ // using namespace boost::svg;
 #include <boost/array.hpp>
   using boost::array;
 #include <vector>
   using std::vector;
 #include <set>
   using std::set; // Automatically sorted - though this is not useful to the plot process.
- using std::multiset; // At present using multiset, allowing duplicates, plot does not indicate duplicates.
- // With 2_D data in multimap, duplicate values are usefully displayed.
+ using std::multiset; // At present using std::multiset, allowing duplicates, plot does not indicate duplicates.
+ // With 2_D data in std::multimap, duplicate values are usefully displayed.
 #include <list>
   using std::list;
 #include <deque>
@@ -48,7 +48,7 @@
 and fictional values are inserted using push_back.
 Since this is a 1-D plot the order of data values is not important.
 */
- vector<float> values;
+ std::vector<float> values;
   values.push_back(3.1f);
   values.push_back(-5.5f);
   values.push_back(8.7f);
@@ -56,11 +56,13 @@
 
 /*`The constructor initializes a new 1D plot, called `my_plot`, and also sets all the many default values.
 */
- svg_1d_plot my_plot;
+
+ using namespace boost::svg;
+ boost::svg::svg_1d_plot my_plot;
 
 /*`Setting (member) functions are fairly self-explanatory:
 Title provides a title at the top for the whole plot,
-and plot adds a (unamed) data series (naming isn't very useful if there is only one data series).
+and plot adds a (unnamed) data series (naming isn't very useful if there is only one data series).
 */
   my_plot.title("vector&lt;float&gt; example");
 /*`
@@ -77,9 +79,9 @@
   {
 //[demo_1d_containers_3
 /*`If the container is a static array, then it must be filled by assignment:*/
- array<long double, 4> values = {3.1L,-5.5L, 8.7L, 0.5L};
+ boost::array<long double, 4> values = {3.1L,-5.5L, 8.7L, 0.5L};
 
- svg_1d_plot my_plot;
+ boost::svg::svg_1d_plot my_plot;
   my_plot.title("array&lt;long double&gt; example");
   my_plot.plot(values);
   my_plot.write("./demo_1d_array_long_double.svg");
@@ -89,14 +91,14 @@
   {
 //[demo_1d_containers_4
 /*`If the container type is a set, then it can be filled with insert:*/
- set<double> values;
+ std::set<double> values;
   values.insert(-8.4);
   values.insert(-2.3);
   values.insert(0.1);
   values.insert(5.6);
   values.insert(7.8);
 
- svg_1d_plot my_plot;
+ boost::svg::svg_1d_plot my_plot;
   my_plot.title("set&lt;double&gt; example");
   my_plot.plot(values);
   my_plot.write("./demo_1d_set_double.svg");
@@ -106,13 +108,13 @@
   {
 //[demo_1d_containers_5
 /*`If the container type is a list, then it can be filled with push_back or push_front:*/
- list<double> values;
+ std::list<double> values;
   values.push_back(-8.4);
   values.push_back(-2.3);
   values.push_back(0.1);
   values.push_back(5.6);
   values.push_back(7.8);
- svg_1d_plot my_plot;
+ boost::svg::svg_1d_plot my_plot;
   my_plot.title("list&lt;double&gt; example");
   my_plot.plot(values);
   my_plot.write("./demo_1d_list_double.svg");
@@ -122,14 +124,14 @@
   {
 //[demo_1d_containers_6
 /*`If the container type is a deque, then it can be filled with push_back or push_front:*/
- deque<double> values;
+ std::deque<double> values;
   values.push_front(-8.4);
   values.push_front(-2.3);
   values.push_front(0.1);
   values.push_front(5.6);
   values.push_front(7.8);
 
- svg_1d_plot my_plot;
+ boost::svg::svg_1d_plot my_plot;
   my_plot.title("deque&lt;double&gt; example");
   my_plot.plot(values);
   my_plot.x_label("X values as doubles");
@@ -137,7 +139,6 @@
   my_plot.write("./demo_1d_deque_double.svg");
 //] [/demo_1d_containers_6]
   }
-
   return 0;
 } // int main()
 
@@ -148,7 +149,7 @@
 
 Compiling...
 demo_1d_containers.cpp
-Linking...
+Linking...
 Embedding manifest...
 Autorun "j:\Cpp\SVG\debug\demo_1d_containers.exe"
 Build Time 0:03

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_uncertainty.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_uncertainty.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_1d_uncertainty.cpp 2012-10-04 12:21:40 EDT (Thu, 04 Oct 2012)
@@ -57,13 +57,13 @@
   setUncDefaults(std::cout);
   typedef unc<false> uncun; // Uncertain Uncorrelated (the normal case).
   float NaN = std::numeric_limits<float>::quiet_NaN();
- vector<uncun> A_times;
+ std::vector<uncun> A_times;
   A_times.push_back(unc<false>(3.1, 0.02F, 8));
   A_times.push_back(uncun(4.2, 0.01F, 14, 0U));
 
   short unsigned int t = UNC_KNOWN | UNC_EXPLICIT| DEG_FREE_EXACT | DEG_FREE_KNOWN;
 
- vector<unc<false> > B_times;
+ std::vector<unc<false> > B_times;
   B_times.push_back(uncun(2.1, 0.001F, 30, t)); // Value, uncertainty, degrees of freedom and type known.
   // (But use of type is not yet implemented.)
   B_times.push_back(unc<>(5.1, 0.025F, 20, 0U)); // Value, uncertainty, and degrees of freedom known - the usual case.
@@ -74,7 +74,7 @@
   // So in both cases show all possibly significant digits (usually 15).
   // This is ugly on a graph, so best to be explicit about uncertainty.
 
- vector<unc<false> > C_times;
+ std::vector<unc<false> > C_times;
   C_times.push_back(uncun(2.6, 0.1F, 5, 0U));
   C_times.push_back(uncun(5.4, 0.2F, 11, 0U));
 
@@ -87,18 +87,20 @@
  and also sets all the very many defaults for axes, width, colors, etc.
 */
   svg_1d_plot my_plot;
-/*`A few (member) functions that are set should be fairly self-explanatory:
+/*`A few (member) functions that are set (using concatenation or chaining) should be fairly self-explanatory:
 
-* title provides a title at the top for the whole plot,
-* `legend_on(true)` will mean that titles of data series and markers will display in the legend box.
-* `x_range(-1, 11)` sets the axis limits from -1 to +11 (instead of the default -10 to +10).
-* `background_border_color(blue)` sets just one of the very many other options.
+* .title() provides a title at the top for the whole plot,
+* .`legend_on(true)` will mean that titles of data series and markers will display in the legend box.
+* .`x_range(-1, 11)` sets the axis limits from -1 to +11 (instead of the default -10 to +10).
+* .`background_border_color(blue)` sets just one of the very many other options.
 */
   my_plot.autoscale_check_limits(false); // Default is true.
   my_plot.autoscale_plusminus(2); // default is 3.
   my_plot.confidence(0.01); // Change alpha from default 0.05 == 95% to 0.01 == 99%.
 
   my_plot
+ .image_x_size(600)
+ .image_y_size(300)
     .plot_window_on(true)
     .background_border_color(blue)
     .plot_border_color(yellow)
@@ -138,7 +140,6 @@
 /*`
 Finally, we can write the SVG to a file of our choice.
 */
-
   std::string svg_file = (my_plot.legend_on() == true) ?
     "./demo_1d_uncertainty_legend.svg" : "./demo_1d_uncertainty.svg";
 

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_uncertainty.cpp 2012-10-04 12:21:40 EDT (Thu, 04 Oct 2012)
@@ -30,7 +30,9 @@
 //[demo_2d_uncertainty_1
 
 /*`First we need some includes to use Boost.Plot and C++ Standard Library:
-*/#include <boost/svg_plot/svg_2d_plot.hpp>
+*/
+
+#include <boost/svg_plot/svg_2d_plot.hpp>
 using namespace boost::svg;
 
 #include <boost/svg_plot/show_2d_settings.hpp> // Only needed for showing which settings in use.
@@ -90,11 +92,6 @@
 
   using boost::svg::detail::operator<<;
 
- // Check pair for double.
- pair<double, double> double_pair; // pair of double X and Y.
- double_pair = make_pair(double(-2.234), double(-8.76));
- cout << "make_pair(double(-2.234), double(-8.76)) = " << double_pair << endl;
-
   setUncDefaults(std::cout);
 
   try
@@ -107,22 +104,22 @@
 are inserted using push_back. Since this is a 2-D plot
 the order of data values is important.
 */
+ typedef unc<false> uncun; // Uncertain Uncorrelated (the normal case).
+
   using boost::svg::detail::operator<<;
 
   // Check pair for double.
   pair<double, double> double_pair; // double X and Y
   double_pair = make_pair(double(-2.234), double(-8.76));
- cout << " make_pair(double(-2.234), double(-8.76)) = " << double_pair << endl;
-
- typedef unc<false> uncun; // Uncertain Uncorrelated (the normal case).
-
+ cout << "make_pair(double(-2.234), double(-8.76)) = " << double_pair << endl;
+
   uncun u1(1.23, 0.56F, 7); // For an X value.
   cout << "u1 = " << u1 << endl; // u1 = 1.23+-0.056 (7)
   uncun u2(3.45, 0.67F, 9); // For a Y value.
   pair<uncun, uncun > mp1 = make_pair(u1, u2); // XY pair of values.
   cout << mp1 << endl; // 1.23+-0.056 (7), 2.345+-0.067 (9)
 
- map<uncun , uncun > data1; // Container for XY points.
+ map<uncun, uncun > data1; // Container for XY pair of points.
   data1.insert(mp1); // u1, u2 = 1.23+-0.056 (7), 2.345+-0.067 (9)
   data1.insert(make_pair(uncun(4.1, 0.4F, 7), uncun(3.1, 0.3F, 18))); //
   data1.insert(make_pair(uncun(-2.234, 0.03F, 7), uncun(-8.76, 0.9F, 9)));
@@ -137,7 +134,7 @@
 Echo the values input:
   */
   cout << data1.size() << " XY data pairs:" << endl;
- copy(data1.begin(), data1.end(), ostream_iterator<pair<uncun, uncun > >(cout, "\n"));
+ std::copy(data1.begin(), data1.end(), ostream_iterator<pair<uncun, uncun > >(cout, "\n"));
   cout << endl;
 
   svg_2d_plot my_plot;


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