Giter VIP home page Giter VIP logo

ggalt's Introduction

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Travis-CI Build Status AppVeyor Build Status CRAN_Status_Badge downloads

ggalt : Extra Coordinate Systems, Geoms, Statistical Transformations, Scales & Fonts for ‘ggplot2’

A compendium of ‘geoms’, ‘coords’, ‘stats’, scales and fonts for ‘ggplot2’, including splines, 1d and 2d densities, univariate average shifted histograms, a new map coordinate system based on the ‘PROJ.4’-library and the ‘StateFace’ open source font ‘ProPublica’.

The following functions are implemented:

  • geom_ubar : Uniform width bar charts

  • geom_horizon : Horizon charts (modified from https://github.com/AtherEnergy/ggTimeSeries)

  • coord_proj : Like coord_map, only better (prbly shld use this with geom_cartogram as geom_map’s new defaults are ugh)

  • geom_xspline : Connect control points/observations with an X-spline

  • stat_xspline : Connect control points/observations with an X-spline

  • geom_bkde : Display a smooth density estimate (uses KernSmooth::bkde)

  • geom_stateface: Use ProPublica’s StateFace font in ggplot2 plots

  • geom_bkde2d : Contours from a 2d density estimate. (uses KernSmooth::bkde2D)

  • stat_bkde : Display a smooth density estimate (uses KernSmooth::bkde)

  • stat_bkde2d : Contours from a 2d density estimate. (uses KernSmooth::bkde2D)

  • stat_ash : Compute and display a univariate averaged shifted histogram (polynomial kernel) (uses ash::ash1/ash::bin1)

  • geom_encircle: Automatically enclose points in a polygon

  • byte_format: + helpers. e.g. turn 10000 into 10 Kb

  • geom_lollipop(): Dead easy lollipops (horizontal or vertical)

  • geom_dumbbell() : Dead easy dumbbell plots

  • stat_stepribbon() : Step ribbons

  • annotation_ticks() : Add minor ticks to identity, exp(1) and exp(10) axis scales independently of each other.

  • geom_spikelines() : Instead of geom_vline and geom_hline a pair of segments that originate from same c(x,y) are drawn to the respective axes.

  • plotly integration for a few of the ^^ geoms

Installation

# you'll want to see the vignettes, trust me
install.packages("ggplot2")
install.packages("ggalt")
# OR: devtools::install_github("hrbrmstr/ggalt")

Usage

library(ggplot2)
library(gridExtra)
library(ggalt)

# current verison
packageVersion("ggalt")
## [1] '0.6.1'

set.seed(1492)
dat <- data.frame(x=c(1:10, 1:10, 1:10),
                  y=c(sample(15:30, 10), 2*sample(15:30, 10), 3*sample(15:30, 10)),
                  group=factor(c(rep(1, 10), rep(2, 10), rep(3, 10)))
)

Horzon Chart

Example carved from: https://github.com/halhen/viz-pub/blob/master/sports-time-of-day/2_gen_chart.R

library(hrbrthemes)
library(ggalt)
library(tidyverse)

sports <- read_tsv("https://github.com/halhen/viz-pub/raw/master/sports-time-of-day/activity.tsv")

sports %>%
  group_by(activity) %>% 
  filter(max(p) > 3e-04, 
         !grepl('n\\.e\\.c', activity)) %>% 
  arrange(time) %>%
  mutate(p_peak = p / max(p), 
         p_smooth = (lag(p_peak) + p_peak + lead(p_peak)) / 3,
         p_smooth = coalesce(p_smooth, p_peak)) %>% 
  ungroup() %>%
  do({ 
    rbind(.,
          filter(., time == 0) %>%
            mutate(time = 24*60))
  }) %>%
  mutate(time = ifelse(time < 3 * 60, time + 24 * 60, time)) %>%
  mutate(activity = reorder(activity, p_peak, FUN=which.max)) %>% 
  arrange(activity) %>%
  mutate(activity.f = reorder(as.character(activity), desc(activity))) -> sports

sports <- mutate(sports, time2 = time/60)

ggplot(sports, aes(time2, p_smooth)) +
  geom_horizon(bandwidth=0.1) +
  facet_grid(activity.f~.) +
  scale_x_continuous(expand=c(0,0), breaks=seq(from = 3, to = 27, by = 3), labels = function(x) {sprintf("%02d:00", as.integer(x %% 24))}) +
  viridis::scale_fill_viridis(name = "Activity relative to peak", discrete=TRUE,
                              labels=scales::percent(seq(0, 1, 0.1)+0.1)) +
  labs(x=NULL, y=NULL, title="Peak time of day for sports and leisure",
       subtitle="Number of participants throughout the day compared to peak popularity.\nNote the morning-and-evening everyday workouts, the midday hobbies,\nand the evenings/late nights out.") +
  theme_ipsum_rc(grid="") +
  theme(panel.spacing.y=unit(-0.05, "lines")) +
  theme(strip.text.y = element_text(hjust=0, angle=360)) +
  theme(axis.text.y=element_blank())

Splines!

ggplot(dat, aes(x, y, group=group, color=group)) +
  geom_point() +
  geom_line()

ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point() +
  geom_line() +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(size=0.5)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=-0.4, size=0.5)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=0.4, size=0.5)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=1, size=0.5)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=0, size=0.5)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=-1, size=0.5)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Alternate (better) density plots

# bkde

data(geyser, package="MASS")

ggplot(geyser, aes(x=duration)) + 
  stat_bkde(alpha=1/2)
## Bandwidth not specified. Using '0.14', via KernSmooth::dpik.

ggplot(geyser, aes(x=duration)) +
  geom_bkde(alpha=1/2)
## Bandwidth not specified. Using '0.14', via KernSmooth::dpik.

ggplot(geyser, aes(x=duration)) + 
  stat_bkde(bandwidth=0.25)

ggplot(geyser, aes(x=duration)) +
  geom_bkde(bandwidth=0.25)

set.seed(1492)
dat <- data.frame(cond = factor(rep(c("A","B"), each=200)), 
                   rating = c(rnorm(200),rnorm(200, mean=.8)))

ggplot(dat, aes(x=rating, color=cond)) + geom_bkde(fill="#00000000")
## Bandwidth not specified. Using '0.36', via KernSmooth::dpik.
## Bandwidth not specified. Using '0.31', via KernSmooth::dpik.

ggplot(dat, aes(x=rating, fill=cond)) + geom_bkde(alpha=0.3)
## Bandwidth not specified. Using '0.36', via KernSmooth::dpik.
## Bandwidth not specified. Using '0.31', via KernSmooth::dpik.

# ash

set.seed(1492)
dat <- data.frame(x=rnorm(100))
grid.arrange(ggplot(dat, aes(x)) + stat_ash(),
             ggplot(dat, aes(x)) + stat_bkde(),
             ggplot(dat, aes(x)) + stat_density(),
             nrow=3)
## Estimate nonzero outside interval ab.
## Bandwidth not specified. Using '0.43', via KernSmooth::dpik.

cols <- RColorBrewer::brewer.pal(3, "Dark2")
ggplot(dat, aes(x)) + 
  stat_ash(alpha=1/3, fill=cols[3]) + 
  stat_bkde(alpha=1/3, fill=cols[2]) + 
  stat_density(alpha=1/3, fill=cols[1]) + 
  geom_rug() +
  labs(x=NULL, y="density/estimate") +
  scale_x_continuous(expand=c(0,0)) +
  theme_bw() +
  theme(panel.grid=element_blank()) +
  theme(panel.border=element_blank())
## Estimate nonzero outside interval ab.
## Bandwidth not specified. Using '0.43', via KernSmooth::dpik.

Alternate 2D density plots

m <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
       geom_point() +
       xlim(0.5, 6) +
       ylim(40, 110)

m + geom_bkde2d(bandwidth=c(0.5, 4))

m + stat_bkde2d(bandwidth=c(0.5, 4), aes(fill = ..level..), geom = "polygon")

coord_proj LIVES! (still needs a teensy bit of work)

world <- map_data("world")
## 
## Attaching package: 'maps'
## The following object is masked from 'package:purrr':
## 
##     map
world <- world[world$region != "Antarctica",]

gg <- ggplot()
gg <- gg + geom_cartogram(data=world, map=world,
                    aes(x=long, y=lat, map_id=region))
gg <- gg + coord_proj("+proj=wintri")
gg

ProPublica StateFace

# Run show_stateface() to see the location of the TTF StateFace font
# You need to install it for it to work

set.seed(1492)
dat <- data.frame(state=state.abb,
                  x=sample(100, 50),
                  y=sample(100, 50),
                  col=sample(c("#b2182b", "#2166ac"), 50, replace=TRUE),
                  sz=sample(6:15, 50, replace=TRUE),
                  stringsAsFactors=FALSE)
gg <- ggplot(dat, aes(x=x, y=y))
gg <- gg + geom_stateface(aes(label=state, color=col, size=sz))
gg <- gg + scale_color_identity()
gg <- gg + scale_size_identity()
gg

Encircling points automagically

d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)

gg <- ggplot(d,aes(x,y))
gg <- gg + scale_x_continuous(expand=c(0.5,1))
gg <- gg + scale_y_continuous(expand=c(0.5,1))

gg + geom_encircle(s_shape=1, expand=0) + geom_point()

gg + geom_encircle(s_shape=1, expand=0.1, colour="red") + geom_point()

gg + geom_encircle(s_shape=0.5, expand=0.1, colour="purple") + geom_point()

gg + geom_encircle(data=subset(d, x==1), colour="blue", spread=0.02) +
  geom_point()

gg +geom_encircle(data=subset(d, x==2), colour="cyan", spread=0.04) + 
  geom_point()

gg <- ggplot(mpg, aes(displ, hwy))
gg + geom_encircle(data=subset(mpg, hwy>40)) + geom_point()

ss <- subset(mpg,hwy>31 & displ<2)

gg + geom_encircle(data=ss, colour="blue", s_shape=0.9, expand=0.07) +
  geom_point() + geom_point(data=ss, colour="blue")

Step ribbons

x <- 1:10
df <- data.frame(x=x, y=x+10, ymin=x+7, ymax=x+12)

gg <- ggplot(df, aes(x, y))
gg <- gg + geom_ribbon(aes(ymin=ymin, ymax=ymax),
                      stat="stepribbon", fill="#b2b2b2")
gg <- gg + geom_step(color="#2b2b2b")
gg

gg <- ggplot(df, aes(x, y))
gg <- gg + geom_ribbon(aes(ymin=ymin, ymax=ymax),
                      stat="stepribbon", fill="#b2b2b2",
                      direction="vh")
gg <- gg + geom_step(color="#2b2b2b")
gg

Lollipop charts

df <- read.csv(text="category,pct
Other,0.09
South Asian/South Asian Americans,0.12
Interngenerational/Generational,0.21
S Asian/Asian Americans,0.25
Muslim Observance,0.29
Africa/Pan Africa/African Americans,0.34
Gender Equity,0.34
Disability Advocacy,0.49
European/European Americans,0.52
Veteran,0.54
Pacific Islander/Pacific Islander Americans,0.59
Non-Traditional Students,0.61
Religious Equity,0.64
Caribbean/Caribbean Americans,0.67
Latino/Latina,0.69
Middle Eastern Heritages and Traditions,0.73
Trans-racial Adoptee/Parent,0.76
LBGTQ/Ally,0.79
Mixed Race,0.80
Jewish Heritage/Observance,0.85
International Students,0.87", stringsAsFactors=FALSE, sep=",", header=TRUE)
 
library(ggplot2)
library(ggalt)
library(scales)
## 
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
## 
##     discard
## The following object is masked from 'package:readr':
## 
##     col_factor
 
gg <- ggplot(df, aes(y=reorder(category, pct), x=pct))
gg <- gg + geom_lollipop(point.colour="steelblue", point.size=2, horizontal=TRUE)
gg <- gg + scale_x_continuous(expand=c(0,0), labels=percent,
                              breaks=seq(0, 1, by=0.2), limits=c(0, 1))
gg <- gg + labs(x=NULL, y=NULL, 
                title="SUNY Cortland Multicultural Alumni survey results",
                subtitle="Ranked by race, ethnicity, home land and orientation\namong the top areas of concern",
                caption="Data from http://stephanieevergreen.com/lollipop/")
gg <- gg + theme_minimal(base_family="Arial Narrow")
gg <- gg + theme(panel.grid.major.y=element_blank())
gg <- gg + theme(panel.grid.minor=element_blank())
gg <- gg + theme(axis.line.y=element_line(color="#2b2b2b", size=0.15))
gg <- gg + theme(axis.text.y=element_text(margin=margin(r=0, l=0)))
gg <- gg + theme(plot.margin=unit(rep(30, 4), "pt"))
gg <- gg + theme(plot.title=element_text(face="bold"))
gg <- gg + theme(plot.subtitle=element_text(margin=margin(b=10)))
gg <- gg + theme(plot.caption=element_text(size=8, margin=margin(t=10)))
gg

library(dplyr)
library(tidyr)
library(scales)
library(ggplot2)
library(ggalt) # devtools::install_github("hrbrmstr/ggalt")

health <- read.csv("https://rud.is/dl/zhealth.csv", stringsAsFactors=FALSE, 
                   header=FALSE, col.names=c("pct", "area_id"))

areas <- read.csv("https://rud.is/dl/zarea_trans.csv", stringsAsFactors=FALSE, header=TRUE)

health %>% 
  mutate(area_id=trunc(area_id)) %>% 
  arrange(area_id, pct) %>% 
  mutate(year=rep(c("2014", "2013"), 26),
         pct=pct/100) %>% 
  left_join(areas, "area_id") %>% 
  mutate(area_name=factor(area_name, levels=unique(area_name))) -> health

setNames(bind_cols(filter(health, year==2014), filter(health, year==2013))[,c(4,1,5)],
         c("area_name", "pct_2014", "pct_2013")) -> health

gg <- ggplot(health, aes(x=pct_2014, xend=pct_2013, y=area_name, group=area_name))
gg <- gg + geom_dumbbell(colour="#a3c4dc", size=1.5, colour_xend="#0e668b", 
                         dot_guide=TRUE, dot_guide_size=0.15)
gg <- gg + scale_x_continuous(label=percent)
gg <- gg + labs(x=NULL, y=NULL)
gg <- gg + theme_bw()
gg <- gg + theme(plot.background=element_rect(fill="#f7f7f7"))
gg <- gg + theme(panel.background=element_rect(fill="#f7f7f7"))
gg <- gg + theme(panel.grid.minor=element_blank())
gg <- gg + theme(panel.grid.major.y=element_blank())
gg <- gg + theme(panel.grid.major.x=element_line())
gg <- gg + theme(axis.ticks=element_blank())
gg <- gg + theme(legend.position="top")
gg <- gg + theme(panel.border=element_blank())
gg

library(hrbrthemes)

df <- data.frame(trt=LETTERS[1:5], l=c(20, 40, 10, 30, 50), r=c(70, 50, 30, 60, 80))

ggplot(df, aes(y=trt, x=l, xend=r)) + 
  geom_dumbbell(size=3, color="#e3e2e1", 
                colour_x = "#5b8124", colour_xend = "#bad744",
                dot_guide=TRUE, dot_guide_size=0.25) +
  labs(x=NULL, y=NULL, title="ggplot2 geom_dumbbell with dot guide") +
  theme_ipsum_rc(grid="X") +
  theme(panel.grid.major.x=element_line(size=0.05))

p <- ggplot(msleep, aes(bodywt, brainwt)) + geom_point()

# add identity scale minor ticks on y axis
p + annotation_ticks(sides = 'l')
## Warning: Removed 27 rows containing missing values (geom_point).

# add identity scale minor ticks on x,y axis
p + annotation_ticks(sides = 'lb')
## Warning: Removed 27 rows containing missing values (geom_point).

# log10 scale
p1 <- p + scale_x_log10()

# add minor ticks on both scales
p1 + annotation_ticks(sides = 'lb', scale = c('identity','log10'))
## Warning: Removed 27 rows containing missing values (geom_point).

mtcars$name <- rownames(mtcars)

p <- ggplot(data = mtcars, aes(x=mpg,y=disp)) + geom_point()

p + 
  geom_spikelines(data = mtcars[mtcars$carb==4,],aes(colour = factor(gear)), linetype = 2) + 
  ggrepel::geom_label_repel(data = mtcars[mtcars$carb==4,],aes(label = name))

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

ggalt's People

Contributors

bbolker avatar benmarwick avatar cpsievert avatar hcrat avatar hrbrmstr avatar jankatins avatar jjchern avatar jonocarroll avatar larmarange avatar pkq avatar rplzzz avatar yonicd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ggalt's Issues

Some projections don't show polygons spaning all longitudes

Don't know if this is an issue of ggalt or a more fundamental problem with coordinate transformations, but using coord_proj(), some projections make large polygons disappear.

library(ggplot2)
world <- map_data("world")
world <- subset(world, lat < 0)
geom_world <- geom_path(aes(long, lat, group = group), data = world, 
                        color = "gray50", size = 0.2)

This square that covers the whole domain works well with no coord

square <- data.frame(lon = c(-180, -180, 180, 180), 
                     lat = c(-90, 0, 0, -90))

(ggplot(square, aes(lon, lat)) +
      geom_world +
   geom_polygon() -> g)

or with coord_polar()

g + coord_polar()

But in coord_proj() it doesn't show up.

g + ggalt::coord_proj("+proj=stere +lat_0=-90")

This also affects ggplot2's coord_map(), so it might be a more fundamental problem? Changing the limits works, but it appears as a low resolution polygon.

square <- data.frame(lon = c(-180, -180, 170, 170), 
                        lat = c(-80, -10, -10, -80))
   
(g <- g %+% square + ggalt::coord_proj("+proj=stere +lat_0=-90"))

which is actually lower resolution if the limits are increased.

While this seems like a nitche problem, it's actually a very big issue when plotting filled contours because (at least in my implementation) there's always a square that acts as "background" so that every part of the map is filled. Here's an example:

library(metR)  # for dataset and geom_contour_fill()
temperature$lon <- with(temperature, ConvertLongitude(lon))
ggplot(subset(temperature, lev == 200 & lat < 0), aes(lon, lat)) +
   geom_contour_fill(aes(z = air), circular = "x") +
   ggalt::coord_proj("+proj=stere +lat_0=-90")

For refference, here's how it should look :)

ggplot(subset(temperature, lev == 200 & lat < 0), aes(lon, lat)) +
   geom_contour_fill(aes(z = air), circular = "x") +
   coord_polar()

geom_dumbbell with scales for line and dots

I'm trying to make a dumbbell chart with additional information about change (green/red) and significance of the change (vol) and add an additional legend for the dots at the end of the dumbbells.

Example plot:

library(ggalt)

# build data set
set.seed(1)

df <- data.frame(country=paste("Region", LETTERS[1:10]))
df$last_year <- runif(nrow(df))
df$this_year <- runif(nrow(df))
df$ydiff <- df$this_year - df$last_year
df$vol <- runif(nrow(df))


# create dumbbell plot
ggplot(df, aes(y=country, group=country)) + 
  geom_dumbbell(aes(x=last_year, xend=this_year, colour = ydiff, size=vol),
                colour_x = "blue",
                colour_xend = "yellow") +
  scale_color_gradient2(low="green", high="red") 

Now, I'd like to add a legend about what the yellow and blue dots are, but I cannot add two color scales, since I already use the gradient2 scale for the bar between the dots. Ideally, I would have a manual fill scale as an additional option to customize the plot (but then I might need long and wide data at the same time). Can you help me?

Dashed Spline

I have just started using geom_xsplines, I like it very much. However, I could not find a way to change the spline from solid to dashed or dotted (as in linetype in geomline). Is there a way around this, or really one should just stick to geom_smooth?

Need an xspline equivalent of geom_path

It seems that geom_xspline is only suitable for use in place of geom_line. Attempting to use it in place of geom_path produces broken results. For example:

mydata <- data.frame(x=c(0,1,0), y=0:2)
ggplot(mydata) + aes(x,y) + geom_path()
ggplot(mydata) + aes(x,y) + geom_xspline()

proj4 error (probably the coord munching around curvature)

Sorry to post this without a solution, but I have to leave it for now.

I get an error from proj4::project for (seemingly) identical inputs when used in coord_proj(), but not directly.

It's likely to do with the coord_munching which I haven't explored yet - these polygons are both stretched around the edges of the laea map with these parameters, and that would likely be true for different polygons and projection combos. (It might be true for the old mapproj idioms for ggplot, but I never learnt to use them).

I don't know if this is a munching problem for ggalt or ggplot2, but either way I'm happy to help. A general "topojson"-like solution would be good in R, etc. etc.

Preparation.

library(dplyr)

library(maptools)
data(wrld_simpl)
library(ggalt)
## either 24 or 175 triggers the problem, everything else is fine
ff <- fortify(wrld_simpl[24, ])
proj <- "+proj=laea +lat_0=-90 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
  1. Ggplot not ok.
ggplot(ff) + aes(x = long, y = lat, group = group) + geom_polygon() + 
  coord_proj(proj, inverse = FALSE, degrees = TRUE, 
             ellps.default = NA)
Error in proj4::project(list(x = df$x, y = df$y), proj = coord$proj, inverse = coord$inverse,  : 
                          tolerance condition error
  1. Cannot recreate error with direct call
df <- ff %>% mutate(x = long, y = lat)

## this shouldn't affect, seems not to
df$x <- ifelse(df$x <= -180, -179.99999999999, df$x)
df$x <- ifelse(df$x >= 180, 179.99999999999, df$x)
df$y <- ifelse(df$y <= -90, -89.99999999999, df$y)
df$y <- ifelse(df$y >= 90, 89.99999999999, df$y)

plot(proj4::project(list(x=df$long, y=df$lat),
                    proj = proj,
                    inverse = FALSE,
                    degrees  = TRUE, 
                    ellps.default = NA), pch = ".", asp = 1)
## how I found the offending objects 24 and 175
# for (i in seq_along(wrld_simpl$NAME)) {
# ff <- fortify(subset(wrld_simpl, NAME == wrld_simpl$NAME[i]))
# proj <- "+proj=laea +lat_0=-90 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
# 
# ## 
# print(
# ggplot(ff) + aes(x = long, y = lat, group = group) + geom_polygon() + 
#   coord_proj(proj, inverse = FALSE, degrees = TRUE, 
#              ellps.default = NA)
# )
# }

annotate_textp - no documentation of facets input

Hi,
The annotate_textp function is awesome! Thanks for building it. I've been looking for something like this for quite a while. However, I'm having trouble implementing the function with different labels across facets. It seems like this functionality is possible via the "facets" argument, but I can't figure out what to pass to this argument, and there is no documentation on it or examples using it. Could you add an example to the documentation and describe in the input section what the facets argument takes?

Add position argument to geom_dumbbell()

Hi Bob,

do you think it would be possible to add a "position" argument to geom_dumbbell() for comparing development between groups?

Thanks for a great package!

S

coord_proj xlim/ylim error

Thanks for the package, I love coord_proj(); however, I get Error: could not find function "scale_transform when trying to use the xlim and ylim parameters.

world <- map_data("world")
world <- world[world$region != "Antarctica",]
ggplot() + 
  geom_map(data=world, map=world, aes(x=long, y=lat, map_id=region)) +
  coord_proj("+proj=wintri", ylim = c(-60, 60))

Output of devtools::session_info():

Session info -----------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.3 (2015-12-10)
 system   x86_64, darwin13.4.0        
 ui       RStudio (0.99.825)          
 language (EN)                        
 collate  en_CA.UTF-8                 
 tz       America/Vancouver           
 date     2016-01-15                  

Packages ---------------------------------------------------------------------------------------
 package      * version    date       source                            
 ash            1.0-15     2015-09-01 CRAN (R 3.2.0)                    
 assertthat     0.1        2013-12-06 CRAN (R 3.2.0)                    
 colorspace     1.2-6      2015-03-11 CRAN (R 3.2.0)                    
 DBI            0.3.1      2014-09-24 CRAN (R 3.2.0)                    
 devtools     * 1.9.1      2015-09-11 CRAN (R 3.2.0)                    
 digest         0.6.8      2014-12-31 CRAN (R 3.2.0)                    
 dplyr          0.4.3      2015-09-01 CRAN (R 3.2.0)                    
 ggalt        * 0.1.1.9000 2016-01-02 Github (hrbrmstr/ggalt@6c1b2fa)   
 ggplot2      * 2.0.0.9001 2016-01-16 Github (hadley/ggplot2@c01e626)   
 gtable         0.1.2      2012-12-05 CRAN (R 3.2.0)                    
 KernSmooth     2.23-15    2015-06-29 CRAN (R 3.2.3)                    
 knitr        * 1.11       2015-08-14 CRAN (R 3.2.2)                    
 magrittr     * 1.5        2014-11-22 CRAN (R 3.2.0)                    
 maps         * 3.0.0-2    2015-10-02 CRAN (R 3.2.0)                    
 MASS           7.3-45     2015-11-10 CRAN (R 3.2.3)                    
 memoise        0.2.1      2014-04-22 CRAN (R 3.2.0)                    
 munsell        0.4.2      2013-07-11 CRAN (R 3.2.0)                    
 plyr           1.8.3      2015-06-12 CRAN (R 3.2.0)                    
 proj4          1.0-8      2012-08-05 CRAN (R 3.2.0)                    
 R6             2.1.1      2015-08-19 CRAN (R 3.2.0)                    
 RColorBrewer   1.1-2      2014-12-07 CRAN (R 3.2.0)                    
 Rcpp           0.12.2     2015-11-15 CRAN (R 3.2.2)                    
 rsconnect      0.4.1.11   2016-01-07 Github (rstudio/rsconnect@3034ab8)
 rstudioapi     0.3.1      2015-04-07 CRAN (R 3.2.0)                    
 scales         0.3.0      2015-08-25 CRAN (R 3.2.0)       

Question about spline implementation

I have a question. I get some data like so. It's polling data information from all the public polling going on. I want to be able to plot a smoothed spline of the data. One feature of the data is that there are sometimes multiple observations at each point. In smooth.spline this is dealt with by the cv=FALSE option.

require(pollstR)
require(ggplot2)
require(magrittr)
require(gridExtra)
require(ggalt)

tmp=pollstr_polls(max_pages = 10000, chart = '2016-national-gop-primary', after = "2015-3-1")
tmp$questions=tmp$questions[tmp$questions$topic=='2016-president-gop-primary',]

tmp1=merge(tmp$polls, tmp$questions, by='id')

tmp1$interviewer="No Interviewer"
tmp1$interviewer[tmp1$method %in% c('Live Phone','IVR/Live Phone')]="Interviewer"

I then wanted to plot the spline using your package:

tmp1[tmp1$choice %in% c('Trump') ,] %>% 
  ggplot(aes(start_date,value)) + 
  geom_point(aes(size=observations, colour=interviewer), alpha=.5) +
  geom_xspline(aes(colour=interviewer, weight=observations)) +
  scale_size(guide=FALSE) +
  scale_colour_brewer("Methodology",palette = "Paired") +
  theme(panel.background =  element_rect(fill = NA, colour = "black", size = 0.25),
        panel.border =      element_blank(),
        panel.grid.major =  element_line(colour = "black", size = 0.05),
        panel.grid.minor =  element_line(colour = "black", size = 0.05),
        plot.title=element_text(size=18, family="Helvetica Neue Light"),
        axis.title.x=element_text(size=14, family="Helvetica Neue Light"),
        axis.text.x=element_text(colour="black", size=14, family="Helvetica Neue Light"),
        axis.title.y=element_text(size=14, family="Helvetica Neue Light"),
        axis.text.y=element_text(colour="black",size=14, family="Helvetica Neue Light"),
        strip.text.x = element_text(size = 14,family="Helvetica Neue Light"),
        strip.text.y = element_text(size = 14,family="Helvetica Neue Light"),
        legend.title = element_text(size=14, family="Helvetica",face="bold"),
        legend.text = element_text(size=14, family="Helvetica Neue Light"),
        strip.background = element_rect(colour = "grey", fill = "white")) +
  xlab("Date") + ylab("%") + ggtitle(paste0("Trump Vote by Whether the Poll Has An Interviewer \n spline"))

If you run that code you get a really funky looking plot. Is there an option for a cv=FALSE type fit where multiple points can be taken in each observation? Should I just jitter the x axis points for it to work?

Thanks for the package. It's great.

plotlines geom

this is pretty trivial, but I'm just putting it here to register/remind myself of it. I've often wished for a combined geom_pointlines() for use cases like

ggplot(...) +
   geom_point(<some complicated arguments>) +
   geom_lines(<the same set of complicated arguments>)

The only questions would be things like:

  • what to do with cases where geom_lines might fail (e.g. different colours apply to different parts of the same line)
  • what if most but not all of the arguments are shared between points and lines?

Neither of these seem to be a very big deal.

package or namespace load failed for ‘ggalt’ in dyn.load

I can't install proj4 using install.packages(), but installing package archive file in RStudio works. I use the same way above to install ggalt, but when I load it the system throws an error as below:

Loading required package: ggplot2
Registered S3 methods overwritten by 'ggplot2':
  method         from 
  [.quosures     rlang
  c.quosures     rlang
  print.quosures rlang
Error: package or namespace load failed for ‘ggalt’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/3.6/site-library/ash/libs/ash.so':
  dlopen(/usr/local/lib/R/3.6/site-library/ash/libs/ash.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/8/libgfortran.5.dylib
  Referenced from: /usr/local/lib/R/3.6/site-library/ash/libs/ash.so
  Reason: image not found
  • R version: 3.6.0_2
  • macOS Mojave version: 10.14.5

I don't know how to solve the error, please help me.

Adding a table to a faceted plot

I had the need for this, maybe you are interested in this (if not please close):

library(grid)
library(gridExtra)
library(gtable)
library(ggplot2)

GeomTable <- ggproto(
  "GeomTable",
  Geom,
  required_aes = c("x", "y",  "table"),
  default_aes = aes(
    widthx = 10,
    widthy = 10,
    rownames = NA
  ),
  draw_key = draw_key_blank,

  draw_panel = function(data, panel_scales, coord) {
    if (nrow(data) != 1) {
      stop(
        sprintf(
          "only one table per panel allowed, got %s (%s)",
          nrow(data),
          as.character(data)
        ),
        call. = FALSE
      )
    }
    wy = data$widthy / 2
    wx = data$widthx / 2

    corners <-
      data.frame(x = c(data$x - wx, data$x + wx),
                 y = c(data$y - wy, data$y + wy))
    d <- coord$transform(corners, panel_scales)

    # gross hack, but I've found no other way to get a table/matrix/dataframe to this point :-(
    table = read.csv(text = data$table, header = TRUE)
    if (!is.na(data$rownames)) {
      rownames(table) <-
        unlist(strsplit(data$rownames, "|", fixed = TRUE))
    }

    x_rng <- range(d$x, na.rm = TRUE)
    y_rng <- range(d$y, na.rm = TRUE)

    vp <-
      viewport(
        x = mean(x_rng),
        y = mean(y_rng),
        width = diff(x_rng),
        height = diff(y_rng),
        just = c("center", "center")
      )

    grob <-
      tableGrob(table, theme = ttheme_minimal())
    # add a line across the header
    grob <- gtable_add_grob(
      grob,
      grobs = segmentsGrob(y1 = unit(0, "npc"),
                           gp = gpar(lwd = 2.0)),
      t = 1,
      b = 1,
      l = 1,
      r = ncol(d) + 1
    )
    editGrob(grob, vp = vp, name = paste(grob$name, facet_id()))
  }
)

facet_id <- local({
  i <- 1
  function() {
    i <<- i + 1
    i
  }
})

geom_table <-
  function(mapping = NULL,
           data = NULL,
           stat = "identity",
           position = "identity",
           na.rm = FALSE,
           show.legend = NA,
           inherit.aes = TRUE,
           ...) {
    layer(
      geom = GeomTable,
      mapping = mapping,
      data = data,
      stat = stat,
      position = position,
      show.legend = show.legend,
      inherit.aes = inherit.aes,
      params = list(na.rm = na.rm, ...)
    )
  }

and then use it like this:

# helper function
to_csv_ <- function(x){paste(capture.output(write.csv(x, stdout(), row.names=F)), collapse="\n")}

# data
data <- data.frame(x=1:20, y=20:1, c = rep(c("a","b"),10))

# this could be the output of a summarize pipe
suma <- to_csv_(data.frame(a=c(1,2), b=c(2,3)))
sumb <- to_csv_(data.frame(a=c(9,9), b=c(9,9)))
dt <- data.frame(c=c("a", "b"), t=c(suma, sumb), stringsAsFactors = FALSE)
#dt

ggplot(data, aes(x, y)) + geom_point() + facet_wrap(~c) + geom_table(data=dt, aes(table=t), x=15, y=15, rownames="mean|sd")

rplot

[I also posted this on stackoverflow: http://stackoverflow.com/a/36022671/1380673, where initialy went for an answer...]

Add position parameter for geom_lollipop?

It would be cool to group geom_lollipops by different aesthetics and position them side-by-side. Right now it ignores position as a parameter, which makes sense—there's not really a way to do position_stack or other positioning algorithms with lollipop plots. However, lollipop plots can be dodged.

This can be done by setting xmin=0 in ggstance::geom_pointrangeh, but it would be nice to have control over the line color and point color and size separately, as in geom_lollipop:

library(tidyverse)
library(ggalt)
library(ggstance)

set.seed(1234)
df <- crossing(trt = LETTERS[1:6],
               grp = LETTERS[7:8]) %>%
  mutate(x = sample(10:90, n()))

ggplot(df, aes(y=trt, x=x, colour=grp)) + 
  geom_lollipop(horizontal=TRUE, position="dodge")
#> Warning: Ignoring unknown parameters: position

ggplot(df, aes(y=trt, x=x, colour=grp)) +
  geom_pointrangeh(aes(xmin=0, xmax=x), position=position_dodgev(height=0.5))

add labeling functions for axes?

Some miscellaneous functionality here for

  • scientific notation with superscripts (i.e. 10^3, 10^4, etc.)
  • latitude/longitude scales

These could be further improved by

  • allowing for a LaTeX (intended for tikzDevice, e.g. $10^2$) vs plotmath output (e.g. parse(text="10^2"));
  • reducing code duplication in lat/long, e.g. generating lat/long scales from a single factory function that determines whether to use E/W or N/S legends
  • could further improve lat/long by allowing it to (optionally) express as degrees/minutes/seconds rather than decimal degrees
  • make a temperature scale function

Does this functionality exist somewhere else in the gg-verse?

add some scale transforms?

I have a 'quiver' of scale transforms I keep at my disposal, and was looking to put them in a package. It makes no sense to have a package just for them, but maybe ggalt would be a good place. For example, 'signed square root':

scl_ssqrt <- scales::trans_new("signed sqrt",
  function(x) sign(x)*sqrt(abs(x)),
  function(y) sign(y)*y^2)

Similarly I have scales for asinh, logit, inverse logit, and so on. Just one-liners! Certainly not worth their own package, but maybe they belong in a 'grab bag' package.

theme_ipsum_rc broken in mac

library(hrbrthemes)
library(ggalt)
library(tidyverse)

sports <- read_tsv("https://github.com/halhen/viz-pub/raw/master/sports-time-of-day/activity.tsv")

sports %>%
  group_by(activity) %>% 
  filter(max(p) > 3e-04, 
         !grepl('n\\.e\\.c', activity)) %>% 
  arrange(time) %>%
  mutate(p_peak = p / max(p), 
         p_smooth = (lag(p_peak) + p_peak + lead(p_peak)) / 3,
         p_smooth = coalesce(p_smooth, p_peak)) %>% 
  ungroup() %>%
  do({ 
    rbind(.,
          filter(., time == 0) %>%
            mutate(time = 24*60))
  }) %>%
  mutate(time = ifelse(time < 3 * 60, time + 24 * 60, time)) %>%
  mutate(activity = reorder(activity, p_peak, FUN=which.max)) %>% 
  arrange(activity) %>%
  mutate(activity.f = reorder(as.character(activity), desc(activity))) -> sports

sports <- mutate(sports, time2 = time/60)

ggplot(sports, aes(time2, p_smooth)) +
  geom_horizon(bandwidth=0.1) +
  facet_grid(activity.f~.) +
  scale_x_continuous(expand=c(0,0), breaks=seq(from = 3, to = 27, by = 3), labels = function(x) {sprintf("%02d:00", as.integer(x %% 24))}) +
  viridis::scale_fill_viridis(name = "Activity relative to peak", discrete=TRUE,
                              labels=scales::percent(seq(0, 1, 0.1)+0.1)) +
  labs(x=NULL, y=NULL, title="Peak time of day for sports and leisure",
       subtitle="Number of participants throughout the day compared to peak popularity.\nNote the morning-and-evening everyday workouts, the midday hobbies,\nand the evenings/late nights out.") +
  theme_ipsum_rc(grid="") +
  theme(panel.spacing.y=unit(-0.05, "lines")) +
  theme(strip.text.y = element_text(hjust=0, angle=360)) +
  theme(axis.text.y=element_blank())

Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  : 
  polygon edge not found
Calls: <Anonymous> ... <Anonymous> -> widthDetails -> widthDetails.text -> grid.Call
In addition: Warning messages:
1: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  no font could be found for family "Roboto Condensed"
2: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  no font could be found for family "Roboto Condensed"

Execution halted
library(hrbrthemes)

df <- data.frame(trt=LETTERS[1:5], l=c(20, 40, 10, 30, 50), r=c(70, 50, 30, 60, 80))

ggplot(df, aes(y=trt, x=l, xend=r)) + 
  geom_dumbbell(size=3, color="#e3e2e1", 
                colour_x = "#5b8124", colour_xend = "#bad744",
                dot_guide=TRUE, dot_guide_size=0.25) +
  labs(x=NULL, y=NULL, title="ggplot2 geom_dumbbell with dot guide") +
  theme_ipsum_rc(grid="X") +
  theme(panel.grid.major.x=element_line(size=0.05))

Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  : 
  polygon edge not found
Calls: <Anonymous> ... <Anonymous> -> heightDetails -> heightDetails.text -> grid.Call
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Execution halted
sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS  10.13

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] bindrcpp_0.2     dplyr_0.7.4      purrr_0.2.4      readr_1.1.1      tidyr_0.7.2      tibble_1.3.4     tidyverse_1.1.1 
 [8] hrbrthemes_0.1.0 ggalt_0.5.0      ggplot2_2.2.1   

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.13       lubridate_1.6.0    lattice_0.20-34    assertthat_0.2.0   rprojroot_1.2      digest_0.6.12     
 [7] proj4_1.0-8        psych_1.7.8        R6_2.2.2           cellranger_1.1.0   plyr_1.8.4         backports_1.1.1   
[13] evaluate_0.10.1    httr_1.3.1         rlang_0.1.4        lazyeval_0.2.1     curl_3.0           readxl_1.0.0      
[19] extrafontdb_1.0    rmarkdown_1.6      labeling_0.3       extrafont_0.17     stringr_1.2.0      foreign_0.8-67    
[25] munsell_0.4.3      hunspell_2.6       rgeolocate_1.0.1   broom_0.4.2        modelr_0.1.1       pkgconfig_2.0.1   
[31] mnormt_1.5-5       htmltools_0.3.6    gridExtra_2.3      viridisLite_0.2.0  MASS_7.3-45        grid_3.3.3        
[37] nlme_3.1-131       jsonlite_1.5       Rttf2pt1_1.3.4     gtable_0.2.0       magrittr_1.5       scales_0.5.0      
[43] KernSmooth_2.23-15 stringi_1.1.5      reshape2_1.4.2     viridis_0.4.0      xml2_1.1.1         ash_1.0-15        
[49] RColorBrewer_1.1-2 tools_3.3.3        forcats_0.2.0      glue_1.2.0         maps_3.2.0         hms_0.3           
[55] parallel_3.3.3     yaml_2.1.14        colorspace_1.3-2   rvest_0.3.2        knitr_1.17         bindr_0.1         
[61] haven_1.1.0       

geom_dumbbell() TODOs

  • arrow parameter (direction)
  • guides? shld the point.colour.* be mapped to guides vs be explicit non-aes params?

coord_proj error

When I try to map using coord_proj, I get the error message:

Error in zero_range(from) : x must be length 1 or 2

Example code:

library(maps)
library(ggalt)
library(ggplot2)

world_map <- map_data("world")
world_map <- subset(world_map, region!="Antarctica")

gg <- ggplot(data = world_map, aes(x = long, y = lat, group = group)) + 
  geom_cartogram(map = world_map, aes(map_id = region))

gg + coord_proj("+proj=robin")

Band ordering in geom_horizon()

Hi! I'm trying to run a toy example with geom_horizon(), influenced by the example in the readme and this FlowingData post. I'm trying to visualize price change for food in Russia in the last 17 years, expressed as percentage of '99 price for each item. Here is a sample of my data for a single item:

> prices %>%
    dplyr::filter(Name == "Капуста") %>%
    select(year, price.change.to.99)
# A tibble: 18 x 2
    year price.change.to.99
   <dbl>              <dbl>
 1  1999          1.0000000
 2  2000          0.9959823
 3  2001          1.0570494
 4  2002          1.4953702
 5  2003          0.9613952
 6  2004          0.9608868
 7  2005          1.1282653
 8  2006          0.9610972
 9  2007          1.4789909
10  2008          0.9536047
11  2009          0.9757401
12  2010          1.9075291
13  2011          0.6759494
14  2012          0.9354862
15  2013          0.9714568
16  2014          1.2883655
17  2015          1.0128819
18  2016          0.7611389

Here is the code I'm using to visualize my data:

ggplot(prices, aes(x = year, y = price.change.to.99 - 1)) +
  geom_horizon(bandwidth = 0.1) +
  facet_grid(Name ~ .) +
  theme_minimal() +
  scale_x_continuous(expand = c(0, 0)) +
  theme(axis.text.y = element_blank(),
        strip.text.y = element_text(hjust = 0, angle = 360)
        ) +
  labs(x = NULL, y = NULL) +
  scale_fill_custom_viridis(discrete = TRUE)

And here is the result this code produces:
plot

scale_fill_custom_viridis() is a modified scale_fill_viridis() that allows to use diverging palette.

The issue I'm struggling with is the mixed order of bands. For instance, in 1999 each item has value of 1, it is displayed as 5th band, but it's ordered as first band, so it gets the most intense red color, which is absolutely counter-intuitive. The issue is well displayed by the way Водка, the first item is visualized. Its price was increasing since ca. 2011, but in the chart it is displayed as colors of the bands getting colored less intense, which is quite the contrary to what actually is going on. Another example is Свинина item: its price values range from 9th to 7th band, but both of them are ordered higher than 8th band, which results in weird band coloring, making the chart for the item unreadable.

The problem persists with the original scale_fill_viridis() as well as with my modification.

I tried to find where the band ordering is defined in the source of geom_horizon(), to tweak it somehow, but I failed at this task, and I have no idea how to proceed from here. I'd be very grateful if you could look into this. Thanks!

Bug in geom_xspline

There is a bug in the implementation of geom_xspline that produce a jittered line.

Looks like the result is rendered similarly to a geom_line rather than a geom_path.

library(ggplot2)
library(ggalt)

d.test = data.frame(GDP = c(675L, 730L, 745L, 780L, 775L), 
                      GINI = c(58.1, 59.5, 61, 63, 60.5))

p <- ggplot(d.test,aes(x=GDP,y=GINI))+geom_xspline()+geom_point(color="red")
p

image

The interpolation halfway 3rd and 4th points start going up and down between
expected line and the 5th (and last) point.

As a comparison the equivalent interpolation line from xspline is correct:

par(mar=c(3,3,1,1))
plot(0,xlim=c(675,780),ylim=c(58,63))
xspline(d.test$GDP,d.test$GINI,shape=-0.25)
xs = xspline(d.test$GDP,d.test$GINI,shape=-0.25,draw=FALSE)

image

As a further check we can superimpose the xspline interpolation on the geom_xspline to see the result:

p + geom_path(aes(x=x,y=y),data=data.frame(xs), color="red", alpha=0.5, size=2)

image

Session information:

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggalt_0.4.0   ggplot2_3.1.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0         Rttf2pt1_1.3.7     rstudioapi_0.9.0   bindr_0.1.1       
 [5] magrittr_1.5       maps_3.3.0         MASS_7.3-51.1      tidyselect_0.2.5  
 [9] munsell_0.5.0      colorspace_1.4-0   R6_2.3.0           rlang_0.3.1       
[13] plyr_1.8.4         dplyr_0.7.8        tools_3.5.1        grid_3.5.1        
[17] gtable_0.2.0       ash_1.0-15         KernSmooth_2.23-15 extrafontdb_1.0   
[21] withr_2.1.2        proj4_1.0-8.1      lazyeval_0.2.1     assertthat_0.2.0  
[25] tibble_2.0.1       crayon_1.3.4       bindrcpp_0.2.2     RColorBrewer_1.1-2
[29] purrr_0.3.0        glue_1.3.0         labeling_0.3       compiler_3.5.1    
[33] pillar_1.3.1       scales_1.0.0       extrafont_0.17     pkgconfig_2.0.2  

geom_xspline only works on properly arranged data frames

This behaviour is not really clear from the documentation. It would help to have this information added.
(or change the underlying Stat to first arrange by x value.)

Example (partly taken from the documentation example:

library(ggplot2)
library(ggalt)

set.seed(1492)
dat <- data.frame(x=c(1:10, 1:10, 1:10),
                  y=c(sample(15:30, 10), 2*sample(15:30, 10),
                      3*sample(15:30, 10)),
                  group=factor(c(rep(1, 10), rep(2, 10), rep(3, 10)))
)

newdat <- dat[1:10,]

ggplot(newdat, aes(x, y)) +
  geom_point(color="black") +
  geom_xspline(size=0.5)

weirddat <- newdat[sample(nrow(newdat)), ]

ggplot(weirddat, aes(x, y)) +
  geom_point(color="black") +
  geom_xspline(size=0.5)

Created on 2021-01-01 by the reprex package (v0.3.0)

dumbbell three X arguments

I'm using geom_dumbbell (really cool btw), to plot 3 values on the x-axis to compare the distances between them. Because it only takes x and x_end args i'm using geom_dumbbell twice, efectively solving my problem. However, since my data changes everytime i run the plot sometimes the line connecting x and x_end of the last plot being created goes over one of the points. Can you see a way around this or another way of plotting 3 values using geom_dumbbell. (example attached)

dumbbell

coord_proj with recentered map

Is there a means or can there be a means of using coord_proj on a map that has been recentered (using maptools, nowrapRecenter)? I often need maps where paths cross the dateline, but where the ability to use coord_proj to set map limits would be very useful. Does coord_proj only work beyond Atlantic-centered maps or shapefiles?

Use ggalt in a package

Hi,

We are working on the development of an R package and we hope to use yours.

In this way, we need to use some of your features using the double colon operator rather than using library command. Indeed, when we used the double colon operator by this way: ggalt::geom_xspline we encountered this kind of error: No stat called StatXspline.

Thanks.

Linetype connecting ends of dumbbell chart - feature request

Hello,

I was wondering if a feature for geom_dumbbell() that would allow the user to select the linetype used to connect the ends of each point has been considered. Or perhaps I am missing something in the documentation. I looked through past issues that may be related to this request but the closest I found was a thread asking for a parameter for arrows/direction.

Thank you!

proj4 error in installation

install.packages("ggalt")

2016-09-05 09:00:49 (473 KB/s) - ‘/tmp/RtmpFo6quQ/downloaded_packages/ggalt_0.1.1.tar.gz’ saved [690266/690266]

* installing *source* package ‘ggalt’ ...
** package ‘ggalt’ successfully unpacked and MD5 sums checked
** R
** preparing package for lazy loading
Error : .onLoad failed in loadNamespace() for 'proj4', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/henk/R/x86_64-pc-linux-gnu-library/3.2/proj4/libs/proj4.so':
  libproj.so.0: cannot open shared object file: No such file or directory
ERROR: lazy loading failed for package ‘ggalt’
* removing ‘/home/henk/R/x86_64-pc-linux-gnu-library/3.2/ggalt’
* restoring previous ‘/home/henk/R/x86_64-pc-linux-gnu-library/3.2/ggalt’
Warning in install.packages :
  installation of package ‘ggalt’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpFo6quQ/downloaded_packages’

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=nl_NL.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=nl_NL.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=nl_NL.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_2.1.0.9000

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.6        assertthat_0.1     MASS_7.3-45        grid_3.2.3         plyr_1.8.4         gtable_0.2.0       scales_0.4.0       KernSmooth_2.23-15 ash_1.0-15         tools_3.2.3        munsell_0.4.3      maps_3.1.0        
[13] rsconnect_0.4.3    colorspace_1.2-6   tibble_1.1        

ggalt dev version installation

Intrigued by the lollipops (by the Chartettes) I tried to install the dev version but got this:

> devtools::install_github("hrbrmstr/ggalt")
Downloading GitHub repo hrbrmstr/ggalt@master
from URL https://api.github.com/repos/hrbrmstr/ggalt/zipball/master
Installing ggalt
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore CMD INSTALL '/tmp/RtmpY2dnby/devtools2eb93e7d9188/hrbrmstr-ggalt-7265318' --library='/home/henk/R/x86_64-pc-linux-gnu-library/3.2' --install-tests 

* installing *source* package ‘ggalt’ ...
** R
** inst
** tests
** preparing package for lazy loading
Error in get(x, envir = ns, inherits = FALSE) : 
  object 'to_basic.GeomLine' not found
Error : unable to load R code in package ‘ggalt’
ERROR: lazy loading failed for package ‘ggalt’
* removing ‘/home/henk/R/x86_64-pc-linux-gnu-library/3.2/ggalt’
* restoring previous ‘/home/henk/R/x86_64-pc-linux-gnu-library/3.2/ggalt’
Error: Command failed (1)
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 15.04

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=nl_NL.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=nl_NL.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=nl_NL.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] rsconnect_0.4.1.11 tools_3.2.3  

Proposal of a stat_prop()

I have developed a new stat for ggplot2 allowing to compute proportions according to a specified denominator.

For example, it allows to compute and to display column proportion on a bar chart with position = fill.

ggplot(as.data.frame(Titanic)) +
  aes(x = Class, fill = Survived, weight = Freq) +
  geom_bar(position = "fill") + 
  geom_text(aes(by = Class), stat = "prop", position = position_fill(.5))

will produce

image

Current code is visible here: https://github.com/larmarange/JLutils/blob/master/R/stat_prop.R

Do you think that such stat could be a good addition for ggalt? Or is it out of the scope of your package?

Best regards

better documentation for geom_encircle

I just had a request for the algorithm used by geom_encircle(). This is what I sent; I ought to flesh this out slightly and add it to the docs.

(1) finds the convex hull of the points
(2) if desired (based on the 'expand' argument), moves the points defining the convex hull outward away from the centroid
(3) constructs an 'xspline' through these points; the details of this (and a literature citation) are given in ?grid::xsplineGrob

geom_lollipop - params not implemented

In your CRAN documentation, you list some parameters such as:
stem.colour
stem.size

That don't appear to be implemented in the current (dev) version. When will they be implemented?

Blank Plot Output when using "geom_xspline" in ggalt package

I recently was trying geom_xspline from the ggalt to replace an existing geom_line in my ggplot object. When using ggarrange and geom_xspline, a blank screen was output and no other plots could be passed through RStudio until the session was restarted. I left a similar post on the ggpubr GitHub page; however, I believe the source of the bug resides in ggalt.

Working Code w/o geom_xspline

library(ggplot2)
library(ggpubr)
myplot = ggplot(data = mtcars, aes(x = wt, y = mpg)) +
geom_line()
ggarrange(myplot, myplot) # Works and outputs fine

Code using geom_xspline (no RStudio preview panel output)

library(ggalt)
library(ggplot2)
library(ggpubr)
myplot = ggplot(data = mtcars, aes(x = wt, y = mpg)) +
geom_xspline()
ggarrange(myplot, myplot) # Output becomes blank and freezes the plot panel

Based upon this stack overflow page, the output from ggarrange can still be saved, even though it doesn't display in RStudio.

There is also a proposed solution to address the issue by making adjustments to geom_xspline2. I am not sure if this is a feasible solution to add to ggalt on CRAN but it appears to work with ggarrange in this rough example:

# Create new geom based upon code from ggalt GitHub page
GeomXSpline3 <- ggproto("GeomXSpline3", Geom,
                        required_aes = c("x", "y"),
                        default_aes = aes(colour = "black", shape=-1, open=T),
                        draw_key = draw_key_point,

                        draw_panel = function(data, panel_params, coord) {
                          coords <- coord$transform(data, panel_params)
                          grid::xsplineGrob(
                            coords$x, coords$y,
                            shape = coords$shape, 
                            open = coords$open[1],
                            gp = grid::gpar(col = coords$colour)
                          )
                        }
)

geom_xspline3 <- function(mapping = NULL, data = NULL, stat = "identity",
                          position = "identity", na.rm = FALSE, show.legend = NA,
                          inherit.aes = TRUE, ...) {
  layer(
    geom = GeomXSpline3, mapping = mapping,  data = data, stat = stat,
    position = position, show.legend = show.legend, inherit.aes = inherit.aes,
    params = list(na.rm = na.rm, ...)
  )
}

# Plot with ggarrange
myplot = ggplot(data = mtcars, aes(x = wt, y = mpg)) +
  geom_xspline3(shape = -.25) + geom_point()
ggpubr::ggarrange(myplot, myplot) 

image

Changing Reference Meridian Wrecks the map

Hi,
First thank you for your package ;)

I struggled with an issue when using a quite unusual projection. I wanted to use the Cylindrical Equal Area Projection:
+proj=cea +lon_0=0 +lat_ts=Standard Parallel +x_0=False Easting +y_0=False Northing
And it works well, but when I centred it on the -160° meridian (+lon_0=-160) it wrecks the map as below:
map_wrecked

library(ggplot2)
library(ggalt)

world = map_data("world")
world = world[world$region != "Antarctica",]

# Works
p = ggplot() +
    geom_map(data = world, map = world, fill = "gray85", colour = "gray65",
             aes(x = long, y = lat, map_id = region)) +
    coord_proj(proj = "+proj=cea +lon_0=Central Meridian
            +lat_ts=Standard Parallel
            +x_0=False Easting
            +y_0=False Northing")

# Wrecks the map
p2 = ggplot() +
    geom_map(data = world, map = world, fill = "gray85", colour = "gray65",
             aes(x = long, y = lat, map_id = region)) +
    coord_proj(proj = "+proj=cea +lon_0=-160
            +lat_ts=Standard Parallel
            +x_0=False Easting
            +y_0=False Northing")

Error in coord_proj()

I have used coord_proj() without an issue until today when I found that I get the following error.

Error in zero_range(from) : x must be length 1 or 2

It seems to occur with the example code provided with ggalt()

world <- map_data("world")
world <- world[world$region != "Antarctica",]
 
gg <- ggplot()
gg <- gg + geom_cartogram(data=world, map=world,
+                           aes(x=long, y=lat, map_id=region))
gg <- gg + coord_proj("+proj=wintri")
gg
Error in zero_range(from) : x must be length 1 or 2

Any thoughts on why this error might occur?
Thanks

Crash of plot viewer in Rstudio when using ggsave of ggplot that includes geom_xspline

The plot viewer crash occurs on my computer, and on Rstudio cloud, due to some interaction with geom_xspline()
I don't know if this is a ggalt issue or a ggsave issue, or an rstudio IDE issue. In any case I've raised it at the rstudio community, at:
https://community.rstudio.com/t/rstudio-plot-viewer-crashes-with-ggsave-and-ggalt-combination-desktop-and-cloud/63822 . I've also raised on ggplot github (tidyverse/ggplot2#3974)

See cloud project here (https://rstudio.cloud/project/1219353).

#ggsave of ggplot crashes viewer

# install.packages("tidyverse")
# install.packages("ggalt")

library(tidyverse)
library(ggalt)

plot(cars)

#This Works
p <- ggplot(mtcars, aes(x=hp, y=mpg, group = cyl, colour=cyl))+
  geom_point(size=1)+
  theme(legend.position = "none")
p
ggsave("my plot 1.png", plot = p)

#This crashes
p <- ggplot(mtcars, aes(x=hp, y=mpg, group = cyl, colour=cyl))+
  geom_point(size=1)+
  theme(legend.position = "none") +
  geom_xspline(spline_shape = -0.5, size=0.5, linetype=2) #adding this line causes ggsave not to work, and crashes plot viewer
p
ggsave("my plot 2.png", plot = p)
sessionInfo()
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_New Zealand.1252  LC_CTYPE=English_New Zealand.1252    LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C                         LC_TIME=English_New Zealand.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ggalt_0.4.0     forcats_0.5.0   stringr_1.4.0   dplyr_0.8.5     purrr_0.3.4     readr_1.3.1     tidyr_1.0.2    
 [8] tibble_3.0.1    ggplot2_3.3.0   tidyverse_1.3.0

loaded via a namespace (and not attached):
 [1] tidyselect_1.0.0   haven_2.2.0        lattice_0.20-41    colorspace_1.4-1   vctrs_0.2.4        generics_0.0.2    
 [7] rlang_0.4.5        pillar_1.4.3       glue_1.4.0         withr_2.2.0        DBI_1.1.0          dbplyr_1.4.3      
[13] RColorBrewer_1.1-2 modelr_0.1.6       readxl_1.3.1       lifecycle_0.2.0    munsell_0.5.0      gtable_0.3.0      
[19] cellranger_1.1.0   rvest_0.3.5        labeling_0.3       extrafont_0.17     fansi_0.4.1        Rttf2pt1_1.3.8    
[25] broom_0.5.6        Rcpp_1.0.4.6       KernSmooth_2.23-16 scales_1.1.0       backports_1.1.6    jsonlite_1.6.1    
[31] farver_2.0.3       fs_1.4.1           proj4_1.0-10       digest_0.6.25      hms_0.5.3          packrat_0.5.0     
[37] stringi_1.4.6      ash_1.0-15         grid_4.0.0         cli_2.0.2          tools_4.0.0        magrittr_1.5      
[43] maps_3.3.0         extrafontdb_1.0    crayon_1.3.4       pkgconfig_2.0.3    ellipsis_0.3.0     MASS_7.3-51.5     
[49] xml2_1.3.1         reprex_0.3.0       lubridate_1.7.8    assertthat_0.2.1   httr_1.4.1         rstudioapi_0.11   
[55] R6_2.4.1           nlme_3.1-147       compiler_4.0.0  

Feature Request: coordinate transformation to show deviation from an expected function

Hi,

I've got some data that roughly follows some f(x). To now show the difference against that function, I'd like to transform the coordinate system, so that the f(x) line becomes the horizontal x-axis, and the (previously horizontal) y-grid lines become curves that are labelled on the right and left side of the diagram (like height lines on a map).

I looked at coord_trans, but that only allows to give single-parameter functions for x and y transformations; I'd like some way to specify eg. 1-exp(-x) should become the x-axis line, so the new y-coordinates depend on x as well.
The graph data (points and/or lines) and grid should get transformed as well, of course.

I already opened tidyverse/ggplot2#2965, and tried to get help at https://community.rstudio.com/t/transforming-coordinate-system/17169, but was now redirected to ggalt.

Thank you for your patience and help!

` coord_proj()` "Error: not implemented"

I'm getting Error: Not implemented when trying to use coord_proj(). Running an example from the documentation:

library(ggplot2)
library(ggalt)

world <- map_data("world")
usa <- world[world$region == "USA",]
usa <- usa[!(usa$subregion %in% c("Alaska", "Hawaii")),]

gg <- ggplot()
gg <- gg + geom_cartogram(data=usa, map=usa,
                          aes(x=long, y=lat, map_id=region))
gg <- gg + coord_proj(
   paste0("+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96",
          " +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"))
gg
#> Error: Not implemented

I've installed the most recent github commit from ggalt and ggplot2.

s_shape documentation

Hello,
I have tried to find guidance on what s_shape is actually doing in geom_encircle() it is used in a number of the examples but not (as far as I can find) described anywhere?

Cheers

geom_split_violin

Hi I would like a split violin plot.
In this example on stackoverflow, they have created a two densities back to back.
However this doesn't really line up nicely with new geoms that you would throw on top of it (f.i. points, boxplots etc).

Looking at hadleys geom_violin it seems the duplication part of the two densities happens at this place in de code.
https://github.com/hadley/ggplot2/blob/master/R/geom-violin.r#L175-L179

I guess I would like a geom_split_violin(aes(split = variable )) geom. That way you don't mess with other groupings, and I guess it would be nice if the density estimation / bandwidth would happen on the two parts of the split at the same time. so that they are identical.

inconsistent Stat naming

> library(ggedit)
> ggedit::gg_session('ggalt')
                fn          geom         position         stat   pkg
1   annotate_textp GeomCustomAnn PositionIdentity StatIdentity ggalt
2        geom_bkde      GeomBkde PositionIdentity     StatBkde ggalt
3      geom_bkde2d    GeomBkde2d PositionIdentity   StatBkde2d ggalt
4   geom_cartogram GeomCartogram PositionIdentity StatIdentity ggalt
5    geom_dumbbell  GeomDumbbell PositionIdentity StatIdentity ggalt
6    geom_encircle  GeomEncircle PositionIdentity StatIdentity ggalt
7    geom_lollipop  GeomLollipop PositionIdentity StatIdentity ggalt
8   geom_stateface GeomStateface PositionIdentity StatIdentity ggalt
9     geom_xspline   GeomXspline PositionIdentity  StatXspline ggalt
10        stat_ash      GeomArea    PositionStack      StatAsh ggalt
11       stat_bkde      GeomArea    PositionStack     StatBkde ggalt
12     stat_bkde2d GeomDensity2d PositionIdentity   StatBkde2d ggalt
13 stat_stepribbon    GeomRibbon PositionIdentity   Stepribbon ggalt <====
14    stat_xspline      GeomLine PositionIdentity  StatXspline ggalt
ggalt::stat_stepribbon
function (mapping = NULL, data = NULL, geom = "ribbon", position = "identity", 
    na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, direction = "hv", 
    ...) 
{
    ggplot2::layer(data = data, mapping = mapping, stat = Stepribbon,  <====
        geom = geom, position = position, show.legend = show.legend, 
        inherit.aes = inherit.aes, params = list(na.rm = na.rm, 
            direction = direction, ...))
}
<environment: namespace:ggalt>
ls('package:ggalt',pattern = '^Stat')
[1] "StatAsh"        "StatBkde"       "StatBkde2d"     "StatStepribbon"
[5] "StatXspline"

ggalt.rdb' is corrupt

Hi. I'm trying to install ggalt from github to use the dumbbel geom and have "ggalt.rdb is corrupt" error. Any suggestions?

annotate_textp

Annotate with text in the plot coordinate system. Could also go as a parameter to the original annotate_text. If you want to take this, I can do a PR...

Based on https://stackoverflow.com/questions/22488563/ggplot2-annotate-layer-position-in-r/22500252#22500252 and only transölated into the new ggplot2 extension model.

annotate_textp <- function(label, x, y, facets=NULL, hjust=0, vjust=0, color='black', alpha=NA,
                          family=thm$text$family, size=thm$text$size, fontface=1, lineheight=1.0,
                          box_just=ifelse(c(x,y)<0.5,0,1), margin=unit(size/2, 'pt'), thm=theme_get()) {
  x <- scales::squish_infinite(x)
  y <- scales::squish_infinite(y)
  data <- if (is.null(facets)) data.frame(x=NA) else data.frame(x=NA, facets)

  tg <- grid::textGrob(
    label, x=0, y=0, hjust=hjust, vjust=vjust,
    gp=grid::gpar(col=alpha(color, alpha), fontsize=size, fontfamily=family, fontface=fontface, lineheight=lineheight)
  )
  ts <- grid::unit.c(grid::grobWidth(tg), grid::grobHeight(tg))
  vp <- grid::viewport(x=x, y=y, width=ts[1], height=ts[2], just=box_just)
  tg <- grid::editGrob(tg, x=ts[1]*hjust, y=ts[2]*vjust, vp=vp)
  inner <- grid::grobTree(tg, vp=grid::viewport(width=unit(1, 'npc')-margin*2, height=unit(1, 'npc')-margin*2))

  layer(
    data = NULL,
    stat = StatIdentity,
    position = PositionIdentity,
    geom = GeomCustomAnn,
    inherit.aes = TRUE,
    params = list(
        grob=grid::grobTree(inner), 
        xmin=-Inf, 
        xmax=Inf, 
        ymin=-Inf, 
        ymax=Inf
    )
  )
}

qplot(1:10,1:10) + annotate_text2('some long text\nx = 1', x=0.5, y=0.5, hjust=1)

-> Adds an annotation in the middle of the plotting area, no matter what the data coordinate system is.

Issue with coord_proj() -- ggproto

I have been using coord_proj() to plot a ggplot2 heat map in the Robinson projection. I had no problems until recently, and now whenever I plot I get the error message:

error: CoordProj was built with an incompatible version of ggproto. Please reinstall the package that provides this extension.

I have tried reinstalling several times to no avail. I assume its a issue with the ggplot2 update but since I'm getting a different error message I thought I'd post.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.