comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Overlaying axes on an image?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Overlaying axes on an image? [message #3380] Fri, 13 January 1995 09:48
sbarrkum is currently offline  sbarrkum
Messages: 5
Registered: August 1994
Junior Member
Heres a procedure for creating image overlaid with plot area
and a color bar based on data.
1) Note if a image s placed after the plot it will erase
the plot. Therefore place image first and then the plot(axes).

2)If a window device is used (non strechable/scalable) pixels
the image has to be first resized to size require. I've defined
the size required in normal coordinates

3) Windows does not allow values more than 234 0-234 color. Hence the
scaling of the image to a top value of 234.

Hope this helps
barr-kum
-=======================

pro mak_plot, filename, x1,y1,x2,y2

; A procedure to resize a image to specified size x1, y1..
; in normal coordinates and put a plot around it
; and a color bar


pict=bytarr(26,14) ; array to hold the image


openr, unit1, filename, /get_lun
; Read the array
readu,unit1, pict
close, unit1 & free_lun, unit1

tmin=min(pict)
tmax=max(pict)

arr_size=convert_coord(x2-x1,y2-y1,/Normal, /To_device)
if arr_size(0) gt 1000.0 then arr_size(0)=26.0 * 50.0 ; this in case postscript
if arr_size(1) gt 700.0 then arr_size(1)=14.0 * 20.0 ; which will give really large sizes
img=congrid(pict,arr_size(0),arr_size(1))

tv, bytscl(img, tmin, tmax, top=255),x1, y1, /Normal, $
xsize = x2-x1, ysize = y2-y1


;Plot lat long grid and Manus coast line
plot,[140.5, 164.5], [-5.5,6.5], /Nodata, Xrange=[140.5, 164.5],YRange = [-5.5,6.5], $
/NOERASE, Linestyle=0, thick =3, XStyle=1 , Ystyle=1, color=backcolor, $
position=[x1,y1,x2,y2], charsize=0.6




;Place color bar

x1=x2+0.07 & y1=y1
x2=x2+0.14 & y2=y2

x = findgen(255) ; was 246
colour_bar=intarr(2,255)
colour_bar(0,0:*)=x
colour_bar(1,0:*)=x
arr_size=convert_coord(x2-x1,y2-y1,/Normal, /To_device)
if arr_size(0) gt 1000.0 then arr_size(0)=24.0 * 20.0
if arr_size(1) gt 700.0 then arr_size(1)=12.0 * 20.0
colour_bar=congrid(colour_bar,arr_size(0),arr_size(1))

tv, bytscl(color_bar, tmin, tmax, top=255), x1, y1, /Normal, xsize = x2-x1, ysize = y2-y1

plot,[0.0,1.0], [tmin, tmax], /Nodata, Xrange=[0.0,1.0],YRange = [tmin, tmax], $
/NOERASE, Linestyle=0, thick=3, XStyle=1, Ystyle=1, color=backcolor, $
position=[x1,y1,x2,y2], xticks=1, xcharsize=.001, YTitle=bar_YTitle, $
charsize=0.8


end
--

____________________________________________________________ ________
| Sereno A. Barr-Kumarakulasinghe | sbarrkum@ic.sunysb.edu |
| Marine Sciences Research Center | |
| State University of New York | |
| Stony Brook, NY 11794-5000 | |
|___________________________________________________________ ________ |
Re: Overlaying axes on an image? [message #3394 is a reply to message #3380] Tue, 10 January 1995 13:20 Go to previous message
n9140397 is currently offline  n9140397
Messages: 13
Registered: July 1994
Junior Member
In article <3esh5d$nqk@mojo.eng.umd.edu> lpoon@Glue.umd.edu (Leon Poon) writes:
> Ok, here's the gist of the problem: I have a simple image (binary)
> file in which I want to overlay x and y axis. So, what commands
> should I use after, say "tvscl, imagearray", to annotate the
> image with x and y axis (with the ranges of my choosing, of course)?

After TVing the plot, try

contour, /nodata, /noerase, [axis data and stuff here --
see contour command in manual and graphics keywords]

and then put on whatever options. You'll probably have
to set !p.position, too, before you TV the image so that it
all goes into the right place.

good luck,
mike

+-----------------------------------+----------------------- ------------+
| Michael Hamilton | Internet: hamilton@mungu.ucsd.edu |
| Climate Research Division | voice: (619) 534-0855 |
| Scripps Institute of Oceanography | |
+-----------------------------------+----------------------- ------------+
Re: Overlaying axes on an image? [message #3395 is a reply to message #3394] Tue, 10 January 1995 13:02 Go to previous message
kennealy is currently offline  kennealy
Messages: 11
Registered: August 1994
Junior Member
lpoon@Glue.umd.edu (Leon Poon) writes:

> Ok, here's the gist of the problem: I have a simple image (binary)
> file in which I want to overlay x and y axis. So, what commands
> should I use after, say "tvscl, imagearray", to annotate the
> image with x and y axis (with the ranges of my choosing, of course)?

Just add the /NOERASE option to your plot command!

Regards,
Jack

--
============================================================ ===
Dr. Jack Kennealy, Nashua, NH kennealy@mv.mv.com
============================================================ ===
Re: Overlaying axes on an image? [message #3396 is a reply to message #3395] Tue, 10 January 1995 07:19 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
lpoon@Glue.umd.edu (Leon Poon) writes:

> Hi,

> I have a fairly simple problem, and I will probably find the
> right combination of commands if I stare at the IDL manuals
> long enough...but probably not since I have already struggled
> with the manuals for a couple of hours now.

> Ok, here's the gist of the problem: I have a simple image (binary)
> file in which I want to overlay x and y axis. So, what commands
> should I use after, say "tvscl, imagearray", to annotate the
> image with x and y axis (with the ranges of my choosing, of course)?

I have some software which will do this for you. The simplest is
plot_image.pro. You can download it from

ftp://idlastro.gsfc.nasa.gov/contrib/thompson

You'll need two of the subdirectories under there, image_display and
graphics_devices. The two LaTeX files explain what these do.

Bill Thompson
Re: Overlaying axes on an image? [message #3398 is a reply to message #3396] Tue, 10 January 1995 00:10 Go to previous message
uphlabh is currently offline  uphlabh
Messages: 8
Registered: December 1994
Junior Member
In article <3esh5d$nqk@mojo.eng.umd.edu>, Leon Poon <lpoon@Glue.umd.edu> wrote:
>
> Ok, here's the gist of the problem: I have a simple image (binary)
> file in which I want to overlay x and y axis. So, what commands
> should I use after, say "tvscl, imagearray", to annotate the
> image with x and y axis (with the ranges of my choosing, of course)?
>
Is this a new sweepstakes entry? Can I try?

First -- plot up a graph of anything you like in a window with the axes
defined however you want, with the ranges just so...

THEN: tvscl, imagearray, xoff=xxx, yoff=yyy

...such that your image just fills the plot window. This is a hack way
of doing it, but if I needed it done NOW, and I was only doing it once,
that's probably how I would approach it. I haven't checked, but there's
probably a graphics keyword you can use to specify just how many pixels
long and high your axes will be. You can then tvrd() your composite
image.

Good luck,

Brian
handy@sxt4.oscs.montana.edu
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Tip for matching BEGIN/ENDs in editors.--Fixed DIAGRAMI
Next Topic: Re: Color Postscript output

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 07:45:42 PDT 2025

Total time taken to generate the page: 0.23946 seconds