#!/usr/bin/env python # coding: utf-8 # ## Hello, I'm ***IPython-Dashboar***, which is inspired by one of the greatest package, ***IPython***. # # I'm a stand alone, light-weight web server for building, sharing graphs created in ipython. Build for data science, data analysis guys. Building an interactive visualization, collaborated dashboard, and real-time streaming graph. # # If you are do data exploring in IPython notebook, and draw some graph or select some metrics from database, which will be used to present to others, but you don't like to share the code or the complicated logic [ for private or page cleaning ], I think I can help you to do the present part job. # # In this tutorial, I'll show you how to do data exploring in ipython notebook and how to share it to others without ipython. # # ![usage](usage-1.jpg) # ## 1. Load packages [ One can't make bricks without straw ] # # # - I recommend import package in a readable and reasonable order, which will be useful as the project gets larger. # # In[1]: # built-in package import os import sys import json import time import datetime as dt # third-parth package import dashboard as dash import pandas as pd import matplotlib as plt import seaborn import mpld3 # package configre pd.options.display.max_columns = 100 pd.options.display.max_rows = 500 # ## 2. Load data # # - I've prepared a test data on this repo. # - Don't forget to take a look at the data before exploring it, that's a good habit. # In[2]: url = """https://github.com/litaotao/IPython-Dashboard/raw/v-0.1.2-visualiza-table/docs/people_number_by_province_lateset_10_years.csv""" data = pd.read_csv(url) # In[3]: data.head(3) # ## 3. Traditionaly way of plotting [ I really like ipython indeed, but ... ] # # - matplotlib + seaborn + mpld3 : I really like it very much, but ... # - raw html : ok, it a way indeed, but ... # In[4]: data.plot(x="地区", y=["2014年", "2013年"], kind="bar", figsize=(12, 5)) mpld3.display() # ## 4. Not enough even arm matplotlib with seaborn, mpld3 # # - If you just wanna share this graph above to others ? # - if you wanna hidden/show a specific field, eg, just show one years' population ? # - If you wanna know the exact number of a bar when the hovering on the bar ? # - if ... # - if ... # # ![are-you-crazy](are-you-crazy.jpg) # ## 5. How IPython-Dashboard make it simple # # - No need to code complicated graph settings # - Flexible to define # - Able to share one graph, multi-graph in a dashboard # - More ? coming soon ... # ### Prerequisite # # - start redis server # - start IPython-Dashboard server # # ![redis-server](redis-server.jpg) # ![dash-server](dash-server.jpg) # ### 5.1 Firstly, send you data to the IPython-Dashboard # In[5]: dash.client.sender(data, key='chinese_population', force=True) # ### 5.2 Secondly, oh, there is no second step, you can explore your graph, dashboard as long as opening [browser](http://127.0.0.1:9090) # ![have-fun](have-fun.jpg) # In[ ]: