我有一個名為“Log_mean”的表,這是一個簡單的例子:
| 號碼ID | 分數 | 模型 |
|---|---|---|
| 1 | 0.3 | 一種 |
| 2 | 0.2 | b |
我使用以下代碼根據分數繪制了 ID:
plot(Log_mean.numberID, Log_mean.Score, '--o');
title('Mean of Log scores.')
ylabel('Score')
xlabel('Models')
這會產生以下圖表:

我的問題是,由于每個圓圈代表特定模型的分數,我是否可以使用表格中的列模型來命名 x 軸上的每個點?
謝謝你。
uj5u.com熱心網友回復:
是的,您只需要一個分類軸
xlabs = categorical( Log_mean.Model, Log_mean.Model ); % using the 2nd input preserves ordering
然后你可以繪制它
plot( xlabs, Log_mean.Score, '--o' );
如果您想組合模型和 ID,您可以通過多種方式實作。像這樣的東西會起作用:
xlabs = arrayfun( @(x) sprintf('%d - %s', Log_mean.numberID(x), Log_mean.Model{x}), 1:height(Log_mean), 'uni', 0 );
xlabs = categorical( xlabs, xlabs );
plot( xlabs, Log_mean.Score, '--o' );
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/459093.html
