我正在定义一个成对的 vector 作为我的绘图数据:
std::vector<std::pair<std::string,double>> data;
字符串表示日期并具有格式(使用 gnuplot 约定)%d/%B/%Y,例如2016 年 1 月 7 日。
我的绘图代码如下:
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);
不幸的是,情节没有被绘制出来。我错过了什么?
感谢您的帮助。
最佳答案
通常,当绘制任何类型的时间或日期时,您必须使用语句明确给出。如果没有,您会遇到错误(不知道gnuplot-iostream如何报告gnuplot错误)。
所以尝试
gp << "plot '-' using 1:2 with lines title 'test'\n";
关于c++ - gnuplot-iostream : no plot when x values are dates,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34136457/