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

Can JMP draw this pattern?

Hello!

Draw a horizontal bar chart of height data,
Graph the data on weight.
Superimpose two graphs on one graph.

2022-06-10_22-34-34.png2022-06-10_22-12-58.png

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Can JMP draw this pattern?

Here is my attempt.  It creates the needle chart transforming the Height and R values to match the range of the Weight and .25% of the r axis.  The a FrameBox copy is done from one graph to the other;

txnelson_0-1654917908989.png

names default to here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );

dt << new column("r", set each value(Row()));

gb1 = dt << Graph Builder(invisible,
	Size( 528, 454 ),
	Show Control Panel( 0 ),
	Variables(
		X( Transform Column( "r 2", Formula( :r * 0.25 ) ) ),
		Y(
			Transform Column(
				"height 2",
				Formula(
					If( Row() == 1,
						ytargetmax = Col Max( :weight );
						ytargetmin = Col Min( :weight );
						ytargetp = (ytargetmax - ytargetmin) / 100;
						ymax = Col Max( :height );
						ymin = Col Min( :height );
						yrange = ymax - ymin;
					);
					yp = ((:height - ymin) / yrange) * 100;
					ytargetmin + ytargetp * yp;
				)
			)
		)
	),
	Elements(
		Bar( X, Y, Legend( 5 ), Bar Style( "Needle" ), Response Axis( "X" ) )
	)
);

gb2 = dt << Graph Builder(
	Size( 528, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :r ), Y( :weight ) ),
	Elements( Line( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"weight",
			ScaleBox,
			{Min( 60.8877083333333 ), Max( 178.48 ), Inc( 20 ), Minor Ticks( 0 )}
		)
	)
);


report(gb1)[framebox(1)]<<copy frame contents;
report(gb2)[framebox(1)]<< paste frame contents;

gb1<<close window;

 

Jim

View solution in original post

txnelson
Super User

Re: Can JMP draw this pattern?

txnelson_0-1655722664257.png

 

Yes.  Graph Builder can easily do this.

  1. I added a transform column set to the Row() and used it for the X axis
  2. I dragged Height and weight to the Y axis
  3. Moved Weight to the right side axis
  4. Then I went into the axis settings for each axis and removed all tick marks and labels.

Documentation on Graph Builder is in the Essential Graphing document

Jim

View solution in original post

18 REPLIES 18
jthi
Super User

Re: Can JMP draw this pattern?

I'm not exactly sure what type of graph you want to plot. You have two different Y-axis on same axis and x-axis which scales to some other values for other data.

You can for example plot something like this where you move other X-axis to other side:

jthi_0-1654872261027.png

 

-Jarmo
lala
Level VII

Re: Can JMP draw this pattern?

Thank Jarmo!

That's exactly what I want.I want the red graph to be shorter on the X-axis.

 

Hope to get specific aspects, Thanks!

 

This kind of graph is easy to draw with Excel, and two data are made into different graphs respectively.Then set the background of one to transparent and overlay it on top of the other.

lala
Level VII

Re: Can JMP draw this pattern?

excel

2022-06-11_09-28-47.png

ih
Super User (Alumni) ih
Super User (Alumni)

Re: Can JMP draw this pattern?

I know this isn't exactly what you asked for before but I frequently draw graphs similar to this, maybe this recording will give you some ideas on how to make something like what you are looking for:

ih_0-1654884282142.png

 

 

lala
Level VII

Re: Can JMP draw this pattern?

Thank you very much!

I learned this method through videos and saw how adding rows can be done this way.

 

2022-06-11_08-24-30.png

lala
Level VII

Re: Can JMP draw this pattern?

2022-06-13_16-18-49.png

txnelson
Super User

Re: Can JMP draw this pattern?

Here is my attempt.  It creates the needle chart transforming the Height and R values to match the range of the Weight and .25% of the r axis.  The a FrameBox copy is done from one graph to the other;

txnelson_0-1654917908989.png

names default to here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );

dt << new column("r", set each value(Row()));

gb1 = dt << Graph Builder(invisible,
	Size( 528, 454 ),
	Show Control Panel( 0 ),
	Variables(
		X( Transform Column( "r 2", Formula( :r * 0.25 ) ) ),
		Y(
			Transform Column(
				"height 2",
				Formula(
					If( Row() == 1,
						ytargetmax = Col Max( :weight );
						ytargetmin = Col Min( :weight );
						ytargetp = (ytargetmax - ytargetmin) / 100;
						ymax = Col Max( :height );
						ymin = Col Min( :height );
						yrange = ymax - ymin;
					);
					yp = ((:height - ymin) / yrange) * 100;
					ytargetmin + ytargetp * yp;
				)
			)
		)
	),
	Elements(
		Bar( X, Y, Legend( 5 ), Bar Style( "Needle" ), Response Axis( "X" ) )
	)
);

gb2 = dt << Graph Builder(
	Size( 528, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :r ), Y( :weight ) ),
	Elements( Line( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"weight",
			ScaleBox,
			{Min( 60.8877083333333 ), Max( 178.48 ), Inc( 20 ), Minor Ticks( 0 )}
		)
	)
);


report(gb1)[framebox(1)]<<copy frame contents;
report(gb2)[framebox(1)]<< paste frame contents;

gb1<<close window;

 

Jim
lala
Level VII

Re: Can JMP draw this pattern?

Thank Jim!

 

This is exactly what I want.How do I change the color of GB1 (bar chart) to red?I still haven't learned.

txnelson
Super User

Re: Can JMP draw this pattern?

The lines are combined with the line chart, which means whatever the line color is, the needles will be the same.

Jim