Skip to content

Instantly share code, notes, and snippets.


James Curley jalapic

View GitHub Profile
yannabraham / beanplots.R
Created Jul 16, 2012
ggplot2 BeanPlots
View beanplots.R
## reproduce the figures from using ggplot2
## parameters
## Figure 1
d <- rnorm(50)
nowherenearithaca /
Last active Apr 11, 2016
Making a Heat Map Legend with D3 - a Simple Example

This is an example of creating what could be a legend for a heat map, demonstrating the simple use of a data-driven linear gradient with D3.

bhoung / trueskill_ex2.r
Last active Sep 30, 2021
Example 2. Running trueskill algorithm on a tennis tournament.
View trueskill_ex2.r
# This second example runs Trueskill on a tennis tournament, the Australian Open.
# Note that actual computation is commented out as it takes about ~40 seconds to
# update skill ratings over 127 matches.
# Data format of ausopen2012 is: Player, Opponent, Margin, Round, WRank, LRank
# create match_id in order to reshape
abresler / tufte
Last active Jul 19, 2020
Recreating Edward Tufte's New York City Weather Visualization
View tufte
"" %>%
read.table() %>% data.frame %>% tbl_df -> data
names(data) <- c("month", "day", "year", "temp")
data %>%
group_by(year, month) %>%
abresler / gist:6911f5eb5d3834fc6d55
Last active Aug 29, 2015
View gist:6911f5eb5d3834fc6d55
<ul class="ze_imagelist" style="width:925px;height:400px;" id="slideshowpj_widget_54da647bbdf7e"><li class="ze_thumb ze_type_image ze_item_number_1"><a class="ze_box" rel="prettyPhoto[pj_widget_54da647bbdf7e]" href=";res=76&amp;cdn=ec&amp;p=y&amp;pid=231720&amp;ph3=b2d1timslim1sat2p2lxtiganpc1chim&amp;d=AMWAjFwULOAANQJsAMnyJRB&amp;as=mp3" title="Salted Caramel - Our Signature Cookie<br />Our Signature Cookie! Caramel-infused dough loaded with Chocolate Chips and drizzled with Salted Caramel Sauce" style="width:190px;height:190px;"> <div class="ze_overlay"></div> <div id="pj_widget_54da647bbdf7e_0_thumbsplash" class="ze_item" style="width:190px;height:190px;"> <img class="ze_postar" style="height:190px;" src=";res=76&amp;cdn=ec&amp;p=y&amp;pid=231720&amp;ph3=b2d1timslim1sat2p2lxtiganpc1chim&amp;d=AMWAjFwULOAANQJsAMnyJRB" t
1wheel / index.html
Last active Oct 31, 2016
Stacked Bump Chart
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
margin: 0px;
font: 10px sans-serif;
hrbrmstr / viridis_scales.R
Created Jul 19, 2015
viridis color/fill scales for ggplot2
View viridis_scales.R
viridis_pal <- function(alpha=1) {
function(n) {
viridis(n, alpha)
scale_color_viridis <- function(..., alpha=1, discrete=TRUE) {
if (discrete) {
discrete_scale("colour", "viridis", viridis_pal(alpha), ...)
abresler / plot_player_shot_chart.r
Last active Apr 24, 2018
R function to auto generate heat map shot charts, need help completing court drawing then to complete
View plot_player_shot_chart.r
#' NBA Player Shot Chart
#' @param player name the player, must be exact
#' @param author, year_end_season: numeric end of season
#' @return
#' @export
#' @examples boggie_bog <- plot_player_shot_chart(player = "Bojan Bogdanovic",
#year_season_end = 2015, exclude_backcourt = T
timelyportfolio /
Last active Aug 29, 2015 — forked from jalapic/gana.csv
Heatmap of touches (in rbokeh)

@jalapic did these really nice set of touch heatmap charts. On Twitter, there was a discussion how to do this interactively with d3.js or some other JavaScript. I definitely have some ideas how to accomplish this, but for now let's see how we can kind of do it in rbokeh. There is just a small issue with palette selection in Bokeh that does not let us allow a no color that prevents us from getting really close.


gana <- read.csv("")

figure() %>%
slowkow / plot_repel.R
Last active May 2, 2018
Repel text labels away from each other in a ggplot2 figure.
View plot_repel.R
# You'll have to play with repulsion, cex.x, and cex.y to get satisfactory results.
plot_text <- function(x, y, label, repulsion = 1, cex.x = 110, cex.y = 40) {
dat <- data.frame(xpos = x, ypos = y, label = label)
dat$label <- as.character(dat$label)
# Use the FField package to repel the text labels away from each other.
dat <- cbind(