From 9f8f6b4ac6d3cbb5a0c1346ca0d7f03a34010ccc Mon Sep 17 00:00:00 2001 From: Cees Bassa Date: Fri, 20 Jan 2023 14:00:06 +0100 Subject: [PATCH] Fix time axis on missing data (fixes #38) Signed-off-by: Cees Bassa --- rfplot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rfplot.c b/rfplot.c index def7df7..302666a 100644 --- a/rfplot.c +++ b/rfplot.c @@ -846,6 +846,17 @@ void time_axis(double *mjd,int n,float xmin,float xmax,float ymin,float ymax) imax=n-1; mjdmin=mjd[imin]; mjdmax=mjd[imax]; + + // Do not plot axis if no data is available + if (mjdmin==0.0 && mjdmax==0.0) + return; + + // Correct maximum + if (mjdmax==0.0) { + for (i=0;imjdmax) + mjdmax=mjd[i]; + } dt=(float) 86400*(mjdmax-mjdmin); // Choose tickmarks