From bb1ae75c56d34a65662d7b285333c595c0ddae7f Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Wed, 7 Apr 2021 12:05:36 +0200 Subject: Nouvelle version du manuscrit avec HTML --- images/l21m2.R | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 images/l21m2.R (limited to 'images/l21m2.R') diff --git a/images/l21m2.R b/images/l21m2.R new file mode 100755 index 0000000..8998a49 --- /dev/null +++ b/images/l21m2.R @@ -0,0 +1,20 @@ +#!/usr/bin/env Rscript +`%>%` <- magrittr::`%>%` +xpoints <- seq (-1, 1, length.out = 100) +ypoints <- seq (-1, 1, length.out = 100) +compute_l1 <- function (x, y) abs (x) + abs (y) +compute_l2 <- function (x, y) sqrt (x ^ 2 + y ^ 2) +data <- (tibble::tibble (expand.grid (x = xpoints, y = ypoints)) + %>% dplyr::mutate (`$\\left\\|W\\right\\|_{2, 1}$` = compute_l1 (x, y), + `$\\left\\|W\\right\\|_F$` = compute_l2 (x, y)) + %>% dplyr::mutate (`$\\left\\|W\\right\\|_{2, 1 - 2}$` = + `$\\left\\|W\\right\\|_{2, 1}$` + - `$\\left\\|W\\right\\|_F$`)) + +plotl21 <- (ggplot2::ggplot (data, ggplot2::aes (x = x, y = y, fill = `$\\left\\|W\\right\\|_{2, 1}$`)) + + ggplot2::geom_raster ()) +plotl21m2 <- (ggplot2::ggplot (data, ggplot2::aes (x = x, y = y, fill = `$\\left\\|W\\right\\|_{2, 1 - 2}$`)) + + ggplot2::geom_raster ()) +plot <- gridExtra::arrangeGrob (plotl21, plotl21m2, nrow = 2) +filename <- Sys.getenv ("OUTPUT") +ggplot2::ggsave (filename, plot, device = "svg", width = 5.5, height = 6.5) -- cgit v1.2.3