[Traminer-users] reduce space between subplots in seqdplot

Reynolds, Jeremy E reyno113 at purdue.edu
Mon Oct 17 14:33:42 CEST 2016


Thank you so much!  Can you also tell me how to change the titles of the subplots and the titles of the Y axes?  The Y-axes could all be the same (e.g., "Proportion" instead of the default "Freq.(weighted n = )", but I would probably want a unique title for each subgraph to replace the medoid ID numbers.

Jeremy

From: traminer-users-bounces at lists.r-forge.r-project.org [mailto:traminer-users-bounces at lists.r-forge.r-project.org] On Behalf Of Matthias Studer
Sent: Monday, October 17, 2016 4:00 AM
To: Users questions <traminer-users at lists.r-forge.r-project.org>
Subject: Re: [Traminer-users] reduce space between subplots in seqdplot

Dear Jeremy,

You can do it by re-specifying the margins of your plot with the par(mar=c(...)) command.

According to the par help page, the mar argument sets the margins using a "numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margins to be specified on the four sides of the plot. The default is c(5, 4, 4, 2) + 0.1"

You typically want to reduce the top and bottom margins. You will probably need several tries to get the right settings.

You can find more information on margin on the "par" help page.

Hope this helps.
Matthias



De : traminer-users-bounces at lists.r-forge.r-project.org<mailto:traminer-users-bounces at lists.r-forge.r-project.org> [mailto:traminer-users-bounces at lists.r-forge.r-project.org] De la part de Reynolds, Jeremy E
Envoyé : vendredi 14 octobre 2016 23:15
À : Users questions <traminer-users at lists.r-forge.r-project.org<mailto:traminer-users at lists.r-forge.r-project.org>>
Objet : [Traminer-users] reduce space between subplots in seqdplot

Dear TraMineR Users,

I would like to reduce the amount of space between the subplots created with seqdplot and the group option.  Does anyone know how to do this?  I have provided an example below that makes the plot and then save it as a .png file.  The code works, but I would like the space between the title of each graph and the adjacent graph to be smaller.

Thanks,

Jeremy



library(TraMineR)
library(WeightedCluster)
data(mvad)
mvad.alphabet <- c("employment", "FE", "HE", "joblessness", "school", "training")
mvad.labels <- c("Employment", "Further Education", "Higher Education", "Joblessness", "School", "Training")
mvad.scodes <- c("EM", "FE", "HE", "JL", "SC", "TR")
mvadseq <- seqdef(mvad[, 17:86], alphabet = mvad.alphabet, states = mvad.scodes, labels = mvad.labels, weights = mvad$weight, xtstep = 6)

#Defining the custom cost matrix
subm.custom <- matrix(
  c(0, 1, 1, 2, 1, 1,
    1, 0, 1, 2, 1, 2,
    1, 1, 0, 3, 1, 2,
    2, 2, 3, 0, 3, 1,
    1, 1, 1, 3, 0, 2,
    1, 2, 2, 1, 2, 0),
  nrow = 6, ncol = 6, byrow = TRUE)

mvaddist1.0 <- seqdist(mvadseq, method = "OM", indel = 1.0, sm = subm.custom)
pamclust1.0 <- wcKMedRange(mvaddist1.0, kvals = 2:10, weights = mvad$weight)

#save plot to file
png(filename = "test.png", width = 1500, height = 3500, units = "px", pointsize=30)
seqdplot(mvadseq, group = pamclust1.0$clustering$cluster4, border = NA,
         use.layout=TRUE, cols=1, axes="bottom", cex.legend=2,legend.prop=.05)
dev.off()


Dr. Jeremy Reynolds
Professor
309 Stone Hall
Department of Sociology
700 W. State Street
Purdue University
West Lafayette, IN 47907
Phone: (765) 496-3348
https://www.cla.purdue.edu/sociology/directory/index.aspx?p=Jeremy_Reynolds

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20161017/9efcca5a/attachment.html>


More information about the Traminer-users mailing list