Incorpora un'immagine di una tabella dati in un grafico.
@Neo ha chiesto : È possibile ottenere una riga e delle colonne da una tabella aperta come inserti in un grafico?
fontscale = 2; // scale up as needed. make the font bigger to make the image bigger.
picScale = .42; // scale down to fit. less than one to prevent pixelation.
topFraction = 0.95; // 0 at bottom, 1 at top of frame
bottomFraction = 0.05; // 0 at left, 1 at right of frame
dt = Open( "$sample_data/big class.jmp" );
// take a picture of the data
box = dt << journal;
oldFont = Get Preferences( fonts );
Preferences( Fonts( English( Text Font( "Segoe UI", 9 * fontscale ), Heading Font( "Segoe UI", 12 * fontscale, "Bold" ), ) ) );
pic = box << getpicture;
{xPixPixels, yPicPixels} = pic << size;
box << closewindow;
Eval( oldFont );
// make the graph
gb = Graph Builder(
Show Control Panel( 0 ),
Size( 1158, 894 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
// add the image
{xFramePixels, yFramePixels} = (Report( gb )[FrameBox( 1 )]) << getsize;
xmin = (Report( gb )[axisBox( 1 )]) << getmin;
xmax = (Report( gb )[axisBox( 1 )]) << getmax;
xUnitsPerPixel = (xmax - xmin) / xFramePixels;
ymin = (Report( gb )[axisBox( 2 )]) << getmin;
ymax = (Report( gb )[axisBox( 2 )]) << getmax;
yUnitsPerPixel = (ymax - ymin) / yFramePixels;
topPos = ymin + (ymax - ymin) * topFraction;
leftPos = xmin + (xmax - xmin) * bottomFraction;
bottomPos = topPos - picScale * yPicPixels * yUnitsPerPixel;
rightPos = leftPos + picScale * xPixPixels * xUnitsPerPixel;
(Report( gb )[FrameBox( 1 )]) << Add Image( image( pic ), bounds( top( topPos ), Left( leftPos ), bottom( bottomPos ), Right( rightPos ) ) );
// clean up. this will capture a picture and close the report and data table
gb << savepicture( "$temp/example.png" );
gb << closewindow;
Close( dt, nosave );
Open( "$temp/example.png" );
A picture of a journaled data table embedded in a graph.Immagine di una tabella di dati registrati incorporata in un grafico.
Se fai clic con il pulsante destro del mouse -> Personalizza grafico, puoi vedere che il comportamento predefinito per le immagini le posiziona dietro il grafico.
The list items are drawn in order from top to bottom (painter's algorithm.) The picture is below the graph.Gli elementi dell'elenco vengono disegnati in ordine dall'alto verso il basso (algoritmo del pittore). L'immagine si trova sotto il grafico.
È possibile spostare l'immagine da disegnare dopo il grafico, ma solitamente non è una scelta auspicabile.
The picture has a solid white background that blocks the graph.L'immagine ha uno sfondo bianco uniforme che nasconde il grafico.
So che è un po' fuori tema, ma JMP ha mai pensato di aggiungere smoother monotoni in Graph Builder? Sarebbe una buona opzione per situazioni come questa, in cui abbiamo una buona idea che la relazione debba essere monotona.