text positioning within multiple plots [message #54709] |
Tue, 10 July 2007 07:38  |
rkombiyil
Messages: 59 Registered: March 2006
|
Member |
|
|
May be this is already been discussed or trivial. In any case, I have
multiple plots that go into same page, and I would like to position
text within each of these sub windows, as they are plotted from within
a loop, while using !p.multi.
What is the best way to do it? For example, I have !
p.multi=[0,2,7,0,1]. Say, I would like to put the station codes inside
each of these 14 subwindows. I tried 'xyouts' with a bunch of
combinations, but didn't work. I was thinking that when we use default
data coordinates, then if we specify the location of each call to
xyouts based on "data" specific to that window, then it should put the
text at the correct location within that specific window. But it's
not?! :-( Appreciate any help.
TIA,
/rk
|
|
|
|
Re: text positioning within multiple plots [message #54833 is a reply to message #54709] |
Wed, 11 July 2007 05:03  |
rkombiyil
Messages: 59 Registered: March 2006
|
Member |
|
|
On Jul 11, 6:14 pm, Craig Markwardt
<craigm...@REMOVEcow.physics.wisc.edu> wrote:
> I use the following tricks to position text on a plot, say in the
> upper right hand corner.
>
> xyouts, !x.crange(1), !y.crange(1), /data, '!C!CMy Label ', align=1.0
------------------------------------------------------------ --------------
Awesome :-) Thanks Craig, I tweaked it for my needs, works like a
charm.
You saved me lots of time. I hope this comes out cool :D As a token of
gratitude, The "cowsay"s it all :-) Don't remove the "cow" :-)
< Craig ROCKS! >
--------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
|
|
|
Re: text positioning within multiple plots [message #54835 is a reply to message #54709] |
Wed, 11 July 2007 02:14  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
metachronist <rkombiyil@gmail.com> writes:
> On Jul 10, 11:50 pm, David Fanning <n...@dfanning.com> wrote:
>
>> Well, I expect this is pilot error. Exactly *when*
>> are you calling your XYOUTS command? If you do it
>> directly after you draw each plot, I think it can't
>> help but go in the right place. :-)
>
> Thank you gentlemen :-) for taking time off to reply.
> It sure was pilot error, for two reasons:
>
> 1. I wanted to look at particular window in the time series and in my
> call to xyouts for specifying "Y" position, I used "max" of the whole
> range instead of the required window.
>
> 2. The range in Y varies from station to station, so I just had to
> figure out an optimum way for the Y position.
> Problem solved after the morning cup of coffee :-)
I use the following tricks to position text on a plot, say in the
upper right hand corner.
xyouts, !x.crange(1), !y.crange(1), /data, '!C!CMy Label ', align=1.0
Explanation
* the !X and !Y CRANGE values position the text cursor in the upper
right hand corner to begin with;
* the "!C!C" embedded format code causes the text cursor to drop down
two text lines (!C = carriage return) to provide a nice top margin;
* the ALIGN=1.0 causes the text to be right justified;
* and the extra spaces at the end of the label puts some margin on the
right side as well.
After some fiddling with the number of !C's and spaces, this looks
great, and is totally independent of the X or Y data ranges. Of
course some small tweaking is required if the plot is log-scale.
The technique is easily adapted to any position on the plot, for
example center-top would be,
xyouts, total(!x.crange)/2, !y.crange(1), /data, ....
Happy plotting!
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|