{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Changing Plot Colors\n\nThis example illustrates use of matplotlib and upsetplot color settings, aside\nfrom matplotlib style sheets, which can control colors as well as grid lines,\nfonts and tick display.\n\nUpsetplot provides some color settings:\n\n* ``facecolor``: sets the color for intersection size bars, and for active\n  matrix dots. Defaults to white on a dark background, otherwise black.\n* ``other_dots_color``: sets the color for other (inactive) dots. Specify as a\n  color, or a float specifying opacity relative to facecolor.\n* ``shading_color``: sets the color odd rows. Specify as a color, or a float\n  specifying opacity relative to facecolor.\n\nFor an introduction to matplotlib theming see:\n\n* [Tutorial](https://matplotlib.org/stable/tutorials/introductory/customizing.html)_\n* [Reference](https://matplotlib.org/stable/gallery/style_sheets/style_sheets_reference.html)_\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from matplotlib import pyplot as plt\nfrom upsetplot import generate_counts, plot\n\nexample = generate_counts()\n\nplot(example, facecolor=\"darkblue\")\nplt.suptitle('facecolor=\"darkblue\"')\nplt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "plot(example, facecolor=\"darkblue\", shading_color=\"lightgray\")\nplt.suptitle('facecolor=\"darkblue\", shading_color=\"lightgray\"')\nplt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "with plt.style.context('Solarize_Light2'):\n    plot(example)\n    plt.suptitle('matplotlib classic stylesheet')\n    plt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "with plt.style.context('dark_background'):\n    plot(example, show_counts=True)\n    plt.suptitle('matplotlib dark_background stylesheet')\n    plt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "with plt.style.context('dark_background'):\n    plot(example, show_counts=True, shading_color=.15)\n    plt.suptitle('matplotlib dark_background stylesheet, shading_color=.15')\n    plt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "with plt.style.context('dark_background'):\n    plot(example, show_counts=True, facecolor=\"red\")\n    plt.suptitle('matplotlib dark_background, facecolor=\"red\"')\n    plt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "with plt.style.context('dark_background'):\n    plot(example, show_counts=True, facecolor=\"red\", other_dots_color=.4,\n         shading_color=.2)\n    plt.suptitle('dark_background, red face, stronger other colors')\n    plt.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.9.15"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}