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
morenopelaez_p
Level III

Overlay variable for ONE graph only

I am trying to replicate a graph for which I have downloaded the exact same data but I am having trouble using overlay selectively.

 

This is the original graph:

Capture.PNG

 

and this is the most I manage to get:

 

Capture.PNG

 

My biggest issue is getting the accumulated black line. As I use overlay to create the stacked bars, the overlay applies to the points too and I end up getting plenty of points/lines...

 

Is there a way to have the overlay apply to only one of the graphs? Maybe via JSL?

 

While we are at it...:) As you can see, the other difference between the graphs is the order of the variables within the bars...can this be changed?

 

Thanks in advance!

2 ACCEPTED SOLUTIONS

Accepted Solutions
pmroz
Super User

Re: Overlay variable for ONE graph only

While we are at it...:) As you can see, the other difference between the graphs is the order of the variables within the bars...can this be changed?

Right click on the column header for the variable in question.  

Select Column Info

Click Column Properties > Value Ordering

Rearrange the values according to your desired sort order

 

Programmatically you can do this like so:

dt = New Table( "", Add Rows( 3 ),
	New Column( "Column 1", Character, "Nominal",
		Set Values( {"a", "b", "c"} )
	)
);

column(dt, "Column 1") << Set Property( "Value Ordering", {"c", "a", "b"} );

 

 

View solution in original post

jerry_cooper
Staff (Retired)

Re: Overlay variable for ONE graph only

What you want to do is probably best accomplished by creating an aggregate column (either a formula column in the data table, or a virtual column in the Graph Builder platform). This column would be the sum of your measures grouped by your X variable. Then:

1. place your data column and the aggregate column in the Y-role in Graph Builder

2. place your X and overlay variables in the appropriate roles 

3. select the Bar Chart (Stacked) element and turn off the aggregate variable

4. then add the line element (shift-click) and turn off the data variable (leaving the aggregate and X variables checked)

5. follow step #4 for the points element if desired (turn off the jitter option)

6. Double-click the legend to edit what is displayed, i.e. captions and line colors

I've enclosed a sample file with a Graph Builder script... hope this helps.

View solution in original post

6 REPLIES 6
Byron_JMP
Staff

Re: Overlay variable for ONE graph only

in Graph Builder, when the control panel is on, look on the left hand side where all the graph elements are.  At the bottom of each element, in your case, the Line element, there is a little grey disclosure triangle infront of the the word "variables"  click that grey triangle and then select which Y variables you want to use for the line, noting that you'll likely also need to include your X variable too. 

JMP Systems Engineer, Health and Life Sciences (Pharma)
pmroz
Super User

Re: Overlay variable for ONE graph only

While we are at it...:) As you can see, the other difference between the graphs is the order of the variables within the bars...can this be changed?

Right click on the column header for the variable in question.  

Select Column Info

Click Column Properties > Value Ordering

Rearrange the values according to your desired sort order

 

Programmatically you can do this like so:

dt = New Table( "", Add Rows( 3 ),
	New Column( "Column 1", Character, "Nominal",
		Set Values( {"a", "b", "c"} )
	)
);

column(dt, "Column 1") << Set Property( "Value Ordering", {"c", "a", "b"} );

 

 

morenopelaez_p
Level III

Re: Overlay variable for ONE graph only

@pmroz Yes! that solves the order issue! I still have the problem with the total of the measures... I think it is just not possible to apply the overlay selectively...

Capture 2.PNG 

morenopelaez_p
Level III

Re: Overlay variable for ONE graph only

I have tried changing those but it does not help to get the dots to be the accumulated values... am I missing something there?

Capture.PNG

jerry_cooper
Staff (Retired)

Re: Overlay variable for ONE graph only

What you want to do is probably best accomplished by creating an aggregate column (either a formula column in the data table, or a virtual column in the Graph Builder platform). This column would be the sum of your measures grouped by your X variable. Then:

1. place your data column and the aggregate column in the Y-role in Graph Builder

2. place your X and overlay variables in the appropriate roles 

3. select the Bar Chart (Stacked) element and turn off the aggregate variable

4. then add the line element (shift-click) and turn off the data variable (leaving the aggregate and X variables checked)

5. follow step #4 for the points element if desired (turn off the jitter option)

6. Double-click the legend to edit what is displayed, i.e. captions and line colors

I've enclosed a sample file with a Graph Builder script... hope this helps.

morenopelaez_p
Level III

Re: Overlay variable for ONE graph only

Great! That works! I was too biased thinking that this should be possible straight away in graph builder to even think of manipulating the table... :)

 

Actually I think it would be a great feature to have the overlay, color and size (and probably other) fields to accept multiple variables that could then be selected on the variables under each graph type (points, bars...) that is being used.

 

For completeness, I had another workaround in mind involving creating the two separate graphs and then "Right click on one of the graph blank space-->Edit-->Copy frame contents" and then go to the other graph and "Paste frame contents". This should do the job but I think the graph is not changeable anymore or can be saved.