Re: axis and the like [message #10432] |
Fri, 05 December 1997 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Kevin Ivory and Tim Osborn both came up with the same
method for suppressing axis labels. Kevin wrote:
> Just for the records: there is another way of doing it
>
> Use XTICKFORMAT='NOLABEL'
>
> and keep the function NOLABEL somewhere:
>
> function NOLABEL, axis, index, value
> ; function for the graphics keyword tickformat
> ; returns an empty string for no tick annotation
> return, ''
> end
This is a method I should have thought of myself. :-)
But what I've always done (and I am ashamed to say I
don't even *really* know why it works) is this:
Plot, data, XTickformat='(A1)'
Nuts, now I'm going to have to think up a new question
for admission into the IDL Expert Programmers Association. :-(
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: axis and the like [message #10435 is a reply to message #10432] |
Fri, 05 December 1997 00:00  |
f055
Messages: 29 Registered: April 1995
|
Junior Member |
|
|
-The other thing I came across today again (it happens about once every
-two months, but I always forget the solution to it) is how to switch off
-the axis labeling (answer: [xyz]tick... -see, I forgot again- ...name =
-replicate(" ",30) ). This is useful if one wants to stack a few plots
-that share a common x axis and display different species or the same
-species at different altitudes etc. Wouldn't it be nice to have a simple
-/NOLABEL option with the plot command ? In fact, this would have one
-other advantage (or do I miss something here?): If you loop through your
-plots, you could write something like:
-
- for i=0,nplots-1 do begin
- !p.position=[llx,lly(i),llx+wx,lly(i)+wy]
- if (i eq 0) then nolabel=0 else nolabel=1
- plot,x,y(i,*),...,nolabel=nolabel
- endfor
-
-I don't see any way how one could do this now, except copying the plot
-command with all the thousand parameters and have one including the
-tickname statement and the other without.
The way I do it is (if I want a stack of plots with just the last one
having a labelled x-axis):
!y.margin=[0,0]
!y.omargin=[4,2]
for i = 0 , nplots-1 do begin
if !p.multi(0) eq 1 then xtf='nolabels' else xtf=''
plot,x,y(i,*),...,xtickformat=xtf
endfor
and I have the following function in my IDL library directory:
function nolabels,axis,index,value
return,' '
end
Not quite as good as a /nolabels option, but it's easier to remember than
other methods
Tim
......................... Dr Tim Osborn . t.osborn@uea.ac.uk
.... ___/.. __ /.. /.. /. Senior Research Associate . phone:01603 592089
... /..... /. /.. /.. /.. Climatic Research Unit . fax: 01603 507784
.. /..... __/.. /.. /... School of Environmental Sciences.
. /..... /\ ... /.. /.... University of East Anglia .
____/.._/..\_..____/..... Norwich NR4 7TJ .
......................... UK .
|
|
|
Re: axis and the like [message #10436 is a reply to message #10432] |
Fri, 05 December 1997 00:00  |
Kevin Ivory
Messages: 71 Registered: January 1997
|
Member |
|
|
Martin Schultz wrote:
>
> The other thing I came across today again (it happens about once every
> two months, but I always forget the solution to it) is how to switch off
> the axis labeling (answer: [xyz]tick... -see, I forgot again- ...name =
> replicate(" ",30) ). This is useful if one wants to stack a few plots
Just for the records: there is another way of doing it
Use XTICKFORMAT='NOLABEL'
and keep the function NOLABEL somewhere:
function NOLABEL, axis, index, value
; function for the graphics keyword tickformat
; returns an empty string for no tick annotation
return, ''
end
> that share a common x axis and display different species or the same
> species at different altitudes etc. Wouldn't it be nice to have a simple
> /NOLABEL option with the plot command ? In fact, this would have one
> other advantage (or do I miss something here?): If you loop through your
> plots, you could write something like:
>
> for i=0,nplots-1 do begin
> !p.position=[llx,lly(i),llx+wx,lly(i)+wy]
> if (i eq 0) then nolabel=0 else nolabel=1
> plot,x,y(i,*),...,nolabel=nolabel
> endfor
>
> I don't see any way how one could do this now, except copying the plot
> command with all the thousand parameters and have one including the
> tickname statement and the other without.
/NOLABEL would be nice, but of course it is possible to have a single plot
command:
label = [[replicate( '', 30)], $ ; label(*,0) gives you default
[replicate(' ', 30)]] ; label(*,1) gives you /nolabel
for i = 0, nplots-1 do begin
plot, x, y(i,*), $
position=[llx,lly(i),llx+wx,lly(i)+wy] $ ; ;-)
; ..., $ ; all the thousand parameters
xtickname=label(*,i eq 0)
endfor
Learn something new in IDL every day :-)
Kevin
--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
|
|
|