Re: Paneling attached plots

From: Kyle Griffin <ksgriffin2_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 25 2013 - 08:34:10 MDT

Hey Carl,

You make a great point about calls from within a function, but
unfortunately that's not how I'm calling things. If we're all good with
talking more pseudo-code, this is basically how my calls are being made.

I would think looping through an array of graphics objects wouldn't be any
different then creating them in a function and ensuring the function passes
the graphics ID back to the main portion of the script (e.g. what Carl
suggested), but someone correct me if that's wrong. I'll see if I can find
a similar non-looping solution that might work, too.

do k=0,2
  a(k) = gsn_csm_contour
  b(k) = gsn_csm_x2y
  c(k) = gsn_csm_x2y
  overlay(b(k),c(k))
  plot(k) = gsn_attach_plots(a(k),b(k))
end do

Kyle
----------------------------------------
Kyle S. Griffin
Department of Atmospheric and Oceanic Sciences
University of Wisconsin - Madison
Room 1421
1225 W Dayton St, Madison, WI 53706
Email: ksgriffin2@wisc.edu

On Fri, Oct 25, 2013 at 7:56 AM, Carl Schreck <cjschrec@ncsu.edu> wrote:

> Hi Kyle,
>
> I've had some success attaching and paneling, so should be possible (see
> attached, no pun intended ;-). The one trick I found was that you have to
> be careful if you're using you're own functions to make the plots.
>
> So for example, this pseudocode works for overlaying:
> --
> function plot_with_overlay
> begin
> draw base plot
> draw top plot
> overlay( base, top )
> return(base)
> end
>
> begin ; main
> plotA = plot_with_overlay
> plotB = plot_with_overlay
>
> gsn_panel( wks, (/ plotA, plotB /), (/ 2, 1 /), False )
> end ; main
> --
>
> But this similar pseudocode would not work:
> --
> function plot_with_attach
> begin
> draw base plot
> draw side plot
> base@attached = gsn_attach_plots( base, side, False, False)
> return(base)
> end
>
> begin ; main
> plotA = plot_with_attach
> plotB = plot_with_attach
>
> gsn_panel( wks, (/ plotA, plotB /), (/ 2, 1 /), False )
> end ; main
> --
> You have to figure out a way for plot_with_attach to return both the base
> plot and the side plot.
>
> Hopefully this is helpful, and not just more confusing :-)
>
> Carl
>
>
>
>
>
>
>
> On Thu, Oct 24, 2013 at 4:12 PM, Kyle Griffin <ksgriffin2@wisc.edu> wrote:
>
>> Hi all,
>>
>> I've been working on what I thought would be a relatively simple task,
>> but it appears I've run into some complications. My goal was to attach an
>> XY plot with 3 different variables plotted to the right side of a
>> gsn_csm_contour plot. I've done this before and it works great, much akin
>> to the sample code #10 under paneling (see
>> http://www.ncl.ucar.edu/Applications/Scripts/panel_10.ncl). However, my
>> issues begin when I try to create a 3-panel figure of these attached plots.
>> While the attaching process works fine, I get the error (included below) at
>> the gsn_csm_panel call. The paneling works just fine if I double the number
>> of panels and plot the XY plot and the contour plots separately in their
>> own panels (see link below).
>>
>> Is there an internal limitation that prevents the paneling of multiple
>> attached plots, or have I done something wrong along the way? I can provide
>> the moderately simple script and FTP the necessary data files if that might
>> be useful to someone's cause here. Any advice would be appreciated here.
>>
>> Thanks!
>>
>>
>> Kyle Griffin
>>
>>
>>
>> Image with each in separated panels, no attach attempted:
>> http://marrella.meteor.wisc.edu/~ksgriffin2/npac/temp/metric_0.png
>>
>>
>> Error code: (note - the last call to line 199 is simply the call to
>> gsn_csm_panel).
>> fatal:Invalid plot ID=189 passed to NhlGetBB
>> warning:pmOverlaySequenceIds isn't a resource in this object
>> warning:NhlGetValues:Error retrieving pmOverlaySequenceIds
>> fatal:["Execute.c":8470]:Execute: Error occurred at or near line 1726 in
>> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>>
>> fatal:["Execute.c":8470]:Execute: Error occurred at or near line 6424 in
>> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>>
>> fatal:["Execute.c":8470]:Execute: Error occurred at or near line 7123 in
>> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>>
>> fatal:["Execute.c":8470]:Execute: Error occurred at or near line 199 in
>> file panel_hov_interact.ncl
>>
>> ----------------------------------------
>> Kyle S. Griffin
>> Department of Atmospheric and Oceanic Sciences
>> University of Wisconsin - Madison
>> Room 1421
>> 1225 W Dayton St, Madison, WI 53706
>> Email: ksgriffin2@wisc.edu
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
>
> <http://www.cicsnc.org/>
> Follow CICS-NC on Facebook <http://www.facebook.com/cicsnc>
> *Carl J. Schreck III, PhD*
> *Research Associate*
> Cooperative Institute for Climate and Satellites NC <http://cicsnc.org/>
> North Carolina State University <http://ncsu.edu/>
> NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
> 151 Patton Ave, Asheville, NC 28801
> e: cjschrec@ncsu.edu
> o: +1 828 257 3140
> CycloneCenter.org: Help analyze tropical cyclones<http://www.cyclonecenter.org/>
> monitor.cicsnc.org/mjo: See recent MJO diagnostics<http://monitor.cicsnc.org/mjo/>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 25 08:34:44 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 01 2013 - 08:58:14 MDT