cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

How to assign colors to lines when using many Y columns in Graph Builder?

Hi,

 

I'm creating a line graph with MANY (over 200 columns) of data, each of which is a line in my plot (continuous variables plotted to y axis, and categorical (rows in table) plotted on x axis. Something like this:

 

8813_Screen Shot 2015-05-20 at 18.39.32.png

 

Everything looks good so far, but how do assign the colors for each line instead of the JMP defaults?  Is the only way right click on the graph and select "customize" and then change the color for each line?  Because when I do that with my giant graph I get this error "menu item overflow".  Hopefully there is a way to do this for each column back in the data table before the graph is created?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
sseligman
Staff

Re: how to specify colors in line plots for many columns (lines)

As Xan said, you can apply a Value Colors column property to choose specific colors for levels of a variable. If you use that variable in the Graph Builder Overlay role, those colors will be applied. Since you're starting with many Y columns, you'll need to stack your data using the Tables -> Stack platform so that you'll have one column of data points and another with a label value, indicating which original Y column the data came from. Use the resulting label variable, with a Value Colors column property applied, in the Overlay role and the graph elements will take on the colors you assigned.

View solution in original post

5 REPLIES 5
ms
Super User (Alumni) ms
Super User (Alumni)

Re: how to specify colors in line plots for many columns (lines)

A quicker way than Customize is to select one, all or any combination of lines (shift-click to select ranges, cmd/ctrl click to select discontinuously) in the legend and then right-click to select color.


The multiple selection of legend items appears to require JMP 12.

Re: how to specify colors in line plots for many columns (lines)

Thanks, is there a solution for JMP11?  I don't have 12.

robot
Level VI

Re: how to specify colors in line plots for many columns (lines)

Are you using Graph Builder?  If yes, one can change color by right-clicking the desired variable on the graph legend in JMP11.  A script may look something like this:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

graph = dt << Graph Builder(

  Show Control Panel( 0 ),

  Variables(

  X( :age ),

  Y( :height ),

  Y( :weight, Position( 1 ) ),

  Group X( :sex )

  ),

  Elements(

  Line(

  X,

  Y( 1 ),

  Y( 2 ),

  Legend( 2 ),

  Row order( 0 ),

  )

  ),

  SendToReport(

  Dispatch(

  {},

  "400",

  ScaleBox,

  {Legend Model(

  2,

  Properties( 0, {Line Color( 6 )} ),

  Properties( 1, {Line Color( 8 )} )

  )}

  )

  )

);

XanGregg
Staff

Re: how to specify colors in line plots for many columns (lines)

Another way is to set the Value Colors property on the Overlay variable. That will override the JMP default colors, and the Value Colors dialog supports multiple selection in older JMPs. And if you're doing this for multiple similar columns, you can use Standardize Attributes to change them all at once.

sseligman
Staff

Re: how to specify colors in line plots for many columns (lines)

As Xan said, you can apply a Value Colors column property to choose specific colors for levels of a variable. If you use that variable in the Graph Builder Overlay role, those colors will be applied. Since you're starting with many Y columns, you'll need to stack your data using the Tables -> Stack platform so that you'll have one column of data points and another with a label value, indicating which original Y column the data came from. Use the resulting label variable, with a Value Colors column property applied, in the Overlay role and the graph elements will take on the colors you assigned.