Hiding Data Point on qplot
I have downloaded the directlabels package in R to further enhance the ggplot2 experience, however I would like to delete the data point of a scatterplot once I have added the labels to them. Is there any way to hide these? My code goes something like this:
But I'm not sure where the command to hide the data point would be. I would use first.qp but in this case I get the error
Error in order.labels(d) : labels are not aligned
so is there a better way of doing this?
You example is not reproducible. So I will just answer this question:
"I would like to delete the data point of a scatterplot once I have added the labels to them."
You can easily for example remove a layer from the gg object. First I create a ggplot2 example and I decorate it using direct.label.
library(directlabels) scatter <- qplot(jitter(hwy),jitter(cty),data=mpg,colour=class, main="Fuel efficiency depends on car size") scatter <- direct.label(scatter,list(cex=0.7,bumpup))
I remaove the first layer now(the geom_point layer)
scatter$layers <- NULL
Then you get this plot , as you see I had only labels without points: