ggforce

Sankey plot where edges between nodes correspond to an N3 column

谁说我不能喝 提交于 2020-01-13 06:49:10
问题 I would like to draw a sankey plot based on the below generated data structure where the edges between nodes correspond to an N3 column and their presence and thickness depend on the Value column. For the below dummy data, the plot would look like this (but with edge thickness corresponding to the value in the Value column). I haven't seen any example of sankey plots built like this. I've tried different options using the riverplot package, but as it doesn't seem to be able to handle the N3

Chop up bsplines and color them

本秂侑毒 提交于 2019-12-11 16:24:16
问题 I am intrigued by this plot of Albert Cairo. I can smooth my curve sufficiently with ggforce::bspline However, now that I don't have a date axis I am unsure as to how to change the color of a spline midway. Let's assume that the three points represent the years 1990, 1991 and 1992. And someone got elected on July 1, 1990. I would like to change the color of the spline at this point. So the curved line would be red from origin until aprox (12, 5.6) then blue from (12, 5.6) to (17,4) I am not

How to save output from ggforce::facet_grid_paginate in only one pdf?

拈花ヽ惹草 提交于 2019-12-03 20:01:44
问题 I'm using the ggforce package to generate facetted plots over several pages: library(ggforce) for(i in 1:6){ ggplot(diamonds) + geom_point(aes(carat, price), alpha = 0.1) + facet_wrap_paginate(~cut:clarity, ncol = 2, nrow = 2, page = i) ggsave(paste0("~/diamonds_", i, ".pdf")) } which is generating the expected 6 PDF files: What is the easiest way have the output in one single pdf with 6 pages? I understand this can be done with the reports and pdftools packages, but I'm wondering if there's

Save facet_wrap() on multiple pages using ggforce/ggplus

时光毁灭记忆、已成空白 提交于 2019-12-02 14:49:20
问题 I got this plot using the code below library(tidyverse) ggplot(df2, aes(x =Date, y = Sales, color = id))+ geom_line(size = 0.01, alpha = 0.3)+ +facet_wrap(~id) scale_x_date(breaks = seq(as.Date("2001-01-01"), as.Date("2007-01-01"), by="1 year"), labels = date_format("%Y")) In my original data, I have 30 levels for the id . If I plot all facets on one page, it will be so messy and difficult to read. Therefore, I want to have a plot similar to the plot above but 4 facets only on each page so it

How to save output from ggforce::facet_grid_paginate in only one pdf?

为君一笑 提交于 2019-11-30 15:29:54
I'm using the ggforce package to generate facetted plots over several pages: library(ggforce) for(i in 1:6){ ggplot(diamonds) + geom_point(aes(carat, price), alpha = 0.1) + facet_wrap_paginate(~cut:clarity, ncol = 2, nrow = 2, page = i) ggsave(paste0("~/diamonds_", i, ".pdf")) } which is generating the expected 6 PDF files: What is the easiest way have the output in one single pdf with 6 pages? I understand this can be done with the reports and pdftools packages, but I'm wondering if there's a more direct way to accomplish this. I'd expect ggforce to provide the functionality for the output to

Making a scatter plot of multiple pie charts of differing sizes, using ggplot2 in R

对着背影说爱祢 提交于 2019-11-29 12:45:29
I have a data frame containing the following data: > data_graph # A tibble: 12 x 4 # Groups: ATTPRO, ATTMAR [?] x y group nb <dbl> <dbl> <chr> <int> 1 0 0 1 1060 2 0 0 2 361 3 0 0 3 267 4 0 1 1 788 5 0 1 2 215 6 0 1 3 80 7 1 0 1 485 8 1 0 2 168 9 1 0 3 101 10 1 1 1 6306 11 1 1 2 1501 12 1 1 3 379 My objective is to have the following chart: Both x and y , qualitative variables, to be put as X/Y axis nb , quantitative variable, representing pie size group , qualitative variable, representing pie parts The best result approching this using ggplot2 package is only giving me bubbles, with this

how to draw two half circles in ggplot in r

瘦欲@ 提交于 2019-11-28 22:05:09
How can I make a plot like this with two different-sized half circles (or other shapes such as triangles etc.)? I've looked into a few options: Another post suggested using some unicode symbol, that didn't work for me. And if I use a vector image, how can I properly adjust the size parameter so the 2 circles touch each other? Sample data (I would like to make the size of the two half-circles equal to circle1size and circle2size ): df = data.frame(circle1size = c(1, 3, 2), circle2size = c(3, 6, 5), middlepointposition = c(1, 2, 3)) And ultimately is there a way to position the half-circles at

Making a scatter plot of multiple pie charts of differing sizes, using ggplot2 in R

和自甴很熟 提交于 2019-11-28 06:13:44
问题 I have a data frame containing the following data: > data_graph # A tibble: 12 x 4 # Groups: ATTPRO, ATTMAR [?] x y group nb <dbl> <dbl> <chr> <int> 1 0 0 1 1060 2 0 0 2 361 3 0 0 3 267 4 0 1 1 788 5 0 1 2 215 6 0 1 3 80 7 1 0 1 485 8 1 0 2 168 9 1 0 3 101 10 1 1 1 6306 11 1 1 2 1501 12 1 1 3 379 My objective is to have the following chart: Both x and y , qualitative variables, to be put as X/Y axis nb , quantitative variable, representing pie size group , qualitative variable, representing

how to draw two half circles in ggplot in r

喜欢而已 提交于 2019-11-27 14:10:57
问题 How can I make a plot like this with two different-sized half circles (or other shapes such as triangles etc.)? I've looked into a few options: Another post suggested using some unicode symbol, that didn't work for me. And if I use a vector image, how can I properly adjust the size parameter so the 2 circles touch each other? Sample data (I would like to make the size of the two half-circles equal to circle1size and circle2size ): df = data.frame(circle1size = c(1, 3, 2), circle2size = c(3, 6