{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Petroff style sheets\n\nThis example demonstrates the \"petroffN\" styles, which implement the 6-, 8- and\n10-color sequences developed by Matthew A. Petroff [1]_ for accessible data\nvisualization.  The styles balance aesthetics with accessibility considerations,\nmaking them suitable for various types of plots while ensuring readability and\ndistinction between data series.\n\n.. [1] https://arxiv.org/abs/2107.02270\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\n\ndef colored_lines_example(ax):\n    t = np.linspace(-10, 10, 100)\n    nb_colors = len(plt.rcParams['axes.prop_cycle'])\n    shifts = np.linspace(-5, 5, nb_colors)\n    amplitudes = np.linspace(1, 1.5, nb_colors)\n    for t0, a in zip(shifts, amplitudes):\n        y = a / (1 + np.exp(-(t - t0)))\n        line, = ax.plot(t, y, '-')\n        point_indices = np.linspace(0, len(t) - 1, 20, dtype=int)\n        ax.plot(t[point_indices], y[point_indices], 'o', color=line.get_color())\n    ax.set_xlim(-10, 10)\n\n\ndef image_and_patch_example(ax):\n    ax.imshow(np.random.random(size=(20, 20)), interpolation='none')\n    c = plt.Circle((5, 5), radius=5, label='patch')\n    ax.add_patch(c)\n\n\nfig = plt.figure(figsize=(6.4, 9.6), layout='compressed')\nsfigs = fig.subfigures(nrows=3)\n\nfor style, sfig in zip(['petroff6', 'petroff8', 'petroff10'], sfigs):\n    sfig.suptitle(f\"'{style}' style sheet\")\n    with plt.style.context(style):\n        ax1, ax2 = sfig.subplots(ncols=2)\n        colored_lines_example(ax1)\n        image_and_patch_example(ax2)\n\nplt.show()"
      ]
    }
  ],
  "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.14.7"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}