{ "cells": [ { "cell_type": "markdown", "id": "974d9749", "metadata": {}, "source": [ "The [ggplot](https://ggplot2.tidyverse.org/) library is a great way to make attractive graphics, but unfortunately it's an R library, so we can't use it with Python.\n", "\n", "Instead, we'll use [plotnine](https://github.com/has2k1/plotnine), which is an attempt to bring ggplot to Python." ] }, { "cell_type": "code", "execution_count": 1, "id": "318c3b6b", "metadata": {}, "outputs": [], "source": [ "from plotnine import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "14b3236e", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 21, "id": "1e8c4b6d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Year | \n", "Type of tree | \n", "Trees sold (millions) | \n", "
---|---|---|---|
0 | \n", "2004 | \n", "Real tree | \n", "27.1 | \n", "
1 | \n", "2005 | \n", "Real tree | \n", "32.8 | \n", "
2 | \n", "2006 | \n", "Real tree | \n", "28.6 | \n", "
3 | \n", "2007 | \n", "Real tree | \n", "31.3 | \n", "
4 | \n", "2008 | \n", "Real tree | \n", "28.2 | \n", "