考虑这些数据:
SELECT ID, CompanyDetails
FROM
(
SELECT ID, VendorName As CompanyDetails, 2 as Tag
FROM tableName
UNION ALL
SELECT ID, CompanyName, 1 As Tag
FROM tableName
) Z
ORDER BY ID, Tag
当我使用以下代码绘制ggplot直方图并更改x轴刻度值时,我得到了绘图但没有x轴值,我在哪里做错了?
mydata <- data.frame(Dia = c(0.00, 7.00, 11.20, 17.40, 24.20, 34.75, 51.15, 0.00, 14.85, 17.40, 33.40, 42.70, 45.30, 52.70, 0.00, 3.20, 5.50, 20.10, 28.30, 43.70, 0.00, 6.85, 12.05, 15.75, 22.75, 24.90, 0.00, 0.01, 13.76, 24.96, 39.66, 41.76, 0.00, 11.20, 14.55, 26.75, 37.60, 0.00, 19.75, 22.45, 33.15, 35.55, 0.00, 7.75, 9.00, 11.85, 19.55, 0.00, 5.30, 13.00, 14.90, 22.05, 0.00, 17.60, 23.70, 27.50, 28.50, 0.00, 2.50, 22.65, 26.25, 0.00, 0.55, 9.05, 12.15, 0.00, 3.15, 6.25, 9.11, 0.00, 5.68, 18.58, 29.58, 0.00, 13.90, 28.60, 35.10, 0.00, 3.25, 16.80, 26.65, 0.00, 23.54, 25.60, 30.60, 0.00, 3.00, 9.50, 13.95, 0.00, 20.50, 23.90, 36.50, 0.00, 7.15, 10.30, 16.00, 0.00, 6.05, 9.75, 10.40, 0.00, 13.60, 17.75, 22.45, 0.00, 2.22, 8.60, 15.85))
答案 0 :(得分:0)
感谢user2100721,我从没想过会这么简单......
ggplot(mydata, aes(mydata$Dia)) +
geom_histogram(breaks=seq(0, 60, by = 10), col="red", fill="green", alpha = .2, bins=6) +
ggtitle('title') +
xlab('x-label') + ylab('y-label') +
scale_x_continuous(breaks=seq(0, 60, by = 10), labels=c(890, 880, 870, 860, 850, 840, 830))