Skip to main content

A wrapper of plolty which makes adding widget much more easy (and lazy)

Project description


A wrapper of interactive visualization package plotly. Sometimes we are just too lazy to make nested dictionary. Especially creating dropdown menus or slide bars is a way too exhuasting. Moreover, variables of different kind of chart are renamed into a single taxonomy.

What is simplified as easy as possible

  1. creating widgets such as dropdown menu or a slider bar
  2. combine different type of charts together into subplots
  3. automatically calculate grid rows and columns of subplots
  4. configuring different type of variable, using them in a single taxonomy
  5. initiate settings for jupyter notebook users


$ pip install plotly lazyplotly

Quick Start

import lazyplotly as lp

# using list data type to fit
bar_1 =[1,2,3,4,5], y=[23,43,62,24,33], cmap=lp.cmap[16], name='male')

# using dataframe to fit
df = dict(x=[1,2,3,4,5],y=[48,32,43,54,62])
bar_2 ='x', y='y', df=df, cmap=lp.cmap[16], name='female')

# combine all charts into dropdown menu, and save as a html file
    datas = [[bar_1,bar_2],[bar_2, bar_1]],
    btn_labels = ['male v.s. female','female v.s. male'], 
    xlabel = 'category', ylabel='value', title='MyAwesomeTitle',
    output = 'MyAwesomePlot.html'

Custom extension

# using dataframe object by setting xy variables with column name
df = dict(order=[1,2,3,4,5],trend=[22,33,47,57,46],lower=[21,32,43,54,32],upper=[23,34,51,60,60])
area = lp.area(x='order', y='lower', y2='upper', df=df, color='rgba(0,176,246,0.2)', name='CI')
line = lp.line(x='order', y='trend', df=df)
line['line'] = dict(dash = 'dash', color='steelblue')

# add output variable to export as a html file
    data = [area, line],
    rangeslider = True,
    layout = dict(title='Time Series with confidence interval'), # layout extension
    config = dict(displayModeBar=True), # util icons on right top side


import numpy as np
import pandas as pd
df = pd.DataFrame(dict(
    monday = np.random.normal(5, 1, 100),
    tuesday = np.random.normal(5, 1.5, 100),
    wednesday = np.random.normal(5, 2, 100),
    thursday = np.random.normal(5, 2.5, 100),
    friday = np.random.normal(5, 3, 100),
    saturday = np.random.normal(5, 3.5, 100),
    sunday = np.random.normal(5, 4, 100),
data = []
for x in df.columns:
    for y in df.columns:
        if x==y:
            data.append(lp.histogram(x=df[x], name=x))
            data.append(lp.scatter(x=df[x], y=df[y], name=f'{x}-{y}'))
# making subplot
lp.plot(data, rows=7)

# or a boxplot collection
lp.plot([[col], name=col) for col in df.columns])

Sunburst, Pie, Donut

df = dict(
    parents = ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve' ],
    labels = ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
    values = [10, 14, 12, 10, 2, 6, 6, 4, 4]
sunburst = lp.pie(x='parents',x2='labels',y='values', df=df)
pie = lp.pie(x='labels', y='values', df=df)
donut = lp.pie(x='labels', y='values', df=df, hole=0.4)
lp.plot([sunburst, pie, donut], cols=3)

3D scatter

import numpy as np
df = dict(
scatter3d = lp.scatter3d(x='x',y='y',z='z', df=df, cmap=lp.cmap[16])
mesh3d = lp.mesh3d(x='x',y='y',z='z', df=df, color=lp.color[0])
lp.plot([scatter3d,mesh3d], no_padding=True)

Sankey Diagram

# sankey diagram
df = dict(
    origin=['Eve', 'Cain', 'Abel', 'Abel', 'Noam'],
    destin=['Abel', 'Abel', 'Awan', 'Enoch', 'Abel'],
sankey = lp.sankey(x='origin', y='destin', z='count', df=df)


token = 'your mapbox api access token, get your own one at'
df = dict(
    stop=['A','B','C','detail information about bus stop D']
scattermapbox = lp.scattermapbox(x='lon',y='lat',z='volume',tooltip='stop',name='bus route',df=df)
scattermapbox['mode'] = 'markers+lines'


lp.cmap     # show all colorscales available in plotly
lp.color    # show all defined css color name in plotly
plot(data=[], layout=dict, output=bool, config=dict,cols=int, rows=int,
    rangeslider=bool,no_padding=bool, title=str, xlabel=str, ylabel=str)
dropdown(datas=[[]], btn_labels=[], layout=dict, output=bool, config=dict,
    no_padding=bool, title=str, xlabel=str, ylabel=str)
slider(datas=[[]], prefix=str, layout=dict, output=bool, config=dict,
    no_padding=bool, title=str, xlabel=str, ylabel=str)
bar(x, y, df, name, color, cmap)
scatter(x, y, df, name, color)
scatter3d(x, y, z, df, name, color, cmap)
line(x, y, df, name, color)
line3d(x, y, z, df, name, color)
area(x, y, y2, df, name, color)
area3d(x, y, z, df, name, color)
mesh3d(x, y, z, df, name, color)
box(y, df, name, color)
histogram(x, df, name, color, <int>bins, <bool>cum, <bool>prob)
pie(x, x2, y, df, name, hole, color)
heatmap(df, cmap)
sankey(x, y, z, df)
scattermapbox(x, y, z, tooltip, df, name)
mapbox(data, token, zoom, output, config)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lazyplotly, version 1.2
Filename, size File type Python version Upload date Hashes
Filename, size lazyplotly-1.2-py3-none-any.whl (6.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size lazyplotly-1.2.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page