Skip to content

Instantly share code, notes, and snippets.

View domoritz's full-sized avatar
📊
charting new territory

Dominik Moritz domoritz

📊
charting new territory
View GitHub Profile
@domoritz
domoritz / filtered_line.json
Last active April 15, 2016 23:24 — forked from willium/filtered_line.json
vega label specs
{
"width": 1,
"height": 1,
"padding": "auto",
"data": [
{
"name": "source",
"url": "data/stocks.csv",
"format": {
"type": "csv",
@domoritz
domoritz / generator.py
Last active May 3, 2016 23:54
Fake commit data
import random
from datetime import datetime, timedelta as td
d1 = datetime(2015, 1, 1, 0, 0, 0)
d2 = datetime(2015, 5, 31, 0, 0, 0)
delta = d2 - d1
print "time,count"
for i in range(delta.days * 24 + 1):
@domoritz
domoritz / .block
Last active June 30, 2021 20:13
Histograms
scrolling: true
license: gpl-3.0
@domoritz
domoritz / Potential_JavaScript_API_for_Vega-Lite.js
Last active October 28, 2016 13:41
Potential JS API for Vega-Lite (akin to Altair)
/// FIGURE 2
var weather = vl.data()
.url('data/weather.csv')
.format('csv');
// Line chart with aggregation
var fig2a = vl.line()
.data(weather)
.x(vl.month('date'))
.y(vl.mean('temp_max'))
@domoritz
domoritz / data.csv
Last active March 27, 2017 01:38
Compute mean delay and error for flight delay data
DayOfWeek DepTimeBlk DepDelay StdMeanErr
1 0001-0559 8.897969052224372 1.230957811414512
1 0600-0659 6.929324482623975 0.7006511663457965
1 0700-0759 7.723363774733638 0.5806981413397009
1 0800-0859 11.068298460323726 0.598413615307324
1 0900-0959 12.297140399913998 0.5771583231861239
1 1000-1059 14.13575152041703 0.612918392530587
1 1100-1159 15.679030558482614 0.6671801433858121
1 1200-1259 17.7011925795053 0.683686132015881
1 1300-1359 17.65929583512237 0.719630306303089
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
{"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
{"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
]
},
{
"data": {
"values": [
{"date": "20010101", "close": "1"},
{"date": "20010102", "close": "2"},
{"date": "20010103", "close": "3"}
],
"format": {
"parse": {
"date": "date:'%Y%m%d'"
@domoritz
domoritz / .block
Last active August 29, 2023 12:24
Vega-Lite Bl.ocks example
license: bsd-3-clause
@domoritz
domoritz / europe_world_bank.csv
Last active April 29, 2017 06:16
Population data for Europe for 2015 from the world bank
Code Country Population_ages_15_64_of_total Population_ages_65_and_above_of_total
ALB Albania 69.0574620108062 12.3963338706153
ARM Armenia 70.7901217876325 10.8259833940416
AUT Austria 67.0332301646914 18.7591300503032
AZE Azerbaijan 72.4553638068118 5.62608981288436
BLR Belarus 69.9508710458679 13.9809217228707
BEL Belgium 64.8307418795963 18.2248164293518
BIH Bosnia and Herzegovina 71.0579632250127 15.4439567753232
BGR Bulgaria 65.8285064995643 20.0274777416446
CHI Channel Islands 68.022872223444 17.2684065195611
@domoritz
domoritz / .block
Last active August 1, 2023 13:43
Vega Bl.ocks example
license: bsd-3-clause