2016-10-03 50 views
2

私はboxplotを傾ける方法を探してみましたが、名前の正しい配置には決して着いていませんでした。傾斜ボックスプロットのxラベルがR

私はモデルごとに異なる精度のこのデータフレームAccuracyを持っています。ボックスプラントに変動性を表示したいと思います。

sample iteration poly_eps.001_C1 poly_eps.01_C1 poly_eps.1_C1 poly_eps.001_C10 poly_eps.01_C10 
(int)  (int)   (dbl)   (dbl)   (dbl)   (dbl)   (dbl) 
    1   1  0.9841270  0.9841270  0.9761905  0.9761905  0.9761905 
    1   2  0.9680000  0.9680000  0.9520000  0.9600000  0.9600000 
    1   3  0.9523810  0.9523810  0.9603175  0.9365079  0.9365079 
    1   4  0.9600000  0.9600000  0.9600000  0.9520000  0.9520000 
    1   5  0.9523810  0.9523810  0.9682540  0.9444444  0.9444444 

その後

 # algorithms helpsvme only getting the desired features for the boxplot 
    algorithms = names(accuracies_table[-c(1:2)]) 

    boxplot(accuracies_table[algorithms], col = color , 
     main = "Polynomial KSVM Models", ylab = "Accuracy", 
     las=2,ylim = c(0.90,1)) 

enter image description here

に私のコードは、誰かが私には、x軸ラベルを傾け助けることができますか?どのようにggplot2でこれを行うことができますか?

答えて

1

これを試してみてください:

library(ggplot2) 
library(reshape2) 
df <- melt(accuracies_table[algorithms]) 
ggplot(df, aes(variable, value, fill=variable)) + geom_boxplot() + 
     ggtitle("Polynomial KSVM Models") + ylab("Accuracy") + 
    theme(axis.text.x = element_text(angle = 45, size=15, hjust = 1)) 

enter image description here

+0

はい、これはうまく動作しますが、私はこれらの優れたチュートリアルを得ることができる任意の洞察力を?私はこの目的のために溶融機能を適用することに感心しています。ありがとうございました! –

関連する問題