-How can I scale the Y- and X- axis to 0,30 and 0,50 respectively and plot the data point according to the scale?
-How do I change the color of groups 1, 2 and 3 to purple, orange and yellow?
library(ggplot2)
library(plotly)
ID <- c("Group 1", "Group 1", "Group 1", "Group 2", "Group 2", "Group 2", "Group 3", "Group 3", "Group 3", "Group 4", "Group 4", "Group 4")
area <- c("Area 1", "Area 1", "Area 1","Area 2", "Area 2", "Area 2", "Area 3", "Area 3", "Area 3", "Area 4", "Area 4", "Area 4")
x <- c(1.0, 10.25, 50.0, 2.0, 5.0, 30.0, 5.0, 9.0, 10.0, 11.0, 23.0, 40.0)
y <- c(1.0, 3.0, 5.0, 20.0, 10.0, 23.0, 25.0, 19.1, 5.0, 15.0, 8.0, 4.0)
df <- cbind(ID, area, x, y)
df <- as.data.frame(df)
df
p <- ggplot(df, aes(x=x, y=y)) + geom_polygon(aes(fill=factor(ID), group=area))
p <- ggplotly(p)
p
I have tried to play around with scale_x_continuous, scale_fill_manual, and scale_fill_identity but it doesn`t seem to do anything.