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
AnneMaryJoy
Level II

Changing fit line color while using fit model

I am using the fit  model to draw fit lines based on the value of my column 'Tools'. I have 2 values in this column 'a' and 'b'. I need a red fit line for 'a' and blue fit line for 'b' in all scenarios. Seems like the  default colors being used in fit models is red for the fit line of the first value and blue for the following, something that I have leveraged to get the required functionality, i.e red fit line for 'a' and blue fit line for 'b' by using value ordering in the code below. It works perfect when I have both “a” and “b” in my Tools column, ‘a’ gets red color(default color) and ‘b’ gets blue. But in scenarios where my 'Tools' column has only  value ‘b', the fit line for ‘b’ shows up in red color(default color). Is there some way I can trick it such that ‘b’ still gets a blue fit line ? Basically, I need control over the colors used for the fit line in the Fit Model. Is that possible in the code below ?

Column( "Tools" ) << Set Property( value ordering, {"a", "b"} );
vdtTmp << append(
	H List Box(
		vFit = Fit Model(
			Y( :Value ),
			Effects( :Date, :Tools ),
			Personality( Standard Least Squares ),
			Emphasis( Effect Leverage ),
			Run Model(
				:Value << {Pareto Plot( 0 ), Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ),
				Plot Effect Leverage( 1 )}
			),
			invisible
		), 

	)
);
2 ACCEPTED SOLUTIONS

Accepted Solutions
gzmorgan0
Super User (Alumni)

Re: Changing fit line color while using fit model

Anne Marie,

 

I had a very detailed response, but I guess it took too long writing it.  I am hoping it can be retrieved, if not I will try to capture the essence later.  Attached is a script that runs in 12, 13 and 14.  My "lost" note proposed an approach. The script uses 2 different methods to do the customization: (1) Xpath finding graph segments and customizing; and (2)  using Dispatch to numbered segments. On approach is to use method 2 and create an onlyAexpr, onlyBexpr and bothexpr, then based upon the scenario run the corresponding expression.

My note explained there are easier options, depending upon your requirements.  Hopefully it will be restored.

 

 

View solution in original post

Jeff_Perkinson
Community Manager Community Manager

Re: Changing fit line color while using fit model

Try using the Value Colors column property.

JMPScreenSnapz196.png 

:Tool << Set Property( "Value Colors", {"A" = "Red", "B" = "Blue"} ); 

 

 

-Jeff

View solution in original post

6 REPLIES 6
gzmorgan0
Super User (Alumni)

Re: Changing fit line color while using fit model

Anne Marie,

 

I had a very detailed response, but I guess it took too long writing it.  I am hoping it can be retrieved, if not I will try to capture the essence later.  Attached is a script that runs in 12, 13 and 14.  My "lost" note proposed an approach. The script uses 2 different methods to do the customization: (1) Xpath finding graph segments and customizing; and (2)  using Dispatch to numbered segments. On approach is to use method 2 and create an onlyAexpr, onlyBexpr and bothexpr, then based upon the scenario run the corresponding expression.

My note explained there are easier options, depending upon your requirements.  Hopefully it will be restored.

 

 

gzmorgan0
Super User (Alumni)

Re: Changing fit line color while using fit model

I was told a draft of my reply should be available, but it was not. So this note will add some details lost with the original post.

Your script is fitting a common slope model (analysis of covariance). Typically, that should always be accompanied with a test for interaction (the slopes vary by tool). The model also uses :Date as the continuous factor which is typical of a time series or control chart model.

 

The reason for these questions is that the line color task is much easier in other platforms, for example, Bivariate where Tool would be a grouping factor.  If you clarify the goal of your model, the bloggers can assess if there might be a better platform to use.  Most often there are multiple methods to achieve a task in JMP.

 

As stated the script (attached) does perform the task you requested. The script uses Big Class where :weight replaces :Value, :height replaces :Date and :sex replaces :Tool. The Fit model statement was slightly modified so that the Fit Model Dialog is closed after it runs.  Some script notes:

  • The first model fit uses only M (males)  to emulate your only "b" scenario.  It uses a method to find named graph segments using Xpath then sends messages to modify the colors.
  • Note: the named segment for the confidence band changed in JMP 14, in JMP 12 & 13, it is called ".05 Significance Curve" and in JMP 14 is is called "0.05 Significance Curve"; there is a comment in the script above the line that needs changing.  
  • The second model fits both F and M (simulating your 2 tool scenario). This is an example of an alternate method using numbered segments and Dispatch statements. 

Another item to note is that JMP 13 and 14 have shaded Confidence bands. I found an issue (that I reported to JMP): changing the shading for one factor changes it for all Fit Model confidence bands in that JMP session, so I chose light gray, a neutral, due to this issue.... so you would not see red bands with blue lines or vice versa.  JMP 12 has no shading so there is no issue. 

 

Not knowing your comfort level with JSL, the second method might be easier to manage.  Create an onlyAExpr, an onlyBExpr and a bothExpr using the second method as a template. For each, specify the preferred coloring.

 

Given your second post, I am attaching a script of alternate displays you might want to investigate, depending upon your goals for the analysis.

 

AnneMaryJoy
Level II

Re: Changing fit line color while using fit model

Hello Morgan,

 

I used your first method and it worked. Thanks a ton! I really needed the help.

Jeff_Perkinson
Community Manager Community Manager

Re: Changing fit line color while using fit model

Try using the Value Colors column property.

JMPScreenSnapz196.png 

:Tool << Set Property( "Value Colors", {"A" = "Red", "B" = "Blue"} ); 

 

 

-Jeff
gzmorgan0
Super User (Alumni)

Re: Changing fit line color while using fit model

Jeff,

 

This is cool.  Yes, this does force the line to be colored by the Value Colors().  I found that Using JMP documents that Value Colors()  is one of the column properties that "attach information that is used in reports and plots" but it is not very specific. It would be nice to add what it does.  Note that :sex is a modeled factor, yet the points do not use it. So maybe another sentence or Tip of what it does vs. doesn't would be nice to have. 

 

Since this is related to Fit model, it would be nice if a colum's predicted and residuals would also use the associated table's Value Colors(), so that Leverage plots, etc. would use that coloring as well.

 

Thank you for documenting this.

 


AnneMaryJoy
Level II

Re: Changing fit line color while using fit model

Hello Jeff,

 

Your method worked as well! Thank you very much for the simple solution!