panel_boxplot {GOsummaries} | R Documentation

## Panel drawing functions

### Description

These functions are used to draw the panel portion of every component based on the Data slots in gosummaries object. These concrete functions assume the data is presented as done by `add_expression.gosummaries`. They provide three options: boxplot, violin plot (which shows the distrubution more precisely) and both combined. Additionally it is possible to combine the values from one each functional group into one box/violin plot using the corresponding functions ending with "_classes".

### Usage

    panel_boxplot(data, fontsize = 10, par)

    panel_violin(data, fontsize = 10, par)

    panel_violin_box(data, fontsize = 10, par)

    panel_boxplot_classes(data, fontsize = 10, par)

    panel_violin_classes(data, fontsize = 10, par)

    panel_violin_box_classes(data, fontsize = 10, par)

### Arguments

`data` | the data from Data slot of the gosummaries object
`fontsize` | fontsize in points, mainly used to ensure that the legend fontsizes match
`par` | additional parameters for drawing the plot, given as list. These functions use only `classes` slot for figuring out which parameter to use for coloring the "geom"-s. However, when building a custom function it provides a way to give extra parameters to the plotting function.

### Details

These functions specify in principle the general setting for the panels, like which "geom"-s, how the data is transformed and summarized, etc. To make small adjustments to the figure such as changing color scheme, write your own customization function (See `customize` as example).

It is possible to write your own panel plotting function, as long as the parameters used and the return value are similar to what is specified here. When writing a new panel function one only has to make sure that it matches the data given in the Data slot of the gosummaries object.

### Value

It returns a function that can draw a ggplot2 plot of the data in Data slot of a gosummaries object. The legend and the actual plots for the panels are extracted later from the figure produced by this function.

### Author(s)

Raivo Kolde <raivo.kolde@eesti.ee>

### Examples

    ## Not run:
    data(gs_kmeans)

    # Draw default version with plot_boxplot
    plot(gs_kmeans, components = 1:3, classes = "Tissue")

    # Define alternative where one boxplot summarises all values in one class
    plot_classes = function(data, fontsize, par){
        qplot(x = data[, par$classes], y = data$y, geom = "boxplot",
              fill = data[, par$classes]) + theme_bw()
    }

    plot(gs_kmeans, components = 1:3, panel_plot = plot_classes, classes = "Tissue")

    # Flip the boxplots to make them more comparable
    plot_classes = function(data, fontsize, par){
        qplot(x = data[, par$classes], y = data$y, geom = "boxplot",
            fill = data[, par$classes]) + coord_flip() + theme_bw()
    }

    plot(gs_kmeans, components = 1:3, panel_plot = plot_classes, classes = "Tissue")

    ## End(Not run)

[Package GOsummaries version 2.28.0 Index]