Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Deep dive Visualizations with - Bokeh , Holoviews , PlotlyJS , d3.js , dc.js and maybe Seaborn #42

Open
RohitDhankar opened this issue May 4, 2020 · 3 comments
Assignees

Comments

@RohitDhankar
Copy link
Member

RohitDhankar commented May 4, 2020

Deep dive Visualizations with - Bokeh , Holoviews , PlotlyJS , d3.js , dc.js and maybe Seaborn
@RohitDhankar and @RohanMathur17 to collab .

Existing old code here -

def bokeh_boxplot_large_userInputs(self,col_with_CategoricalValues): #

@S-T-A-R-L-O-R-D ( DEVESH SOLANKI ) to collab with @RohanMathur17 for Plotly Python version and Bokeh plots / charts.

@S-T-A-R-L-O-R-D
Copy link
Collaborator

Screenshot (72)
** It's an Interactive Plot, if we hover over any field it will display more information about that field like tableau**
Looking forward to creating more engaging and Interactive visuals.

@RohitDhankar
Copy link
Member Author

@S-T-A-R-L-O-R-D - thanks Devesh , this is awesome :)

@S-T-A-R-L-O-R-D
Copy link
Collaborator

from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.models.tools import HoverTool
from bokeh.transform import factor_cmap
from bokeh.palettes import Blues8
from bokeh.embed import components
from bokeh.io import output_notebook,show
import pandas as pd
##x = [1, 2, 3, 4, 5]
#y = [4, 6, 2, 4, 3]
#Read CSV
df = pd.read_csv("cars.csv")
#car = df['Car']
#hp = df['Horsepower']
#ColumnDataSource from data frame
source = ColumnDataSource(df)

output_notebook()
output_file("index.html")

#Add plot

p = figure(
y_range=source.data['Car'].tolist(), plot_width=800, plot_height=600,
title="Cars With Top Horsepower ", x_axis_label="Horsepower", tools="pan,box_select,zoom_in,zoom_out,save,reset")

#Render Glyph
p.hbar(y='Car', right='Horsepower', left=0, height=0.4,
fill_color=factor_cmap('Car',palette=Blues8,factors=source.data['Car'].tolist()),
fill_alpha=0.5, legend='Car' ,source=source)

#Adding Legend
p.legend.orientation='vertical'
p.legend.location='top_right'
p.legend.label_text_font_size='10px'

#Adding Tooltip
hover = HoverTool()
hover.tooltips = """

@CAR

Price: @price
Horsepower: @horsepower
Cars

"""
p.add_tools(hover)
#show results
show(p)
#print out div and script
script,div=components(p)
print(div)
print(script)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants