]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Run a loop backwards since otherwise gnuplot thinks the upper side is
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Mar 1999 11:48:09 +0000 (11:48 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Mar 1999 11:48:09 +0000 (11:48 +0000)
the lower side and draws the diagram in strange colors.

git-svn-id: https://svn.dealii.org/trunk@983 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/histogram.cc

index 608e37ed566fe892e10f76d6e74e5d67e6230852..1862ec14d4540fe36f17d5e966a42250db0328f7 100644 (file)
@@ -200,43 +200,48 @@ void Histogram::write_gnuplot (ostream &out) const
                                     // otherwise create a whole 3d plot
                                     // for the data. use th patch method
                                     // of gnuplot for this
-    for (unsigned int i=0; i<intervals.size(); ++i)
+                                    //
+                                    // run this loop backwards since otherwise
+                                    // gnuplot thinks the upper side is the
+                                    // lower side and draws the diagram in
+                                    // strange colors
+    for (int i=intervals.size()-1; i>=0; --i)
       {
        for (unsigned int n=0; n<intervals[i].size(); ++n)
          out << intervals[i][n].left_point
              << ' '
-             << y_values[i]
+             << (i<static_cast<int>(intervals.size())-1 ?
+                 y_values[i+1] :
+                 y_values[i] + (y_values[i]-y_values[i-1]))
              << ' '
              << intervals[i][n].content
              << endl
              << intervals[i][n].right_point
              << ' '
-             << y_values[i]
+             << (i<static_cast<int>(intervals.size())-1 ?
+                 y_values[i+1] :
+                 y_values[i] + (y_values[i]-y_values[i-1]))
              << ' '
              << intervals[i][n].content
              << endl;
-       
+
        out << endl;
-       
        for (unsigned int n=0; n<intervals[i].size(); ++n)
          out << intervals[i][n].left_point
              << ' '
-             << (i<intervals.size()-1 ?
-                 y_values[i+1] :
-                 y_values[i] + (y_values[i]-y_values[i-1]))
+             << y_values[i]
              << ' '
              << intervals[i][n].content
              << endl
              << intervals[i][n].right_point
              << ' '
-             << (i<intervals.size()-1 ?
-                 y_values[i+1] :
-                 y_values[i] + (y_values[i]-y_values[i-1]))
+             << y_values[i]
              << ' '
              << intervals[i][n].content
              << endl;
-
+       
        out << endl;
+       
       };
 
   AssertThrow (out, ExcIO());

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.