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

Home » Public Forums » archive » Problems with control the size of the lat-lon tick labels and the position of my colorbar
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
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 Go to previous messageGo to previous message
David Fanning is currently offline  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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Array containing maximum values for two arrays
Next Topic: How to determine the mask portion (or unwanted region) from an image and rotate for direction correction using IDL tools?

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

Current Time: Wed Oct 08 17:33:06 PDT 2025

Total time taken to generate the page: 0.00416 seconds