2020年8月16日日曜日

plot3d color col=

 


Don't forget "col="  in the parameters. it's not scatterplot3d!!


library(rgl)

len <- dim(mdf)[1]

x3d <- c()

for(i in seq(1,47,1)){ x3d <- append(x3d,rep(i,len))}

z3d <- c()

for(i in seq(1,47,1)){ z3d <- append(z3d,dmdf[,i])}

y3d <- as.integer(gsub('-','',as.character(dmdf$t)))

# aichi 23, osaka 27, fukuoka 40, tokyo 13.

# color <- c(rep("grey",12*len),rep("orange",len),rep("grey",9*len),rep("pink",len),rep("grey",3*len),rep("yellow",len),rep("grey",12*len),rep("green",len),rep("grey",6*len),rep("red",len))

par(bg = 'grey25', fg = 'white',col.axis = 'white',col.lab='white')

y3d <- seq(1,len,1)

# plot3d(x3d,rep(y3d,47),z3d,col = color, type = "h", pch = " ",zlim=c(0, max(dmdf[,-48])))

plot3d(x3d,rep(y3d,47),z3d,col = as.vector(matrix(rep(rainbow(47),len),ncol=47,byrow=t)), type = "h", pch = " ",zlim=c(0, max(dmdf[,-48])))




==


2020年8月11日火曜日

scatterplot3d

 use same data.frame mdf as the previous entry.


library("scatterplot3d")

len <- dim(mdf)[1]

x3d <- c()

for(i in seq(1,47,1)){ x3d <- append(x3d,rep(i,len))}

z3d <- c()

for(i in seq(1,47,1)){ z3d <- append(z3d,mdf[,i])}

# scatterplot3d(x3d,rep(mdf$t,47),z3d,highlight.3d = TRUE, type = "h", pch = " ",zlim=c(0,500))

y3d <- as.integer(gsub('-','',as.character(mdf$t)))

# scatterplot3d(x3d,rep(y3d,47),z3d,highlight.3d = TRUE, type = "h", pch = " ",zlim=c(0,500))

color <- c(rep("black",12*len),rep("orange",len),rep("black",13*len),rep("yellow",len),rep("black",12*len),rep("green",len),rep("black",7*len))

# scatterplot3d(x3d,rep(y3d,47),z3d,highlight.3d = TRUE, type = "h", pch = " ",zlim=c(0,30),angle = 65)

scatterplot3d(x3d,rep(y3d,47),z3d,color, type = "h", pch = " ",zlim=c(0, max(mdf[,-48])),angle = 65,col.grid="grey")



color <- c(rep("grey",12*len),rep("orange",len),rep("grey",13*len),rep("yellow",len),rep("grey",12*len),rep("green",len),rep("grey",7*len))
par(bg = 'grey25', fg = 'white',col.axis = 'white',col.lab='white')
scatterplot3d(x3d,rep(y3d,47),z3d,color, type = "h", pch = " ",zlim=c(0, max(mdf[,-48])),angle = 65)


2020年8月10日月曜日

scatterplot3d

when mdf is like below

head(mdf,2)

  Hokkaido Aomori Iwate Miyagi Akita Yamagata Fukushima Ibaraki Tochigi Gunma Saitama Chiba Tokyo Kanagawa Niigata Toyama

1       10      0     0      0     0        0         0       0       0     0       6     2     2        0       3      0

2        8      0     0      0     0        0         0       0       0     2       3     2     2        3       0      0

  Ishikawa Fukui Yamanashi Nagano Gifu Shizuoka Aichi Mie Shiga Kyoto Osaka Hyogo Nara Wakayama Tottori Shimane Okayama

1        0     0         0      0    0        1     7   5     0     2     9     8    0        0       0       0       0

2        0     0         0      0    0        0     3   0     0     0     3    13    0        0       0       0       0

  Hiroshima Yamaguchi Tokushima Kagawa Ehime Kochi Fukuoka Saga Nagasaki Kumamoto Oita Miyazaki Kagoshima Okinawa

1         0         0         0      0     0     0       0    0        0        0    0        0         0       0

2         0         0         0      0     0     0       0    1        0        0    0        0         0       0

           t

1 2020-03-12

2 2020-03-13


do as below

library("scatterplot3d")

len <- dim(mdf)[1]

x3d <- c()

for(i in seq(1,47,1)){ x3d <- append(x3d,rep(i,len))}

z3d <- c()

for(i in seq(1,47,1)){ z3d <- append(z3d,mdf[,i])}

# scatterplot3d(x3d,rep(mdf$t,47),z3d,highlight.3d = TRUE, type = "h", pch = " ",zlim=c(0,500))

y3d <- as.integer(gsub('-','',as.character(mdf$t)))

# scatterplot3d(x3d,rep(y3d,47),z3d,highlight.3d = TRUE, type = "h", pch = " ",zlim=c(0,500))

scatterplot3d(x3d,rep(y3d,47),z3d,highlight.3d = TRUE, type = "h", pch = " ",zlim=c(0,500),angle = 65)