I am using ggplot2 to create a dot plot. My data is basically in the form of three columns x_axis, y_axis and z_axis, x_axis and y_axis together represents a pair and z_axis represents the pair count.
So I am plotting x_axis vs y_axis and using z_axis to color the dots. There are certain situations where I would like to skip plotting a particular count, for eg: The count of 1 occurs multiple times and sometimes I would like to skip plotting 1, but the legend should show 1. The following is my code:
> new<-read.table("PB1_combo.txt", header=T, sep="\t")
> bp <-ggplot(data=new, aes(x_axis,y_axis, colour=factor(z_axis)), size=z_axis) +
geom_point(size=5)
> bp + ggtitle("PB1-PB1")
> last_plot()+ scale_colour_discrete(name="Counts")
> last_plot()+ theme_bw()
Sample data from PB1_combo.txt
x_axis y_axis z_axis
14 576 2
394 652 2
759 762 2
473 762 2
65 763 3
114 390 2
762 763 4
758 762 2
388 616 2
217 750 2
65 762 2
473 763 2
743 759 2
65 213 2
743 762 2