Quantcast
Channel: グラフ - 廿TT
Viewing all articles
Browse latest Browse all 123

かけ算九九の表をグラフにしてみました

$
0
0
library(dplyr)library(cowplot)
kuku <-data_frame(left=rep(1:9,each=9),right=rep(1:9,9))%>% 
     mutate(ans=left*right)

ggplot(kuku,aes(x=factor(left),y=factor(right)))+
  geom_tile(aes(fill=ans))+
  geom_text(aes(label=ans))+
  scale_fill_continuous(low="white",high="cornflowerblue")+
  xlab("")+ylab("")+theme(legend.title = element_blank())

f:id:abrahamcow:20170407013639p:plain

ggplot(kuku,aes(x=1,y=ans))+
  geom_bar(stat ="identity")+
  facet_grid(right~left)+
  xlab("")+ylab("")+
  theme(legend.title = element_blank(),
        axis.text.x=element_blank(),
        axis.ticks.x = element_blank())

f:id:abrahamcow:20170407013650p:plain

ggplot(kuku,aes(x=factor(left),y=factor(right)))+
  geom_point(aes(size = ans))+
  xlab("")+ylab("")+
  theme(legend.title = element_blank())

f:id:abrahamcow:20170407013705p:plain


Viewing all articles
Browse latest Browse all 123

Trending Articles