2016-04-11 24 views
0

Elmas fiyatını keserek elmas oranını gösteren histogramlar oluşturmaya çalışıyorum. Ancak bu kadar alabilirsiniz: Ben estetik sargı içinde ama boşunaYığılmış bir histogramın kodu

color = cut 

ve ayrıca

fill = cut 

kullanarak denedi

ggplot(aes(x = price), data = diamonds_df) + 
geom_histogram(binwidth = 0.1, fill = "white", colour = "black") + 
facet_wrap(~color, scales = "free_y") + 
scale_x_log10() + 
ylab("Total Count") + 
xlab("Diamond Price") + 
ggtitle("Distribution of diamond prices for different diamond colours and cuts") 

.

cevap

0

Bu kod, istediğim arsayı verir ancak oldukça dağınık görünüyor.

ggplot(diamonds_df, aes(price, fill=cut)) + 
geom_bar(width = 0.05) + 
facet_wrap(~color, scales = "free_y") + 
scale_x_log10() + 
ylab("Total Count") + 
xlab("Diamond Price") + 
ggtitle("Distribution of diamond prices for different diamond colours and cuts") 
+1

'geom_histogram'ını kullanın ve daha büyük bir 'binwidth' belirtin mi? – Axeman

+0

Bu mükemmel çalışıyor. Teşekkür ederim. – Seanosapien

İlgili konular