easylabel {easylabel} | R Documentation |
Interactive scatter plot labels
Description
Interactive labelling of scatter plots using shiny/plotly interface.
Usage
easylabel(
data,
x,
y,
labs = NULL,
startLabels = NULL,
cex.text = 0.72,
col = NULL,
colScheme = NULL,
alpha = 1,
shape = NULL,
shapeScheme = 21,
size = 8,
sizeRange = c(4, 80),
xlab = x,
ylab = y,
xlim = NULL,
ylim = NULL,
xticks = NULL,
yticks = NULL,
showOutliers = TRUE,
outlier_shape = 5,
outline_col = "white",
outline_lwd = 0.5,
plotly_filter = NULL,
width = 800,
height = 600,
showgrid = FALSE,
zeroline = TRUE,
hline = NULL,
vline = NULL,
mgp = c(1.8, 0.5, 0),
Ltitle = "",
Rtitle = "",
LRtitle_side = 1,
labelDir = "radial",
labCentre = NULL,
lineLength = 75,
text_col = "black",
line_col = "black",
rectangles = FALSE,
rect_col = "white",
border_col = "black",
padding = 3,
border_radius = 5,
showLegend = TRUE,
legendxy = c(1.02, 1),
filename = NULL,
panel.last = NULL,
fullGeneNames = FALSE,
AnnotationDb = NULL,
custom_annotation = NULL,
output_shiny = TRUE,
...
)
Arguments
data |
Dataset (data.frame or data.table) to use for plot. |
x |
Specifies column of x coordinates in |
y |
Specifies column of y coordinates in |
labs |
Specifies the column in |
startLabels |
Vector of initial labels. With a character vector, labels
are identified in the column specified by |
cex.text |
Font size for labels. Default 0.72 to match plotly font size.
See |
col |
Specifies which column in |
colScheme |
A single colour or a vector of colours for points. |
alpha |
Alpha value for transparency of points. |
shape |
Specifies which column in |
shapeScheme |
A single symbol for points or a vector of symbols.
See |
size |
Either a single value for size of points (default 8), or
specifies which column in |
sizeRange |
Range of size of points for bubble charts. |
xlab |
x axis title. Accepts expressions when exporting base graphics.
Set |
ylab |
y axis title. Accepts expressions when exporting base graphics. |
xlim |
The x limits (x1, x2) of the plot. |
ylim |
The y limits of the plot. |
xticks |
List of custom x axis ticks and labels specified as a list of
two named vectors |
yticks |
List of custom y axis ticks and labels specified as a list of
two named vectors |
showOutliers |
Logical whether to show outliers on the margins of the plot. |
outlier_shape |
Symbol for outliers. |
outline_col |
Colour of symbol outlines. Set to |
outline_lwd |
Line width of symbol outlines. |
plotly_filter |
Refers to a column of logical values in |
width |
Width of the plot in pixels. Saving to pdf scales 100 pixels to 1 inch. |
height |
Height of the plot in pixels. |
showgrid |
Either logical whether to show gridlines, or a character value where "x" means showing x axis gridlines and "y" means showing y axis gridlines. |
zeroline |
Logical whether to show lines at x = 0 and y = 0. |
hline |
Adds horizontal lines at values of y. |
vline |
Adds vertical lines at values of x. |
mgp |
The margin line for the axis title, axis labels and axis line.
See |
Ltitle |
A character or expression (see plotmath) value specifying
text for left side title. Size of font can be changed using |
Rtitle |
A character or expression value specifying text for right side
title. Size of font can be changed using |
LRtitle_side |
On which side of the plot for |
labelDir |
Initial label line directions. Options include 'radial' (default) for radial lines around the centre of the plot, 'origin' for radial lines around the origin, 'horiz' for horizontal and 'vert' for vertical, 'xellipse' and 'yellipse' for near-horizontal and near-vertical lines arranged in an elliptical way around the centre, 'rect' for rectilinear lines (a mix of horizontal and vertical), 'x' for diagonal lines, 'oct' for lines in 8 directions around the centre. |
labCentre |
Coordinates in x/y units of the central point towards which radial labels converge. Defaults to the centre of the plot. |
lineLength |
Initial length of label lines in pixels. |
text_col |
Colour of label text. If set to
|
line_col |
Colour of label lines. If set to
|
rectangles |
Logical whether to show rectangles around labels (not supported by plotly). |
rect_col |
Colour for filling rectangles (not supported by plotly). If
set to |
border_col |
Colour of rectangle borders (not supported by plotly).
Use |
padding |
Amount of padding in pixels around label text. |
border_radius |
Amount of roundedness in pixels to apply to label rectangles (not supported by plotly). |
showLegend |
Logical whether to show or hide the legend. |
legendxy |
Vector of coordinates for the position of the legend.
Coordinates are in plotly paper reference with |
filename |
Filename for saving plots to pdf in a browser. Rstudio opens its own pdf file. |
panel.last |
An expression to be evaluated after plotting has taken place but before the axes, title and box are added. This can be useful for adding extra titles, legends or trend lines. Currently only works when saving plots using base graphics and does not work with plotly. See plot.default |
fullGeneNames |
Logical whether to expand gene symbols using
Bioconductor AnnotationDbi package. With multiple matches, returns first
value only.
See |
AnnotationDb |
Annotation database to use when expanding gene symbols.
Defaults to human gene database |
custom_annotation |
List of annotations to be added via
|
output_shiny |
Logical whether to output a shiny app. If |
... |
Further graphical parameters passed to |
Details
Instructions:
Hover over and click on/off genes which you want to label.
When you have selected all your chosen genes, then drag gene names to move label positions.
Click the save button to export a PDF in base graphics.
The Table tab shows a table view of the dataset to help with annotation.
To export an SVG from plotly:
Switch to SVG when finalised (only do this at last moment as otherwise editing is very slow).
Press camera button in modebar to save image as SVG.
Value
By default no return value. If output_shiny = FALSE
or the shiny
button 'Export plotly & exit' is pressed, a plotly figure is returned.
See Also
Examples
# Simple example using mtcars dataset
data(mtcars)
# Launch easylabel Shiny app: only run this example in interactive R sessions
if (interactive()) {
easylabel(mtcars, x = 'mpg', y = 'wt', col = 'cyl')
}