Is it possible to make a graph with pattern fills using TraMineR and R base graphs?

喜欢而已 提交于 2019-12-04 16:50:33

Following the comments, I came up with this "solution" whose graphics are still improvable. Unfortunately, I was not able to overwrite the legends as well, so that they still need some work. I would be happy if someone had an idea!?

## Define smaller black/grey palette, delete almost white tones
greys <- c("black", "black", "black", "black", brewer.pal(5, "Greys")[2:5])

## Example plot using density and overwriting angle options
par(mar=c(1,2,1,1))
layout(matrix(c(1,2), 2, 1, byrow = TRUE), heights=c(2,1))
seqiplot(biofam.seq, withlegend=FALSE,
         cpal=greys,
         density=c(20, 20, 20, 20, -1, -1, -1, -1), 
         angle=c(45, 90, 45, 0, 0, 0, 0, 0))
seqiplot(biofam.seq, withlegend=FALSE,
         cpal=greys,
         density=c(20, 20, 20, 20, -1, -1, -1, -1), 
         angle=c(45, 90, 135, 0, 0, 0, 0, 0),
         add=TRUE)
         # Different angle for third state creates grid instead of patterns
seqlegend(biofam.seq, pos="center", ncol=3, fontsize=.7,
          cpal=greys,
          density=c(20, 20, 20, 20, -1, -1, -1, -1), 
          angle=c(45, 90, 45, 0, 0, 0, 0, 0))
seqlegend(biofam.seq, pos="center", ncol=3, fontsize=.7,
          cpal=greys,
          density=c(20, 20, 20, 20, -1, -1, -1, -1), 
          angle=c(45, 90, 135, 0, 0, 0, 0, 0))
          # Draws an additional legend instead of overwriting the first

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!