I am trying to make a plot where I could just specify the min or the max value for the y axis. But I get Error in if (zero_range(range)) { : missing value where TRUE/FALSE needed
From the documentation:
You can leave one value as NA to compute from the range of the data.
Thus, I did:
#Getting some data in
plot <- ggplot(mydata,
aes_string(y="yvar", x="xvar", colour="group", group="group", fill="group")
)
#Adding some error bars
plot <- plot + geom_errorbar(aes(ymax=agg+var, ymin=agg-var), size=0.5, colour="black", data=mydata)
plot <- plot + geom_point(size=4)
plot <- plot + geom_line(size=1)
#Here is when I just want to set y max
plot <- plot + coord_cartesian(ylim= c(NA, 100))
If I remove the ylim
or change the NA
to a numeric value, it works well. What am I missing here?