facet

How to format my own objects when using STL streams?

风流意气都作罢 提交于 2019-12-23 17:32:05
问题 I want to output my own object to a STL stream but with customized formatting. I came up with something like this but since I never used locale and imbue before I have no idea if this makes sense and how to implement MyFacet and operator<<. So my questions are: does this make sense and how to implement MyFacet and operator<< ? The following is a simplified example which shows you what I want to do. struct MyObject { int i; std::string s; }; std::ostream &operator<<(std::ostream &os, const

ggplot2 boxplot stat_summary text placement by group

…衆ロ難τιáo~ 提交于 2019-12-23 03:07:05
问题 In the plot below, I'd like the number of observations (40 in this case) to be overlayed on top of each boxplot. My code below doesn't work when there's a fill aesthetic. The text need to be adjusted horizontally (1 left, 1 center, 1 right in this case) so that they properly overlay their corresponding boxplots. dt <- data.table( x = factor(rep(1:2, each=120)) , f = rep(letters[1:3], 40) , y = c(rnorm(120, 1:3), rnorm(120, 1:3*2)) ) table(dt$x, dt$f) +--------------+ | a b c | +--------------

Mysql | Faceted search

倖福魔咒の 提交于 2019-12-23 02:25:09
问题 I have a fiddle: http://sqlfiddle.com/#!2/46a7b5/18 This request return all attributes. | META_NAME | META_VALUE | COUNT | |----------------|------------|-------| | Car Type | Coupe | 2 | | Car Type | Sedan | 1 | | Color | Black | 1 | | Color | Red | 1 | | Color | White | 1 | | Interior Color | Black | 2 | | Interior Color | Grey | 1 | | Make | BMW | 2 | | Make | Honda | 1 | | Model | 2Series | 1 | | Model | 3Series | 1 | | Model | Civic | 1 | To get searched result I have the request below:

Plot multiple days data of multiple homes in Facet form of ggplot

喜欢而已 提交于 2019-12-23 01:49:19
问题 I have hourly timeseries data of three homes( H1, H2, H3 ) for continuous five days created as library(xts) library(ggplot2) set.seed(123) dt <- data.frame(H1 = rnorm(24*5,200,2),H2 = rnorm(24*5,150,2),H3 = rnorm(24*5,50,2)) # hourly data of three homes for 5 days timestamp <- seq(as.POSIXct("2016-01-01"),as.POSIXct("2016-01-05 23:59:59"), by = "hour") # create timestamp dt$timestamp <- timestamp Now I want to plot data homewise in facet form; accordingly I melt dataframe as tempdf <-

R how to add facet labels for pyramid like plot in ggplot2

有些话、适合烂在心里 提交于 2019-12-23 00:31:52
问题 I have created pyramid like plot and I want to add labels for each side of the plot (something like facet labels). My data: dt <- data.frame(Answer = factor(x = rep(x = c(1:3), times = 2), labels = c("Yes", "No", "Maybe")), Gender = factor(x = rep(x = c(1:2), each = 3), labels = c("Female", "Male")), Prc = c(74.4, 25.0, 0.6, 61.3, 35.5, 3.2), label = c("74.4%", "25.0%", "0.6%", "61.3%", "35.5%", "3.2%")) My plot: My code for plot generation: xmi <- -70 xma <- 80 library(ggplot2) ggplot(data =

how to search for more than one facet in solr?

匆匆过客 提交于 2019-12-22 11:16:45
问题 I need to search for facets in solr as below: fq=country:usa fq=country:canada fq=topic:industrial fq=topic:political now i need to search for the articles that have the above facets (logical And) and (logical Or). suppose that i have the following articles country=USA France //Topic: Industrial Scientific country=USA canada //Topic: Industrial country=USA canada //Topic: Industrial political now, i have tried http://127.0.0.1:8888/solr/Collection1/select?q=*:*&start=0&rows=10&facet=true&fq

Adding table to ggplot with facets

痞子三分冷 提交于 2019-12-21 22:40:37
问题 Reproducible code: x = sample(1:12,100,replace=TRUE) y = rnorm(100) z = sample(c('Sample A','Sample B'),100,replace=TRUE) d = data.frame(x,y,z) ggplot(data=d, aes(factor(x),y)) + geom_boxplot() + stat_summary(fun.y=mean, geom="line", aes(group=1), color ='red') + stat_summary(fun.y=mean, geom="point", color='red') + xlab('Months') + ylab('Metric') + facet_wrap(~z) I want to add a table at the end of this chart that displays the summary statistics- mean, median, quartiles and number of records

set “space” in facet_wrap like in facet_grid

梦想的初衷 提交于 2019-12-20 09:37:18
问题 I need different-width facets; the left plot shows the dynamic range of an experiment, and the right has the test conditions. Is there a way to have both free x and y scales with facet_wrap? It is possible in facet_grid, but even with scale="free", there is a fixed y scale. facet_wrap allows free y scale, but the x scale seems fixed. The same question was posted on a google page a few years back, but the answer is unsatisfactory. https://groups.google.com/forum/#!topic/ggplot2/1RwkCcTRBAw

Why this facet_grid doesn't delete columns?

风流意气都作罢 提交于 2019-12-20 02:42:35
问题 Hi have this dataset : tdat=structure(list(Condition = structure(c(1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L), .Label = c("AS", "Dup", "MCH"), class = "factor"), variable = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("Bot", "Top", "All"), class = "factor"), value = c(1.782726022, 1, 2.267946449, 1.095240234, 1, 1.103630141, 1.392545278, 1, 0

R ggplot2: boxplots with wilcoxon significance levels, and facets. Show only significant comparisons with asterisks

纵然是瞬间 提交于 2019-12-19 19:49:47
问题 Following up on this question and for the sake of completeness, I modified the accepted answer and customized the resulting plot, but I am still facing some important problems. To sum up, I am doing boxplots reflecting significance of Kruskal-Wallis and pairwise Wilcoxon test comparisons. I want to replace the p-value numbers with asterisks, and show only the significant comparisons, reducing vertical spacing to the max. Basically I want to do this, but with the added problem of facets, that