hyperdraw: How can I control node label font size?
1
0
Entering edit mode
hettling ▴ 60
@hettling-5170
Last seen 10.3 years ago
Hello, I am using the Hyperdraw package and am wondering how I can set the font size for the labels of my node? I took the example from the vignette: ## dh1 <- DirectedHyperedge("A", "B", "R1") dh2 <- DirectedHyperedge(c("A", "B"), c("C", "D"), "R2") dh3 <- DirectedHyperedge("D", "E", "R3") hg <- Hypergraph(LETTERS[1:5], list(dh1, dh2, dh3)) testbph <- graphBPH(hg) testrabph <- graphLayout(testbph) nodeDataDefaults(testrabph, "shape") <- "plain" plot(testrabph) ## Here is what I tried: ## nodeDataDefaults(testrabph, "cex") <- 0.5 ## the above seems to control the size of the labels for the edges, not the nodes A-E. Then I tried to set the font size manually for each node: ## for (i in seq_along(testrabph at graph@AgNode)){ testrabph at graph@AgNode[[i]]@txtLabel at labelFontsize <- 2 } ## but this did not work either. Does anyone know how I could set the font size in this example? Any help is appreciated, many thanks in advance, Hannes
hyperdraw hyperdraw • 1.3k views
ADD COMMENT
0
Entering edit mode
Paul Murrell ▴ 30
@paul-murrell-5669
Last seen 10.1 years ago
New Zealand
Hi This is a bug (or "missing feature") in 'hyperdraw'. I will update the package with a fix, but in the meantime, does this workaround do what you want ? pushViewport(viewport(gp=gpar(cex=.5))) plot(testrabph, newpage=FALSE) Paul On 05/07/13 21:39, hettling wrote: > Hello, > > I am using the Hyperdraw package and am wondering how I can set the font > size for the labels of my node? > > I took the example from the vignette: > > ## > dh1 <- DirectedHyperedge("A", "B", "R1") > dh2 <- DirectedHyperedge(c("A", "B"), c("C", "D"), "R2") > dh3 <- DirectedHyperedge("D", "E", "R3") > hg <- Hypergraph(LETTERS[1:5], list(dh1, dh2, dh3)) > testbph <- graphBPH(hg) > testrabph <- graphLayout(testbph) > nodeDataDefaults(testrabph, "shape") <- "plain" > plot(testrabph) > ## > > Here is what I tried: > > ## > nodeDataDefaults(testrabph, "cex") <- 0.5 > ## > > the above seems to control the size of the labels for the edges, not the > nodes A-E. > Then I tried to set the font size manually for each node: > > ## > for (i in seq_along(testrabph at graph@AgNode)){ > testrabph at graph@AgNode[[i]]@txtLabel at labelFontsize <- 2 > } > ## > > but this did not work either. > > Does anyone know how I could set the font size in this example? Any help > is appreciated, > > many thanks in advance, > > Hannes > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
ADD COMMENT
0
Entering edit mode
Hello, thank you for the quick reply, the workaround that you suggested works very well for me! Kind Regards Hannes On Wed, 2013-05-08 at 09:43 +1200, Paul Murrell wrote: > Hi > > This is a bug (or "missing feature") in 'hyperdraw'. > I will update the package with a fix, but in the meantime, does this > workaround do what you want ? > > pushViewport(viewport(gp=gpar(cex=.5))) > plot(testrabph, newpage=FALSE) > > Paul > > On 05/07/13 21:39, hettling wrote: > > Hello, > > > > I am using the Hyperdraw package and am wondering how I can set the font > > size for the labels of my node? > > > > I took the example from the vignette: > > > > ## > > dh1 <- DirectedHyperedge("A", "B", "R1") > > dh2 <- DirectedHyperedge(c("A", "B"), c("C", "D"), "R2") > > dh3 <- DirectedHyperedge("D", "E", "R3") > > hg <- Hypergraph(LETTERS[1:5], list(dh1, dh2, dh3)) > > testbph <- graphBPH(hg) > > testrabph <- graphLayout(testbph) > > nodeDataDefaults(testrabph, "shape") <- "plain" > > plot(testrabph) > > ## > > > > Here is what I tried: > > > > ## > > nodeDataDefaults(testrabph, "cex") <- 0.5 > > ## > > > > the above seems to control the size of the labels for the edges, not the > > nodes A-E. > > Then I tried to set the font size manually for each node: > > > > ## > > for (i in seq_along(testrabph at graph@AgNode)){ > > testrabph at graph@AgNode[[i]]@txtLabel at labelFontsize <- 2 > > } > > ## > > > > but this did not work either. > > > > Does anyone know how I could set the font size in this example? Any help > > is appreciated, > > > > many thanks in advance, > > > > Hannes > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor at r-project.org > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > > >
ADD REPLY

Login before adding your answer.

Traffic: 495 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6