- Timestamp:
- Aug 2, 2006, 9:52:39 PM (17 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/GnuplotFE.cc
r84 r133 25 25 #include "Gnuplot.h" 26 26 27 #include <cassert> 27 28 #include <string> 28 29 #include <sstream> … … 36 37 37 38 38 void GnuplotFE::plot( conststd::vector<u_int>& y, const std::string& format)39 void GnuplotFE::plot(std::vector<u_int>& y, const std::string& format) 39 40 { 40 41 if (!date_.empty()) { 42 assert(date_.size()>=y.size()); 43 if (date_.size()!=y.size()) { 44 y.reserve(date_.size()); 45 for (size_t i=y.size(); i<date_.size(); ++i) 46 y.push_back(*y.rbegin()); 47 } 41 48 command(std::string("set xdata time")); 42 49 command("set timefmt '" + date_input_format_ + "'"); … … 50 57 51 58 52 void GnuplotFE::replot( conststd::vector<u_int>& y)59 void GnuplotFE::replot(std::vector<u_int>& y) 53 60 { 54 61 if (!date_.empty()) { 62 assert(date_.size()>=y.size()); 63 if (date_.size()!=y.size()) { 64 y.reserve(date_.size()); 65 for (size_t i=y.size(); i<date_.size(); ++i) 66 y.push_back(*y.rbegin()); 67 } 55 68 command(std::string("set xdata time")); 56 69 Gnuplot::replot(y,date_); -
trunk/lib/GnuplotFE.h
r123 r133 60 60 61 61 /// 62 /// Plot the data \a y. If a date vector is set with set_dates 63 /// function before calling this function, the date vector will be 64 /// used as x values using \a format as date format 65 /// description. If no date vector is set then the \a y data will 66 /// be plot as a function of subversion revision. 62 67 /// 68 /// @see Gnuplot documentation for date formats. 63 69 /// 64 void plot(const std::vector<u_int>& y,const std::string& format="%y-%b"); 70 /// @note \a y may change in this call: In some cases the date and 71 /// \a y data vectors may have different length. This is an effect 72 /// from subversions treatment of revisions, i.e., subversion 73 /// controlled items may have different revisions but still up to 74 /// date (at the items last changed revision). The date vector 75 /// typically contains all revisions of the repository and thus a 76 /// clash of different sized vectors may occur in gnuplot. This 77 /// situation is resolved by adding elements to \a y such that the 78 /// vector sizes match. The date vector is never expected to be 79 /// shorter than \a y vector. 80 /// 81 void plot(std::vector<u_int>& y,const std::string& format="%y-%b"); 65 82 66 83 /// 84 /// Plot the data \a y as a function of \a x using the Gnuplot 85 /// 'replot' command, see plot documentation for information on x 86 /// axis data and possible modifications of \a y. 67 87 /// 68 /// 69 void replot(const std::vector<u_int>& y); 88 void replot(std::vector<u_int>& y); 70 89 71 90 ///
Note: See TracChangeset
for help on using the changeset viewer.