gl.plot.structure

28 views
Skip to first unread message

Juliana Souza

unread,
Jun 10, 2024, 12:00:54 PMJun 10
to dartR
Hi dartR team, 

I have some simples questions related to plotting the results for the structure run. 
1. When using clumplak = T (k=2), we get the plots for 2.1 and 2.2. I was wondering if it would be possible to get only one plot (i.e. only 2.1). Something similar to the clumpak simulation online. 
2. We need to change the font size for the individuals names. Are there any built in options? 

Best regards,
Juliana

Jose Luis Mijangos

unread,
Jun 12, 2024, 1:20:00 AMJun 12
to dartR
Hi Juliana,

I added the option to plot just one plot (k_name), see text in bold red in the code below. 
You need first to install the developing version of dartR.popgen as shown below.
You can also see in the code below how you can modify the font of the individual labels using the parameter "size" also in bold red.

Cheers,
Luis 

library(devtools)
#install developing version of dartR.popgen
install_github("green-striped-gecko/dartR.popgen@dev")
library(dartR.popgen)
t1 <- platypus.gl
t1 <- gl.filter.callrate(t1,threshold = 1)
t1 <- gl.filter.monomorphs(t1)
res_struc <- gl.run.structure(t1,
                              exec = "./structure",
                              k.range = 2:4,
                              num.k.rep = 3,
                              burnin = 1000,
                              numreps = 1000,
)

# plotting results
r1 <- gl.plot.structure(res_struc,
                        k_name = "3.1",
                        plot.out = TRUE,
                        plot.file = "test",
                        plot.dir = getwd())
# reading rds file with plot
p1 <- readRDS("test.RDS")
# change the font size for the individuals name
p1 +
  theme(
    axis.text.x = element_text(
      size = 14,
      angle = 90,
      vjust = 0.5,
      hjust = 1
    )
  )

Juliana Lopes

unread,
Jun 12, 2024, 11:38:54 PMJun 12
to da...@googlegroups.com
Dear Dr. Mijangos,
The adjustments worked perfectly. 
Thank you very much,
Juliana

--
You received this message because you are subscribed to the Google Groups "dartR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dartr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dartr/4fb62a68-b82a-4c9a-a26d-5475a1b0a353n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages