차트에 데이터 표의 그림을 삽입합니다.
@Neo가 질문했습니다 . 열린 테이블의 행과 열을 차트에 삽입하는 게 가능할까요?
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.그래프에 포함된 저널링된 데이터 테이블의 그림입니다.
그래프를 마우스 오른쪽 버튼으로 클릭->사용자 정의를 선택하면 기본적으로 이미지가 그래프 뒤에 배치되는 것을 볼 수 있습니다.
The list items are drawn in order from top to bottom (painter's algorithm.) The picture is below the graph.목록 항목은 위에서 아래로 순서대로 그려집니다(페인터 알고리즘). 그림은 그래프 아래에 있습니다.
그래프 뒤로 그림을 옮길 수도 있지만, 그렇게 하는 것은 일반적으로 바람직하지 않습니다.
The picture has a solid white background that blocks the graph.그림에는 그래프를 가리는 흰색 배경이 있습니다.
원래 주제에서 약간 벗어나긴 하지만, JMP에서 Graph Builder에 단조로운 평활화 도구를 추가하는 것을 고려한 적이 있나요? 관계가 단조로워야 한다는 생각이 꽤 있는 이런 상황에서는 좋은 옵션이 될 겁니다.