Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.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,我在R是个新手。我试着用我的数据(用于性研究的实验数据集)绘制几何点图。数据结构有392个OB。和5个变量。变量为: 医学型(1:6)、gen型(1:17)、探索型(“Arosal”、“Plessure”、“美学”、“想象力”)、平均值m2(平均值)、标准值m2(标准值) 我做了这些阴谋: ggplot(sum_tra_heterot_m, aes(x = gen_type , y = mean_m2)) + geom_point(aes(shape=as.factor(gen_type),

我在R是个新手。我试着用我的数据(用于性研究的实验数据集)绘制几何点图。数据结构有392个OB。和5个变量。变量为:

医学型(1:6)、gen型(1:17)、探索型(“Arosal”、“Plessure”、“美学”、“想象力”)、平均值m2(平均值)、标准值m2(标准值)

我做了这些阴谋:

ggplot(sum_tra_heterot_m, aes(x = gen_type , y = mean_m2)) +
  geom_point(aes(shape=as.factor(gen_type), color=as.factor(med_type)), size=2, position = position_dodge(width = 0.3))+
  scale_shape_manual(values=c(1:17),
                     name = "Genre_type",
                     breaks = c(1:17),
                     labels = c("hetero woman on top", "hetero Missionary", "hetero Doggy", "hetero Fellation",
                                "hetero Cunnilingus", "homo Fellation", "homo anal sex", "homo Cunnilingus",
                                "lesbian sex", "men masturbation", "woman masturbation", "naked woman",
                                "naked men", "men erection", "kissing", "detail of penetration",
                                "detail of genital"))+
  scale_color_manual(values=c('#ff0000','#e9ff00', '#32ff00', '#00ffff', '#4300ff', '#ff00fa'),
                     name = "Medium_type",
                     breaks = c(1:6),
                     labels = c("Foto","Sculpture","Painting","Graphic","Shunga","Hentai")) +
  ggtitle("Men - mean_of_evaluation_by_genre&medium_and_type_of_question") +
  theme(legend.position="bottom")+
  facet_wrap(~ quest_type, labeller = labeller(quest_type = labeller_names_2)
             )
结果如下:

问题是单个“med_类型”垂直排列,并且经常重叠可以将它们水平并排折叠吗?如下:

您可以这样尝试:

   ggplot()   + 
      geom_bar(data=sum_tra_heterot_m,  aes(x = gen_type , y = mean_m2, fill =  as.factor(med_type) ) ,
               stat = 'identity', position = 'dodge', alpha = 0.7) +
      faced_wrap(~as.factor(gen_type), ncol = 2)
请说明如何发布一个人们可以回答的R问题,例如包括数据样本,而不仅仅是其变量的描述。