{ "cells": [ { "cell_type": "markdown", "id": "db00a1df", "metadata": {}, "source": [ "# Readme example\n", "\n", "This example generates the simple example for the readme and landing page." ] }, { "cell_type": "code", "execution_count": 1, "id": "6d5a34d7", "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "" ], "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "%config InlineBackend.figure_formats = ['svg']\n", "import robodraw\n", "\n", "d = robodraw.Drawing(\n", " presets={\n", " \"node\": {\"radius\": 0.2, \"linewidth\": 0.5},\n", " \"edge\": {\"color\": (0, 0.3, 1, 0.8), \"width\": 0.04, \"shorten\": 0.2},\n", " },\n", " projection=(25, 25),\n", ")\n", "\n", "center = (0, 0, 0)\n", "corners = [(1, 1, 1), (1, -1, -1), (-1, 1, -1), (-1, -1, 1)]\n", "\n", "# nodes\n", "for c in corners:\n", " color = robodraw.hash_to_color(str(c))\n", " d.circle(c, preset=\"node\", color=color)\n", "\n", "# center\n", "d.circle(center, preset=\"node\", radius=0.15, color=\"black\")\n", "d.text(center, \"$\\\\psi$\", color=\"yellow\")\n", "\n", "# edges to center\n", "for c in corners:\n", " d.zigzag(c, center, preset=\"edge\")\n", "\n", "d.patch_around(corners, radius=0.5)\n", "d.grid3d()\n", "\n", "d.savefig(\"../_static/robodraw-simple-example.png\")" ] } ], "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" } }, "nbformat": 4, "nbformat_minor": 5 }