{ "cells": [ { "cell_type": "markdown", "id": "9b091448", "metadata": {}, "source": [ "# The `plot_inset` Parameter in `theme()`\n", "\n", "The `plot_inset` parameter in `theme()` specifies the inset for a plotting area, including the axes with their labels, but without titles.\n", "The parameter is set according to the margin rules: accept a number or a list of numbers." ] }, { "cell_type": "code", "execution_count": 1, "id": "d443f816", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "5936e6bd", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "20006cf6", "metadata": {}, "outputs": [], "source": [ "np.random.seed(42)\n", "\n", "x = np.linspace(-np.pi, np.pi, 100)\n", "y = np.sin(x)\n", "\n", "p = ggplot({'x': x, 'y': y}, aes(x='x', y='y')) + \\\n", " geom_line() + \\\n", " ggtitle(\"Sine wave\") + \\\n", " theme_light() + \\\n", " theme(plot_background=element_rect(size=1))" ] }, { "cell_type": "code", "execution_count": 4, "id": "d07bb38e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gggrid([\n", " p,\n", " p + theme(plot_inset=20)\n", "])" ] }, { "cell_type": "code", "execution_count": 5, "id": "52a6dfe7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gggrid([\n", " p + theme(axis='blank'),\n", " p + theme(axis='blank') + theme(plot_inset=[0, 30])\n", "])" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.19" } }, "nbformat": 4, "nbformat_minor": 5 }