{ "cells": [ { "cell_type": "markdown", "id": "656e7b52", "metadata": {}, "source": [ "# Option to show/hide plot messages\n", "\n", "The option `plot_message` allows to hide messages produced by sampling." ] }, { "cell_type": "code", "execution_count": 1, "id": "2eb0f327", "metadata": {}, "outputs": [], "source": [ "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "cedf8b23-85e1-439e-8ba4-9587c7d2008e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "1fc369a0-1d09-444c-bfa9-441258666ede", "metadata": {}, "outputs": [], "source": [ "d = { \n", " 'x': [it for it in range(100)] \n", "}" ] }, { "cell_type": "code", "execution_count": 4, "id": "fc5e08e6-227d-442d-bcf1-a09d84c14e67", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p = ggplot(d) + geom_point(aes(x='x'), sampling=sampling_random(n=10))\n", "p" ] }, { "cell_type": "markdown", "id": "707fec5f-4e3c-4cd4-becc-aa123d66029b", "metadata": {}, "source": [ "### Using the `plot_message` parameter" ] }, { "cell_type": "code", "execution_count": 5, "id": "2a0e59d1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p + theme(plot_message='blank')" ] }, { "cell_type": "markdown", "id": "7935ee20", "metadata": {}, "source": [ "### Hiding plot messages for the whole notebook\n", "\n", "Using the `LestPlot.set_theme(...)` function messages can be suppressed for the whole notebook." ] }, { "cell_type": "code", "execution_count": 6, "id": "b76694b7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LetsPlot.set_theme(theme(plot_message='blank'))\n", "ggplot(d) + geom_point(aes(x='x'), sampling=sampling_random(n=10))" ] } ], "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.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }