使用不同的脚本导出多个图表嘿,Jmp 用户,
我正在尝试在 Jmp 中导出多个图表。有没有办法选择相应的脚本并一起导出所有图表。
多谢 !
I
自动化和脚本大规模定制回复:使用不同的脚本导出多个图形PMROZ,
尝试打开“图表”时,我仍然看到一个空白窗口。 我需要包括一些基本的东西吗? 我的目标是将所有三个图(Graphs、Graphs2 和 Graphs3)放在一个窗口中,这样我就可以复制并粘贴到 Powerpoint 中。
非常感谢任何输入。
尼尔
回复:使用不同的脚本导出多个图形PMROZ,
非常感谢您的输入! 作为新手,我仍在习惯 JSL 流程和功能,很高兴获得专家指导。 我包括了整个脚本(精简),以向您展示整体流程。 根据以前考虑主宏和子例程的编码经验,我试图将例程封装在表达式中,以便稍后在程序中调用它们(“Files()”、“Join_files”和“Con”)。
我将“Graphs = Eval Expr”更改为“Graphs = Expr”,一切正常。 我不确定这是否需要 Eval,因为它是在另一个表达式 (Join_files) 中调用的。
我在新窗口中使用了图表,但仍然得到一个空窗口。
再次感谢您的宝贵时间。
尼尔
Files = Expr(
SD1 = "C:\Users\";
path = {};
f1 = Files In Directory( SD1, recursive(1));
For( i = 1, i <= N Items( f1 ), i++,
If(Ends With( f1[i], ".csv" ),
f1[i] = Convert File Path(SD1) || f1[i];
b= f1[i];
Insert Into(path, b)
);
);
);
Join_files = Expr(
For( i = 1, i <= N Items( path ), i+=2,
/*area, %area, and pore pixel count*/
jointable1 = Open( path[i] );
//jointable1 << Get Name;
samplename = Substr( jointable1 << Get Name, 1, 18 ); //sample replicate name //
samplename2 = Word(1,q, "_"); // only sample name, no replicate suffix
jointable1 << New Column( "Sample",
Character,
Nominal,
Set Each Value( samplename ) // setting each row in column 1 to samp rep name //
);
jointable2 = Open( path[i + 1] );
dt = Data Table( jointable1 ) << Join(
With( Data Table( jointable2 ) ),
Select( :Sample, :Area, :Name( "%Area" ),:scale,:thick),
SelectWith( :pixD1, :count1),
Cartesian Join
);
Close( jointable1, no save );
Close( jointable2, no save );
Columns();
Graphs();
Graphs2();
Graphs3();
dt << Set Name(samplename);
po = dt << get name;
dt << Save(SD1 || po);
);
nw = new window("Example Export Multiple Platforms",
chart_output = vlistbox(
graphs,
);
);
);
Columns = Eval Expr(
dt << New Column( "Sample 2",
Character,
"Nominal",
Set Each Value(samplename2),
Set Display Width( 150 ),
);
);
Graphs = Eval Expr(
/*set graphs*/
dt << New Table Property( "Cumulative Resistivity",
Graph Builder(
Size( 591, 496 ),
Show Control Panel( 0 ),
Grid Color( "Black" ),
Graph Spacing( 2 ),
Variables(
X( :Name( "Diameter (um)" ) ),
Y( :Name( "flow resistivity (Pa*s/m^2)") ),
Overlay( :Sample )
),
Elements( Position( 1, 1 ), Line( X, Y, Legend( 20 ) ) ),
SendToReport(
Dispatch(
{},
"Diameter (um)",
ScaleBox,
{Min( 0 ), Max( 80 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row(
{Show Major Grid( 1 ), Show Minor Grid( 1 )}
)}
),
Dispatch(
{},
"flow resistivity (Pa*s/m^2)",
ScaleBox,
{Scale( "Log" ), Format( "Scientific", 12 ), Min( 100000 ),
Max( 10000000000000 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
),
)
)
)
);
Con = Expr(
dt = {};
// Sort list ascending (sample replicates) //
For( i = 1, i <= N Table(), i++,
table = data table(i);
insert into(dt, table);
sort list into(dt)
);
// Concatenate each file (sample replicates) //
dt_all= Data Table( dt[1] ) << Concatenate(
Data Table( dt[2] ),
Data Table( dt[3] ),
Output Table( "Concatenated Table" )
);
// Rename file to sample name and Save //
dt_all << set name(samplename2);
dt_all:Sample << Set Display Width( 150 ); // Widen to include entire title
p = dt_all << get name;
dt_all << Save(SD1 || p);
close(dt_all, no save);
close(dt[1], no save);
close(dt[2], no save);
close(dt[3], no save);
);
Files();
Join_files();
Con();
回复:使用不同的脚本导出多个图形嗨 NRW - 我认为你把事情复杂化了。您不需要将连接逻辑放入表达式中。只需在没有周围的 expr() 的情况下运行它。
这图表逻辑在你的帖子中被切断了,但我会这样做表达式() , 而不是评估表达式() .
最后在你的新窗口中放
graphs,
并不是
graphs("Cumulative Resistivity"),
回复:使用不同的脚本导出多个图形伙计们,
我只是偶然发现了这个线程,我想这就是我一直在追求的。 但是,我仍在努力克服 JSL 学习障碍,但我无法完全得到结果。
快速总结:
- 将 CSV 数据集合并到一张 JMP 表中
- 创建绘图脚本并将其保存到数据表
- 稍后打开表格时,我运行三个绘图脚本,然后将每个绘图复制并粘贴到一张 Powerpoint 幻灯片中(与绘图对应的图像已经粘贴在同一张幻灯片中)
我希望通过至少将所有三个图表汇集在一起并以可以同时导出所有三个图表的格式来最大程度地减少点击和复制步骤。 我一直在探索这是否需要使用仪表板或日志来完成,它们以某种方式分组并保存为我可以拉过来的文件。 圣杯是将我的 jpg 图像与我的 JMP 图配对,然后带到 PP。
我试过 Vlist 命令但是得到一个空窗口在尝试获取保存为脚本的情节时。 显示了部分相关脚本片段。
欢迎任何想法或意见。
尼尔
Join_files = Expr(
For( i = 1, i <= N Items( path ), i+=2,
/*area, %area, and pore pixel count*/
jointable1 = Open( path[i] );
//jointable1 << Get Name;
samplename = Substr( jointable1 << Get Name, 1, 18 ); //sample replicate name //
samplename2 = Word(1,q, "_"); // only sample name, no replicate suffix
jointable1 << New Column( "Sample",
Character,
Nominal,
Set Each Value( samplename ) // setting each row in column 1 to samp rep name //
);
/*diameter and pore pixel count*/
jointable2 = Open( path[i + 1] );
dt = Data Table( jointable1 ) << Join(
With( Data Table( jointable2 ) ),
Select( :Sample, :Area, :Name( "%Area" ),:scale,:thick),
SelectWith( :pixD1, :count1),
Cartesian Join
);
Close( jointable1, no save );<SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="report summ_.JPG" style="width: 829px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="report summ_.JPG" style="width: 829px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="report summ_.JPG" style="width: 829px;"><span class="lia-inline-image-display-wrapper" image-alt="report summ_.JPG" style="width: 829px;"><img src="https://us.v-cdn.net/6038925/uploads/images/32980i018D050D35ACCDD9/report%20summ_.JPG" role="button" title="report summ_.JPG" alt="report summ_.JPG" /></span></SPAN></SPAN></SPAN>
Close( jointable2, no save );
Columns();
Graphs();
Graphs2();
Graphs3();
dt << Set Name(samplename);
po = dt << get name;
dt << Save(SD1 || po);
);
<BR />Graphs = Eval Expr(<BR />/*set graphs*/<BR />dt << New Table Property( "Cumulative Resistivity",<BR />Graph Builder(<BR />Size( 591, 496 ),<BR />Show Control Panel( 0 ),<BR />Grid Color( "Black" ),<BR />Graph Spacing( 2 ),<BR />Variables(<BR />X( :Name( "Pore Diameter (um)" ) ),<BR />Y( :Name( "Cumulative flow resistivity (Pa*s/m^2)") ),<BR />Y( :Pore Size Dist ),<BR />Y( :Name( "Cumulative Pore fraction (pore+solid)" ) ),<BR />Overlay( :Sample )<BR />),<BR />Elements( Position( 1, 1 ), Line( X, Y, Legend( 20 ) ) ),<BR />Elements( Position( 1, 2 ), Line( X, Y, Legend( 18 ) ) ),<BR />Elements( Position( 1, 3 ), Line( X, Y, Legend( 19 ) ) ),<BR />SendToReport(<BR />Dispatch(<BR />...<BR />
nw = new window("Example Export Multiple Platforms",
chart_output = vlistbox(
graphs("Cumulative Resistivity"),
);
);
);
回复:使用不同的脚本导出多个图形你好@JMP发现者,
我想出了一个类似的解决方案@pmroz ,我喜欢他们所做的。
这是我的想法,但不如制作word文档等好。您也可以将它们直接保存为PPT文件。 我在 JSL 中创建报告只是为了让它们方便使用,但是如果您已经打开它们,for 循环也可以工作。 但是,如果您编写一个生成报告的脚本,您可以只通过变量名引用报告而不是查找窗口列表。
Names Default To Here( 1 );
dt = open("$sample_data\Big Class.jmp");
rpt1 = dt << Bivariate( Y( :weight ), X( :height ) );
rpt2 = dt << Oneway( Y( :height ), X( :age ), X Axis Proportional( 0 ) );
rpt3 = dt << Fit Group(
Oneway( Y( :weight ), X( :age ), X Axis Proportional( 0 ) ),
Bivariate( Y( :weight ), X( :height ) ),
<<{Arrange in Rows( 2 )}
);
reportlist = {};
For( i = 0, i <= N Items( Window() ), i++,
If(
!Is Missing( Regex( Window( i ) << getwindow title, "Fit" ) ) == 1 | !Is Missing(
Regex( Window( i ) << getwindow title, "Oneway" )
) == 1 | !Is Missing( Regex( Window( i ) << getwindow title, "Bivariate" ) ) == 1,
Insert Into( reportlist, Window( i ) << get window title )
)
);
For( i = 1, i <= N Items( reportlist ), i++,
picbox = Window( reportlist[i] ) << getPicture;
picbox << SaveImage(
"whatever your local directory to save is\pic" || Char( i ) || ".png"
);
);这些应该让你在路上工作得很好。
祝你好运!,
DS
回复:使用不同的脚本导出多个图形下面是一个将三个图形输出从 Big Class 导出到 word 文档的示例。
dt = open("$sample_data\Big Class.jmp");
dist = expr(dt << Distribution(
Continuous Distribution( Column( :weight ) ),
Nominal Distribution( Column( :age ) )
));
gb1 = expr(dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :age ), Y( :sex ) ),
Elements( Heatmap( X, Y, Legend( 2 ) ) )
));
gb2 = expr(dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
));
nw = new window("Example Export Multiple Platforms",
chart_output = vlistbox(
dist,
page break box(),
gb1,
page break box(),
gb2
);
);
chart_output << save msword("c:\temp\SampleCharts.doc", Native);