Skip to content

Instantly share code, notes, and snippets.

View MarcSkovMadsen's full-sized avatar

Marc Skov Madsen MarcSkovMadsen

View GitHub Profile
console.log("hiplot 1");
@MarcSkovMadsen
MarcSkovMadsen / hvPlot_render.ipynb
Last active December 21, 2023 18:46
hvplot notebook with rendered output
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MarcSkovMadsen
MarcSkovMadsen / app.py
Created May 29, 2022 05:03
Data App with Altair Selections
import altair as alt
import pandas as pd
import panel as pn
pn.extension("vega", sizing_mode="stretch_width")
data = pd.read_json(
"https://raw.githubusercontent.com/vega/vega/master/docs/data/penguins.json"
)
@MarcSkovMadsen
MarcSkovMadsen / panel_hvplot_getting_started.py
Last active January 9, 2022 04:41
Basic Examples for the blog post "I prefer using Panel for my Data Apps. Here is why"
# run: pip install pandas panel hvplot
import panel as pn
import pandas as pd, numpy as np
import hvplot.pandas # noqa
primary_color="#3E5F8A"
secondary_color="#EA899A"
idx = pd.date_range('1/1/2000', periods=1000)
@MarcSkovMadsen
MarcSkovMadsen / panel_getting_started.ipynb
Last active March 4, 2024 04:58
Panel - Getting Started Notebook Example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MarcSkovMadsen
MarcSkovMadsen / panel_getting_started.py
Last active March 15, 2022 20:43
Panel - Getting Started .py Example
import numpy as np
import pandas as pd
from matplotlib.figure import Figure
data_url = "https://cdn.jsdelivr.net/gh/holoviz/panel@master/examples/assets/occupancy.csv"
data = pd.read_csv(data_url, parse_dates=["date"]).set_index("date")
primary_color = "#0072B5"
secondary_color = "#94EA84"
@MarcSkovMadsen
MarcSkovMadsen / messages.py
Last active November 1, 2023 04:46
Panel with Tranquilizer REST API
import ast
import requests
url = 'http://localhost:5006/rest/post_data'
def post(value):
data = {'data': value}
response = requests.post(url, data = data)
if response.status_code==200:
print(ast.literal_eval(response.text))
//Formatter to generate line chart
var lineFormatter = function(cell, formatterParams, onRendered){
onRendered(function(){ //instantiate sparkline after the cell element has been aded to the DOM
$(cell.getElement()).sparkline(cell.getValue(), {width:"100%", type:"line", disableTooltips:true});
});
};
//generate bar chart
var barFormatter = function(cell, formatterParams, onRendered){
onRendered(function(){ //instantiate sparkline after the cell element has been aded to the DOM
@MarcSkovMadsen
MarcSkovMadsen / HvplotInteractive.ipynb
Created November 1, 2021 19:42
HvplotInteractive.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MarcSkovMadsen
MarcSkovMadsen / hvplot_interactive.py
Last active January 3, 2023 20:12
Example of using hvPlot .interactive with Panel
import pandas as pd
import hvplot.pandas
import panel as pn
pn.extension(sizing_mode="stretch_width")
PALETTE = [
"#ff6f69",
"#ffcc5c",
"#88d8b0",