I have a species and gene dataset like this:
How do I draw gene neighbourhood diagram where each gene would be represented as a rectangle with arrowhead pointing in right or left direction based on the orientation column? Each rectangle must be of equal size regardless of the start and stop coordinates of the gene, although the genes must be in order according to the coordinates. The species name must be written on the left side. The gene name must be written in the centre of each respective rectangles and each gene must be coloured uniquely based on their label.
I tried using the gggenes package:
ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule, fill = gene,
forward = orientation)) +
geom_gene_arrow() +
facet_wrap(~ molecule, scales = "free", ncol = 1) +
scale_fill_brewer(palette = "Set3") +
theme_genes()
Result:
But it draws gene of unequal size which makes it harder to label it. It also leaves a huge gap between each gene.