[R] using geom_bar with ggmap package
0
0
Entering edit mode
aviveil • 0
@aviveil-9829
Last seen 9.0 years ago

Hello

i'm trying to use the geom_bar on ggmap data to present 3 bars of different values for each point in the map.. i can't seem to understand how to seperate the aesthetics of the x,y values(coords) and the 3 bar values i want to plot on them..

my dataset:

        lon      lat    Station   min      mean    max Station_Color

1 34.79146 31.25297 Beer Sheva 102.2 180.61875 315.2 red

2 34.95193 29.55767 Eilat 1.4 15.84375 44.0 orange

3 34.98957 32.79405 Haifa 343.4 695.11875 1084.9 green

4 35.21371 31.76832 Jerusalem 321.3 506.63125 755.0 blue

5 34.78177 32.08530 Tel Aviv 348.1 586.47500 851.1 yellow

 

the code:

map1 <- ggmap(map, extent="panel") +

geom_bar(aes(x = lon, y = lat, color=Station_Stats[,3]), data =Station_Stats, stat="identity") +

xlim(34,36) + ylim(29.5,33.5) + scale_color_manual(values=Station_Color)

map1

 

another try was:

map <- ggmap(israel_map, extent="panel", crop=T) +

geom_point(aes(x=lon, y=lat, color=Station_Color), data=Station_Stats) +

xlim(34,36) + ylim(29.5,33.5) + scale_color_manual(values=Station_Color)

data=Station_Stats, stat="identity")

map <- map + geom_bar(aes(x=Station, y=mean,color=Station_Color),

 

gives me the error:

Error: Discrete value supplied to continuous scale

 

how can i do it properly?

r ggmap geom_bar • 1.6k views
ADD COMMENT

Login before adding your answer.

Traffic: 745 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6