Sharedsupport / 2016-11-24-r-graph.ipynbOpen in CoCalc
Examples for support purposes...
options(jupyter.plot_mimetypes = "image/png") 

# Define the cars vector with 5 values
cars <- c(1, 3, 6, 4, 9)

# Graph the cars vector with all defaults
plot(cars)
options(jupyter.plot_mimetypes = "image/svg+xml") 

# Define the cars vector with 5 values
cars <- c(1, 3, 6, 4, 9)

# Graph the cars vector with all defaults
plot(cars)
# Create a plot with some normally distributed data
library("ggplot2")
set.seed(42)
n <- 1000
p <- ggplot(data.frame(x = rnorm(n), y = rnorm(n)), aes(x=x, y=y)) + 
  geom_point(alpha = 0.25, size = 1, colour = "blue") +
  geom_density2d(colour = "red")

p + ggtitle(sprintf("Mime type = '%s'", getOption("jupyter.plot_mimetypes")))