{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from lets_plot import *\n", "\n", "LetsPlot.setup_html() " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = {\n", " 'x': [1, 1, 1, 1, 1, 1.5, 1.5, 2, 2, 2 ],\n", " 'y': [1, 1, 1, 1, 1, 2, 2, 1.5, 1.5, 1.5],\n", " 's': [3, 1, 2, 1, 4, 1, 3, 3, 3, 1],\n", " 'n': ['a', 'b', 'a', 'c', 'a', 'a', 'b', 'c', 'a', 'b']\n", "}\n", "\n", "ggplot(data) + geom_pie(aes('x', 'y', slice='s', fill='n'), hole=0.3, stat='identity') " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot({\n", " 'x': [0, 20, 200],\n", " 'y': [1, 2, 3]\n", "}) + geom_pie(aes('x', 'y'), hole=0.2, stat='identity')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot({\n", " 'x': [10, 20, 30],\n", " 'y': [-100, 15, 200]\n", "}) + geom_pie(aes('x', 'y'), hole=0.2, stat='identity')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data2 = {\n", " 'x': [0, 1, 2, 3, 4, 5],\n", " 'y': [1, 1, 1, 1, 1, 1],\n", " 'size': [1, 2, 5, 10, 20, 40]\n", "}\n", "\n", "ggplot(data2, aes('x', 'y', size='size')) + geom_pie(hole=0.2, stat='identity')" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# geom_point\n", "\n", "ggplot(data2, aes('x', 'y', size='size')) + geom_point() + scale_size_identity()" ] } ], "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.4" } }, "nbformat": 4, "nbformat_minor": 4 }