Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Re: Graph Builder Charts By Variable with different Y axis scales

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 16, 2020 1:07 PM
(359 views)

All,

I need to modify my Scripted Graph Builder so that it sets various scales for each plot.

I have a table of the (simplified) form:

:date - just a date

:rawValue - some numeric value

:byVariable - several categorical values to separate :rawValues into groups

:rawMedian - just a median value for each of the groups, formula Col Quantile(:rawValue, 0.5, :byVariable)

I plot it this way:

```
Graph Builder(
Size( 800, 500 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :date ),
Y( :rawValue ),
Y( :rawMedian ) //It's just a straight horizontal line on each plot
),
By( :byVariable )
)
```

Now, I would like to set the Y axis scale for each plot separately, and be equal, let's say, 3*:rawMedian for that specific :byVariable.

What's the best way of doing this?

Thanks,

M.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here is a simple example that is setting different values for each of the axes for the by groups. If you don't understand how the script is using the Display Trees to change the values, the Display Trees are documented in the Scripting Guide

Help==>Documentation Library

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/aircraft incidents.jmp" );
dt:Event Date << set name( "Date" );
dt:Total Uninjured << set name( "rawValue" );
dt:Engine Type << set name( "byVariable" );
dt << New Column( "rawMedian", formula( Col Quantile( :rawValue, .5, :byVariable ) ) );
gb = Graph Builder(
Size( 800, 500 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :date ),
Y( :rawValue ),
Y( :rawMedian ) //It's just a straight horizontal line on each plot
),
By( :byVariable )
);
summarize(groups=by(:byVariable));
// loop across the different byVariable values and changes the axes
For(i=1,i<=nitems(groups), i++,
report(gb[i])[AxisBox(2)]<< max (14-i);
report(gb[i])[AxisBox(3)] << min (.6 +.01*i);
);
```

Jim

3 REPLIES 3

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here is a simple example that is setting different values for each of the axes for the by groups. If you don't understand how the script is using the Display Trees to change the values, the Display Trees are documented in the Scripting Guide

Help==>Documentation Library

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/aircraft incidents.jmp" );
dt:Event Date << set name( "Date" );
dt:Total Uninjured << set name( "rawValue" );
dt:Engine Type << set name( "byVariable" );
dt << New Column( "rawMedian", formula( Col Quantile( :rawValue, .5, :byVariable ) ) );
gb = Graph Builder(
Size( 800, 500 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :date ),
Y( :rawValue ),
Y( :rawMedian ) //It's just a straight horizontal line on each plot
),
By( :byVariable )
);
summarize(groups=by(:byVariable));
// loop across the different byVariable values and changes the axes
For(i=1,i<=nitems(groups), i++,
report(gb[i])[AxisBox(2)]<< max (14-i);
report(gb[i])[AxisBox(3)] << min (.6 +.01*i);
);
```

Jim

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Graph Builder Charts By Variable with different Y axis scales

Jim,

Yes, I came to the same conclusion. Only I'm doing a temp summary table for all byVariables and read it into an Associative Array. My data table structure and plots are much more complicated than I showed, that's why. What I'm trying to do now and what I'm struggling with is finding the right AxisBox on my plot.

Yes, I came to the same conclusion. Only I'm doing a temp summary table for all byVariables and read it into an Associative Array. My data table structure and plots are much more complicated than I showed, that's why. What I'm trying to do now and what I'm struggling with is finding the right AxisBox on my plot.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Graph Builder Charts By Variable with different Y axis scales

Right click on the Outline box for the Graph builder, and select Edit==>Show Tree Structure, then when you click on the axis you are interested in, it will highlight in the tree structure

Jim