{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Patheffect Demo\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\nfrom matplotlib import patheffects\n\nfig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(8, 3))\nax1.imshow([[1, 2], [2, 3]])\ntxt = ax1.annotate(\"test\", (1., 1.), (0., 0),\n                   arrowprops=dict(arrowstyle=\"->\",\n                                   connectionstyle=\"angle3\", lw=2),\n                   size=20, ha=\"center\",\n                   path_effects=[patheffects.withStroke(linewidth=3,\n                                                        foreground=\"w\")])\ntxt.arrow_patch.set_path_effects([\n    patheffects.Stroke(linewidth=5, foreground=\"w\"),\n    patheffects.Normal()])\n\npe = [patheffects.withStroke(linewidth=3,\n                             foreground=\"w\")]\nax1.grid(True, linestyle=\"-\", path_effects=pe)\n\narr = np.arange(25).reshape((5, 5))\nax2.imshow(arr)\ncntr = ax2.contour(arr, colors=\"k\")\n\ncntr.set(path_effects=[patheffects.withStroke(linewidth=3, foreground=\"w\")])\n\nclbls = ax2.clabel(cntr, fmt=\"%2.0f\", use_clabeltext=True)\nplt.setp(clbls, path_effects=[\n    patheffects.withStroke(linewidth=3, foreground=\"w\")])\n\n# shadow as a path effect\np1, = ax3.plot([0, 1], [0, 1])\nleg = ax3.legend([p1], [\"Line 1\"], fancybox=True, loc='upper left')\nleg.legendPatch.set_path_effects([patheffects.withSimplePatchShadow()])\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.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}