2
votes

I'm defining a vector of pairs as my plotting data:

std::vector<std::pair<std::string,double>> data;

The strings represent dates and have the format (using gnuplot convention) %d/%B/%Y, e.g. 07/January/2016.

My code for the plotting is the following:

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);

Unfortunately the plot does not get drawn. What am I missing?

Thanks for any help.

1

1 Answers

2
votes

In general, when plotting any kind of times or dates you must explicitely give a using statement. If not, you get an error (don't know how gnuplot-iostream reports gnuplot errors).

So try

gp << "plot '-' using 1:2 with lines  title 'test'\n";