# Visualize as barplot

Source: `R/visualization.R`
`plot_proportion_barplot.Rd`

Visualize genes and it's transcript proportions in a barplot.

    plot_proportion_barplot(
      dturtle,
      genes = NULL,
      meta_gene_id = NULL,
      group_colors = NULL,
      fit_line_color = "red",
      text_size = 11,
      label_angle = c(25, 1, 1),
      savepath = NULL,
      filename_ext = "_barplot.png",
      add_to_table = FALSE,
      BPPARAM = BiocParallel::SerialParam(),
      ...
    )

## Arguments

dturtle | `dturtle` result object of `posthoc_and_stager()`.
genes | Character vector of genes to plot. If `NULL`, defaults to all found significant genes (`sig_genes`).
meta_gene_id | Optionally specify the column name in `meta_table_gene`, which contains real gene identifiers or gene names.
group_colors | Optionally specify the colours for the two sample groups in the plot. Must be a named vector, with the group names as names.
fit_line_color | Optionally specify the colour to use for the mean fit line.
text_size | Specify basic text size (in pt) to use in plot.
label_angle | Specify the angle of the x-axis labels, the vjust and hjust value (in that order).
savepath | If you want your files to be saved to disk, specify a save path here. The directories will be created if necessary.
filename_ext | Optionally specify a file name extension here, which also defines the save image format. The file name will be 'gene_name+extension'.
add_to_table | If a `savepath` is provided, add the filepaths of the created plots to the corresponding entries in `dtu_table`. The name of the column that shall be created can be specified here.
BPPARAM | If multicore processing should be used, specify a `BiocParallelParam` object here. Among others, can be `SerialParam()` (default) for non-multicore processing or `MulticoreParam('number_cores')` for multicore processing. See `BiocParallel` for more information.

...

Arguments passed on to `ggplot2::ggsave`

`filename`

  File name to create on disk.

`plot`

  Plot to save, defaults to last plot displayed.

`device`

  Device to use. Can either be a device function (e.g. `png()`), or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only).

`path`

  Path of the directory to save plot to: `path` and `filename` are combined to create the fully qualified file name. Defaults to the working directory.

`scale`

  Multiplicative scaling factor.

`width`

  Plot size in `units` ("in", "cm", or "mm"). If not supplied, uses the size of current graphics device.

`height`

  Plot size in `units` ("in", "cm", or "mm"). If not supplied, uses the size of current graphics device.

`units`

  Plot size in `units` ("in", "cm", or "mm"). If not supplied, uses the size of current graphics device.

`dpi`

  Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types.

`limitsize`

  When `TRUE` (the default), `ggsave` will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.

## Value

Returns list of saved plots, for adding to the DTU table. If no `savepath` is provided, returns a list of the created plots for further processing. If `add_to_table` is provided, return the altered `dturtle` object, if at least one of the plots could be added to the DTU summary table.

## Details

Shows the transcripts proportional change per analysis group, together with the mean fit value via a horizontal line. Significant transcript's names are marked in red.

## See also

`run_drimseq()` and `posthoc_and_stager()` for DTU object creation. `create_dtu_table()` and `plot_dtu_table()` for table visualization.

Other DTUrtle visualization: `create_dtu_table()`, `plot_dimensional_reduction()`, `plot_proportion_pheatmap()`, `plot_transcripts_view()`