如何将气泡集中在面网格中

问题描述 投票:0回答:1

我需要帮助在每个面网格内分布气泡并删除下图中每个面网格内的网格线。

graph <- ggplot(patog1, aes(x = Prevalence, y = Microorganism)) +
  geom_point(data=patog1,aes(x=JitCoOr, y=JitCoOrPow,size = Samples, colour = Study), alpha=.5)+
  geom_text(data=patog1,aes(x=JitCoOr, y=JitCoOrPow,label=Samples)) + 
  scale_size(range = c(1,30))+
  scale_x_continuous(breaks = scales::breaks_width(10))+ 
  facet_grid(Microorganism~.)+
  theme_bw()
graph

graph + theme(axis.text.y=element_blank(), 
             axis.ticks.y=element_blank())

我还想知道微生物的名称 - 左侧的脸。

r bubble-chart
1个回答
0
投票

可以使用

theme(panel.grid.minor = element_blank())
删除网格线,也可以使用
panel.grid.major=
或仅使用
panel.grid=
删除。参见
?theme
,即:

panel.grid, panel.grid.major, panel.grid.minor, panel.grid.major.x,
          panel.grid.major.y, panel.grid.minor.x, panel.grid.minor.y:
          grid lines (element_line()). Specify major grid lines, or
          minor grid lines separately (using ‘panel.grid.major’ or
          ‘panel.grid.minor’) or individually for each axis (using
          ‘panel.grid.major.x’, ‘panel.grid.minor.x’,
          ‘panel.grid.major.y’, ‘panel.grid.minor.y’).  Y axis grid
          lines are horizontal and x axis grid lines are vertical.
          panel.grid.*.* inherits from panel.grid.* which inherits from
          ‘panel.grid’, which in turn inherits from ‘line’

facet_grid(..., switch=""y")
处理从右到左切换面条。参见
?facet_grid
,即

  switch: By default, the labels are displayed on the top and right of
          the plot. If ‘"x"’, the top labels will be displayed to the
          bottom. If ‘"y"’, the right-hand side labels will be
          displayed to the left. Can also be set to ‘"both"’.

也许是这样:

graph <- ggplot(patog1, aes(x = Prevalence, y = Microorganism)) +
  geom_point(data=patog1,aes(x=JitCoOr, y=JitCoOrPow,size = Samples, colour = Study), alpha=.5)+
  geom_text(data=patog1,aes(x=JitCoOr, y=JitCoOrPow,label=Samples)) + 
  scale_size(range = c(1,30))+
  scale_x_continuous(breaks = scales::breaks_width(10))+ 
  facet_grid(Microorganism~., switch = "y")+
  theme_bw()
graph +
  theme(
    axis.text.y=element_blank(), 
    axis.ticks.y=element_blank(),
    panel.grid = element_blank()
  )
© www.soinside.com 2019 - 2024. All rights reserved.