help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Boxed legend not correct size


From: Ben Abbott
Subject: Re: Boxed legend not correct size
Date: Fri, 24 Feb 2012 10:21:44 -0500

On Feb 24, 2012, at 9:40 AM, am304 wrote:

> The following sort of gives an idea. I think the problem is to do with the
> NaN present in the data, maybe in conjunction with the use of dates.
> 
> xdata = datenum(2012,02,22,18,00,00):0.01:now;
> ydata = sin(xdata);
> ydata(2:2:end) = NaN;
> plot(xdata(~isnan(ydata)),ydata(~isnan(ydata)))
> datetick('x',13)
> 
> Which gives with fltk:
> 
> http://octave.1599824.n4.nabble.com/file/n4417375/test_fltk.jpg 
> 
> and with gnuplot:
> 
> http://octave.1599824.n4.nabble.com/file/n4417375/test_gnuplot.jpg 
> 
> Thanks,
> 
> Arnaud

Thanks. The problem is with single precision.

        median (diff (xdata) ./ median (xdata))
        ans =  1.3607e-08
        eps single
        ans =  1.1921e-07

You can work around it by ...

        xtick = get (gca, "xtick");
        xticklabel = get (gca, "xticklabel");
        limits = axis () - median (xdata) * [1, 1, 0, 0];
        xtick = xtick - median (xdata);
        xdata = xdata - median (xdata);
        plot (xdata (~isnan (ydata)), ydata (~isnan (ydata)))
        set (gca, "xtick", xtick, "xticklabel", xticklabel)
        axis (limits) 

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]