[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Controlling axis labels in IDL plots?
- To: Rachel Howe <rhowe(at)noao.edu>
- Subject: Re: Controlling axis labels in IDL plots?
- From: "Liam E.Gumley" <Liam.Gumley(at)ssec.wisc.edu>
- Date: Thu, 13 Apr 2000 12:39:20 -0500
- Newsgroups: comp.lang.idl-pvwave
- Organization: Space Science and Engineering Center, UW-Madison
- References: <38F513D6.BE45C14@noao.edu>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:19257
Rachel Howe wrote:
> I'm getting very finicky about my IDL plots. (I use direct graphics
> only, no objects --
> conceptually I'm still in the v3.6 era).
> I've learned to use the !p, !x and !y system variables, their associated
> and the axis command, to override most of the defaults, but one thing
> eludes me.
> Does anyone know how the distance of the axis label from the axis is
> determined in a single-panel 2d plot?
> There doesn't seem to be any way to control it directly, but it must be
> some arcane function of the plot area, position/margin settings, and
> character size. If anyone knows an algorithm, I'd be delighted to hear
> Or would it be easier to give up and just use
> XYOUTS to put the annotations where I want them?
Here's a quick and dirty method which can be used to push the X and Y
axis labels further away from the axes using the !C (carriage return)
font positioning code:
;- Set a reasonable character size and create data
device, set_character_size=[10, 12]
x = findgen(200) * 0.1
y = sin(x)
;- Default axis label positions
plot, x, y, xtitle='X AXIS', ytitle='Y AXIS'
;- Move X axis label down one character
IDL> plot, x, y, xtitle='!CX AXIS', ytitle='Y AXIS'
;- Move Y axis lable left one character
IDL> plot, x, y, xtitle='X AXIS', ytitle='Y AXIS!C'
I find this particularly useful when adding titles to maps which have a
map_set, -30, 130, scale=40e6, $
xmargin=[2, 2], ymargin=[2, 4], title='MAP TITLE!C'
map_grid, /box, charsize=0.75
Unless you add the trailing !C to the title, it is displayed at the same
height as the top row of longitude labels. If this method doesn't suit
your needs, I think you will have to resort to manually positioned