plot cos(x)-2
I want the x-y axis and tick marks to be displayed in the center of
the plot (not the borders). I don't see how to do this easily, so I'm
trying to create these axes using arrows, as follows:
unset border
set format x ""
set format y ""
ymax = 1.2
ymin = -ymax
yoffset = -2.0
ymax = ymax + yoffset
ymin = ymin + yoffset
set yrange [ymin:ymax]
set style arrow 1 head filled size screen 0.02,25,45 lt -1 lw 0.5
set arrow from xmin,yoffset to xmax+0.05*(xmax-xmin),yoffset as 1
set arrow from 0,ymin to 0,ymax+0.1 as 1
This works fine, but when it comes to plotting the xtick marks, they
appear on the border, not the x-arrow that I've created. That's
reasonable behavior.
There must be an easier way of doing this. Helpful tips much
appreciated. Should I be using zeroaxis? Can I use zeroaxis with
some kind of offet, so that the xzeroaxis is set at y=-2?
Regards, Darren
> plot cos(x)-2
>
> I want the x-y axis and tick marks to be displayed in the center of
> the plot (not the borders).
And what on earth would you want to be doing that for?
IMHO, zero-axes are problematic enough when there's a valid excuse for
putting them in the middle of the graph --- zero is a bit of a special
position on axes after all. But putting axes in the middle of nowhere
when it's not even the _middle_ of somewhere makes no sense at all.
> set style arrow 1 head filled size screen 0.02,25,45 lt -1 lw 0.5
> set arrow from xmin,yoffset to xmax+0.05*(xmax-xmin),yoffset as 1
> set arrow from 0,ymin to 0,ymax+0.1 as 1
You're trying way too hard. Re-read "help set arrow" and follow the
link to "help coordinates" to see how this:
set arrow from 0, graph 0 to 0, graph 1.0
works.