我使用R創建一些箱型圖。R:在boxplot中更改y軸縮放比例
這裏是我的代碼:
fps_error <- c(0.033872847, 0.041710742,0.023839866,0.017763328,0.044510719,0.016390502,0.056766647,0.101326807,0.013990558,0.014848592)
fps_error = fps_error *100
fps_qp_error <-c(1.631578947, 2.263157895, 1.45, 1.2, 2.388888889, 1.05, 1.764705882, 4.642857143, 0.95, 1.047619048)
bit_error <- c(0.113818414,0.17059614, 0.110048539, 0.030207725, 0.157858064, 0.031467476, 0.258009778, 0.220182593, 0, 0.030935528)
bit_error = bit_error *100
bit_qp_error <-c(0.65, 0.80952381, 0.523809524, 0.142857143, 0.904761905, 0.142857143, 1.473684211, 1.047619048, 0, 0.19047619)
ssim_error <-c(0.012973075, 0.006374072, 0.003292312, 0.003139452, 0.009791549,0.008385301, 0.003566528, 0.00986248, 0.003586361, 0.003680912)
ssim_qp_error <-c(3.476190476, 0.944444444, 0.7, 0.65, 2.095238095, 1.470588235, 0.75, 1.529411765, 0.736842105, 0.8)
ssim_qp_error = ssim_qp_error *100
all_errors = cbind(fps_error, bit_error, ssim_error)
modes = cbind(rep("FPS error",10), rep("Bitrate error",10), rep("SSIM error",10))
journal_linear_data <-data.frame(fps_error, fps_qp_error,bit_error,bit_qp_error,ssim_error,ssim_qp_error)
bp = boxplot(all_errors~modes, data=journal_linear_data, main="Percentage error per mode for B2", xlab="Mode", ylab="% error")
我想改變Y軸的比例,以顯示所有的boxlots足夠公平。例如。對於SSIM錯誤,我看不到錯誤。
你可以用'ylim',但它不會告訴你所有你想要的youur SSIM誤差值太小的細節。 SSIM誤差方差(與其他兩個相比)太小。 – rbm
剛剛用ylim = c(-10,30)運行你的代碼,這增加了規模,但是@rbm指出,這不是你想要的。 – user1945827
y軸可能有不相等的步長嗎? – zinon