turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- X,Y scatter plot with coloured zones

Topic Options

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

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

Oct 30, 2015 9:28 AM
(592 views)

2 REPLIES

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

Oct 30, 2015 12:24 PM
(345 views)

You can use a graphics script to do this (see for example: http://www.jmp.com/support/help/Adding_Scripts_to_Graphs.shtml for how to do this 'by hand').

If you want to do it programmatically, you can tinker with the script below to get it the way you want. Cut and paste the code into an editor window, then select 'Edit > Run Script').

NamesDefaultToHere**(****1****)**;

// Example data

dt = NewTable**(**"Scatter PLot",

NewColumn**(**"x", Numeric, Continuous, Formula**(**RandomNormal**()))**,

NewColumn**(**"y", Numeric, Continuous, Formula**(**RandomNormal**()))**,

AddRows**(****100****)**;

**)**;

// Bivariate plot

biv = dt << **Bivariate****(**X**(**:x**)**, Y**(**:y**))**;

// Add graphics script for 'quadrants'

xVals = Column**(**dt, "x"**)** << **getValues**;

xMid = Quantile**(****0.5**, xVals**)**;

xDel = Max**(**Abs**(**Max**(**xVals**)** - xMid**)**, Abs**(**xMid - Min**(**xVals**)))**;

xMin = xMid - **100***xDel;

xMax = xMid + **100***xDel;

yVals = Column**(**dt, "y"**)** << **getValues**;

yMid = Quantile**(****0.5**, yVals**)**;

yDel = Max**(**Abs**(**Max**(**yVals**)** - yMid**)**, Abs**(**yMid - Min**(**yVals**)))**;

yMin = yMid - **100***yDel;

yMax = yMid + **100***yDel;

// Tempate expression to add graphics script

ags =

Expr**(**

Report**(**biv**)[**FrameBox**(****1****)]** <<

Add Graphics Script**(**

**1**,

Description**(** "Quadrants" **)**,

Transparency**(** **0.3** **)**;

// Top left

Fill Color**(** "Red" **)**;

Rect**(** xMinTBD, yMaxTBD, xMidTBD, yMidTBD, **1** **)**;

// Top right

Fill Color**(** "Green" **)**;

Rect**(** xMidTBD, yMaxTBD, xMaxTBD, yMidTBD, **1** **)**;

// Bottom left

Fill Color**(** "Blue" **)**;

Rect**(** xMinTBD, yMidTBD, xMidTBD, yMinTBD, **1** **)**;

// Bottom right

Fill Color**(** "Black" **)**;

Rect**(** xMidTBD, yMidTBD, xMaxTBD, yMinTBD, **1** **)**;

**)**;

**)**;

// 'Bake in' values for this data to this expression

SubstituteInto**(**ags,

Expr**(**xMinTBD**)**, xMin,

Expr**(**xMidTBD**)**, xMid,

Expr**(**xMaxTBD**)**, xMax,

Expr**(**yMinTBD**)**, yMin,

Expr**(**yMidTBD**)**, yMid,

Expr**(**yMaxTBD**)**, yMax,

**)**;

// Add the graphics script

ags;

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

Nov 2, 2015 5:53 AM
(345 views)

Ian@JMP has a good idea.

Another option in JMP 12 is to use the new color and range options in the Axis specification dialog to do this.

Double click on the axis and then use the Allow Ranges and Color options in the Reference Lines section.

-Jeff

-Jeff