lc_image
adds a graphical object to the page. It can be any graphical R object (for example,
objects of class ggplot
) or image that is stored locally. Note: currently works only on Linux and iOS.
lc_image(data = list(), place = NULL, ..., chartId = NULL, with = NULL)
Name-value pairs of properties passed through the dat
function. These
properties will be re-evaluated on each updateCharts
call.
An ID of the container, where to place new chart. It will be ignored if the chart already exists. If not defined, the chart will be appended to the web page's body.
Name-value pairs of properties that will be evaluated only once and then will remain
constant. These properties can still be changed later using the setProperties
function.
An ID for the chart. All charts must have unique IDs. If a chart with the same ID already
exists, it will be replaced. If ID is not defined, it will be the same as the
value of the place
argument. And if both are not defined, the ID will be set to ChartN
,
where N - 1
is the number of existing charts.
A dataset or a list from which other properties should be taken. If the dataset doesn't have a
column with the requested name, the variable will be searched for outside of the dataset. Must be
a data.frame
or a list
.
You can read more about different properties here.
One of img
and src
properties is required.
img
- static plot to display. Anything that can be saved as png can be used here. .png image fill be saved to
a temporary directory (see tempdir
).
src
- path to an already saved image. Can be an absolute path or a path relative to the current working directory.
If img
is defined, this property will be ignored.
Global chart settings
title
- title of the input block.
width
- width of the chart in pixels. By default, width will be set to fit the content.
If width is defined and it's smaller than content's width, scrolling will be possible.
heigth
- height of the chart in pixels. By default, height will be set to fit the content.
If height is defined and it's smaller than content's height, scrolling will be possible.
paddings
- padding sizes in pixels. Must be a list with all the following fields:
"top", "bottom", "left", "right"
.
if (FALSE) {
library(ggplot2)
pl <- ggplot() + geom_point(aes(1:10, 1:10))
lc_image(dat(img = pl,
title = "Some plot",
paddings = list(top = 100, bottom = 100, left = 10, right = 10)))
}
Run the code above in your browser using DataLab