Description Usage Arguments Note Examples
This function allows you to draw a simple line plot of y vs. x, using one or two images
1 2 3 4 |
bottomImg |
The image "below" the line. This should be an image object
as obtained by |
topImg |
The image "above" the line. |
bgColor |
Background color above the line in case you don't specify
|
lineColor |
Line color as accepted by R in the |
lineWidth |
Line width as accepted by R in the |
lineType |
Line type as accepted by R in the |
... |
Other standard ggplot2 parameters such as mapping, data, stat etc. |
By default geom_line_with_image
will not add padding in the x and y axes.
This default behavior of ggplot2 does not make sense when it comes to plotting with images.
You can however override this by adding + xlim(c(0, 100))
. Make sure
the result is meaningful though.
1 2 3 4 5 6 | annapurna <- png::readPNG(system.file("extdata", "annapurna.png", package = "ggwithimages"))
sky <- png::readPNG(system.file("extdata", "sky.png", package = "ggwithimages"))
kathmandu_hourly_aqi <- readr::read_csv(system.file("extdata", "kathmandu_hourly_aqi.csv", package = "ggwithimages"))
library(ggplot2)
ggplot(kathmandu_hourly_aqi, aes(hour, aqi)) +
geom_line_with_image(annapurna, sky)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.