Problems with control the size of the lat-lon tick labels and the position of my colorbar [message #86911] |
Thu, 12 December 2013 08:51  |
atmospheric physics
Messages: 121 Registered: June 2010
|
Senior Member |
|
|
Hello,
I tried to write the following code to make a plot:
(N.B:This is not complete but a part of the code!)
;------------
PRO test
cgPS_Open, Fig.ps, FONT=-1, CHARSIZE=0.5
cgDisplay,1200,1000
Lats=[50.84D,50.96D] & CenterLat=(Max(Lats) + Min(Lats)) / 2.0
Lons=[6.36D,6.50D] & CenterLon=(Max(Lons) + Min(Lons)) / 2.0
cgMap_Set, CenterLat, CenterLon, /Cylindrical, /NoBorder, /NoErase, $
Limit=[50.84D,6.35D,50.96D, 6.51D], Position=[0.05, 0.47, 0.5, 0.92]
cgMap_Grid, /BOX, Color='charcoal', Thick=(!D.Name EQ 'PS') ? 2 : 1
cgLoadCT, 33 , Bottom=1
tickvalues=['0','100','200','300','400','500',$
'600','700','800','900','1000',$
'1100','1200','1300','1400','1500']
cgColorbar, Range=[0,1500],Bottom=1,Font=-1, Divisions=15, Title='W m!E-2!N', $
Format='(I4)',Ticknames=tickvalues,TLOCATION='Bottom',/FIT, $
Minor=10, CHARSIZE=0.7,OOB_FACTOR=0.5, Position=cgLayout([2,2,1])
cgPS_Close,/PNG
cgPS2Raster,Fig_filename,/PNG, Width=300
END
; ------------------------
Here are my problems ...
(1) How to control the font size of the lat-lon values on the grid map?
(2) Can I disable to display of lat-lon values on TOP and RIGHT side on the grid map?
(3) If I want to include X-label (i.e., 'Latitude') and Y-label(i.e., Latitude) for the grid map, then how can I do that?
(4) How to position the colorbar if I want to at the bottom of this grid map?
(5) If I change the Position values in the cgMap_Set command, I see the width of the colorbar at the top changes? What keyword actually controls the width of this colorbar?
I want to divide my plotting area into 2 columns and 2 rows and include this figure in the first column and first row. I was playing with almost all keywords basing on the descriptions for cgMap_Set, chMap_Grid, cgColorbar and still unable to understand properly what I am doing wrong in my figure? I want my colorbar on top as now and want to position properly so that i can see the title also properly. Can anyone point at what I am doing wrong?
Thanks in advance
|
|
|
Re: Problems with control the size of the lat-lon tick labels and the position of my colorbar [message #86916 is a reply to message #86911] |
Thu, 12 December 2013 09:43   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Madhavan Bomidi writes:
> I tried to write the following code to make a plot:
> (N.B:This is not complete but a part of the code!)
>
> ;------------
> PRO test
> cgPS_Open, Fig.ps, FONT=-1, CHARSIZE=0.5
>
> cgDisplay,1200,1000
>
> Lats=[50.84D,50.96D] & CenterLat=(Max(Lats) + Min(Lats)) / 2.0
> Lons=[6.36D,6.50D] & CenterLon=(Max(Lons) + Min(Lons)) / 2.0
>
> cgMap_Set, CenterLat, CenterLon, /Cylindrical, /NoBorder, /NoErase, $
> Limit=[50.84D,6.35D,50.96D, 6.51D], Position=[0.05, 0.47, 0.5, 0.92]
>
> cgMap_Grid, /BOX, Color='charcoal', Thick=(!D.Name EQ 'PS') ? 2 : 1
>
> cgLoadCT, 33 , Bottom=1
>
> tickvalues=['0','100','200','300','400','500',$
> '600','700','800','900','1000',$
> '1100','1200','1300','1400','1500']
>
> cgColorbar, Range=[0,1500],Bottom=1,Font=-1, Divisions=15, Title='W m!E-2!N', $
> Format='(I4)',Ticknames=tickvalues,TLOCATION='Bottom',/FIT, $
> Minor=10, CHARSIZE=0.7,OOB_FACTOR=0.5, Position=cgLayout([2,2,1])
>
> cgPS_Close,/PNG
> cgPS2Raster,Fig_filename,/PNG, Width=300
> END
> ; ------------------------
>
> Here are my problems ...
>
> (1) How to control the font size of the lat-lon values on the grid map?
> (2) Can I disable to display of lat-lon values on TOP and RIGHT side on the grid map?
> (3) If I want to include X-label (i.e., 'Latitude') and Y-label(i.e., Latitude) for the grid map, then how can I do that?
> (4) How to position the colorbar if I want to at the bottom of this grid map?
> (5) If I change the Position values in the cgMap_Set command, I see the width of the colorbar at the top changes? What keyword actually controls the width of this colorbar?
>
> I want to divide my plotting area into 2 columns and 2 rows and include this figure in the first column and first row. I was playing with almost all keywords basing on the descriptions for cgMap_Set, chMap_Grid, cgColorbar and still unable to understand properly what I am doing wrong in my figure? I want my colorbar on top as now and want to position properly so that i can see the title also properly. Can anyone point at what I am doing wrong?
Well, there is quite a lot wrong here. :-)
> (1) How to control the font size of the lat-lon values on the grid
map?
I get the distinct feeling you do not like to read program
documentation. You are not alone in this, of course, but it really,
really helps when you are trying to get something to work. :-)
The documentation is in the header to the files, or it is available on-
line. Please bookmark it for future use.
http://www.idlcoyote.com/idldoc/cg/index.html
In this case a Charsize keyword will work. :-)
> (2) Can I disable to display of lat-lon values on TOP and RIGHT side on the grid map?
It is not possible with this software.
> (3) If I want to include X-label (i.e., 'Latitude') and Y-label(i.e., Latitude) for the grid map, then how can I do that?
The easiest way would probably just be to add them with a couple of
cgText commands.
> (4) How to position the colorbar if I want to at the bottom of this grid map?
You position the color bar with the Position keyword to cgColorbar.
> (5) If I change the Position values in the cgMap_Set command, I see the width of the colorbar at the top changes? What keyword actually controls the width of this colorbar?
The position values in the cgMap_Set command will have no effect on the
colorbar width. The width of the colorbar is determined by the Position
keyword to cgColorbar.
If you want to position your color bar with respect to the map, then you
should calculate its position relative to the map position. I would not
be using cgLayout to position a colorbar, unless you like very fat
colorbars. :-)
A couple of other things I notice. You have a NoErase keyword on the
cgMap_Set command. What is the purpose of that? It doesn't look like it
belongs there to me.
You are making two PNG files (one when you close the PostScript device,
and another when you run cgPS2Raster). They are overwriting each other,
so this is taking twice as long (at least!) as it should. Do you want
two PNG files, or just one?
You are probably right to use cgLayout if you want to add colorbars to
your map, because you probably won't have enough space underneath it to
add a color bar. The cgLayout progrm will allow you to adjust the "gap"
between plots so you can have enough room. You can see details on this
page:
http://www.idlcoyote.com/code_tips/multiplots.php
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: Problems with control the size of the lat-lon tick labels and the position of my colorbar [message #86919 is a reply to message #86918] |
Thu, 12 December 2013 12:13   |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
Madhavan, please stop deleting your messages (it looks like you have done it twice today), it makes the discussion less useful for others looking back through the archives.
On Thursday, December 12, 2013 2:51:27 PM UTC-5, David Fanning wrote:
> Madhavan Bomidi writes:
>
>
>
>> I want to divide my plotting area into 2 columns and 2 rows and include this figure in the first column and first row. I was playing with almost all keywords basing on the descriptions for cgMap_Set, chMap_Grid, cgColorbar and still unable to understand properly what I am doing wrong in my figure?
>
>
>
> I put a new example program in the Coyote Gallery today that shows you
>
> how to create multiple plots, each plot with its own annotations, such
>
> as color bars. You can find it here:
>
>
>
> http://www.idlcoyote.com/gallery/index.html#MULTIANNOTATE_PL OT
>
>
>
> Time spent answering question and creating a new gallery plot: 2.5
>
> hours. Donations so far this month: $350.
>
>
>
> 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: Problems with control the size of the lat-lon tick labels and the position of my colorbar [message #86922 is a reply to message #86919] |
Fri, 13 December 2013 06:47   |
atmospheric physics
Messages: 121 Registered: June 2010
|
Senior Member |
|
|
Sorry for deleting my messages. I have found solution to my problems and so I thought others shall not waste time in answering to my post.
On Thursday, December 12, 2013 9:13:17 PM UTC+1, AMS wrote:
> Madhavan, please stop deleting your messages (it looks like you have done it twice today), it makes the discussion less useful for others looking back through the archives.
>
>
>
> On Thursday, December 12, 2013 2:51:27 PM UTC-5, David Fanning wrote:
>
>> Madhavan Bomidi writes:
>
>>
>
>>
>
>>
>
>>> I want to divide my plotting area into 2 columns and 2 rows and include this figure in the first column and first row. I was playing with almost all keywords basing on the descriptions for cgMap_Set, chMap_Grid, cgColorbar and still unable to understand properly what I am doing wrong in my figure?
>
>>
>
>>
>
>>
>
>> I put a new example program in the Coyote Gallery today that shows you
>
>>
>
>> how to create multiple plots, each plot with its own annotations, such
>
>>
>
>> as color bars. You can find it here:
>
>>
>
>>
>
>>
>
>> http://www.idlcoyote.com/gallery/index.html#MULTIANNOTATE_PL OT
>
>>
>
>>
>
>>
>
>> Time spent answering question and creating a new gallery plot: 2.5
>
>>
>
>> hours. Donations so far this month: $350.
>
>>
>
>>
>
>>
>
>> 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: Problems with control the size of the lat-lon tick labels and the position of my colorbar [message #86923 is a reply to message #86922] |
Fri, 13 December 2013 06:51  |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
Ok, for the future, it would be more helpful for others to keep the post visible and add your solutions as additional messages. :)
On Friday, December 13, 2013 9:47:58 AM UTC-5, Madhavan Bomidi wrote:
> Sorry for deleting my messages. I have found solution to my problems and so I thought others shall not waste time in answering to my post.
>
>
>
>
>
>
>
> On Thursday, December 12, 2013 9:13:17 PM UTC+1, AMS wrote:
>
>> Madhavan, please stop deleting your messages (it looks like you have done it twice today), it makes the discussion less useful for others looking back through the archives.
>
>>
>
>>
>
>>
>
>> On Thursday, December 12, 2013 2:51:27 PM UTC-5, David Fanning wrote:
>
>>
>
>>> Madhavan Bomidi writes:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>> I want to divide my plotting area into 2 columns and 2 rows and include this figure in the first column and first row. I was playing with almost all keywords basing on the descriptions for cgMap_Set, chMap_Grid, cgColorbar and still unable to understand properly what I am doing wrong in my figure?
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I put a new example program in the Coyote Gallery today that shows you
>
>>
>
>>>
>
>>
>
>>> how to create multiple plots, each plot with its own annotations, such
>
>>
>
>>>
>
>>
>
>>> as color bars. You can find it here:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> http://www.idlcoyote.com/gallery/index.html#MULTIANNOTATE_PL OT
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Time spent answering question and creating a new gallery plot: 2.5
>
>>
>
>>>
>
>>
>
>>> hours. Donations so far this month: $350.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> 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.")
|
|
|