Im trying to graph types as shown here http://traminer.unige.ch/preview-typology.shtml
I can only fit 8 types in my screen until i get the error Error in plot.new() : figure margins too large
. That´s as far as my UI goes, I can't make the graph interface any taller.
I'm trying to make more types, is there any way I can do this?
This is the plot I'm trying to do.
seqIplot(f3.seq, group = cl1.4fac, sortv = "from.end",with.legend = "none", xtlab=c(rep(18:29, each = 1)))
The 'Figure margins too wide' error is related to the graphic device you are using. It means that the margins do not leave enough place for the figure itself.
There are several possible workarounds (that can possibly be combined).
Changing the number of columns of the graphical area by means of the cols
argument of the seqplot
function.
Reducing the size of the tick marks labels (cex.axis
argument), of the title (cex.main
argument) and suppressing axis labels.
Suppressing the y and x axes (axes
and yaxis
arguments).
Changing the values of the margins (par(mar=...)
).
Changing default parameters of the graphic device, e.g. play with the width
and height
values of pdf()
or png()
.
I illustrate the first four solutions below using the mvad
data that ships with TraMineR
.
library(TraMineR)
data(mvad)
mvad.labels <- c("employment", "further education", "higher education",
"joblessness", "school", "training")
mvad.scode <- c("EM", "FE", "HE", "JL", "SC", "TR")
mvad.seq <- seqdef(mvad[, 17:86], states = mvad.scode,
labels = mvad.labels, xtstep = 6)
diss <- seqdist(mvad.seq, method="LCS")
mvad.clus <- hclust(as.dist(diss), method="ward.D")
k <- 9
mvad.cl <- cutree(mvad.clus,k=k)
## changing text size and number of columns of graphical area
seqdplot(mvad.seq, group=mvad.cl, border=NA, cols=3,
cex.axis=.5, cex.main=0.6, ylab='', xlab='')
## default margins are: par(mar=c(5, 4, 4, 2) + 0.1)
## setting 0 margins except for top
opar <- par(mar=c(0, 0, 2, 0) + 0.1)
seqdplot(mvad.seq, group=mvad.cl, border=NA,
axes=FALSE, yaxis=FALSE)
par(opar) ## resetting default mar