import pandas as pd, numpy as np
import hvplot.pandas
import seaborn as sns
dfLiving = pd.read_csv('data/CombinedLivingArangDf.csv')
dfLiving = dfLiving.set_index('Year')
dfLiving = dfLiving.drop(labels='Count', axis=1)
dfLiving.hvplot(value_label='Percent of Age Group')
dfPenguins = sns.load_dataset("penguins")
dfPenguins.hvplot.bivariate('bill_length_mm', 'bill_depth_mm', width=500, height=400, legend=False) *\
dfPenguins.hvplot.scatter('bill_length_mm', 'bill_depth_mm', color='black', size=15, legend=False) +\
dfPenguins.hvplot.table(['bill_length_mm', 'bill_depth_mm'], width=250, height=350)
import xarray as xr, cartopy.crs as ccrs
import hvplot.xarray
air_data = xr.tutorial.open_dataset('air_temperature').load()
proj = ccrs.Orthographic(-90, 30)
air_data.air.isel(time=slice(0, 9, 3)).hvplot.quadmesh(
'lon', 'lat', projection=proj, project=True, global_extent=True,
cmap='viridis', rasterize=True, dynamic=False, coastline=True,
frame_width=500)
import hvplot.streamz
from streamz.dataframe import Random
stream_df = Random(freq='10ms')
stream_df.hvplot(backlog=80, height=300, width=400) +\
stream_df.hvplot.hexbin(x='x', y='z', backlog=1600, height=300, width=400)
import networkx as nx
import hvplot.networkx as hvnx
characters = ["R2-D2",
"CHEWBACCA",
"C-3PO",
"LUKE",
"DARTH VADER",
"CAMIE",
"BIGGS",
"LEIA",
"BERU",
"OWEN",
"OBI-WAN",
"MOTTI",
"TARKIN",
"HAN",
"DODONNA",
"GOLD LEADER",
"WEDGE",
"RED LEADER",
"RED TEN"]
edges = [("CHEWBACCA", "R2-D2"),
("C-3PO", "R2-D2"),
("BERU", "R2-D2"),
("LUKE", "R2-D2"),
("OWEN", "R2-D2"),
("OBI-WAN", "R2-D2"),
("LEIA", "R2-D2"),
("BIGGS", "R2-D2"),
("HAN", "R2-D2"),
("CHEWBACCA", "OBI-WAN"),
("C-3PO", "CHEWBACCA"),
("CHEWBACCA", "LUKE"),
("CHEWBACCA", "HAN"),
("CHEWBACCA", "LEIA"),
("CAMIE", "LUKE"),
("BIGGS", "CAMIE"),
("BIGGS", "LUKE"),
("DARTH VADER", "LEIA"),
("BERU", "LUKE"),
("BERU", "OWEN"),
("BERU", "C-3PO"),
("LUKE", "OWEN"),
("C-3PO", "LUKE"),
("C-3PO", "OWEN"),
("C-3PO", "LEIA"),
("LEIA", "LUKE"),
("BERU", "LEIA"),
("LUKE", "OBI-WAN"),
("C-3PO", "OBI-WAN"),
("LEIA", "OBI-WAN"),
("MOTTI", "TARKIN"),
("DARTH VADER", "MOTTI"),
("DARTH VADER", "TARKIN"),
("HAN", "OBI-WAN"),
("HAN", "LUKE"),
("C-3PO", "HAN"),
("LEIA", "MOTTI"),
("LEIA", "TARKIN"),
("HAN", "LEIA"),
("DARTH VADER", "OBI-WAN"),
("DODONNA", "GOLD LEADER"),
("DODONNA", "WEDGE"),
("DODONNA", "LUKE"),
("GOLD LEADER", "WEDGE"),
("GOLD LEADER", "LUKE"),
("LUKE", "WEDGE"),
("BIGGS", "LEIA"),
("LEIA", "RED LEADER"),
("LUKE", "RED LEADER"),
("BIGGS", "RED LEADER"),
("BIGGS", "C-3PO"),
("C-3PO", "RED LEADER"),
("RED LEADER", "WEDGE"),
("GOLD LEADER", "RED LEADER"),
("BIGGS", "WEDGE"),
("RED LEADER", "RED TEN"),
("BIGGS", "GOLD LEADER"),
("LUKE", "RED TEN")]
G = nx.Graph()
G.add_nodes_from(characters)
G.add_edges_from(edges)
pos = nx.circular_layout(G)
hvnx.draw_circular(G, labels="index")