我将对的矢量定义为我的绘图数据:
std::vector<std::pair<std::string,double>> data;
字符串代表日期并具有格式(使用gnuplot约定)%d /%B /%Y ,例如的 07 /月/ 2016
我的绘图代码如下:
Gnuplot gp;
gp << "set terminal wxt size 1000,800\n";
gp << "set xdata time\n";
gp << "set timefmt '%d/%B/%Y'\n";
gp << "set xrange ['01/January/2016':'30/April/2016']\n";
gp << "plot '-' with lines title 'test'\n";
gp.send1d(data);
不幸的是情节不会被绘制出来。我错过了什么?
感谢您的帮助。
答案 0 :(得分:1)
通常,在绘制任何类型的时间或日期时,必须明确地给出using
语句。如果没有,则会出现错误(不知道gnuplot-iostream如何报告gnuplot错误)。
所以试试
gp << "plot '-' using 1:2 with lines title 'test'\n";