圖形產生器條形圖標籤偏移圖形產生器可以在長條圖上顯示值標籤,不幸的是,如果資料也繪製在長條圖上,則標籤會完全被遮蔽。

幸運的是,手動重新定位標籤相對容易。正確對齊是有點棘手的,而且多次這樣做會相對令人沮喪。在圖形的第二次或第三次迭代之後,即使編輯圖形腳本以獲得正確的對齊方式也是乏味的。借助一點 JSL 魔法,我們可以找到框架和條形段並自動調整標籤偏移量。
在下面的腳本中,開啟了一個範例資料表,然後執行一個圖形腳本,然後是一些格式化指令。
若要使用此腳本,請取代資料表引用或取消註解“dt=current data table();”行讓腳本針對目前表運行。圖形產生器腳本是一個範例,您可以使用 RTM>儲存腳本> 到剪貼簿來取得圖形產生器腳本,然後將其貼到範例的位置。
names default to here(1);
//paste your data table reference here, or just use the current data table.
dt=Open( "$SAMPLE_DATA/Big Class.jmp" );
//dt=current data table();
obj=dt<<
//Paste your graph builder script here
Graph Builder(
Size( 518, 470 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements(
Bar(X,Y,Legend( 4 ),
Error Interval( "Standard Error" ),
Label( "Label by Value" )),
Points( X, Y, Legend( 5 ) )),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model(4,
Properties(0,{Fill Color( 0 ), Fill Pattern( "none" )},Item ID( "Mean", 1 )))}))
);
// End of graph builder script.
//Make a reference for the bar chart segments
fbi= N Items( (obj << xpath( "//FrameBox" )) );
for (ii=1, ii<=fbi, ii++,
frame = Report( obj )[FrameBox( ii )];
seg = (frame << Find Seg( "Bar Seg" ));
//Get variable used for the X axis
vars=obj<< Get Variables();
xx=vars[1];xx[1];
//Find the number of bars (or levels used to make bars)
Summarize( levels = By( eval(xx[1])));
Eval List( levels );
//Build an expression to change the offset
qq=expr(set label offset());
for (i=0, i<=nitems(levels)*fbi, i++, //Note there is a multipler, *fbi. This assumes each level is the same for each frame. Its kind of sloppy, might need to just replace it with a fixed value.
rr={};
insert into (rr, i); //This is the Bar number, starts with zero
insert into (rr,i); //This is the x offset, which is the same as the bar number
insert into(rr, 10); //This is the Y offset
insert into (qq, (rr));
);
//Make magic happen
eval(substitute(expr(seg<<QQ></QQ>
<P> </P>
<P>在先前的部落格文章中,我描述了這些步驟,並包含一個自動化腳本,用於為「Dynamite」圖、帶有間隔線的條形圖添加帶有註釋的誤差線。 <A href="https://community.jmp.com/t5/Byron-Wingerd-s-Blog/One-Way-ANOVA-Figure-for-Scientists/ba-p/265156" target="_blank">https://community.jmp.com/t5/Byron-Wingerd-s-Blog/One-Way-ANOVA-Figure-for-Scientists/ba-p/265156</A></P><LINGO-TEASER id="lingo-teaser-777858" slang="en-US" mode="UPDATE"><P>您的資料是否模糊了您的資料標籤?</P></LINGO-TEASER><LINGO-LABS id="lingo-labs-777858" slang="en-US" mode="UPDATE"><LINGO-LABEL>自動化和腳本編寫</LINGO-LABEL><LINGO-LABEL>基礎資料分析與建模</LINGO-LABEL><LINGO-LABEL>數據探索和視覺化</LINGO-LABEL><LINGO-LABEL>分享和交流成果</LINGO-LABEL></LINGO-LABS>回覆:圖形產生器條形圖標籤已修復嗨@Byron_JMP ,好技巧。很有用。
或者,可以將標籤新增到第二個長條圖元素:
dt=Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
Size( 563, 522 ),
Summary Statistic( "Median" ),
Graph Spacing( 4 ),
Variables( X( :age ), Y( :height ) ),
Elements(
Bar( X, Y, Legend( 4 ), Error Interval( "Standard Error" ) ),
Points( X, Y, Legend( 5 ) ),
Bar( X, Y, Legend( 6 ), Bar Style( "Float" ), Label( "Label by Value" ) )
)
);
我經常遇到一個相關問題:水平標籤沒有空間:

是否有透過 JSL 來旋轉標籤的解決方法?
回覆:圖形產生器條形圖標籤已修復聽起來您希望標籤像這樣旋轉:

如果沒有你的問題我就不會嘗試。有一些晦澀的 JSL 可以讓您設定字體屬性和角度。老實說,我以前從未見過這樣做,而且看起來非常棒。
JSL 是這樣的:Set Font( "" , 18 , "" , 90 )。字體為“”,大小為 18 磅,格式為“”,角度為 90。將角度更改為 -90 可使文字從下到上閱讀。
names default to here(1);
//paste your data table reference here, or just use the current data table.
dt=Open( "$SAMPLE_DATA/Big Class.jmp" );
//dt=current data table();
obj=dt<<
//Paste your graph builder script here
Graph Builder(
Size( 518, 470 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements(
Bar(X,Y,Legend( 4 ),
Error Interval( "Standard Error" ),
Label( "Label by Value" )),
Points( X, Y, Legend( 5 ) )),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model(4,
Properties(0,{Fill Color( 0 ), Fill Pattern( "none" )},Item ID( "Mean", 1 )))}),
Dispatch( {}, "Graph Builder", FrameBox,
{DispatchSeg(
BarSeg( 1 ),
Set Font( "", 18, "", 90 )
)}
)
)
);
// End of graph builder script.
//Make a reference for the bar chart segments
fbi= N Items( (obj << xpath( "//FrameBox" )) );
for (ii=1, ii<=fbi, ii++,
frame = Report( obj )[FrameBox( ii )];
seg = (frame << Find Seg( "Bar Seg" ));
//Get variable used for the X axis
vars=obj<< Get Variables();
xx=vars[1];xx[1];
//Find the number of bars (or levels used to make bars)
Summarize( levels = By( eval(xx[1])));
Eval List( levels );
//Build an expression to change the offset
qq=expr(set label offset());
for (i=0, i<=nitems(levels)*fbi, i++, //Note there is a multipler, *fbi. This assumes each level is the same for each frame. Its kind of sloppy, might need to just replace it with a fixed value.
rr={};
insert into (rr, i); //This is the Bar number, starts with zero
insert into (rr,i); //This is the x offset, which is the same as the bar number
insert into(rr, 10); //This is the Y offset
insert into (qq, (rr));
);
//Make magic happen
eval(substitute(expr(seg<<QQ></QQ>
<P> </P>回覆:圖形產生器條形圖標籤偏移涼爽的!驚人的!
謝謝。
回覆:圖形產生器條形圖標籤偏移嗯...
我只是想知道如何在沒有任何 JSL 的情況下設法將標籤遠離圖表頂部。
-> 啊:JMP17!
因此,作為「條形圖標籤偏移」的另一種解決方法:
切換回JMP 17 ,x 軸上的使用者年齡作為疊加:
// JMP 17!
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << new column("one", set each value(1));
dt << Graph Builder(
Variables( X( :age ), Y( :height ), Overlay( :age ), Color( :one ) ),
Elements(
Bar(
X,
Y,
Legend( 1 ),
Summary Statistic( "Mean" ),
Error Interval( "Standard Error" ),
Label( "Label by Value" )
),
Points( X, Y, Overlay( 0 ), Legend( 2 ) )
),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
1,
Properties(
0,
{Fill Color( 0 ), Fill Pattern( "none" )},
Item ID( "1", 1 )
)
), Legend Model(
2,
Properties( 0, {Line Color( 0 )}, Item ID( "1", 1 ) )
)}
)
)
);

缺點:
- 誤差線似乎有一個錯誤,已通過 JMP18 修復。
- 沒有其他很酷的 JMP 18 功能。
回覆:圖形產生器條形圖標籤偏移想想所有沒有 JSL 經驗的 JMP 使用者...
實際上,GUI 中應該有一個用於放置標籤的控制項。
啊, @shampton82的 2020 年願望是這樣的:
圖形生成器條形圖資料標籤控件
回覆:圖形產生器條形圖標籤偏移感謝您連結此部落格和願望清單項目@hogi !雖然我們可以使用JSL 添加如此多的功能真是太好了,但在展示JMP 時最尷尬的事情之一是無法使用用戶可以在excel 中執行的圖表自訂來執行非常基本的操作(並且已經習慣了,這讓他們大吃一驚,因為你不能在 JMP 中輕鬆做到這一點)。
@Byron_JMP請與 JMP 團隊合作,使這款出色的客製化變得不基於 JSL!
史蒂夫
回覆:圖形產生器條形圖標籤偏移同意。
回覆:圖形產生器條形圖標籤偏移我剛剛發現 JMP 17 和 JMP18 之間有什麼區別:
切換到堆疊模式時,標籤會以 JMP18 為中心。
不幸的是,這種模式與錯誤欄不相容。
因此,必須使用另一個浮動條形圖來新增誤差線。
總共:

100% GUI - 0% 腳本。
這是腳本:
看更多...Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
Size( 521, 429 ),
Variables( X( :age ), Y( :height ) ),
Elements(
Points( X, Y, Legend( 2 ) ),
Bar(
X,
Y,
Bar Style( "Stacked" ),
Summary Statistic( "Mean" ),
Label( "Label by Value" )
),
Bar(
X,
Y,
Bar Style( "Float" ),
Summary Statistic( "Mean" ),
Error Interval( "Standard Error" )
)
)
);
……我希望這篇文章不會被用來鼓吹反對指定標籤位置的新功能。
回覆:圖形產生器條形圖標籤偏移感謝這些帖子。這會很有幫助。
回覆:圖形產生器條形圖標籤偏移熱圖也有一個「段」可以對話嗎?
不在此列表中:

它被稱為熱圖單元格嗎?
myseg << get description = "Heatmap Cells";
-> 不。
回覆:圖形產生器條形圖標籤偏移矩形段。
不幸的是,Heatmap Seg = Rect Seg 完全充耳不聞:(