Skip to content

Instantly share code, notes, and snippets.

View timelyportfolio's full-sized avatar

timelyportfolio timelyportfolio

View GitHub Profile
@timelyportfolio
timelyportfolio / README.md
Last active April 1, 2024 12:45 — forked from mbostock/.block
demo programmatic control of a d3 brush

Programmatically Control a d3 brush

Forked from Mike Bostock's focus+context zoom gist to demonstrate how we can drive a d3 brush with code.

anybody know how to brush with code in #d3js?

— klr (@timelyportfolio) September 10, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

So I found this discussion, but I could not find an example demonstrating the steps proposed by Athan Reines.

For auto-redraw such that the focus of a 1D brush matches the graphed domain, you need to do as follows:
@timelyportfolio
timelyportfolio / example.Rmd
Last active February 5, 2024 19:34
summary widget with flexdashboard valueBox
---
title: "Example of filtered values boxes"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
mathjax: null
---
```{r setup, include=FALSE}
@timelyportfolio
timelyportfolio / BarChart.js
Last active September 30, 2023 02:44
dexvis map experiment
BarChart.prototype = new DexComponent();
BarChart.constructor = BarChart;
function BarChart(userConfig)
{
DexComponent.call(this, userConfig,
{
parent : null,
labels : [ "X", "Y" ],
id : "BarChart",
@timelyportfolio
timelyportfolio / Readme.md
Last active August 15, 2023 16:10
R ( igraph + DiagrammeR + pipeR +htmltools ) + JS ( mermaid.js + d3.js + dagre-d3.js )

This is an example how we might integrate the R package igraph with the new DiagrammeR which uses htmlwidgets to allow us access to the very popular new Javascript library mermaid.js.

code

@timelyportfolio
timelyportfolio / Readme.md
Created July 6, 2018 01:41
dygraphs point fun

supplement to Stack Overflow

Code

library(dygraphs)
library(scales)

lungDeaths <- xts::as.xts(cbind(mdeaths, fdeaths))
@timelyportfolio
timelyportfolio / Readme.md
Last active February 19, 2023 23:01
3d yield curve with Plotly in R

Nowhere near as spectacular as the Upshot/New York Times 3d yield curve by Amanda Cox and Gregor Aisch, but not bad at all for a couple of lines of R code with the plotly htmlwidget.

library(plotly)
library(dplyr)
library(tidyr)
library(purrr)
library(quantmod)
library(magrittr)
@timelyportfolio
timelyportfolio / Readme.md
Last active September 27, 2022 13:04
vega-lite changing bar size and spacing
@timelyportfolio
timelyportfolio / Readme.md
Last active September 12, 2022 18:26
experiment with vega formula transform and new zip functionality

Vega Experiments with Stats and Formula Transform and New Zip

Using the barley.json example from the vega package, I wanted to try to add plots with x as

  1. Yield Difference From Site Mean
  2. Yield Difference From Aggregate Mean

Please do not replicate, since I'm guessing I'm performing this ugly hack instead of the more elegant preferred method that I have overlooked. New projects are like puzzles, and I'm still a long way from completing this one.

@timelyportfolio
timelyportfolio / README.md
Created April 19, 2016 18:11 — forked from jcheng5/README.md
Using arbitrary Leaflet plugins with Leaflet for R

Using arbitrary Leaflet JS plugins with Leaflet for R

The Leaflet JS mapping library has lots of plugins available. The Leaflet package for R provides direct support for some, but far from all, of these plugins, by providing R functions for invoking the plugins.

If you as an R user find yourself wanting to use a Leaflet plugin that isn't directly supported in the R package, you can use the technique shown here to load the plugin yourself and invoke it using JS code.

@timelyportfolio
timelyportfolio / README.md
Last active July 11, 2022 06:14
d3 hierarchies in R

Built with blockbuilder.org

It seems that working with d3.js hierarchies in R causes much consternation. Here is a quick little demonstration of working with the flare.json hierarchy often used in d3, processing, and Protovis. data.tree eases the pain considerably. I also include the purrr code for those interested in this library and/or some hierarchy recursion in R.

loading the data

# work through d3 hierarchies in R
#  using data.tree and dplyr
#  on the commmonly used flare.json