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

- JMP User Community
- :
- Discussions
- :
- Why won't the axis box scripting work if we add "by" in the Bivariate function?

- 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

Oct 11, 2018 8:08 PM
(2960 views)

Hi,

I tried a sample script in the guide and found out that when we add "by" in Bivariate plot, we cannot do axis manipulation using jsl. Is there a workaround for this? Thanks.

Sample script that works:

```
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( X( :height ), Y( :weight ), FitLine );
rbiv = biv << report;
xaxis = rbiv[axis box( 2 )];
yaxis = rbiv[axis box( 1 )];
xaxis << Axis Settings( Show Major Grid( 1 ) );
yaxis << Axis Settings( Decimal( 10, 3 ) );
```

Sample script that does not work. Plots are outputted but the axes are not modified.

```
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( X( :height ), Y( :weight ), by(:sex), FitLine );
rbiv = biv << report;
xaxis = rbiv[axis box( 2 )];
yaxis = rbiv[axis box( 1 )];
xaxis << Axis Settings( Show Major Grid( 1 ) );
yaxis << Axis Settings( Decimal( 10, 3 ) );
```

Thanks,

Shaira

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

The issue is, that you have 2 different graphs being created in the By(:sex) configuration. You can see this if you run the code and show the value of "biv" after producting the chart or charts. If you show "biv" in the non By version of the chart, "biv" has the value of:

{Bivariate[]}

If you show() the value of "biv" after the By version you will see:

{Bivariate[], Bivariate[]}

There are 2 sets of chart output. Therefore, this needs to be handled in the code. The script below will show you one way to do this:

```
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( X( :height ), Y( :weight ), by(:sex), FitLine );
For(i=1,i<=N items(biv),i++,
rbiv = (biv << report)[i];
xaxis = rbiv[axis box( 2 )];
yaxis = rbiv[axis box( 1 )];
xaxis << Axis Settings( Show Major Grid( 1 ) );
yaxis << Axis Settings( Decimal( 10, 3 ) );
);
```

Jim

2 REPLIES 2

Highlighted

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

The issue is, that you have 2 different graphs being created in the By(:sex) configuration. You can see this if you run the code and show the value of "biv" after producting the chart or charts. If you show "biv" in the non By version of the chart, "biv" has the value of:

{Bivariate[]}

If you show() the value of "biv" after the By version you will see:

{Bivariate[], Bivariate[]}

There are 2 sets of chart output. Therefore, this needs to be handled in the code. The script below will show you one way to do this:

```
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( X( :height ), Y( :weight ), by(:sex), FitLine );
For(i=1,i<=N items(biv),i++,
rbiv = (biv << report)[i];
xaxis = rbiv[axis box( 2 )];
yaxis = rbiv[axis box( 1 )];
xaxis << Axis Settings( Show Major Grid( 1 ) );
yaxis << Axis Settings( Decimal( 10, 3 ) );
);
```

Jim

Highlighted
##

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

Re: Why won't the axis box scripting work if we add "by" in the Bivariate function?

@txnelson, Thanks! Solution is neat and I finally understood the problem.

Article Labels

There are no labels assigned to this post.