2010-10-22 10 views
16

ben sonuca bağlı olan ve bir virgül yok Gelir için efsanede sayısal değerlerini görebilirsinizggplot2 açıklaması için sayı değerlerini nasıl biçimlendiririm? Ben bir grafik bitiriyor üzerinde çalışıyorum

ggplot(timeSeries, aes(x=Date, y=Unique.Visitors, colour=Revenue)) 
+ geom_point() + stat_smooth() + scale_y_continuous(formatter=comma) 

... şöyle ggplot2 kullanılarak oluşturulan. Bu değerlere virgül nasıl ekleyebilirim? Eksen için scale_y_continuous'ı kullanabildim, bu efsane için de kullanılabilir mi?

alt text

cevap

10

Not 2014/07/16: Bu yanıtında sözdizimi süredir eskimiş olmuştur. Sağ scale_colour_ tabakası anladım almanın sadece meselesi - metasequoia's answer!


Yep kullanın. Deneyin:

ggplot(timeSeries, aes(x = Date, y = Unique.Visitors, colour = Revenue)) + 
    geom_point() + 
    stat_smooth() + 
    scale_y_continuous(formatter = comma) + 
    scale_colour_continuous(formatter = comma) 

size efsane nokta arkasında tuhaf çizgi vermez, böylece ben şahsen de, geom_point tabakasına benim renk eşleme hareket olacaktır:

ggplot(timeSeries, aes(x = Date, y = Unique.Visitors)) + 
    geom_point(aes(colour = Revenue)) + 
    stat_smooth() + 
    scale_y_continuous(formatter = comma) + 
    scale_colour_continuous(formatter = comma) 
+0

bkz That iyiydi. sağol Matt. – analyticsPierce

33

Sadece için geçerli tutmak, ggplot2_0.9.3 işçi sözdizimi:

require(scales) 
ggplot(timeSeries, aes(x=Date, y=Unique.Visitors, colour=Revenue)) + 
    geom_point() + 
    stat_smooth() + 
    scale_y_continuous(labels=comma) + 
    scale_colour_continuous(labels=comma) 

Ayrıca this exchange

+0

'' scale_size_continuous (label = virgül) '' '' '' '' ('' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ifadesini kullanırsanız, aynı şekilde şekil ve dolgulu sanırım. – PatrickT

İlgili konular