!p.multi , colorbar&set_viewport ? [message #86568] |
Wed, 20 November 2013 02:16  |
anil
Messages: 34 Registered: August 2009
|
Member |
|
|
Hello,
I'm trying to plot many figures with multi-plots in each of them.
I use !p.multi. The problem is I plot my colorbar using set_viewport,as below:
b=clevels
r=size(b)
aa = dblarr(r(1),2)
aa = [[b], [b]]
cc = dblarr(1, 2)
cc = [0, 1]
cc=transpose(cc)
set_viewport, 0.05,0.55,0.55,0.57
contour,aa, b ,cc,/cell_fill, levels = b, /noer,$
ytickinterval = 1, ycharsize = 1, ys =4,xs = 1,charthick=1,charsize=0.4 ,$
c_colors=indgen(269)+1,/overplot
My code works fine until this point. I plot map projections with contour on top of them. Then I want to add my colorbar beneath this figure but what happens is starting from the 2nd file, it only plots the frame (from set_viewport command) and plots everythin else inside this frame. How can I fix this? I use /advance and /noerase keywords in the map projection and contour routines but it gets stuck in this viewport. When i just do set_viewport,device. I can see the map projection and contour on top of it. So I am sure it is plotting, just not where i want it. Any help is appreciated
Cheers,
Anil
|
|
|
Re: !p.multi , colorbar&set_viewport ? [message #86572 is a reply to message #86568] |
Wed, 20 November 2013 05:33   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
anil writes:
> I'm trying to plot many figures with multi-plots in each of them.
> I use !p.multi. The problem is I plot my colorbar using set_viewport,as below:
>
> b=clevels
> r=size(b)
> aa = dblarr(r(1),2)
> aa = [[b], [b]]
> cc = dblarr(1, 2)
> cc = [0, 1]
> cc=transpose(cc)
> set_viewport, 0.05,0.55,0.55,0.57
>
> contour,aa, b ,cc,/cell_fill, levels = b, /noer,$
> ytickinterval = 1, ycharsize = 1, ys =4,xs = 1,charthick=1,charsize=0.4 ,$
> c_colors=indgen(269)+1,/overplot
>
> My code works fine until this point. I plot map projections with contour on top of them. Then I want to add my colorbar beneath this figure but what happens is starting from the 2nd file, it only plots the frame (from set_viewport command) and plots everythin else inside this frame. How can I fix this? I use /advance and /noerase keywords in the map projection and contour routines but it gets stuck in this viewport. When i just do set_viewport,device. I can see the map
projection and contour on top of it. So I am sure it is plotting, just not where i want it. Any help is appreciated
>
Hard to know what "Set_Viewport" command you are using, but the one I
found on my machine (in the "obsolete" directory, unfortunately) simply
sets the !P.Position system variable. If you try to set both the
position *and* use !P.Multi, chaos always ensues.
I think I would have a look at the Coyote Plot Gallery for an example of
how to do multiple contour plots on map projections. Adding a color bar
to each of the plots in the Small Contour Multiples plot is trivial. The
example uses cgLayout (rather than !P.Multi) so that you can adjust the
"gap" between plots to give yourself some room for adding the color bar.
http://www.idlcoyote.com/gallery/index.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: !p.multi , colorbar&set_viewport ? [message #86602 is a reply to message #86572] |
Fri, 22 November 2013 00:47  |
anil
Messages: 34 Registered: August 2009
|
Member |
|
|
On Wednesday, November 20, 2013 3:33:13 PM UTC+2, David Fanning wrote:
> anil writes:
>
>
>
>> I'm trying to plot many figures with multi-plots in each of them.
>
>> I use !p.multi. The problem is I plot my colorbar using set_viewport,as below:
>
>>
>
>> b=clevels
>
>> r=size(b)
>
>> aa = dblarr(r(1),2)
>
>> aa = [[b], [b]]
>
>> cc = dblarr(1, 2)
>
>> cc = [0, 1]
>
>> cc=transpose(cc)
>
>> set_viewport, 0.05,0.55,0.55,0.57
>
>>
>
>> contour,aa, b ,cc,/cell_fill, levels = b, /noer,$
>
>> ytickinterval = 1, ycharsize = 1, ys =4,xs = 1,charthick=1,charsize=0.4 ,$
>
>> c_colors=indgen(269)+1,/overplot
>
>>
>
>> My code works fine until this point. I plot map projections with contour on top of them. Then I want to add my colorbar beneath this figure but what happens is starting from the 2nd file, it only plots the frame (from set_viewport command) and plots everythin else inside this frame. How can I fix this? I use /advance and /noerase keywords in the map projection and contour routines but it gets stuck in this viewport. When i just do set_viewport,device. I can see the map
>
> projection and contour on top of it. So I am sure it is plotting, just not where i want it. Any help is appreciated
>
>>
>
>
>
> Hard to know what "Set_Viewport" command you are using, but the one I
>
> found on my machine (in the "obsolete" directory, unfortunately) simply
>
> sets the !P.Position system variable. If you try to set both the
>
> position *and* use !P.Multi, chaos always ensues.
>
>
>
> I think I would have a look at the Coyote Plot Gallery for an example of
>
> how to do multiple contour plots on map projections. Adding a color bar
>
> to each of the plots in the Small Contour Multiples plot is trivial. The
>
> example uses cgLayout (rather than !P.Multi) so that you can adjust the
>
> "gap" between plots to give yourself some room for adding the color bar.
>
>
>
> http://www.idlcoyote.com/gallery/index.html
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Thanks David. I'll try that.
Cheers
|
|
|