使用ggplot2在较小的中断处放置轴标签 [英] Placement of axis labels at minor breaks with ggplot2
问题描述
我使用ggplot2来做一些基因组数据的绘图,所以基本格式是有一个染色体和一个位置。我将这些位置转换为连续的尺度,然后将这些中断置于染色体的边界处:
scale_x_continuous(Genome Position ,break = c(0,cumsum(chromosome_length)))
看起来很棒,就实际绘图而言,然后将标记放在染色体的起始和末端。我希望它们在每条染色体上居中,在默认情况下绘制小断点的位置。
这可能吗?
这是怎么回事?
break <-c (0,cumsum(chromosome_length))
scale_x_continuous(Genome Position,breaks = break + 0.5,labels = breaks)
I am using ggplot2 to do some plotting of genomic data, so the basic format is that there is a chromosome and a position along it. I convert the positions to be on a continuous scale, then put the breaks at the boundaries of the chromosomes with:
scale_x_continuous("Genome Position", breaks = c(0, cumsum(chromosome_length)))
That looks great, as far as the actual plotting is concerned, but the labels are then put at the start and end of the chromosomes. I would like them to be centered along each chromosome, at the position where the minor break is drawn by default.
Is this possible?
How about this?
breaks <- c(0, cumsum(chromosome_length))
scale_x_continuous("Genome Position", breaks = breaks + 0.5, labels = breaks)
这篇关于使用ggplot2在较小的中断处放置轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!