plot.pkgndep: Plot method

Description Usage Arguments Details Value Examples

View source: R/pkgndep.R

Description

Plot method

Usage

1
2
3
## S3 method for class 'pkgndep'
plot(x, pkg_fontsize = 10*cex, title_fontsize = 12*cex, legend_fontsize = 8*cex,
    fix_size = !dev.interactive(), unit = "in", cex = 1, ...)

Arguments

x

The object from pkgndep.

pkg_fontsize

Fontsize for the package names.

title_fontsize

Fontsize for the titles.

legend_fontsize

Fontsize for the legends.

fix_size

Should the rows and columns in the heatmap have fixed size?

unit

The unit of the returned figure width and height.

cex

A factor multiplicated to all font sizes.

...

Other arguments.

Details

If fix_size is set to TRUE. The size of the whole plot can be obtained by:

1
    size = plot(x, fix_size = TRUE)  

where size is a unit object with the width and height of the whole heatmap. If you want to save the plot in to e.g. a PDF file that has the same size of the heatmap, you need to make the plot twice. First save the plot into a null device, just to obtain the size of the plot:

1
2
3
4
5
6
7
8
    pdf(NULL) # a null device
    size = plot(x, fix_size = TRUE)
    dev.off()
    width = as.numeric(size[1])
    height = as.numeric(size[2])
    pdf(..., width = width, height = height)
    plot(x)
    dev.off()  

If there are no dependency packages stored in x, NULL is returned.

Value

A list of two units that correspond to the width and height of the plot.

Examples

1
# See examples in `pkgndep()`.

jokergoo/pkgndep documentation built on July 6, 2021, 7:56 p.m.