グラフビルダーで箱ひげ図を生成するスクリプトがありますが、最初はグラフからキャプチャされたものです。 コードは次のとおりです。
inboundDataTable << New Script("Boxplots and Means for Sites w/Low Read Rates",
Names Default to Here(1);
Delete Symbols();
inboundData = Current Data Table();
inboundData << Graph Builder(
Size(650, 481),
Grid Color({79, 98, 40}),
Variables(X(:IDENT Code), Y(:Read Rate)),
Elements(
Box Plot(X, Y, Legend(2), Jitter("Random Normal")),
Points(X, Y, Legend(3), Summary Statistic("Mean"))
),
SendToReport(
Dispatch(
{},
"Read Rate",
ScaleBox,
{
Format("Percent", 5, 0),
Minor Ticks(4),
Add Ref Line(0.95, "Solid", {255, 0, 0}, "", 1),
Label Row({Show Major Grid(1), Show Minor Grid(1)})
}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
2,
Base(1, 0, 0, Item ID("Read Rate", 2)),
Properties(1, {Fill Color(0)}, Item ID("Read Rate", 2)),
Properties(
-1,
{Line Color(-4221340), Marker("FilledCircle"), Fill Color(0)},
Item ID("Mean", 1)
)
), Legend Model(
3,
Properties(
0,
{Line Color(-16776960), Marker("Diamond"), Fill Color(0)},
Item ID("Mean", 1)
)
)}
),
Dispatch({}, "X title", TextEditBox, {Set Text("Crossing (Site)")}),
Dispatch(
{},
"Graph Builder",
FrameBox,
{
Marker Size(5), Grid Line Order(1), Reference Line Order(2),
DispatchSeg(
Box Plot Seg("Box Plot (ALC)"),
{Line Color({44, 77, 117}), Fill Color({79, 129, 189}), Fill(1)}
),
DispatchSeg(
Box Plot Seg("Box Plot (CIA)"),
{Line Color({44, 77, 117}), Fill Color({79, 129, 189}), Fill(1)}
),
DispatchSeg(
Box Plot Seg("Box Plot (JKM)"),
{Line Color({44, 77, 117}), Fill Color({79, 129, 189}), Fill(1)}
),
DispatchSeg(
Box Plot Seg("Box Plot (POR)"),
{Line Color({44, 77, 117}), Fill Color({79, 129, 189}), Fill(1)}
),
DispatchSeg(
Box Plot Seg("Box Plot (RAI)"),
{Line Color({44, 77, 117}), Fill Color({79, 129, 189}), Fill(1)}
),
DispatchSeg(
Box Plot Seg("Box Plot (THO)"),
{Line Color({44, 77, 117}), Fill Color({79, 129, 189}), Fill(1)}
)
}
)
)
)
);下部近くには FrameBox ブロックがあり、元のグラフから作成された各ボックスプロットの DispatchSeg を確認できます。 私がやりたいのは、コードのそのセクションを動的にすることです。これは、サイトの数がサイトの人口ごとに異なる可能性があるためです。
必要なのは、除外されていない一意のサイトの数を取得し、その数を使用してループを作成し、各ボックスプロットの線と塗りつぶしの色を設定する方法です。 どうすればこれについて行くことができますか。
@mdawson69 、
この例は、JMP 13 用に GraphBuilder をカスタマイズするための学習スクリプトとして作成されたものですが、それ以降のバージョンでは機能します。カスタムラベルを作成する麻生です。JMP 15 には、Textlet、Graphlet などの新しい機能があり、カスタム テキストを簡単に追加できます。 スクリプトが添付されており、それが作成する画像を以下に示します。
あなたが望むことをするためのいくつかの重要な機能があります:
- X変数によって定義された箱ひげ図の数を取得する方法。 このスクリプトは、boxplot 参照 bpseg[i] を作成する XPath を使用します。
- Dispatch の代わりに JSL send 構文 << を使用する方法
- ループ用。
JSL を初めて使用する場合は、ヘルプ > スクリプト インデックスためにXPath 、グラフビルダーボックスとフレームボックス。
以下で説明するようにスクリプトを実行することをお勧めします。
- 1 行目から 50 行目をハイライトして実行します。
- 51 行目から 54 行目を読み取り、強調表示して実行し、すべての箱ひげ図に加えられた変更を確認します
- 55 行目から 59 行目を読み、強調表示し、実行して、一度に 1 つの箱ひげ図を変更する方法を確認します
キーコードは次のとおりです。
//assume you like March's style and do not want to show the points
//here is the code to set all
bpseg = gb << Xpath("//BoxPlotSeg");
bpseg << {Box Style( "Solid" ), Confidence Diamond( 1 ), Fences( 0 )};
//if you want to color each by month
for(i=1, i<=nitems(bpseg), i++,
bpseg[i] << Fill Color(Color Of(As Row State(cc[i])))
);
//if you want to remove points. since ponts are the 3rd element
report(gb)[GraphBuilderBox(1)] << remove element(1,1,3);
//to add them back, uncomment and run the next line
//report(gb)[GraphBuilderBox(1)] << Add Element(1, 1, {Type("Points"), X, Y});
これで始められることを願っています。ああ、保存したスクリプトで個々の箱ひげ図を対象とする Dispatch ステートメントを削除する必要があります。添付のスクリプトは、symatx とトレーニングの目的を比較するためだけに、3 つのディスパッチ ステートメントを保持していました。
