{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "taruma-hidrokit-viz-graph", "version": "0.3.2", "provenance": [], "collapsed_sections": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "_CtZpmBbCbAg", "colab_type": "text" }, "source": [ "# Tutorial `hidrokit.viz.graph`\n", "\n", "- **Kategori**: _data visualization_\n", "- __Tujuan__: Menampilkan dataset melalui bentuk grafik/plot\n", "- __Dokumentasi__: [readthedocs](https://hidrokit.readthedocs.io/en/stable/viz.html#viz.graph.subplots)\n", "\n", "## Informasi notebook\n", "\n", "- __notebook name__: `taruma_hidrokit_viz_graph`\n", "- __notebook version/date__: `1.0.1`/`20190713`\n", "- __notebook server__: Google Colab\n", "- __hidrokit version__: `0.2.0`\n", "- **python version**: `3.7`\n" ] }, { "cell_type": "markdown", "metadata": { "id": "BPm5qNh_DQjj", "colab_type": "text" }, "source": [ "## Instalasi hidrokit" ] }, { "cell_type": "code", "metadata": { "id": "aeLepUrl_nxm", "colab_type": "code", "outputId": "69c1d309-3a48-44d6-96a5-6c752c1b8f22", "colab": { "base_uri": "https://localhost:8080/", "height": 204 } }, "source": [ "### Instalasi melalui PyPI\n", "!pip install hidrokit\n", "\n", "### Instalasi melalui Github\n", "# !pip install git+https://github.com/taruma/hidrokit.git\n", "\n", "### Instalasi melalui Github (Latest)\n", "# !pip install git+https://github.com/taruma/hidrokit.git@latest" ], "execution_count": 0, "outputs": [ { "output_type": "stream", "text": [ "Requirement already satisfied: hidrokit in /usr/local/lib/python3.6/dist-packages (0.2.0)\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from hidrokit) (1.16.4)\n", "Requirement already satisfied: pandas in /usr/local/lib/python3.6/dist-packages (from hidrokit) (0.24.2)\n", "Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/dist-packages (from hidrokit) (3.0.3)\n", "Requirement already satisfied: pytz>=2011k in /usr/local/lib/python3.6/dist-packages (from pandas->hidrokit) (2018.9)\n", "Requirement already satisfied: python-dateutil>=2.5.0 in /usr/local/lib/python3.6/dist-packages (from pandas->hidrokit) (2.5.3)\n", "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->hidrokit) (0.10.0)\n", "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->hidrokit) (2.4.0)\n", "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->hidrokit) (1.1.0)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/dist-packages (from python-dateutil>=2.5.0->pandas->hidrokit) (1.12.0)\n", "Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from kiwisolver>=1.0.1->matplotlib->hidrokit) (41.0.1)\n" ], "name": "stdout" } ] }, { "cell_type": "markdown", "metadata": { "id": "APb9vC-zDaV4", "colab_type": "text" }, "source": [ "## Import Library" ] }, { "cell_type": "code", "metadata": { "id": "Gx6h8iSxDfQY", "colab_type": "code", "colab": {} }, "source": [ "import numpy as np\n", "import pandas as pd" ], "execution_count": 0, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "Kny2T1itDlz6", "colab_type": "text" }, "source": [ "## Dataset" ] }, { "cell_type": "code", "metadata": { "id": "xdDdm1pbD-AO", "colab_type": "code", "outputId": "3f9b7284-3af4-476c-e31d-833afe219a7b", "colab": { "base_uri": "https://localhost:8080/", "height": 357 } }, "source": [ "# Ambil dataset dari data test hidrokit\n", "!wget -O dataset.csv \"https://github.com/taruma/hidrokit/blob/master/tests/data/one_year_three_columns.csv?raw=true\"" ], "execution_count": 0, "outputs": [ { "output_type": "stream", "text": [ "--2019-07-12 03:20:27-- https://github.com/taruma/hidrokit/blob/master/tests/data/one_year_three_columns.csv?raw=true\n", "Resolving github.com (github.com)... 140.82.114.3\n", "Connecting to github.com (github.com)|140.82.114.3|:443... connected.\n", "HTTP request sent, awaiting response... 302 Found\n", "Location: https://github.com/taruma/hidrokit/raw/master/tests/data/one_year_three_columns.csv [following]\n", "--2019-07-12 03:20:27-- https://github.com/taruma/hidrokit/raw/master/tests/data/one_year_three_columns.csv\n", "Reusing existing connection to github.com:443.\n", "HTTP request sent, awaiting response... 302 Found\n", "Location: https://raw.githubusercontent.com/taruma/hidrokit/master/tests/data/one_year_three_columns.csv [following]\n", "--2019-07-12 03:20:27-- https://raw.githubusercontent.com/taruma/hidrokit/master/tests/data/one_year_three_columns.csv\n", "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...\n", "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 7242 (7.1K) [text/plain]\n", "Saving to: ‘dataset.csv’\n", "\n", "\rdataset.csv 0%[ ] 0 --.-KB/s \rdataset.csv 100%[===================>] 7.07K --.-KB/s in 0s \n", "\n", "2019-07-12 03:20:27 (65.6 MB/s) - ‘dataset.csv’ saved [7242/7242]\n", "\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "id": "nJdvdBzjEH96", "colab_type": "code", "outputId": "b70a7c25-78f4-4d67-bf80-f3d389f7a2fc", "colab": { "base_uri": "https://localhost:8080/", "height": 359 } }, "source": [ "# Baca dataset\n", "dataset = pd.read_csv('dataset.csv', index_col=0, parse_dates=True)\n", "dataset.head(10)" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "
\n", " | sta_a | \n", "sta_b | \n", "sta_c | \n", "
---|---|---|---|
2000-01-01 | \n", "7 | \n", "79 | \n", "19 | \n", "
2000-01-02 | \n", "17 | \n", "79 | \n", "65 | \n", "
2000-01-03 | \n", "79 | \n", "51 | \n", "25 | \n", "
2000-01-04 | \n", "48 | \n", "75 | \n", "31 | \n", "
2000-01-05 | \n", "81 | \n", "33 | \n", "80 | \n", "
2000-01-06 | \n", "26 | \n", "3 | \n", "96 | \n", "
2000-01-07 | \n", "78 | \n", "75 | \n", "26 | \n", "
2000-01-08 | \n", "71 | \n", "95 | \n", "65 | \n", "
2000-01-09 | \n", "48 | \n", "71 | \n", "22 | \n", "
2000-01-10 | \n", "32 | \n", "89 | \n", "88 | \n", "