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
BHarris
Level VI

Making Graph Builder's "Size" scale to axes

Suppose I have a dataset of flaws found on a surface of manufactured products that looks like this:

 

SNX(cm)Y(cm)Diameter(cm)
00012.31.150.04
00012.70.440.12
00011.52.60.35
00025.41.90.17
00023.14.10.59

 

In Graph Builder given that I Local-Data-Filter the SN, and plot X(cm)->X, Y(cm)->Y, and Diameter(cm)->Size, is there a way to make the resulting dot sizes be drawn to scale on the plot?

 

7 REPLIES 7
Byron_JMP
Staff

Re: Making Graph Builder's "Size" scale to axes

easy solution, but not perfectly scaled

Byron_JMP_0-1723662764659.png

Solving the problem with just a little clicking around:

In graph builder I put X and Y on the X and Y axis boxes, then drug SN to the color role and Diameter to the size role.

 

Here's what the script would look like:

Graph Builder(
	Size( 409, 391 ),
	Variables(
		X( :"X(cm)"n ),
		Y( :"Y(cm)"n ),
		Color( :SN ),
		Size( :"Diameter(cm)"n )
	),
	Elements( Points( X, Y, Legend( 9 ) ) )
);

 

JMP Systems Engineer, Health and Life Sciences (Pharma)
BHarris
Level VI

Re: Making Graph Builder's "Size" scale to axes

Looks like you replicated the process in the question well.  I was hoping someone might know of a shift-click option or something else that would help with the scaling.

jthi
Super User

Re: Making Graph Builder's "Size" scale to axes

I think you might have to do this with a graphic script. Below is very quick and hacky solution, it can give an idea what you could possibly do

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(5),
	Compress File When Saved(1),
	New Column("SN", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1, 2, 2])),
	New Column("X(cm)", Numeric, "Continuous", Set Values([2.2999999999999998, 2.7000000000000002, 1.5, 5.4000000000000004, 3.1000000000000001])),
	New Column("Y(cm)", Numeric, "Continuous", Set Values([1.1499999999999999, 0.44, 2.6000000000000001, 1.8999999999999999, 4.0999999999999996])),
	New Column("Diameter(cm)",
		Numeric,
		"Continuous",
		Set Values([0.040000000000000001, 0.12, 0.34999999999999998, 0.17000000000000001, 0.58999999999999997])
	)
);

gb = dt << Graph Builder(
	Size(518, 454),
	Show Control Panel(0),
	Lock Scales(1),
	Variables(X(:"X(cm)"n), Y(:"Y(cm)"n), Size(:"Diameter(cm)"n)),
	Elements(Points(X, Y, Legend(5))),
	Local Data Filter(Add Filter(columns(:SN), Modeling Type(:SN, Nominal)))
);

frame = Report(gb)[FrameBox(1)];

Eval(EvalExpr(
	frame << Add Graphics Script(
		cur_gb = Expr(Report(gb));
		fb = cur_gb[FrameBox(1)];
		ms = fb << Find Seg(Marker Seg(1));
		xs = ms << Get X Values;
		ys = ms << Get Y Values;
		For(i = 1, i <= N Items(xs), i++,
			dt = cur_gb << Get Data Table;
			m_rows = dt << Get Rows Where(:"X(cm)"n == xs[i] & :"Y(cm)"n);
			diam = dt[m_rows, "Diameter(cm)"][1];
			Circle({xs[i], ys[i]}, diam/2);
		);
	);	
));

jthi_3-1723663153330.png

 

Also read how Circle's radius behaves https://www.jmp.com/support/help/en/18.0/#page/jmp/graphics-functions.shtml?os=win&source=applicatio...

-Jarmo
BHarris
Level VI

Re: Making Graph Builder's "Size" scale to axes

Thanks, @jthi -- you obviously have an impressive command of jsl! 

 

This feels like a capability that JMP should have, and seems like it would be easy to fold into the marker size settings (at least from a UI perspective).  I'll add it to the wish-list.

BHarris
Level VI

Re: Making Graph Builder's "Size" scale to axes

Wish-list item posted here:

 

Graph Builder: Enable axes-aware sizing of dots with Size drop-zone - JMP User Community

 

@jthi -- ok to copy/paste your example image above into the wish-list item?

jthi
Super User

Re: Making Graph Builder's "Size" scale to axes

Of course. You could modify it a bit to use "FILL" argument in Circle so it would look something like this (might be a good idea to hide legend when you do this as the circles contain the size information not the underlaying markers)

jthi_0-1723781494787.png

 

-Jarmo
XanGregg
Staff

Re: Making Graph Builder's "Size" scale to axes

I'm not quite following this entire discussion, but I thought a few notes might be relevant.

  • There is a "Size to Isometric" command in Right Click > Graph > Size/Scale > Size To Isometric. It sizes the graph so that the X and Y have the same values per pixel. It doesn't persist though.
  • The size variable is represented as circle area, not diameter.
  • A few versions ago we added the Marker Draw Expo functionality to markers and Graph Builder (called Shape Expressions under Points red-triangle menu).

XanGregg_0-1726088683422.png

 

Graph Builder(
	Size( 496, 501 ),
	Show Control Panel( 0 ),
	Lock Scales(1),
	Variables( X( :"X(cm)"n ), Y( :"Y(cm)"n ) ),
	Elements(
		Points( X, Y, Legend( 5 ),
			Set Shape Expression(
				Expr(
					Function( {this seg, this row, x, y, pixel size, row state},
						{r = :"Diameter(cm)"n / 2},
						Oval( x - r, y + r, x + r, y - r, 1 )
					)
				)
			)
		)
	),
	Local Data Filter( Add Filter( columns( :SN ), Modeling Type( :SN, Nominal ) ) ),
	SendToReport(
		Dispatch( {}, "Graph Builder", FrameBox, {Size To Isometric} )
	)
);