2016-11-23 2 views
-1

私は、バープロットと、それらがレポート作成のために並べて生成されたデータフレームを表示する方法を見つけようとしています。バープロットを別の表に表示する - R

barplot(green$MB,names.arg=green$Date,las=2,main="Draymond Green MB Fantasy Points") 

Draymond Green MB Fantasy Points

barplot(green$DS,names.arg=green$Date,las=2,main="Draymond Green DS Fantasy Points") 

Draymond Green DS Fantasy Points

は私のことができるようにしたいもの:

> green 
    Player.Name Tm at Opp W/L MP FG FGA x3P x3PA FT FTA ORB DRB TRB AST STL BLK TOV PF PTS USG. Line MB DS  Date 
Draymond Green GSW SAS L 32:37 7 14 2 5 2 2 5 7 12 6 5 1 2 2 18 22.8 29 51.4 55.25 20161025 
Draymond Green GSW @ NOP W 34:04 3 10 1 2 1 2 4 7 11 7 2 0 3 5 8 16.7 -8 32.7 33.75 20161028 
Draymond Green GSW @ PHO W 37:47 2 9 0 4 1 2 1 12 13 9 0 3 2 3 5 13.4 -6 38.1 37.75 20161030 
Draymond Green GSW @ POR W 30:01 2 3 1 2 1 2 0 8 8 9 3 2 0 2 6 5.4 -23 39.1 40.00 20161101 
Draymond Green GSW OKC W 29:10 2 9 0 2 5 6 4 6 10 5 1 4 4 3 9 22.6 -26 34.5 35.00 20161103 
Draymond Green GSW @ LAL L 33:41 6 10 0 3 4 6 2 7 9 4 4 0 1 1 16 16.9 20 39.8 39.25 20161104 
Draymond Green GSW NOP W 34:42 2 7 0 1 0 0 2 10 12 11 2 2 2 3 4 11.3 -10 40.9 43.25 20161107 
Draymond Green GSW DAL W 34:36 6 11 4 6 0 1 1 9 10 4 0 2 1 3 16 17.5 -21 37.0 42.50 20161109 
Draymond Green GSW @ DEN W 28:46 4 7 3 4 2 2 0 9 9 5 3 0 1 2 13 13.6 -24 36.3 39.50 20161110 
Draymond Green GSW PHO W 37:01 4 10 1 5 5 5 2 5 7 11 3 2 3 3 14 16.9 -13 45.9 49.25 20161113 
Draymond Green GSW @ TOR W 34:54 5 13 1 4 0 0 0 7 7 5 2 3 3 4 11 19.8 -6 33.9 34.75 20161116 
Draymond Green GSW @ BOS W 35:09 3 11 2 6 3 4 1 7 8 8 1 1 1 3 11 17.7 -16 35.6 36.25 20161118 
Draymond Green GSW @ MIL W 35:31 3 7 0 1 4 4 1 1 2 5 3 2 2 3 10 12.0 -3 27.9 28.00 20161119 
Draymond Green GSW @ IND W 29:25 4 7 0 2 2 2 3 6 9 7 2 2 1 1 10 12.5 -37 38.3 38.50 20161121 

そして、これから

は私が使用してbarplotsを作成します。たとえば、私は、次のデータフレームを持っていますdoは次のような出力を作成します。バープロットは垂直方向に整列され、データフレームは右側に整列されます(垂直にセンタリングされていることが必須です)。

Combined Barplots and Table

答えて

0

green$Date <- as.factor(green$Date) 
library(gridExtra) 
library(grid) 
grid.arrange(
    ggplot(green, aes(Date, MB)) + geom_bar(stat='identity') + theme(axis.text.x = element_text(angle=90, vjust = 0.5)) + ggtitle('Draymond Green MB Fantasy Points'), 
    ggplot(green, aes(Date, DS)) + geom_bar(stat='identity') + theme(axis.text.x = element_text(angle=90, vjust = 0.5)) + ggtitle('Draymond Green DS Fantasy Points'), 
    tableGrob(green), ncol=4, layout_matrix = rbind(c(1,3,3,3),c(2,3,3,3))) 

enter image description here

0

あなたはgplotsパッケージと一緒にlayout()機能を使用することができます。 Exemple:ggplot2で

library(gplots) 

layout(matrix(c(1, 2, 3, 3), nrow = 2)) 
hist(rnorm(100)) 
hist(rnorm(50)) 
textplot(head(iris)) 

enter image description here

関連する問題