ggplot problem -> i don't know how to handle this. this isn't like a assignment. i'm studying by myself. Please help me to handle this problem

str(cities)
'data.frame': 20 obs. of 4 variables:
X : num 1 2 3 4 5 6 28.5 8 9 10 ... long: num 24 25.3 26.4 26.8 27.7 27.6 54.3 28.7 29.2 30.2 ...
lat : chr "55" "54.7" "54.4" "54.3" ... city: chr "Kowno" "Wilna" "Smorgoni" "Moiodexno" ...

str(troops)
'data.frame': 51 obs. of 6 variables:
X : int 1 2 3 4 5 6 7 8 9 10 ... long : num 24 24.5 25.5 26 27 28 28.5 29 30 30.3 ...
lat : num 54.9 55 54.5 54.7 54.8 54.9 55 55.1 55.2 55.3 ... survivors: int 340000 340000 340000 320000 300000 280000 240000 210000 180000 175000 ...
direction: Factor w/ 2 levels "A","R": 1 1 1 1 1 1 1 1 1 1 ... group : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
str(temps)
'data.frame': 9 obs. of 5 variables:
X : int 1 2 3 4 5 6 7 8 9 long: num 37.6 36 33.2 32 29.2 28.5 27.2 26.7 25.3
temp: int 0 0 -9 -21 -11 -20 -24 -30 -26 days: int 6 6 16 5 10 4 3 5 1
$ date: Factor w/ 8 levels "01-Dec","06-Dec",..: 6 7 4 5 NA 8 1 2 3

when i code this,

ggplot(data = troops, aes(long, lat)) + geom_path(aes(group = group, color = direction, size = survivors), lineend = "round") + scale_size(range = c(0.5,15)) + scale_color_manual(values = c("#DFC17E", "252523")) + xlab("") + ylab("") + guides(color = F, size = F) + geom_text(data = cities, aes(long, lat, label = city))

there' s a error -> Discrete value supplied to continuous scale

I don't know what the problem is.

Help me.

long and lat are continuous variables, they can take on a theoretically infinite number of variables, but the scale_color_manual arguments only provide for two. See the FAQ: How to do a minimal reproducible example reprex for beginners for tips on presenting questions in a way that can be answered with a concrete example. In the meantime, I've written about thematic maps on color selection for continuous variables, which illustrates the problem.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.