Multiple images in the same Window [message #85563] |
Fri, 16 August 2013 08:55  |
Cornelio Zolin
Messages: 5 Registered: August 2013
|
Junior Member |
|
|
Hi all,
I’m trying to plot 7 images (columns) in the same window to analyze them together. Using the code bellow I can display the images, but they didn’t appear side by side, instead they overlay one another (I think that’s why I can see just one).
In the IDL.Docs we have some ideas about how to do this using the CURRENT property, but I couldn’t figure out how to put this in the code.
Can anyone help on that?
Thanks a lot.
Zolin
Pro MultImage
compile_opt idl2
catch, error
if error ne 0 then begin
!null = dialog_message('Try again, we found problems')
return
endif
;Find all the .dat files in that folder
Thesefiles=file_search('C:\Anomalies\*.dat',count=numfiles)
Print, 'Number of Files:', numFiles
FOR i=0,numFiles-1 DO BEGIN
OpenR, lun, theseFiles[i], /Get_Lun
File = fltarr(620, 500)
ReadU, lun, File
Free_Lun, lun
Pfile = Image(File,/CURRENT, LAYOUT=[[7,1,1],[7,1,2],[7,1,3], [7,1,4], [7,1,5], [7,1,6], [7,1,7]],$
MARGIN=[?, ?, ?, ?])
POSITION= ??
free_lun, lun
ENDFOR
END
|
|
|
Re: Multiple images in the same Window [message #85564 is a reply to message #85563] |
Fri, 16 August 2013 09:02   |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
You can set the system variable !p.multi to set the number of plots to shown in a single window. Here is an excerpt from the IDL online help for the plot procedure (it is probably elsewhere too):
Multiple Plots on a Page
Plots can be grouped on the display or page in the horizontal and/or vertical directions using the system variable field !P.MULTI. IDL sets the plot window to produce the given number of plots on each page and moves the window to a new sector at the beginning of each plot. If the page is full, it is first erased. If more than two rows or columns of plots are produced, IDL decreases the character size by a factor of 2.
!P.MULTI controls the output of multiple plots. Set !P.MULTI equal to an integer vector in which:
The first element of the vector contains the number of empty sectors remaining on the page. The display is erased if this field is zero when a new plot is begun.
The second element of the vector contains the number of plots per page in the horizontal direction.
The third element contains the number of plots per page in the vertical direction.
The fourth element contains the number of plots stacked in the Z dimension.
The fifth element controls the order in which plots are drawn. Set the fifth element equal to zero to make plots from left to right (column major), and top to bottom. Set the fifth element equal to one to make plots from top to bottom, left to right (row major).
Omitting any of the five elements from the vector is the same as setting that element equal to zero.
For example, to set up two plots vertically on each page, use the following statement:
!P.MULTI = [0, 1, 2]
Note that the first element, !P.MULTI (0), is set to zero to cause the next plot to begin a new page. To make four plots per page with two columns and two rows, use the following statement:
!P.MULTI = [0, 2, 2]
To reset to the default of one plot per page, set the value of !P.MULTI to 0, as shown in the following statement:
!P.MULTI = 0
So, if you have 7 images, you might want to try setting !p.multi=[0,4,2] before your first plot of the 7, which will give you 2 rows of 4 plots each. If you don't supply position arguments, IDL will automagically order them for you in the window (left-right, then top-bottom). The caveat here is that I have not used the new function graphics in IDL 8, which is what it looks like you may be using, so I don't know if additional information is needed for that.
So you might try:
!p.multi=[0,4,2] ; Set up 4x2 plots per window
for n=0,6 do begin ; Loop over your 7 variables
(plot code here)
endfor
!p.multi=0 ; Resets to default settings
Andy
On Friday, August 16, 2013 11:55:55 AM UTC-4, Cornelio Zolin wrote:
> Hi all,
>
> I’m trying to plot 7 images (columns) in the same window to analyze them together. Using the code bellow I can display the images, but they didn’t appear side by side, instead they overlay one another (I think that’s why I can see just one).
>
> In the IDL.Docs we have some ideas about how to do this using the CURRENT property, but I couldn’t figure out how to put this in the code.
>
>
>
> Can anyone help on that?
>
>
>
> Thanks a lot.
>
>
>
> Zolin
>
>
>
> Pro MultImage
>
>
>
> compile_opt idl2
>
>
>
> catch, error
>
> if error ne 0 then begin
>
> !null = dialog_message('Try again, we found problems')
>
> return
>
> endif
>
>
>
> ;Find all the .dat files in that folder
>
>
>
> Thesefiles=file_search('C:\Anomalies\*.dat',count=numfiles)
>
> Print, 'Number of Files:', numFiles
>
>
>
> FOR i=0,numFiles-1 DO BEGIN
>
> OpenR, lun, theseFiles[i], /Get_Lun
>
> File = fltarr(620, 500)
>
> ReadU, lun, File
>
> Free_Lun, lun
>
>
>
> Pfile = Image(File,/CURRENT, LAYOUT=[[7,1,1],[7,1,2],[7,1,3], [7,1,4], [7,1,5], [7,1,6], [7,1,7]],$
>
> MARGIN=[?, ?, ?, ?])
>
> POSITION= ??
>
>
>
> free_lun, lun
>
>
>
> ENDFOR
>
> END
|
|
|
Re: Multiple images in the same Window [message #85565 is a reply to message #85563] |
Fri, 16 August 2013 11:42   |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
You're going to need to make separate call for each image - LAYOUT should be a three element array:
http://www.exelisvis.com/docs/IMAGE.html#LAYOUT
So, something like this:
pfile = IMAGE(file, LAYOUT=[7, 1, 1], MARGIN=0)
pfile = IMAGE(file, LAYOUT=[7, 1, 2], MARGIN=0, /CURR)
pfile = IMAGE(file, LAYOUT=[7, 1, 3], MARGIN=0, /CURR)
....
will tile the the same image in a row. You don't want to use both LAYOUT and POSITION keywords - LAYOUT is ignored if you do.
|
|
|
Re: Multiple images in the same Window [message #85570 is a reply to message #85565] |
Sat, 17 August 2013 12:46  |
Cornelio Zolin
Messages: 5 Registered: August 2013
|
Junior Member |
|
|
On Friday, August 16, 2013 11:42:36 AM UTC-7, Phillip Bitzer wrote:
> You're going to need to make separate call for each image - LAYOUT should be a three element array:
>
> http://www.exelisvis.com/docs/IMAGE.html#LAYOUT
>
>
>
> So, something like this:
>
>
>
> pfile = IMAGE(file, LAYOUT=[7, 1, 1], MARGIN=0)
>
> pfile = IMAGE(file, LAYOUT=[7, 1, 2], MARGIN=0, /CURR)
>
> pfile = IMAGE(file, LAYOUT=[7, 1, 3], MARGIN=0, /CURR)
>
> ....
>
>
>
> will tile the the same image in a row. You don't want to use both LAYOUT and POSITION keywords - LAYOUT is ignored if you do.
Thank you all for the help..I think I'm almost there...
|
|
|