Dear all,

I would like to ask you a basic question concerning the creation of a bubble plot for GO term visualization.
I have the table structure as follows:

Table structure

while generating a bubble plot using ggplo2 library I do not manage to cluster GO terms that belong to the same group.
The script I am using is the following:

ggplot(data, aes(y = reorder(GO_term, as.numeric(Class)), x = pValue, size = GeneNumber)) + geom_point(aes(color = Class), alpha = 1.0) +
geom_tile(aes(width = Inf, fill = Class), alpha = 0.2) + 
scale_fill_manual(values = c("red", "yellow", "green", "blue", "purple", "pink"))

The final graph I obtain is the one showed below:

Bubble plot

As you can clearly see, the group1 is splitted by the group6. Moreover, if I increase the number of GO terms to show, this issue occurs several times (several groups are splitted by other groups).
May be it is a simple task or may be not, but now I am completely stucked on this.
Please, could you give me some help to solve this issue?

Thanks in advance.

Source link