Create a Python powered dashboard in under 10 minutes

From: https://moderndata.plot.ly/create-a-plotly-dashboards-in-under-10-minutes/

Plotly graphs can be embedded in web sites to create interactive, highly customized dashboards that have many advantages over what is available with expensive, traditional BI software. Many of the world’s leading data driven companies (Netflix, Google, Siemens, and others) are using Plotly to power their dashboards.

This article shows you how to create a simple Plotly dashboard using the Dashboard Wrapper in a few simple steps.

Live Python-Powered, Plotly dashboard

STEP 1: INITIALIZE A DASHBOARD

Let’s start by initializing a new dashboard. To get a preview of the HTML representation of the dashboard organization, where the items in the dashboard are located with respect to one another, it is highly recommended that you use a Jupyter Notebook to run the .get_preview() method in a notebook cell. Everytime you modify your dashboard you should run this to check what the layout looks like.

import plotly.dashboard_objs as dashboard
import IPython.display
from IPython.display import Image

my_dboard = dashboard.Dashboard()
my_dboard.get_preview()

grid_response

STEP 2: ADD BOXES

If you want to place a plot, text box or a webpage into dashboard, you need to place it in a box (which is just a dictionary) and insert it into your dashboard. A simple box has the keys typeboxTypefileIdshareKey and title. To learn about different types of boxes you can add to your dashboard, checkout the Plotly Dashboard API Doc Page.

box_1 = {
‘type’: ‘box’,
‘boxType’: ‘plot’,
‘fileId’: ‘PlotBot:1296’,
‘title’: ‘scatter-for-dashboard’
}

box_2 = {
‘type’: ‘box’,
‘boxType’: ‘plot’,
‘fileId’: ‘PlotBot:1298’,
‘title’: ‘pie-for-dashboard’
}

box_3 = {
‘type’: ‘box’,
‘boxType’: ‘plot’,
‘fileId’: ‘PlotBot:1342’,
‘title’: ‘box-for-dashboard’,
‘shareKey’:’uVoeGB1i8Xf4fk0b57sT2l’
}

my_dboard.insert(box_1)

grid_response

my_dboard.insert(box_2, ‘above’, 1)

grid_response

my_dboard.insert(box_3, ‘left’, 2)

grid_response

STEP 3: UPLOAD YOUR DASHBOARD

import plotly.plotly as py
py.dashboard_ops.upload(my_dboard, ‘My First Dashboard with Python’)

python dashboard

MORE RESOURCES

Want to make more complicated dashboards and websites with embedded Plotly graphs? Check out these resources. For Ubuntu and Apache in particular, there is an infinite source of free help and documentation online through Google search and forums.

UBUNTU & APACHE

Official Ubuntu LAMP documentation

Another LAMP tutorial from folks at Digital Ocean

Easy Ubuntu Server set-up on AWS

ZaReason: Inexpensive source of physical servers with Ubuntu preinstalled

WEBSITE CREATION AND STYLING

Bootstrap: Slick css library and examples for quickly creating great-looking sites

PLOTLY SPECIFIC

Python Dashboard API

Embedding Plotly graphs in external websites

Plotly-Python streaming API

Python Powered dashboard

R / ggplot2 Powered dashboard

MATLAB Powered dashboard

Leave a comment