facet

ggplot2:: Facetting plot with the same reference plot in all panels

百般思念 提交于 2019-12-02 10:08:24
问题 I would like to facet a plot, but with a reference plot in each panel. Let me try to show with pictures what I want to achieve: My example data_frame: require(dplyr) df <- data_frame( id = c(rep('ctr',40), rep('pat',80)), class = c(rep('ctr',40), rep(c('a','b'), each = 40)), rank = rep (1:20,6), mean = c(rep(seq(3,-3, length.out = 20),2), rep(seq(1,-4, length.out = 20),2), rep(seq(-2,-8, length.out = 20),2)), sd = rep(seq(1.2,0.8, length.out = 20), times = 6), exam = rep(c('blue','red'), each

How to use ggplot2 facet colors and shapes?

一曲冷凌霜 提交于 2019-12-02 08:19:51
Maybe, I missed something in the ggplot grammar. The following 3 facets can be plotted without any error. Unfortuantely, the facet plots mixed up colors and shapes. The right hand column should show blue markers only, while the center one should have green markers. data1 num delay claim supply project 1 -236.347551 3000 DIF site1 2 65.132011 5000 Hoc site2 3 61.401260 5000 Hoc site2 4 96.902894 500 Hoc site2 .. base04 <- ggplot(data1, aes(num, delay, size=claim, color=supply, shape=project)) base04 + geom_point() + facet_grid( . ~ supply ) base04 + geom_point() + facet_grid( project ~ . )

JSF <f:facet> contents not rendered

泪湿孤枕 提交于 2019-12-02 08:16:47
问题 I have a page where I need to nest some components inside a <f:facet name="last> , in order to apply custom styles (I'm using Primefaces and this is their their way of handling CSS priority ordering as mentioned here). But I'm not able to render anything placed inside the <f:facet> tags. Here's some sample code: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http:/

Color code points based on percentile in ggplot

假装没事ソ 提交于 2019-12-02 07:27:01
问题 I have some very large files that contain a genomic position (position) and a corresponding population genetic statistic (value). I have successfully plotted these values and would like to color code the top 5% (blue) and 1% (red) of values. I am wondering if there is an easy way to do this in R. I have explored writing a function that defines the quantiles, however, many of them end up being not unique and thus cause the function to fail. I've also looked into stat_quantile but only had

ggplot2:: Facetting plot with the same reference plot in all panels

假如想象 提交于 2019-12-02 06:07:29
I would like to facet a plot, but with a reference plot in each panel. Let me try to show with pictures what I want to achieve: My example data_frame: require(dplyr) df <- data_frame( id = c(rep('ctr',40), rep('pat',80)), class = c(rep('ctr',40), rep(c('a','b'), each = 40)), rank = rep (1:20,6), mean = c(rep(seq(3,-3, length.out = 20),2), rep(seq(1,-4, length.out = 20),2), rep(seq(-2,-8, length.out = 20),2)), sd = rep(seq(1.2,0.8, length.out = 20), times = 6), exam = rep(c('blue','red'), each = 20, times = 3)) My plot: # first, create reference plot of the 'controls' require(ggplot2) p_ctr <-

Combining grid_arrange_shared_legend() and facet_wrap_labeller() in R

强颜欢笑 提交于 2019-12-02 05:20:11
问题 I am trying to combine grid_arrange_shared_legend() and facet_wrap_labeller() in R. More specifically, I want to draw a figure including two ggplot figures with multiple panels each and have a common legend. I further want to italicize part of the facet strip labels. The former is possible with the grid_arrange_shared_legend() function introduced here, and the latter can be achieved with the facet_wrap_labeller() function here. However, I have not been successful in combining the two. Here's

JSF <f:facet> contents not rendered

时光总嘲笑我的痴心妄想 提交于 2019-12-02 05:15:32
I have a page where I need to nest some components inside a <f:facet name="last> , in order to apply custom styles (I'm using Primefaces and this is their their way of handling CSS priority ordering as mentioned here ). But I'm not able to render anything placed inside the <f:facet> tags. Here's some sample code: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:head> <title>TODO supply a title</title> </h:head> <h:body> <div> <h:form> <h

Stacked bar chart with group by and facet

北慕城南 提交于 2019-12-02 04:09:23
My data looks like this: system operation_type prep_time operation_time A x 0.7 1.4 A y 0.11 2.3 A z 1.22 6.7 B x 0.44 5.2 B y 0.19 2.3 B z 3.97 9.5 C x 1.24 2.4 C y 0.23 2.88 C z 0.66 9.7 I would like to have a stacked chart on prep_time and operation time that gives me total_time grouped by system and then faceted by operation_type. My code looks like this for now. library(ggplot2) df <- read.csv("test.csv", strip.white=T) plot <- ggplot(df, aes(x=system,y=(prep_time+operation_time))) + geom_bar(stat="identity") + facet_grid(.~operation_type) The output I get is What I need is a distinction

Combine geom_tile() and facet_grid/facet_wrap and remove space between tiles (ggplot2)

妖精的绣舞 提交于 2019-12-02 03:51:13
问题 I have a data set with x, y, and z ( resp ) values along with two columns for facetting in order to create a grid of tile plots. The output of dput() is at the end of the post. library(ggplot2) My actual data set has six unique interactions between variables, however I've limited it to four for simplicity. I can create a tile plot with each unique combination, but not the whole set. The output of dput() is at the end of the post. I thought it might have to do with ggplot needing a common y

Combining grid_arrange_shared_legend() and facet_wrap_labeller() in R

可紊 提交于 2019-12-02 01:06:14
I am trying to combine grid_arrange_shared_legend() and facet_wrap_labeller() in R. More specifically, I want to draw a figure including two ggplot figures with multiple panels each and have a common legend. I further want to italicize part of the facet strip labels. The former is possible with the grid_arrange_shared_legend() function introduced here , and the latter can be achieved with the facet_wrap_labeller() function here . However, I have not been successful in combining the two. Here's an example. library("ggplot2") set.seed(1) d <- data.frame( f1 = rep(LETTERS[1:3], each = 100), f2 =