# Re: Map + histogram

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 13 2011 - 12:58:00 MDT

Hi Louis,

Another way to do it, if you need the two plots to "stay" with the map plot, is to use gsn_add_annotation to attach the two plots as annotations of the map.

I created a "dummy" example. See example 6 at:

The basic premise is to create the three plots, making them all small enough to fit on the page together, and then attach them with:

;---Resources for adding xy1/xy2 to base_map.
amres = True
amres@amJust = "CenterLeft"

amres@amParallelPosF = -1.15 ; Left side
amres@amOrthogonalPosF = -0.4 ; Almost halfway up

;---Attach first XY plot

amres@amOrthogonalPosF = 0.4 ; Almost halfway down

;---Attach second XY plot
--Mary

On Apr 13, 2011, at 9:44 AM, Adam Phillips wrote:

> Hi Louis,
> Andrea's idea is one way to get everything looking the way you want. If
> you want to give it a shot in NCL here's what I would do:
>
> Use gsn_panel to place the 4 histograms. Within your panel resource
> list, set gsnPanelXWhiteSpacePercent to something like 40:
>
> plot = new(3,graphic)
> do gg = 0,3
> plot(gg) = gsn_histogram(wks,x(gg,:),False)
> end do
> panres = True
> panres@gsnPanelXWhiteSpacePercent = 40.
> panres@gsnFrame = False
> gsn_panel(wks,plot,(/2,2/),panres)
>
> For the map plot, specify the exact location of the plot between the
> histograms by specifying vpXF and vpYF, which are the left and top
> starting points for the plot in NDC coordinates. vpXF ranges from
> 0.0->1.0 from the left to the right side of the page. vpYF ranges from
> 0.0->1.0 from the bottom to the top of the page.
>
> You can use drawNDCGrid:
> http://www.ncl.ucar.edu/Document/Functions/Shea_util/drawNDCGrid.shtml
> to visualize the NDC grid space that vpYF/vpXF corresponds to.
>
> res = True
> res@vpXF = 0.3
> res@vpYF = 0.8
> res@mpMinLatF = 1.
> res@mpMaxLatF = 15.
> res@mpMinLonF = 7.5
> res@mpMaxLonF = 17.5
> res@gsnFrame = False
> .....
> map = gsn_csm_contour_map(wks,data,res)
> drawNDCGrid(wks) ; draw for assistance in plot placement
> frame(wks)
>
> Obviously other resources will need to be set, but hopefully that gets
> you going in the right direction..
>
>
> On 04/13/2011 04:42 AM, louis Vonder wrote:
>> hello ncl users,
>>
>> I am trying to reproduce a figure such the one I attached.
>> To proceed, I am usingexample 9 of histogram
>> http://www.ncl.ucar.edu/Applications/histo.shtml <http://>.
>>
>> But I don't know how to put the histogram exactly ouside of the map.
>>
>> The histogram can be substituted by a xy plot?
>>
>> Regards
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> __________________________________________________
> asphilli@ucar.edu
> National Center for Atmospheric Research tel: (303) 497-1726
> Climate and Global Dynamics Division fax: (303) 497-1333
> P.O. Box 3000
> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 14 04:58:10 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 19 2011 - 18:32:03 MDT