{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "sublime-retention", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "from lets_plot import *\n", "\n", "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 2, "id": "competent-advertiser", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot() + \\\n", " geom_hline(yintercept=1,size=20, tooltips='none') + \\\n", " geom_point(x=0.5,y=1,\n", " shape=21,size=10,stroke=10,fill=\"orange\",color=\"green\",\n", " tooltips=layer_tooltips().line(\"size=^size, stroke=^stroke\")) + \\\n", " geom_point(x=0.6,y=1,\n", " shape=21,size=20,stroke=0,fill=\"orange\",\n", " tooltips=layer_tooltips().line(\"size=^size, stroke=^stroke\")) + \\\n", " geom_point(x=0.7,y=1,\n", " shape=21,size=0,stroke=20,color=\"green\",\n", " tooltips=layer_tooltips().line(\"size=^size, stroke=^stroke\")) + \\\n", " theme_classic() + theme(axis='blank') + ggsize(600,200)" ] }, { "cell_type": "code", "execution_count": 3, "id": "manual-discretion", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = {\n", " 'x': (list(range(7)) * 4)[:26],\n", " 'y': ([3] * 7 + [2] * 7 + [1] * 7 + [0] * 7)[:26],\n", " 'shape': list(range(26)),\n", "}\n", "\n", "p = ggplot(data, aes('x', 'y')) + \\\n", " scale_shape_identity() + \\\n", " xlim(-0.5, 6.5) + \\\n", " ylim(-0.5, 3.5) + \\\n", " theme_classic() + theme(axis='blank')\n", "\n", "p + \\\n", " geom_hline(aes(yintercept='yi'), data = {'yi': [0,1,2,3] }, color='light_gray', tooltips='none') + \\\n", " geom_point(aes(shape='shape'), color=\"black\", fill=\"blue\") " ] }, { "cell_type": "code", "execution_count": 4, "id": "dental-evaluation", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p + \\\n", " geom_hline(aes(yintercept='yi'), data = {'yi': [0,1,2,3] }, color='light_gray', tooltips='none', size=10) + \\\n", " geom_point(aes(shape='shape'), color=\"black\", fill=\"pink\", size=10, stroke=1) " ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }