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
- :
- Fit Y by X, is it possible to color the boxes in a...

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

Jun 2, 2015 1:37 PM
(2379 views)

In the Fit Y by x Platform, is it possible to color the boxes by a cloumn? For example, I have a plot of machine efficiencies (y-axis) against the month/year (x-axis) and would like to have different colors for the boxes by year; 2011 - red, 2012 - blue, etc I have tried several things, but cannot get the colors.

Steve

1 ACCEPTED SOLUTION

Accepted Solutions

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

Jun 3, 2015 7:26 AM
(3056 views)

Solution

If you don't need other features of *Fit Y by X* than box plots, you could try Graph Builder where box plots can be colored by a variable dragged to the Overlay Role.

Try the example code below. (The code demonstrates PMroz tip about the date format, but in my localization "m/y" has to be typed like "m-y".)

dt = New Table**(**"example",

add rows**(****360****)**,

New Column**(**"date",

Numeric,

Format**(**"m-y", **7****)**,

formula**(**Date Increment**(**Informat**(**"1-2009", "m-y"**)**, "month", Mod**(**Row**()** - **1**, **36****)))**

**)**,

New Column**(**"data", numeric, formula**(**Random Uniform**()))**,

New Column**(**"year", nominal, formula**(**Year**(**:date**)))**

**)**;

dt << **Graph Builder****(**Variables**(**X**(**:date**)**, Y**(**:data**)**, Overlay**(**:year**))**, Elements**(**Box Plot**(**X, Y, Legend**(****7****))))**;

4 REPLIES

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

Jun 2, 2015 1:45 PM
(1923 views)

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

Jun 3, 2015 5:20 AM
(1923 views)

That does not seem to be working for me at all. Besides, I have 72 boxes (12 months by 6 years). Seems to me I should be able to color the boxes by year. Another issue I am having. I can't find the right format for my "Month" column to make the chart plot the months by time order instead of alphabetical order. I am getting Apr-01, Apr-02, Apr-03, etc. instead of Jan-01, Feb-01, Mar-01, etc. I know I can use the value order function in column prop[erties, but what a tedious task! Any suggestions?

Steve

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

Jun 3, 2015 5:57 AM
(1923 views)

Two suggestions:

1. Use a format that will sort alphabetically, such as 2015-01, 2015-02, 2015-03 etc.

2. Convert your month column to a numeric, and set the format to "**m/y**".

Can you give us a flavor of what your data looks like?

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

Jun 3, 2015 7:26 AM
(3057 views)

If you don't need other features of *Fit Y by X* than box plots, you could try Graph Builder where box plots can be colored by a variable dragged to the Overlay Role.

Try the example code below. (The code demonstrates PMroz tip about the date format, but in my localization "m/y" has to be typed like "m-y".)

dt = New Table**(**"example",

add rows**(****360****)**,

New Column**(**"date",

Numeric,

Format**(**"m-y", **7****)**,

formula**(**Date Increment**(**Informat**(**"1-2009", "m-y"**)**, "month", Mod**(**Row**()** - **1**, **36****)))**

**)**,

New Column**(**"data", numeric, formula**(**Random Uniform**()))**,

New Column**(**"year", nominal, formula**(**Year**(**:date**)))**

**)**;

dt << **Graph Builder****(**Variables**(**X**(**:date**)**, Y**(**:data**)**, Overlay**(**:year**))**, Elements**(**Box Plot**(**X, Y, Legend**(****7****))))**;