Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3022

Re: Xtics offset

From Janis Papanagnou <janis_papanagnou@hotmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Xtics offset
Date 2015-08-16 01:04 +0200
Organization Aioe.org NNTP Server
Message-ID <mqoghv$jou$1@speranza.aioe.org> (permalink)
References <mqlvnt$amq$1@speranza.aioe.org>

Show all headers | View raw


On 15.08.2015 02:05, Janis Papanagnou wrote:
> I have tabular data of amount values to be plotted over time. I use
> 
>   set xdata time
>   set format x "%Y"
>   set xlabel "Date"
>   set mxtics 0
> 
> Unfortunately the date labels are not placed centered (to visualize that
> the whole range from 1st Jan to 31st Dec belongs to the respective year)
> 
>   |----|----|----|
>    2009 2010 2011
> 
> but rather the year labels are placed at (virtually) 1st Jan
> 
>   |----|----|----|
>  2009 2010 2011
> 
> So I worked around the issue with 'set xtics ... offset ...'.
> 
> The problem I am facing is that the effect of any hard coded offset will
> depend on the number of data on the xaxis; i.e. with a data range of e.g.
> 15 years the date labels will be placed too far to the right
> 
>   |----|----|----|
>     2009 2010 2011
> 
> while with a data range of e.g. six years the date labels will be placed
> too far to the left
> 
>   |----|----|----|
>   2009 2010 2011
> 
> As initially mentioned I want the labels centered. How can I achieve that?

Some more trial and error gave me these insights:

In my very first approach (where I started) I had defined

   set xtics 31536000 offset first 15768000

which had been fine, until I added a a logarithmic Y-axis

   set logscale y

which gave me this error

   line 0: ytics has y coord of 0; must be above 0 for log scale!

That error vanished after I removed the 'first' offset specifier

   set xtics 31536000 offset 5

which has the reported problem of being dependent of the number of dates on
the X-axis.

To sum up: Introduction of the 'logscale' for Y-axis made it impossible to
use the 'offset first' specifier for the X-axis without getting above error.

Now I am confused. The defaults for 'ytics' works fine with *linear* Y-axis.
And the defaults for 'ytics' works also fine with an X-axis *without X-axis
offset* and *logarithmic* Y-axis. But it does *not* work with X-axis 'offset'
and logarithmic Y-axis. Note the dependency of X-axis and Y-axis definitions!
(I abstain to comment on intuitive behaviour here, beyond that the defaults
seem not be well defined.) It seems in this case I need to specify explicitly
the 'ytics' to prevent that error wich 'logscale y' and 'xtics offset first'.
(I couldn't find a working 'ytics' setting, though. Hmm..)

Janis

> 
> I'm using gnuplot 4.4 PL2
> 
> Thanks!
> 
> Janis
> 

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-15 02:05 +0200
  Re: Xtics offset Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-08-15 12:34 +0200
    Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-15 12:57 +0200
      Re: Xtics offset Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-08-15 21:38 +0200
        [meta] Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-15 23:34 +0200
      Re: Xtics offset Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-08-16 00:57 +0200
        Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-16 01:15 +0200
          Re: Xtics offset Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-08-16 01:59 +0200
  Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-16 01:04 +0200
    Re: Xtics offset Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-08-16 01:11 +0200
      Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-16 01:22 +0200
        Re: Xtics offset Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-08-16 01:57 +0200
          [meta] Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-16 14:03 +0200
            Re: [meta] Re: Xtics offset Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-08-16 14:49 +0200
              Re: [meta] Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-16 15:35 +0200
                Re: [meta] Re: Xtics offset Ethan A Merritt <merritt@u.washington.edu> - 2015-08-17 10:26 -0700
                Re: [meta] Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-17 21:27 +0200
        Re: Xtics offset Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-08-16 02:19 +0200
          Re: Xtics offset Janis Papanagnou <janis_papanagnou@hotmail.com> - 2015-08-16 14:22 +0200

csiph-web