如何根據數據范圍本身自動調整分佈中的 bin 寬度?當我使用分發平台時,默認情況下,bin 寬度總是很大,這無助於更好地了解分發。 我必須處理的數據以 maginutes(兆、毫、單位等)的順序變化,因此用於所有直方圖的固定 bin 不起作用。 同樣在我需要處理的實際情況中,我有數百個測試,因此逐一調整圖也不可行。 有沒有辦法讓每個單獨的圖的 bin 寬度由數據范圍決定? 例如,我想簡單地獲取範圍並將其分成 100 個等份或 50 等份。因此無論單位如何,所有地塊的外觀都會有些統一,而無需單獨調整它們。 附件是 3 個繪圖示例,我希望默認設置是將 bin 寬度設置為數據范圍的 1/100。
謝謝!
圖形回复:如何根據數據范圍本身自動調整分佈中的 bin 寬度?你好@breino ,
從這裡開始:
https://community.jmp.com/t5/JMP-Add-Ins/2D-Histograms/ta-p/377945
如果有幫助,請告訴我們。
回复:如何根據數據范圍本身自動調整分佈中的 bin 寬度?你好羅恩:
感謝您的建議。 不幸的是它不喜歡大量的測試,我嘗試添加大約 30 個要繪製的測試,並給出了“無法添加項目:列表已經包含最大數量的項目”的錯誤。
我希望有一個通用設置來調整 bin 寬度,因為大多數分佈都帶有寬條,因此必須是關於如何確定它們有多寬的全局設置。
回复:如何根據數據范圍本身自動調整分佈中的 bin 寬度?您可以嘗試編寫腳本。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Students.jmp");
colList = {"height", "weight"};
dist = dt << Distribution(
Continuous Distribution(Column(:height)),
Continuous Distribution(Column(:weight))
);
wait(2);
rep_layer = Report(dist);
axisbox = rep_layer[axis box(1)];
For Each({val}, colList,
//some calculation for inc
newInc = Col Max(Column(dt, val)) - Col Min(Column(dt, val));
newInc = newInc/10;
cur_rep = rep_layer[OutlineBox(val)];
axisbox = cur_rep[axis box(1)];
axisbox << Inc(newInc);
);還有 Bin Span() 但我不確定在構建發行版後是否可以修改它。
回复:如何根據數據范圍本身自動調整分佈中的 bin 寬度?你好@breino
如何將其作為開發基礎:
Open( "$SAMPLE_DATA/Big Class.jmp" );
Distribution(
Continuous Distribution( Column( :height ), Set Bin Width( (colmax(:height)-colmin(:height))/50 ) ),
Continuous Distribution( Column( :weight ), Set Bin Width( (colmax(:weight)-colmin(:weight))/100 ) )
);
回复:如何根據數據范圍本身自動調整分佈中的 bin 寬度?最有可能使用 Set Bin Width() 對我以前的代碼進行改進@ron_horne .
循環很可能以更聰明的方式進行:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Students.jmp");
colList = {"height", "weight"};
dist = dt << Distribution(
Continuous Distribution(Column(:height)),
Continuous Distribution(Column(:weight))
);
wait(1);
For(i = 1, i <= N Items(colList), i++,
newInc = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
newInc = newInc/10;
dist[i] << Set Bin Width(newInc);
);