{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Radius range\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "By default, the range of the radial coordinate are determined by values of\nthe second argument. If all the values are nonnegative, the range is from\nzero to the maximum of the values.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import plotly\nimport ptvis\n\n\nelements = list(ptvis.Element) * 4\nradii = (\n [1.]*len(ptvis.Element)\n + [2.]*len(ptvis.Element)\n + [3.]*len(ptvis.Element)\n + [4.]*len(ptvis.Element)\n)\n\nfig = plotly.graph_objects.Figure()\nptvis.attach_polar_bar_cells(fig, elements, radii)\n\nplotly.io.show(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If all the values are nonpositive, the range is from the minimum of the\nvalues to zero.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import plotly\nimport ptvis\n\n\nelements = list(ptvis.Element) * 4\nradii = (\n [-4.]*len(ptvis.Element)\n + [-3.]*len(ptvis.Element)\n + [-2.]*len(ptvis.Element)\n + [-1.]*len(ptvis.Element)\n)\n\nfig = plotly.graph_objects.Figure()\nptvis.attach_polar_bar_cells(fig, elements, radii)\n\nplotly.io.show(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Otherwise, the range is from the minimum to maximum of the values.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import plotly\nimport ptvis\n\n\nelements = list(ptvis.Element) * 4\nradii = (\n [-1.5]*len(ptvis.Element)\n + [-0.5]*len(ptvis.Element)\n + [0.5]*len(ptvis.Element)\n + [1.5]*len(ptvis.Element)\n)\n\nfig = plotly.graph_objects.Figure()\nptvis.attach_polar_bar_cells(fig, elements, radii)\n\nplotly.io.show(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The range can be changed by the `radius_min` and `radius_max` arguments.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import plotly\nimport ptvis\n\n\nelements = list(ptvis.Element) * 4\nradii = (\n [-1.5]*len(ptvis.Element)\n + [-0.5]*len(ptvis.Element)\n + [0.5]*len(ptvis.Element)\n + [1.5]*len(ptvis.Element)\n)\n\nfig = plotly.graph_objects.Figure()\nptvis.attach_polar_bar_cells(\n fig,\n elements,\n radii,\n radius_min=-2.5,\n radius_max=2.5,\n)\n\nplotly.io.show(fig)" ] } ], "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.13.3" } }, "nbformat": 4, "nbformat_minor": 0 }