Subscribe Bookmark RSS Feed

Rearrange graphs made with “page” to a 3x3 trellis like presentation


Community Trekker


Sep 22, 2015

Dear all,


I am looking for a way to improve the layout of my graphs by rearranging what I made with graph builder. I now have 9 small graphs below each other, using the “Page” option. What I would want, is to have them arranged 3X3 as this looks way nicer (some kind of trellis display). I know you can obtain this using the “Wrap” button, but in that case, all axes are set equally, which is not an option since the grouping variable I use for “Page” relates to parameters with very different units and very different orders of magnitude…. In a similar way the "X group” or “Y group” would not work either. I tried to send the graphs to a journal and reorder them manually, but I don’t manage to nicely paste the graphs next to another one.


Not sure if I would need to write a script for this, to make sure the report is structured using “picture/displayboxes” or so but the problem is that, each time I save the script for my graph builder and then later rerun it, the graph are not shown, only the axes are… So easiest (I think) is to first make the graph in graph builder, send it to a journal and then rearrange the journal. Right?


Any ideas on how to deal with this?

Many thanks!!



Community Trekker


Sep 30, 2016

You could create individual graphs and then put them together in a window. If you always show the same 9 graphs the script below might be all you need; if the levels change you could build the window hierarchy with a loop.

Names default to here( 1 );

//Open sample data and create a binning column
dt = Open("$SAMPLE_DATA/Body");

dt << New Column( "Age (decades)",
	Format( "Best", 10 ),
	Formula( 10 * Floor( :Name( "Age (years)" ) / 10 ) )

//function to build each individual graph with a local data filter
GraphDecade = function({decade},
	gb = dt << Graph Builder(
		Size( 300, 300 ),
		Show Control Panel( 0 ),
		Show Legend( 0 ),
		Variables( X( :Name( "Age (years)" ) ) ),
		Elements( Histogram( X, Legend( 5 ) ) ),
		SendToReport( Dispatch( {}, 
			"Graph Builder", 
			{Set Title( "Decade: " || Char( decade ) )} ) 
		Local Data Filter(
			Close Outline( 1 ),
			Add Filter(
				columns( :Name( "Age (decades)" ) ),
				Where( :Name( "Age (decades)" ) == decade ),
				Display( :Name( "Age (decades)" ), Size( 256, 168 ), List Display )

//Window with graphs
win = new window( "Ages by Decade",
	V List Box(
		Text Box( "Distribution of Ages within Decades", << Set Font Size( 20 ), << Set Width( 600 ) ),
		H List Box( 
			vb1 = V List Box(
			vb2 = V List Box(

(vb1[1] << Find("Local Data Filter")) << visibility("collapse");
(vb1[2] << Find("Local Data Filter")) << visibility("collapse");
(vb2[1] << Find("Local Data Filter")) << visibility("collapse");
(vb2[2] << Find("Local Data Filter")) << visibility("collapse");


Edited: Fixed bug