{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Leave values as they are\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The :class:`ptvis.color.IdentityColorConversion` class defines a conversion\nfrom a value to itself. Therefore, the value must be a color.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import plotly\nimport ptvis.color\n\n\nelements = list(ptvis.Element)\ncolors = [\"black\" if i % 2 else \"white\" for i in range(len(elements))]\n\nfig = plotly.graph_objects.Figure()\nptvis.attach_plain_cells(\n fig,\n elements,\n colors=colors,\n color_conversion=ptvis.color.IdentityColorConversion(),\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 }