Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.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的刻面或美学而产生的空洞观察 我需要排除空洞的观测,即只能看到栅栏而不是空白观测。 现在它不知何故是错的 ggplot( frame, aes( y = sil_width, x = observation) )+ coord_flip()+ geom_bar(stat="identity") + facet_grid( cluster~., labeller = label_both) > frame cluster neighbor sil_width observation 10 1 2 0.9044976 10 6 1 2 0.9040205 6 2 1 2 0.8969660 2 4 1 2 0.8966644 4 1 1 2 0.8959830 1 5 1 2 0.8866528 5 9 1 2 0.8548683 9 7 1 2 0.8408474 7 3 1 2 0.8389057 3 8 1 2 0.7521333 8 12 2 1 0.9252061 12 15 2 1 0.9250464 15 17 2 1 0.9189154 17 20 2 1 0.9171968 20 13 2 1 0.9144334 13 24 2 1 0.9106160 24 19 2 1 0.9072514 19 18 2 1 0.8991627 18 14 2 1 0.8931934 14 23 2 1 0.8919554 23 16 2 1 0.8877312 16 22 2 1 0.8794240 22 11 2 1 0.8777455 11 21 2 1 0.8660889 21 25 2 1 0.7620662 25_R_Ggplot2_Facet - Fatal编程技术网

排除因R中ggplot2的刻面或美学而产生的空洞观察 我需要排除空洞的观测,即只能看到栅栏而不是空白观测。 现在它不知何故是错的 ggplot( frame, aes( y = sil_width, x = observation) )+ coord_flip()+ geom_bar(stat="identity") + facet_grid( cluster~., labeller = label_both) > frame cluster neighbor sil_width observation 10 1 2 0.9044976 10 6 1 2 0.9040205 6 2 1 2 0.8969660 2 4 1 2 0.8966644 4 1 1 2 0.8959830 1 5 1 2 0.8866528 5 9 1 2 0.8548683 9 7 1 2 0.8408474 7 3 1 2 0.8389057 3 8 1 2 0.7521333 8 12 2 1 0.9252061 12 15 2 1 0.9250464 15 17 2 1 0.9189154 17 20 2 1 0.9171968 20 13 2 1 0.9144334 13 24 2 1 0.9106160 24 19 2 1 0.9072514 19 18 2 1 0.8991627 18 14 2 1 0.8931934 14 23 2 1 0.8919554 23 16 2 1 0.8877312 16 22 2 1 0.8794240 22 11 2 1 0.8777455 11 21 2 1 0.8660889 21 25 2 1 0.7620662 25

排除因R中ggplot2的刻面或美学而产生的空洞观察 我需要排除空洞的观测,即只能看到栅栏而不是空白观测。 现在它不知何故是错的 ggplot( frame, aes( y = sil_width, x = observation) )+ coord_flip()+ geom_bar(stat="identity") + facet_grid( cluster~., labeller = label_both) > frame cluster neighbor sil_width observation 10 1 2 0.9044976 10 6 1 2 0.9040205 6 2 1 2 0.8969660 2 4 1 2 0.8966644 4 1 1 2 0.8959830 1 5 1 2 0.8866528 5 9 1 2 0.8548683 9 7 1 2 0.8408474 7 3 1 2 0.8389057 3 8 1 2 0.7521333 8 12 2 1 0.9252061 12 15 2 1 0.9250464 15 17 2 1 0.9189154 17 20 2 1 0.9171968 20 13 2 1 0.9144334 13 24 2 1 0.9106160 24 19 2 1 0.9072514 19 18 2 1 0.8991627 18 14 2 1 0.8931934 14 23 2 1 0.8919554 23 16 2 1 0.8877312 16 22 2 1 0.8794240 22 11 2 1 0.8777455 11 21 2 1 0.8660889 21 25 2 1 0.7620662 25,r,ggplot2,facet,R,Ggplot2,Facet,实现这一点的唯一方法是使用facet_wrap,而不是像这样使用facet_grid: a <- ggplot( frame, aes( y = sil_width, x = observation) ) a + facet_wrap( ~cluster , scales='free') + geom_bar(stat='identity', shape=1) a抱歉:)这应该是审美的,我看这里没有任何东西。集群1中的任何内容都位于集群1方面。除非你需要排除空的观察,即只能看到条形

实现这一点的唯一方法是使用facet_wrap,而不是像这样使用facet_grid:

a <- ggplot( frame, aes( y = sil_width, x = observation) ) 
a + facet_wrap( ~cluster ,  scales='free') + geom_bar(stat='identity', shape=1) 

a抱歉:)这应该是审美的,我看这里没有任何东西。集群1中的任何内容都位于集群1方面。除非你需要排除空的观察,即只能看到条形图,而不能看到空白的观察结果,而且,正如亨利克的评论,有一些帖子表明,解决方案(<代码>天平=“免费”< /代码>)与<代码> COODRIPFLUL/<代码>不匹配。因此,您可能需要切换
x
y
,而不要使用
coord\u flip
。谢谢。对我来说太糟糕了。我想你的x轴有问题。像这些字符一样,它们被视为整数,但它们实际上是字符。