Skip to content

Instantly share code, notes, and snippets.

View mbramson's full-sized avatar

Mathew Bramson mbramson

  • CoverMyMeds
  • Cleveland, OH
View GitHub Profile
@tomhopper
tomhopper / ggplot2_axis_ranges.R
Last active October 2, 2020 10:36
Get the actual x- and y-axis ranges from a ggplot object. Works on ggplot2 >= 0.8.9 (tested on 0.9.3.1). Code from http://stackoverflow.com/questions/7705345/how-can-i-extract-plot-axes-ranges-for-a-ggplot2-object
library(ggplot2)
#' create a data frame with test data.
my.df <- data.frame(index = 1:10, value = rnorm(10))
#' create the ggplot object
my.ggp <- ggplot(data = my.df, aes(x = index, y = value)) + geom_point() + geom_line()
#' get the x- and y-axis ranges actually used in the graph
# This worked in early versions of ggplot2 (probably <2.2)
@akfish
akfish / pre-commit.sh
Last active September 8, 2022 07:21
Run MSBuild and MSTest for C# project from git pre-commit hook
#!/bin/sh
# Helper
safeRunCommand() {
typeset cmd="$*"
typeset ret_code
echo cmd=$cmd
eval $cmd
ret_code=$?