- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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:
SN | X(cm) | Y(cm) | Diameter(cm) |
0001 | 2.3 | 1.15 | 0.04 |
0001 | 2.7 | 0.44 | 0.12 |
0001 | 1.5 | 2.6 | 0.35 |
0002 | 5.4 | 1.9 | 0.17 |
0002 | 3.1 | 4.1 | 0.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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Making Graph Builder's "Size" scale to axes
easy solution, but not perfectly scaled
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 ) ) )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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);
);
);
));
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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).
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} )
)
);