{ "cells": [ { "cell_type": "markdown", "id": "b510fa67-3de8-4613-8b47-95ad306f80f1", "metadata": {}, "source": [ "# Repro from issue" ] }, { "cell_type": "code", "execution_count": 1, "id": "7684a714-cfbb-47f9-835c-cfcf8a3496d8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from lets_plot import *\n", "LetsPlot.setup_html()\n", "\n", "df = {\n", " 'x': [0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4],\n", " 'y': [0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4],\n", "}\n", "ggplot(data=df, mapping=aes(x='x', y='y')) \\\n", " + geom_point() \\\n", " + ggmarginal(\"tr\", size=0.5, layer=geom_density()) \\\n", " + coord_fixed() \\\n", " + ggsize(600, 800) " ] }, { "cell_type": "markdown", "id": "71b67130-5460-42d1-8aeb-2900a5a17d06", "metadata": {}, "source": [ "# Other cases" ] }, { "cell_type": "code", "execution_count": 2, "id": "43eeb7ed-48f0-469b-b140-a638512f5825", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "thm = theme(\n", " panel_background=element_rect(fill='pink'),\n", " plot_background=element_rect(fill='cyan')\n", " )\n", "\n", "def plots(polar=False):\n", " df = {\n", " 'x': [0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4],\n", " 'y': [0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4],\n", " }\n", " insets = theme(panel_inset=[0, 50])\n", " extreme = theme(panel_inset=[0, 250])\n", " mar = ggmarginal('ltrb', layer=geom_density(), size=0.3)\n", " vert = ggsize(400, 800)\n", " fixed = coord_fixed()\n", " p = ggplot(df, aes(x='x', y='y')) \\\n", " + geom_point() \\\n", " + ggsize(800, 400) \\\n", " + thm \n", "\n", " if polar:\n", " p += coord_polar()\n", " fixed = coord_polar(transform_bkgr=False)\n", "\n", "\n", " p_fixed = p + fixed + ggtitle('fixed')\n", " p_insets = p + insets + ggtitle('insets')\n", " p_fixed_insets = p + fixed + insets + ggtitle('fixed + insets')\n", " p_vert = p + vert + ggtitle('vert')\n", " p_vert_fixed = p + vert + fixed + ggtitle('vert + fixed')\n", " p_vert_insets = p + vert + insets + ggtitle('vert + insets')\n", " p_vert_fixed_insets = p + vert + fixed + insets + ggtitle('vert + fixed + insets')\n", " \n", "\n", " p_mar = p + mar + ggtitle('mar')\n", " p_mar_fixed = p + mar + fixed + ggtitle(' mar + fixed')\n", " p_mar_insets = p + mar + insets + ggtitle('mar + insets')\n", " p_mar_fixed_insets = p + mar + fixed + insets + ggtitle('mar + fixed + insets')\n", "\n", " \n", " p_mar_vert = p + mar + vert + ggtitle('mar + vert')\n", " p_mar_vert_fixed = p + mar + vert + fixed + ggtitle('mar + vert + fixed')\n", " p_mar_vert_insets = p + mar + vert + insets + ggtitle('mar + vert + insets')\n", " p_mar_vert_fixed_insets = p + mar + vert + fixed + insets + ggtitle('mar + vert + fixed + insets')\n", "\n", " p_extreme = p + extreme + ggtitle('exrteme_insets')\n", " p_fixed_extreme = p + fixed + extreme + ggtitle('fixed + extreme')\n", " p_vert_extreme = p + vert + extreme + ggtitle('vert + extreme')\n", " p_vert_fixed_extreme = p + vert + fixed + extreme + ggtitle('vert + fixed + extreme')\n", "\n", " p_mar_extreme = p + mar + extreme + ggtitle('exrteme_insets')\n", " p_mar_fixed_extreme = p + mar + fixed + extreme + ggtitle('fixed + extreme')\n", " p_mar_vert_extreme = p + mar + vert + extreme + ggtitle('vert + extreme')\n", " p_mar_vert_fixed_extreme = p + mar + vert + fixed + extreme + ggtitle('vert + fixed + extreme')\n", "\n", " \n", " \n", " return [\n", " p, p_fixed, p_insets, p_fixed_insets,\n", " p_vert, p_vert_fixed, p_vert_insets, p_vert_fixed_insets,\n", " p_mar, p_mar_fixed, p_mar_insets, p_mar_fixed_insets,\n", " p_mar_vert, p_mar_vert_fixed, p_mar_vert_insets, p_mar_vert_fixed_insets,\n", " p_extreme, p_fixed_extreme, p_vert_extreme, p_vert_fixed_extreme,\n", " p_mar_extreme, p_mar_fixed_extreme, p_mar_vert_extreme, p_mar_vert_fixed_extreme\n", " ]\n", "\n", "for plot in plots(polar=True):\n", " plot.show()\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "5d915b6a-698a-4727-bb67-8d55a16748f2", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "for plot in plots(polar=False):\n", " plot.show()" ] } ], "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.18" } }, "nbformat": 4, "nbformat_minor": 5 }