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:

q<-qplot(x,y)+geom_point(aes(colour=z))

direct.label(q,list(cex=0.75,fontface="bold",bumpup))

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?

Answers


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[1] <- NULL

Then you get this plot , as you see I had only labels without points:

scatter


Need Your Help

Deselect value in Jquery Datepicker?

jquery asp.net-mvc jquery-ui

How to deselect the value in Jquery Datepicker?

Glitch on one type death (but not the other) and winning in java applet game

java audio applet paint

This is a java Applet game. There are 3 game states, Running, Dead and Win. My question is two part, but I think they are related since they happen at the same point.