Re: colorbar positioning in postscript [message #51327] |
Mon, 13 November 2006 09:16 |
jesscobrien
Messages: 6 Registered: August 2006
|
Junior Member |
|
|
It just had a very silly error.
Was using
pos_image = [0.15,0.15,0.75,0.95]
pos_bar = [0.75,0.2,0.85,0.8]
when x and y span of pos_image should have been the same as the image
is square and I call tvimage with /keep_aspect_ratio. ie. I should have
used:
pos_image = [0.15,0.2,0.75,0.8]
pos_bar = [0.75,0.2,0.85,0.8]
Sorry for all the hassle. Thanks for writing the psconfig package. I'm
sure I will use it many a time in future.
- Jess
|
|
|
Re: colorbar positioning in postscript [message #51330 is a reply to message #51327] |
Mon, 13 November 2006 08:17  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
jesscobrien@gmail.com writes:
> Originally I tried writing to postscript using these normalised
> positions, but didnt realise I needed to get the size of the postscript
> window right. So have removed my rescaling of the positions. And set my
> postscript window size such that it has the same aspect ratio as the
> image + colorbar combined. However this aspect ratio doesnt cater for
> the axis annotations of the image and colorbar, which change the aspect
> ratio, so my PS version shows the colorbar oversized relative to the
> image. How can I get the full region of my image and colorbar,
> including the space taken up by annotations, so that I can set the PS
> size with the correct aspect ratio?
Say what!? :-(
Here is how I do this, assuming I have just displayed my
graphics in a window on my display to see how it all looks,
with my graphics display command DoMyThingHere:
; Set up PS with same aspect as display window
keywords = PSConfig(_Extra=PSWindow(), CANCEL=cancelled)
IF ~cancelled THEN BEGIN
thisDevice = !D.Name
thisFont = !P.Font
!P.Font = 1
Set_Plot, 'PS'
Device, _Extra=keywords
DoMyThingHere
Device, /Close
!P.Font = thisFont
Set_Plot, thisDevice
ENDIF
Perhaps this is a problem with how DoMyThingHere is
written. I don't know. I've just never run into the
problems you seem to be having.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: colorbar positioning in postscript [message #51332 is a reply to message #51330] |
Mon, 13 November 2006 07:51  |
jesscobrien
Messages: 6 Registered: August 2006
|
Junior Member |
|
|
Hi David,
> Both of
> those routines were written expressly so that you
> do NOT have to do anything different to get them
> to work in PostScript.
>
> I simply make my PostScript "window" the right size,
> and just call the same routine that places the graphics
> in the display window. If graphics are placed with
> normalized or data coordinates, they should show up
> in the same locations in both windows.
Originally I tried writing to postscript using these normalised
positions, but didnt realise I needed to get the size of the postscript
window right. So have removed my rescaling of the positions. And set my
postscript window size such that it has the same aspect ratio as the
image + colorbar combined. However this aspect ratio doesnt cater for
the axis annotations of the image and colorbar, which change the aspect
ratio, so my PS version shows the colorbar oversized relative to the
image. How can I get the full region of my image and colorbar,
including the space taken up by annotations, so that I can set the PS
size with the correct aspect ratio?
Thanks,
Jess
|
|
|
Re: colorbar positioning in postscript [message #51334 is a reply to message #51332] |
Mon, 13 November 2006 06:38  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jess writes:
> I am using David Fannings colorbar routine to place a colorbar on the
> RHS of my image which I want to write to postscript. Positioning both
> image and colorbar in normalised coords (using tvimage for the image).
> Thanks David for the great routines tvimage and colorbar. When writing
> to PS device, I am scaling the positions from normalised coords to the
> size of the PS image, but this is causing a call to axis in colorbar
> to crash with:
>
> % AXIS: Data coordinate system not established.
> % Error occurred at: COLORBAR 353
> /usr/local/rsi/add-ons/fanning/colorbar.pro
>
> Can someone point out where I went wrong?
I think you went wrong when you thought you needed
to do something different for PostScript. Both of
those routines were written expressly so that you
do NOT have to do anything different to get them
to work in PostScript.
I simply make my PostScript "window" the right size,
and just call the same routine that places the graphics
in the display window. If graphics are placed with
normalized or data coordinates, they should show up
in the same locations in both windows.
Have you tried this simpler approach?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|