Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Position of Yaxis

2,424 views
Skip to first unread message

peter

unread,
Sep 21, 2008, 5:20:14 PM9/21/08
to
I am plotting data which has an x-range of -15 to 50. Gnuplot seems to
want to place the y-axis always on the left hand side at x=-15. Is it
possible to delete this axis and have it properly located with
annotation at x=0

Ethan Merritt

unread,
Sep 21, 2008, 7:42:34 PM9/21/08
to
peter wrote:

set border 0
set yzeroaxis
set xzeroaxis

peter

unread,
Sep 22, 2008, 2:45:36 PM9/22/08
to
On Sep 22, 12:42 am, Ethan Merritt <emerr...@eskimo.com.invalid>
wrote:

thx, but doent seem to work, just puts a dotted line at x=0 and y=o,
also y axis annotation is stll on left hand side at x=-15

Hans-Bernhard Bröker

unread,
Sep 22, 2008, 6:36:32 PM9/22/08
to

I have to protest the assertion of this being the "proper" location for
axes. Yes, I'm aware it's taught that way in many schools worldwide.
But that doesn't change the fact that it's a stupid choice.

First off, there's the massive issue that zero could be arbitrarily far
outside the range of plotted data --- so how can zero be the "proper"
location for the axis if that puts it 500 miles outside the plot?

But even if we set that aside, it's just plain silly to put axes and all
their decorations in the middle of the plot, where they'll have to fight
for space with the actual data. You end up with data hiding the tick
labels, tick labels hiding data, or both. Humans with practically
infinite amounts of time at their hands may be able to handle such
conflicts nicely --- a computer generally can't.

Ethan Merritt

unread,
Sep 22, 2008, 10:21:38 PM9/22/08
to
peter wrote:

> On Sep 22, 12:42 am, Ethan Merritt <emerr...@eskimo.com.invalid>
> wrote:
>> peter wrote:
>> > I am plotting data which has an x-range of -15 to 50. Gnuplot seems
>> > to want to place the y-axis always on the left hand side at x=-15.
>> > Is it possible to delete this axis and have it properly located
>> > with annotation at x=0
>>
>> set border 0
>> set yzeroaxis
>> set xzeroaxis
>
> thx, but doent seem to work, just puts a dotted line at x=0 and y=o,

??? I thought that's what you wanted.
Please state more clearly what you would like, so we can
suggest how to do it.

> also y axis annotation is stll on left hand side at x=-15

Please read the help sections for "set xtics" "set border"
"set xzeroaxis" and "linetype".

You probably want some variant on
set ytics axis
set yzeroaxis linetype 1 linecolor rgb "black"
set border 0

and so on.

peter

unread,
Sep 23, 2008, 2:54:23 PM9/23/08
to

In response to Hans's comments I am afraid that I don't agree , It is
important in some case to easily see from a gtaph those values which
are in the +ve or -ve segment as they sometimes have real physical
significance, It is much easier to see the relevance of these values
if the axes are in this case at x=0 y=0. In general I have plotted
many graphs where the axis has been at say an arbitaary x or y
value .For example an x-axis drawn at y= -1 , where the -1 has real
physical significance.
I agree to put a y axis at x=0 when the x-values range from 1000 to
2000 say would not be sensible, but couls be at x=1500.

Thanks for your help Ethan, what I am looking for , to expand on the
above comments is the ability to put fully annotated axes at any
arbitary x or y value and not at the boundary of the plot, In my
particular case the x values range from -15 to 50, I would like a
fully annotated y-axis at x=0 , and not at the present position of x=
-15. (i.e the boundary), the use of yzeroaxis, with correct line
weight just gives a vertical line, with no annotation. I find this
strange as all other packages i have used allow the user to position
the axes wherever they like. I hope this describes what i am after

sfeam

unread,
Sep 23, 2008, 4:49:36 PM9/23/08
to
peter wrote:

> On Sep 23, 3:21 am, Ethan Merritt <emerr...@eskimo.com.invalid> wrote:
>> peter wrote:
>> > On Sep 22, 12:42 am, Ethan Merritt <emerr...@eskimo.com.invalid>
>> > wrote:
>> >> peter wrote:
>> >> > I am plotting data which has an x-range of -15 to 50. Gnuplot seems
>> >> > to want to place the y-axis always on the left hand side at x=-15.
>> >> > Is it possible to delete this axis and have it properly located
>> >> > with annotation at x=0
>>
>> >> set border 0
>> >> set yzeroaxis
>> >> set xzeroaxis
>>
>> > thx, but doent seem to work, just puts a dotted line at x=0 and y=o,
>>
>> ??? I thought that's what you wanted.
>> Please state more clearly what you would like, so we can
>> suggest how to do it.
>>
>> > also y axis annotation is stll on left hand side at x=-15
>>
>> Please read the help sections for "set xtics" "set border"
>> "set xzeroaxis" and "linetype".
>>
>> You probably want some variant on
>> set ytics axis
>> set yzeroaxis linetype 1 linecolor rgb "black"
>> set border 0

> Thanks for your help Ethan, what I am looking for , to expand on the


> above comments is the ability to put fully annotated axes at any
> arbitary x or y value and not at the boundary of the plot, In my
> particular case the x values range from -15 to 50, I would like a
> fully annotated y-axis at x=0 , and not at the present position of x=
> -15. (i.e the boundary), the use of yzeroaxis, with correct line
> weight just gives a vertical line, with no annotation. I find this
> strange as all other packages i have used allow the user to position
> the axes wherever they like. I hope this describes what i am after

Did you actually try the commands I suggested above?
They should produce the result that you are describing.
You may still want to further adjust the appearance of the
tickmarks themselves, or the label format + offset, etc, etc.

Setting the axis to some arbitrary place other than 0 or the current
edge of the plot is difficult at best. I would probably leave the
true axis at 0, but hide this by a using an explicit coordinate transform
while plotting.

peter

unread,
Sep 23, 2008, 5:37:06 PM9/23/08
to

Hi,
Yes just tried it, worked great, sorry i missed your reply before,
all i now need to do is work out how to put the border back with no
annotation on it, Many thanks

0 new messages