[Traminer-users] FW: seqrplot: Error in plot.new() : figure margins too large
Matthias Studer
Matthias.Studer at unige.ch
Fri Mar 11 09:24:47 CET 2011
Dear Jane,
Usually, your data are loaded in a data.frame, an object containing all
your covariates (probably the object you gave to seqdef). Suppose that
this data.frame was named mydata. You can run the following command
table(cluster6, mydata$female)
You can also use the female covariate in seqfplot (or any seq*plot
functions) with the following
seqfplot(Org.seq, group=mydata$female)
You can use two covariates at the same time with the interaction function
seqfplot(Org.seq, group=interaction(cluster6, mydata$female))
With the mvad data set this could be
library(TraMineR)
data(mvad)
## mvad is the data.frame
mvad.labels <- c("employment", "further education", "higher education",
"joblessness", "school", "training")
mvad.scodes <- c("EM", "FE", "HE", "JL", "SC", "TR")
mvad.seq <- seqdef(mvad, 15:86, states = mvad.scodes, labels = mvad.labels)
## Grouping with male information
seqfplot(mvad.seq, group=mvad$male)
## Grouping using an interaction male and unemployed father
seqfplot(mvad.seq, group=interaction(mvad$male, mvad$funemp))
Hope this helps.
Matthias Studer
Le 10.03.2011 22:31, Jane K. Ohgami a écrit :
>
> I appreciate the explanations-they have been helpful.
>
> I have one more question regarding options for the seqfplot commands.
> Is it possible to compare the graphs by another variable such as gender?
> Or alternatively with a simple [table] command so that I can determine
> how many fall into each cluster?
>
> For example:
> table(cluster6, female)
>
> yields: Error in table : object 'female' not found
> which I understand to be because 'female' is in my larger data set but
> not my sequence data set?
>
> Again, many thanks for your help!
>
> Regards,
> Jane
>
> ------------------------------
>
> Date: Thu, 10 Mar 2011 10:19:35 +0100
> From: Matthias Studer <Matthias.Studer at unige.ch>
> Subject: Re: [Traminer-users] seqrplot: Error in plot.new() : figure
> margins too large
> To: Users questions <traminer-users at r-forge.wu-wien.ac.at>
> Message-ID: <4D7897A7.9060608 at unige.ch>
> Content-Type: text/plain; charset="windows-1252"; Format="flowed"
>
> Dear Jane,
>
> The problems is that the margins of your plot are too large and that
> there is not enough space to plot it (and to plot what is inside the
> margins). This error appears sometimes on windows if your plot window is
> too small. You may try to maximize it before plotting. Another solution
> would be to plot into a pdf with an appropriate size (maybe try several
> values of width and height)
>
> pdf(file="myplot.pdf", width=20, height=20)
> seqmtplot(Org.seq, group=co.fac)
> dev.off()
>
> Finally, another solution would be to reduce the margins using the "par"
> command (see the help of "par" for more details) for instance:
>
> par(mar = c(1,1,1,1))
> seqmtplot(Org.seq, group=co.fac)
>
> Let us know if it fixed your problem.
> All the best,
>
> Matthias Studer
>
> Le 09.03.2011 16:27, Alexis Gabadinho a ?crit :
> > Dear Jane,
> >
> > I tried to reproduce the problem by creating an artificial sequence
> > data set and a clustering variable with the same characteristics as
> yours:
> >
> > library(TraMineR)
> >
> > co.fac <- rep(paste("Gr",1:8, sep=""), 500)
> > ex <- seqgen(4000, 120, 1:10)
> > Org.seq <- seqdef(ex)
> >
> > ## mean time plot
> > seqmtplot(Org.seq, group=co.fac)
> >
> > The code above works perfectly both on Linux (R 2.10) and Windows (R
> > 2.12). You can try it on your computer. If you get an error with this
> > code, could you tell me which R and TraMineR versions you use ?
> >
> > Moreover I see an error in your "seqrplot" code :
> >
> > seqrplot(Org.seq, group = co.fac, co.fac, border=NA)
> >
> > You have to provide a distance matrix (created with "seqdist()") for
> > plotting representative sequences, and instead you pass "co.fac"
> > again. Your code should look like this (replace "my.dist.matrix" by
> > the name of your distance matrix):
> >
> > seqrplot(Org.seq, group = co.fac, dist.matrix= my.dist.matrix ,
> border=NA)
> >
> > Sometimes, if a graphic window is open and an error occurs with the
> > plotting function, you have to close the graphic window before running
> > the corrected code again.
> >
> > Let me know if this is the solution to your problem.
> >
> > Best,
> > Alexis.
> >
> >
> >
> > Le 08. 03. 11 21:08, Jane K. Ohgami a ?crit :
> >>
> >> I am new to TraMineR and have what is probably a very basic question
> >> regarding plot/graphing commands for cluster analysis.
> >> I am analyzing career transitions and my data set consists of
> >>
> >> [>] 3842 sequences with 10 distinct events/states
> >> [>] 2590 distinct sequences
> >> [>] min/max sequence length: 120/120
> >>
> >> Trying to exercise the following syntax:
> >> seqmtplot(Org.seq, group = co.fac, border=NA) or
> >> seqrplot(Org.seq, group = co.fac, co.fac, border=NA)
> >>
> >> I get the following error message:
> >> >Error in plot.new() : figure margins too large
> >>
> >> I have unsuccessfully tried to adjust for this so would appreciate
> >> any suggestions. Basically I need to figure out how my 8 clusters
> >> break down. Any suggestions/advice would be greatly appreciated.
> >> Thank you!
> >>
> >>
> >> _______________________________________________
> >> Traminer-users mailing list
> >> Traminer-users at lists.r-forge.r-project.org
> >>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users
> >
> >
> > _______________________________________________
> > Traminer-users mailing list
> > Traminer-users at lists.r-forge.r-project.org
> >
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20110310/209c988a/attachment-0001.htm>
>
> ------------------------------
>
> _______________________________________________
> Traminer-users mailing list
> Traminer-users at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users
>
>
> End of Traminer-users Digest, Vol 8, Issue 3
> ********************************************
>
>
>
> _______________________________________________
> Traminer-users mailing list
> Traminer-users at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20110311/797f0989/attachment-0001.htm>
More information about the Traminer-users
mailing list