0

终于想通了如何在 R 中制作我的河图,现在我想知道如何让我的字体变小?

    library(riverplot)

    #Bring in file of nodes and edges
    nodes <- read_xlsx("riverplot_cell_p.xlsx", sheet = "nodes")
    edges <- read_xlsx("riverplot_cell_p.xlsx", sheet = "edges")

    #Convert to data frame
    nodes <- as.data.frame(nodes)
    edges <- as.data.frame(edges)
    rownames(nodes) = nodes$ID


    #Construct a list of styles
    library(RColorBrewer)
    palette = paste0(brewer.pal(9, "Set1"), "60")
    styles = lapply(nodes$y, function(n) {
      list(col = palette[n+1], lty = 0, textcol = "black")})
    names(styles) = nodes$ID

    #Construct riverplot
    library(riverplot)
    rp <- list(nodes = nodes, edges = edges, styles = styles)
    class(rp) <- c(class(rp), "riverplot")
    plot(rp)

[河图[1]

4

1 回答 1

0

我从 的帮助页面中看不到任何更改文本字体大小的方法plot.riverplot,但您始终可以使用宽度/高度参数修改图形设备的尺寸。例如:

w <- 3 # tinker with these multipliers
h <- 2
tiff(file="Figure_1.tiff", width=480*w, height=480*h)
plot(rp)
dev.off()

看看这是否有效。

于 2020-02-10T05:52:45.517 回答