Madhavan Bomidi writes:
> cgPS_Open,FigFileName,FONT=-1, CHARSIZE=0.6
>
> ; Setting variables to plot
> thick = (!D.Name EQ 'PS') ? 2 : 1 ; Setup variable to the plot
>
> ; Display window
> cgDisplay,XSIZE=2000,YSIZE=1500 ; Create a map projection space
>
> !P.Multi=[0,2,2] ; 2 columns X 2 rows
>
> pos1 = [0.05,0.49,0.5,0.89]
> pos2 = [0.57,0.55,0.92,0.9]
> pos3 = [0.07,0.1,0.5,0.40]
> pos4 = [0.6,0.1,0.90,0.40]
>
> ; Sub-Plot#1
>
>
>
> ; Sub-Plot#2
> READ_JPEG,SkyImgFile,img1,ORDER=1
> cgImage,img1,/NOERASE,Position=pos2,/KEEP_ASPECT_RATIO
>
> ;Sub-Plot#3
>
>
> ;Sub-Plot#4
>
> cgHistoplot,flux,/Frequency,/OProbability,ProbColorName='red ', $
> ProbThick=2,PolyColor='dodger blue', /NAN, DataColorName='navy', $
> POSITION=pos4,XTITLE='Flux in W/m^2', Charsize=0.85,$
> /LINE_FILL,LINE_THICK=2,/OUTLINE,SMOOTH=1,THICK=2,XRange=[0. 0,1.2], $
> FONT=-1,YRange=[0.0,0.5]
>
> !P.Multi=0
>
> cgPS_Close
>
> ; Create a PNG file with a width of 1500 pixels
> cgPS2Raster,FigFileName,/PNG, Width=1500
>
> -----------------------------------------------------------
>
> Please let me know where I am going wrong!!!
Well, you are doing quite a lot of things...I hestitate to use the word
"wrong", but certainly "unnecessarily"...which in combination are giving
you a lot of trouble.
There are still a few people who disagree with me, but I do think it is
a grave error to use !P.MULTI and the POSITION keyword at the same time.
If it is not "wrong", then it is certainly responsible for weeks, if not
months, of head scratching. It wouldn't surprise me to learn that just
removing the position keywords allowed you to muddle through with these
plots in some form you could live with.
You set the plot up like this:
> cgPS_Open,FigFileName,FONT=-1, CHARSIZE=0.6
>
> ; Setting variables to plot
> thick = (!D.Name EQ 'PS') ? 2 : 1 ; Setup variable to the plot
>
> ; Display window
> cgDisplay,XSIZE=2000,YSIZE=1500 ; Create a map projection space
This may be exactly what you want, but there is usually no need for all
this. cgPS_Open will do all the character sizing and changing of line
thicknesses for you if you just get out of its way. I've always found it
to go a great job with this, but there are people who like to tweak it.
You may be one of them.
I'm not sure exactly what you are doing with cgDisplay, but I can assure
you it is NOT creating a PostScript page that is 2000 by 1000 pixels in
size, which seems your intention here. I'm on vacation and so can't test
this readily this morning, but I suspect it is simply giving you a
PostScript "page" that has this aspect ratio. That is it's normal job in
a PostScript file.
I'm not sure why you are using a NOERASE keyword on the cgImage call,
but that might really mess up your following histogram, if you are using
!P.Multi to set the position. cgImage will do the right thing when using
it with !P.Multi without having to manipulate it in any way.
If you want to fill up the !P.Multi position space with your image,
don't set the KEEP_ASPECT keyword. If you do set the keyword, it will
fill the space while keeping the aspect ratio. If you want the image to
fill less of the space, use the MULTIMARGIN keyword. The image is really
small right now because you are giving it so many contradictory messages
it doesn't know if it is coming or going.
Good luck with this!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|