drawScatterplotTrack {gmoviz} | R Documentation

## Add a scatterplot track to an existing plot

### Description

Adds a scatterplot track to the existing plot. Must have initialised the circular plot (by `gmovizInitialise` first).

### Usage

    drawScatterplotTrack(plot_data, track_border_colour = "black",
      track_height = 0.3, point_bicolour_cutoff = NULL,
      point_colour = "black", point_outline_colour = "black",
      point_size = 0.55, point_type = 21, ylim = NULL,
      yaxis_increment = NULL, show_yaxis = TRUE, yaxis_label_size = 0.6,
      yaxis_tick_size = 0.5, yaxis_location = CELL_META$sector.index,
      yaxis_side = "left", yaxis_colour = "black", show_gridlines = TRUE,
      gridline_colour = "#aaaaaa")

### Arguments

`plot_data` | Either: (1) a GRanges object with a metadata column of y values to plot OR (2) a data frame with four columns; `chr` (should match those supplied when initialising the plot); `start` and `end` (x values of the point: can both be the same if you only have a single x value for position) and then a fourth column of y values.
`track_border_colour` | Colour of the border of the plotting region.
`track_height` | The proportion (between 0 and 1) of the circle taken up by this track.
`point_bicolour_cutoff` | A numeric threshold for the colour of the points (points above/below this number will be different colours).
`point_colour` | The fill colour of the points. If `point_bicolour_cutoff != NULL` then this should be a vector with two elements.
`point_outline_colour` | The colour of the outline of the points. If using point_bicolour_cutoff then this should be a vector with two elements.
`point_size` | Size of the points.
`point_type` | Type (shape) of the points, same as base R.
`ylim` | Vector of length 2; upper and lower limits for y axis.
`yaxis_increment` | The increment the y axis and gridlines will use.
`show_yaxis` | If `TRUE`, a y axis will be drawn.
`yaxis_label_size` | Size of the labels on the y axis.
`yaxis_tick_size` | Size of the ticks on the y axis.
`yaxis_location` | Sector the y axis is drawn on.
`yaxis_side` | Side of the sector the y axis is on; either `'left'` or `'right'`.
`yaxis_colour` | Colour of the y axis.
`show_gridlines` | If `TRUE` then gridlines will be drawn.
`gridline_colour` | Colour of the gridlines.

### Value

Adds a scatterplot track to existing visualisation.

### See Also

`gmovizInitialise`, which must be used to initialise the graph before this function. Also `drawLinegraphTrack` for a similar function which displays data as a line graph instead.

### Examples

    ## you must initialise first!
    small_ideo <- data.frame(chr=c('region 1', 'region 2', 'region 3'),
                             start=c(0, 0, 0), end=c(10000, 12000, 10000))
    gmovizInitialise(small_ideo, custom_sector_width=c(0.3, 0.3, 0.3))

    ## make the data
    smallplot_data <- data.frame(
    chr = sample(c('region 1', 'region 2','region 3'), size=40, replace=TRUE),
    start = seq(0, 10000, length.out=40), end = seq(0, 10000, length.out=40),
    val = rnorm(40, 2, 0.5))

    ## scatterplot where all points are the same colour
    drawScatterplotTrack(smallplot_data)

    ## scatterplot with bi-colour cutoff of 2
    drawScatterplotTrack(smallplot_data, point_bicolour_cutoff=2,
                         point_colour=c('red', 'blue'),
                         point_outline_colour=c('black', 'black'))

[Package gmoviz version 1.4.0 Index]