Hi all
I am trying to do a plot where the X axis has a date format.
I'm following the example x29.cc , but I am having some trouble figuring it
out
this is my code
this example plots 19 points, between these 2 dates
pls->ctime(2016, 5, 30, 0, 0, 0, tstart);
pls->ctime(2016, 6, 1, 0, 0, 0, tend);
that is, 2016-05-30 and 2016-06-01
for the example, I calculate the time interval for the 19 points as
time_t tinterval = (tend - tstart) / NSIZE;
then the x points are made this way, the start time plus the interval
for (int idx_orb = 0; idx_orb < NSIZE; idx_orb++)
{
x[idx_orb] = tstart + tinterval;
}
the plot is made in
pls->env(tstart, tend, 0, NSIZE, 0, 0);
pls->line(NSIZE, x, y);
however I don't get a date axis
the complete code:
thanks
pls->init();
pls->adv(0);
pls->scol0(0, 255, 255, 255);
pls->clear();
pls->scol0(1, 0, 0, 0);
pls->col0(1);
//data
const int NSIZE = 19;
PLFLT *x, *y;
x = new PLFLT[NSIZE];
y = new PLFLT[NSIZE];
//time
PLFLT tstart, tend;
pls->timefmt("%Y-%m-%d");
pls->ctime(2016, 5, 30, 0, 0, 0, tstart);
pls->ctime(2016, 6, 1, 0, 0, 0, tend);
time_t tinterval = (tend - tstart) / NSIZE;
for (int idx_orb = 0; idx_orb < NSIZE; idx_orb++)
{
x[idx_orb] = tstart + tinterval;
y[idx_orb] = idx_orb;
}
pls->env(tstart, tend, 0, NSIZE, 0, 0);
pls->line(NSIZE, x, y);
delete[] x;
delete[] y;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general