{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Fonts demo (object-oriented style)\n\nSet font properties using setters.\n\nSee :doc:`fonts_demo_kw` to achieve the same effect using keyword arguments.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nfrom matplotlib.font_manager import FontProperties\n\nfig = plt.figure()\nalignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'}\nyp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2]\nheading_font = FontProperties(size='large')\n\n# Show family options\nfig.text(0.1, 0.9, 'family', fontproperties=heading_font, **alignment)\nfamilies = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace']\nfor k, family in enumerate(families):\n    font = FontProperties(family=[family])\n    fig.text(0.1, yp[k], family, fontproperties=font, **alignment)\n\n# Show style options\nstyles = ['normal', 'italic', 'oblique']\nfig.text(0.3, 0.9, 'style', fontproperties=heading_font, **alignment)\nfor k, style in enumerate(styles):\n    font = FontProperties(family='sans-serif', style=style)\n    fig.text(0.3, yp[k], style, fontproperties=font, **alignment)\n\n# Show variant options\nvariants = ['normal', 'small-caps']\nfig.text(0.5, 0.9, 'variant', fontproperties=heading_font, **alignment)\nfor k, variant in enumerate(variants):\n    font = FontProperties(family='serif', variant=variant)\n    fig.text(0.5, yp[k], variant, fontproperties=font, **alignment)\n\n# Show weight options\nweights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black']\nfig.text(0.7, 0.9, 'weight', fontproperties=heading_font, **alignment)\nfor k, weight in enumerate(weights):\n    font = FontProperties(weight=weight)\n    fig.text(0.7, yp[k], weight, fontproperties=font, **alignment)\n\n# Show size options\nsizes = [\n    'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']\nfig.text(0.9, 0.9, 'size', fontproperties=heading_font, **alignment)\nfor k, size in enumerate(sizes):\n    font = FontProperties(size=size)\n    fig.text(0.9, yp[k], size, fontproperties=font, **alignment)\n\n# Show bold italic\nfont = FontProperties(style='italic', weight='bold', size='x-small')\nfig.text(0.3, 0.1, 'bold italic', fontproperties=font, **alignment)\nfont = FontProperties(style='italic', weight='bold', size='medium')\nfig.text(0.3, 0.2, 'bold italic', fontproperties=font, **alignment)\nfont = FontProperties(style='italic', weight='bold', size='x-large')\nfig.text(0.3, 0.3, 'bold italic', fontproperties=font, **alignment)\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
}