{ "cells": [ { "cell_type": "markdown", "id": "68dbee24-cf81-471a-b331-3cf08d427e18", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# Option to show/hide plot messages\n", "\n", "The option `plotMessage` allows to hide messages produced by sampling." ] }, { "cell_type": "code", "execution_count": 1, "id": "ea0aa561-34ee-4890-abd5-6bfa93863c30", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%useLatestDescriptors\n", "%use lets-plot" ] }, { "cell_type": "code", "execution_count": 2, "id": "46159eb1-3fb7-49de-b748-1fa76fde073e", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "val d = mapOf(\"x\" to MutableList(11) { it })" ] }, { "cell_type": "code", "execution_count": 3, "id": "74defcf1-3a30-4762-abbd-14654a260973", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val p = letsPlot(d) + geomPoint(sampling = samplingRandom(n = 10)) { x = \"x\" }\n", "p" ] }, { "cell_type": "markdown", "id": "83304039-01a4-40f9-862b-c428bc97f7e0", "metadata": {}, "source": [ "### Using the `plotMessage` parameter\n", "Use `elementBlank()` to show no messages, or `elementText()` to show sampling messages. Note that `elementText()` options don't affect a message text." ] }, { "cell_type": "code", "execution_count": 4, "id": "61d91358-85cc-44cb-a1cc-c52ca61c43db", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p + theme(plotMessage=elementBlank())" ] }, { "cell_type": "markdown", "id": "26e5886e-e3e5-4fcc-bfab-3cea5ac3ffa0", "metadata": {}, "source": [ "### Hiding plot messages for the whole notebook\n", "\n", "Using the `LestPlot.theme` property messages can be suppressed for the whole notebook." ] }, { "cell_type": "code", "execution_count": 5, "id": "f6f2ee74-8d2e-4fa0-b5dc-44b0bd16c74f", "metadata": {}, "outputs": [], "source": [ "LetsPlot.theme = theme(plotMessage = elementBlank())" ] }, { "cell_type": "code", "execution_count": 6, "id": "f038cfd6-216d-41e1-a415-c1f7c3219107", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "letsPlot(d) + geomPoint(sampling = samplingRandom(n = 10)) { x = \"x\" }" ] } ], "metadata": { "kernelspec": { "display_name": "Kotlin", "language": "kotlin", "name": "kotlin" }, "language_info": { "codemirror_mode": "text/x-kotlin", "file_extension": ".kt", "mimetype": "text/x-kotlin", "name": "kotlin", "nbconvert_exporter": "", "pygments_lexer": "kotlin", "version": "1.8.20" } }, "nbformat": 4, "nbformat_minor": 5 }