Dt =打开(“ $ SAMPLE_DATA \世界人口统计数据。JMP”);
隐藏第一行,并删除列名中带有“(1000)”的前五列。
使用以下代码生成气泡图。
dt = Current Data Table();
c11 = Quantile( 1, (:Crude Birth Rate << get values) ) * 1.01;
c12 = Quantile( 0, (:Crude Birth Rate << get values) ) * 0.99;
c21 = Quantile( 1, (:Crude Death Rate << get values) ) * 1.01;
c22 = Quantile( 0, (:Crude Death Rate << get values) ) * 0.99;
c31 = Quantile( 1, (:Population << get values) );
c32 = Quantile( 0, (:Population << get values) );
pa = {0.05, 0.275, 0.5, 0.725, 0.95};
xF = {};
For( c = 1, c <= 5, c++,
na = Quantile( pa[c], (:Infant Mortality Rate << get values) );
Insert Into( xF, na );
);
Bubble Plot(
X( :Crude Birth Rate ),
Y( :Crude Death Rate ),
Sizes( :Population ),
Coloring( :Infant Mortality Rate ),
ID( :Territory ),
Color Levels( xF ),
Title Position( 0, 0 ),
SendToReport(
Dispatch( {}, "1", ScaleBox, {Format( "Best", 10 ), Min( c12 ), Max( c11 ), Inc( 5 ), Minor Ticks( 1 )} ),
Dispatch( {}, "2", ScaleBox, {Format( "Best", 12 ), Min( c22 ), Max( c21 ), Inc( 5 ), Minor Ticks( 0 )} )
)
);
Wait( 0 );如何在气泡图中使用自定义颜色参数替换自动生成的参数?
由软件自动生成的参数JSL代码是
Color Levels([2.31 46.785 91.26 135.735 180.21])
如果要改为使用自己的参数,如何编写JSL?

谢谢!
Color Levels()的参数必须为矩阵-列表参数将被忽略。 这是一个有效的示例:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/PopAgeGroup.jmp" );
cl = [100000 150000000 300000000 450000000 600000000];
obj = Bubble Plot(
X( :Name( "Portion 0-19" ) ),
Y( :Name( "Portion60+" ) ),
Sizes( :Pop ),
Coloring( :Pop ),
ID( :Country ),
Color Levels( cl )
);
感谢danschikore!
现在的重点是如何将xf更改为矩阵形式,我已经搜索了仍然找不到答案,请寻求帮助。
我试图编写这样的代码,但是没有用。谢谢!
……<BR />Mat = Number Col Box("",xf) << get as matrix;<BR />……<BR />Color Levels( Mat ),的 JMP脚本指南很好地概述了在JSL中使用矩阵的方法。 如果已经有了列表,则可以将其转换为矩阵:
Create a column vector from a single list:
A = Matrix( {1, 2, 3} );
[1,2,3]
您还可以创建一个空矩阵并通过串联构建它,类似于您使用列表的方式:
cl = [];
cl = cl || 100000;
cl = cl || 150000000;
cl = cl || 300000000;
cl = cl || 450000000;
cl = cl || 600000000;
[100000 150000000 300000000 450000000 600000000]
如果您提前知道矩阵的大小,则可以创建完整的矩阵并使用下标分配值:
cl = J(1,5);
cl[1] = 100000;
cl[2] = 150000000;
cl[3] = 300000000;
cl[4] = 450000000;
cl[5] = 600000000;
Show(cl);
cl = [100000 150000000 300000000 450000000 600000000];
希望有帮助!