{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# hist" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This section describes various options available for histogram plots in **fivecentplots**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "See the full API https://endangeredoxen.github.io/fivecentplots/0.5.0/api/hist.html#hist" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import packages:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import fivecentplots as fcp\n", "import pandas as pd\n", "import numpy as np\n", "from pathlib import Path\n", "import matplotlib.pylab as plt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Read some fake data to generate plots:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Batch | \n", "Sample | \n", "Region | \n", "Value | \n", "ID | \n", "
---|---|---|---|---|---|
0 | \n", "101 | \n", "1 | \n", "Alpha123 | \n", "3.5 | \n", "ID701223A | \n", "
1 | \n", "101 | \n", "1 | \n", "Alpha123 | \n", "0.0 | \n", "ID7700-1222B | \n", "
2 | \n", "101 | \n", "1 | \n", "Alpha123 | \n", "3.3 | \n", "ID701223A | \n", "
3 | \n", "101 | \n", "1 | \n", "Alpha123 | \n", "3.2 | \n", "ID7700-1222B | \n", "
4 | \n", "101 | \n", "1 | \n", "Alpha123 | \n", "4.0 | \n", "ID701223A | \n", "
Note that \"counts\" are automatically calculated based on the data in the \"x\" column
\n", "Alert! What just happened? If you were paying close attention you noticed we did not pass a `DataFrame` to the `hist` plot. This is a sneaky, under-the-table trick that exists to make life easier when using `hist` or `imshow` with for 2D `numpy.ndarrays`. These arrays are converted into `DataFrames` behind the scenes so you don't have to take an extra step. This can be our dirty little secret...
\n", "