切换facet_grid标签的位置 [英] Switch placement of facet_grid labels

查看:200
本文介绍了切换facet_grid标签的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不切换公式的情况下更改 facet_grid()标签的位置?

<$ p $ (plyr)
库(ggplot2)

data = data.frame(id = 1:10,value = rnorm(100 * 10))
data = ddply(data,。(id),transform,obs = 1:100)

ggplot(data = data,aes(x = obs,y = value,color = factor id)))+
geom_line()+
facet_grid(id〜。)

在下面的图片中,我希望面板文本从右侧切换到面板的顶部。



解决方案

  ggplot(data = data,aes(x = obs,y = value,color = factor(id)))+ 
geom_line()+
facet_wrap(〜id,ncol = 1)


How can I change the placement of the labels of facet_grid() without switching the formula?

library(plyr)
library(ggplot2)

data = data.frame(id = 1:10, value = rnorm(100*10))
data = ddply(data, .(id), transform, obs = 1:100)

ggplot(data = data, aes(x = obs, y = value, color = factor(id))) + 
  geom_line() +
  facet_grid(id ~.)

In the following picture, I want the panel text to switch from the right to the top of the panel.

解决方案

ggplot(data = data, aes(x = obs, y = value, color = factor(id))) + 
         geom_line() +
         facet_wrap( ~id, ncol=1)

这篇关于切换facet_grid标签的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆