Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R GGplot2:从面板上卸下零件(端面缠绕)_R_Ggplot2 - Fatal编程技术网

R GGplot2:从面板上卸下零件(端面缠绕)

R GGplot2:从面板上卸下零件(端面缠绕),r,ggplot2,R,Ggplot2,我想修改我在下图中标记的零件。我说的是灰色部分。如果可能的话,我想删除它或使它变小,这取决于两个结果的外观。这样,我将有更多的空间来添加一行额外的绘图。我的代码在图片下方。 根据Marco Sandri的评论,下面将删除灰色部分和文本。在主题中,您必须添加:strip.background=element\u blank, strip.text.x=元素\空白。因此,完整代码变为第11行和第12行: spaghetti_plot_multiple <- function(input, M

我想修改我在下图中标记的零件。我说的是灰色部分。如果可能的话,我想删除它或使它变小,这取决于两个结果的外观。这样,我将有更多的空间来添加一行额外的绘图。我的代码在图片下方。


根据Marco Sandri的评论,下面将删除灰色部分和文本。在主题中,您必须添加:strip.background=element\u blank, strip.text.x=元素\空白。因此,完整代码变为第11行和第12行:

spaghetti_plot_multiple <- function(input, MV, item_level){
  MV <- enquo(MV)
  titles <- enquo(item_level)
  input %>% 
  filter(!!(MV) == item_level) %>% 
  mutate(first_answer = first_answer) %>%
  ggplot(.,aes( x = time, y = jitter(Answer), group = ID)) +
  geom_line(aes(colour = factor(first_answer))) +
  labs(title = titles ,x = 'Time', y = 'Answer', colour = 'Answer time 0') +
  facet_wrap(~ ID, scales = "free_x")+ 
  theme( strip.background = element_blank(),
      strip.text.x = element_blank(),
      plot.title = element_text(hjust = 0.5, size = 20,
                                face = 'bold', color = 'black')) + 
  scale_colour_manual(values = c("1" = "green", "2" = "black", 
                               "3" = "#ff7f00", "4" = "blue", '5' = "#e41a1c"))
}

根据Marco Sandri的评论,下面将删除灰色部分和文本。在主题中,您必须添加:strip.background=element\u blank, strip.text.x=元素\空白。因此,完整代码变为第11行和第12行:

spaghetti_plot_multiple <- function(input, MV, item_level){
  MV <- enquo(MV)
  titles <- enquo(item_level)
  input %>% 
  filter(!!(MV) == item_level) %>% 
  mutate(first_answer = first_answer) %>%
  ggplot(.,aes( x = time, y = jitter(Answer), group = ID)) +
  geom_line(aes(colour = factor(first_answer))) +
  labs(title = titles ,x = 'Time', y = 'Answer', colour = 'Answer time 0') +
  facet_wrap(~ ID, scales = "free_x")+ 
  theme( strip.background = element_blank(),
      strip.text.x = element_blank(),
      plot.title = element_text(hjust = 0.5, size = 20,
                                face = 'bold', color = 'black')) + 
  scale_colour_manual(values = c("1" = "green", "2" = "black", 
                               "3" = "#ff7f00", "4" = "blue", '5' = "#e41a1c"))
}

您需要只移除上面的前两个条带还是移除所有条带?全部移除。如果可能的话,还有一个替代方案,就是只把它们变小。希望看到两种解决方案的效果。非常感谢,您的问题帮助我找到了答案。我使用了:strip.background=element\u blank,strip.text.x=element\u blank您只需要删除上面的前两个条带还是删除所有条带?全部删除。如果可能的话,还有一个替代方案,就是只把它们变小。希望看到两种解决方案的效果。非常感谢,您的问题帮助我找到了答案。我使用了:strip.background=element\u blank,strip.text.x=element\u blank