R: Class "AgTextLabel": Represents a graphviz text label
AgTextLabel-class
R Documentation
Class "AgTextLabel": Represents a graphviz text label
Description
This class is used to represent the textlabel object in
C from the Graphviz library
Objects from the Class
Objects can be created by calls of the form new("AgTextLabel", ...).
Slots
labelText:
Object of class "character" The
actual label text
labelLoc:
Object of class "xyPoint" The
location of the label
labelJust:
Object of class "character" The
justification of the label
labelWidth:
Object of class "integer" The width
of the label
labelColor:
Object of class "character" The
color to print the label
labelFontsize:
Object of class "numeric" The
font size for the label
Methods
labelText
Retrieves the labelText slot
labelLoc
Retrieves the labelLoc slot
labelJust
Retrieves the labelJust slot
labelWidth
Retrieves the labelWidth slot
labelColor
Retrieves the labelColor slot
labelFontsize
Retrieves the labelFontsize slot
Author(s)
Jeff Gentry
See Also
AgEdge-class, AgNode-class
Examples
V <- letters[1:10]
M <- 1:4
g1 <- randomGraph(V, M, .2)
## Make the labels be the edge weights. This code is from the vignette
eAttrs <- list()
ew <- edgeWeights(g1)
lw <- unlist(unlist(ew))
toRemove <- removedEdges(g1)
lw <- lw[-toRemove]
names(lw) <- edgeNames(g1)
eAttrs$label <- lw
z <- agopen(g1,"foo", edgeAttrs=eAttrs)
x <- AgEdge(z) ## list of AgEdge objects
x[[1]] ## AgEdge
a <- txtLabel(x[[1]])
a ## txtLabel object
labelText(a)
labelLoc(a)
labelJust(a)
labelWidth(a)
labelColor(a)
labelFontsize(a)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Rgraphviz)
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: grid
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Rgraphviz/AgTextLabel-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: AgTextLabel-class
> ### Title: Class "AgTextLabel": Represents a graphviz text label
> ### Aliases: AgTextLabel-class labelText labelLoc labelJust labelWidth
> ### labelColor labelFontsize labelFontsize,AgTextLabel-method
> ### labelColor,AgTextLabel-method labelText,AgTextLabel-method
> ### labelLoc,AgTextLabel-method labelJust,AgTextLabel-method
> ### labelWidth,AgTextLabel-method drawTxtLabel
> ### Keywords: classes
>
> ### ** Examples
>
> V <- letters[1:10]
> M <- 1:4
> g1 <- randomGraph(V, M, .2)
>
> ## Make the labels be the edge weights. This code is from the vignette
> eAttrs <- list()
> ew <- edgeWeights(g1)
> lw <- unlist(unlist(ew))
> toRemove <- removedEdges(g1)
> lw <- lw[-toRemove]
> names(lw) <- edgeNames(g1)
> eAttrs$label <- lw
>
> z <- agopen(g1,"foo", edgeAttrs=eAttrs)
> x <- AgEdge(z) ## list of AgEdge objects
> x[[1]] ## AgEdge
An edge between g and a with 1 BezierCurve objects:
27,377 27,317 27,168 27,108
> a <- txtLabel(x[[1]])
> a ## txtLabel object
An object of class "AgTextLabel"
Slot "labelText":
[1] "1"
Slot "labelLoc":
x: 30, y: 243
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 7
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
>
> labelText(a)
[1] "1"
> labelLoc(a)
x: 30, y: 243
> labelJust(a)
[1] "n"
> labelWidth(a)
[1] 7
> labelColor(a)
[1] "black"
> labelFontsize(a)
[1] 14
>
>
>
>
>
> dev.off()
null device
1
>