cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Julianveda
Level III

Problem Graph builder second Y axis

Hello Community,

 

I'm having trouble trying to create a second Y axis for a bar chart representation. I already followed the procedure explained in other discussions (select Y variables and move right), but the results for the case of bar charts are not good. Please see the picture below and you'll see that the variable I moved right is either behind or in front of the bars from the left Y axis, but I need them to be next to each other.

Could you help me in solving this ?

 

Julianveda_0-1686728856619.png

 

Thanks for reading.

Julian

 

2 REPLIES 2
txnelson
Super User

Re: Problem Graph builder second Y axis

You can get the separation if you use an Overlay column.  If that Overlay column follows the left and right specification, you will get the bars fully displayed. 

txnelson_0-1686743937704.png

The above chart required the data table to be modified.  The Height and Weight need to be identified by an overlay column.  The way I do this, is to copy all of the Weight data into new rows, and to set all of the Weight data in the original rows to missing.  Then I added a new column called Group which has the value 1 for the original rows, and a 2 for the new rows.

txnelson_1-1686744526220.png

 

 

 

Jim

Re: Problem Graph builder second Y axis

Hi @Julianveda ,

 

I like Jim's answer, but if you are looking for a graph that looks like this instead ...

John_Powell_JMP_0-1686746835091.png

... you need to drag the Position variable onto the X axis twice.

 

I hope this helps, 

~John 

 Here's the script for the graph above.

Open( "$SAMPLE_DATA/Football.jmp" ) <<
Graph Builder(
	Size( 413, 246 ),
	Show Control Panel( 0 ),
	Variables(
		X( :Position ),
		X( :Position ),
		Y( :Weight, Side( "Right" ) ),
		Y( :Height, Position( 1 ) )
	),
	Elements( Position( 1, 1 ), Bar( X, Y( 2 ), Legend( 70 ) ) ),
	Elements( Position( 2, 1 ), Bar( X, Y( 1 ), Legend( 73 ) ) ),
	SendToReport(
		Dispatch( {}, "Weight", ScaleBox,
			{Min( 0 ), Max( 296.774225863422 ), Inc( 50 ), Minor Ticks( 0 )
			}
		),
		Dispatch( {}, "graph title", TextEditBox,
			{Set Text( "Mean(Height) & Mean(Weight) vs. Position" )}
		)
	)
)