{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Export Plot to SVG, PDF, HTML, PNG\n", "\n", "1. [Export Using `ggsave()`](#1.-Export-Using-`ggsave()`)\n", " - [Export SVG to file](#Export-SVG-to-file)\n", " - [Export PDF to file](#Export-PDF-to-file)\n", " - [Export HTML to file](#Export-HTML-to-file)\n", " - [Export to PNG file](#Export-to-PNG-file)\n", "2. [Export Plot to a File or File-Like Object](#2.-Export-Plot-to-a-File-or-File-Like-Object)\n", " - [Saving to a File](#Saving-to-a-File)\n", " - [Wrighting to a Stream of In-Memory Bytes](#Wrighting-to-a-Stream-of-In-Memory-Bytes)\n", "3. [Parameter `dpi`](#3.-Parameter-dpi)\n", " - [72 dpi](#72-dpi)\n", " - [300 dpi](#300-dpi)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:27:31.368827Z", "iopub.status.busy": "2024-04-17T07:27:31.368307Z", "iopub.status.idle": "2024-04-17T07:27:31.682667Z", "shell.execute_reply": "2024-04-17T07:27:31.682344Z" } }, "outputs": [], "source": [ "import io\n", "\n", "import numpy as np\n", "import pandas as pd\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:27:31.684124Z", "iopub.status.busy": "2024-04-17T07:27:31.683987Z", "iopub.status.idle": "2024-04-17T07:27:31.686686Z", "shell.execute_reply": "2024-04-17T07:27:31.686425Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:27:31.699917Z", "iopub.status.busy": "2024-04-17T07:27:31.699522Z", "iopub.status.idle": "2024-04-17T07:27:31.840930Z", "shell.execute_reply": "2024-04-17T07:27:31.840511Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(150, 5)\n" ] }, { "data": { "text/html": [ "\n", " | sepal_length | \n", "sepal_width | \n", "petal_length | \n", "petal_width | \n", "species | \n", "
---|---|---|---|---|---|
0 | \n", "5.1 | \n", "3.5 | \n", "1.4 | \n", "0.2 | \n", "setosa | \n", "
1 | \n", "4.9 | \n", "3.0 | \n", "1.4 | \n", "0.2 | \n", "setosa | \n", "
2 | \n", "4.7 | \n", "3.2 | \n", "1.3 | \n", "0.2 | \n", "setosa | \n", "
3 | \n", "4.6 | \n", "3.1 | \n", "1.5 | \n", "0.2 | \n", "setosa | \n", "
4 | \n", "5.0 | \n", "3.6 | \n", "1.4 | \n", "0.2 | \n", "setosa | \n", "