Displaying 20 results from an estimated 3000 matches similar to: "Label bars in a faceted bar plot in ggplot2"
2011 Jul 08
1
Referencing a vector of data labels in ggplot function
Hi,
I really feel I've looked everywhere, although I know this can't be a hard
problem. I'd like to be able to call the graph below as a function, but I
can't get the function to recognize variables beyond 'dframe'. I've read
through many papers on writing functions in R, but I can't get this to work.
data <- data.frame('date' = as.Date(rep(c(15101,
2012 Mar 12
1
Faceted bar plot shows wrong counts (ggplot2)
I have encountered a problem with faceted bar plots. I have tried to
create something like the example explained in the ggplot2 book (see pp.
126-128):
library(ggplot2)
mpg4 <- subset(mpg, manufacturer %in%
c("audi", "volkswagen", "jeep"))
mpg4$manufacturer <- as.character(mpg4$manufacturer)
mpg4$model <- as.character(mpg4$model)
base <-
2011 Nov 16
1
geom_bar with missing data in package ggplot
Dear all,
I was hoping someone could help with a ggplot question. I would like
to generate a faceted bar chart, but missing data are causing
problems.
g<-structure(list(Date = structure(c(11322, 11687, 12052, 11322,
11687, 12052, 11322, 11687, 12052, 11322, 11687, 12052), class = "Date"),
variable = c("Govt Revenues to GDP", "Govt Revenues to GDP",
2011 Oct 11
1
controling text in facets (ggplot2)
Hi R-helpers!
Here is my problem:
I have a graph with 3 different facets where there are 3 different
regression line. My goal is to mention separately in each facet each
equation that describes my lines.
So far, I managed to add a line and the same equation to all my facets but
that's not unfortunately what I want.
Is there a way to do that? Any suggestion would be gladly welcome!
Thanks
2009 Dec 01
1
Does xapian support attribute search & faceted search?
Can I use xapian for a search like:
'title' has the phrase "dinner jacket" AND 'color' == BLACK AND 'state' == MA AND 'size' == XL
What about faceted search?
Thanks
2013 Oct 15
0
compute current values in a facet
Hello Experts,
I found this example on web and use it just for explanation.
( http://stackoverflow.com/questions/15867263/ggplot2-geom-text-with-facet-grid )
library(ggplot2)
x <-runif(9, 0, 125)
data <-
2008 Jun 17
1
ggplot facet spacing, wrapping
I'm running into some problems with the spacing of some faceted ggplot plots.
I have a number of time series faceted to be one above another, but the
scale labels of the y axes all clobber each other at the bottom/top of each.
for example, try:
qplot(x, y, data = data.frame(x = 1:10, y = 1:10, size = 1:10), facets =
size ~ ., size = size) + scale_x_continuous(breaks = 1:10) +
2012 Jun 27
0
ggplot2 ordering in a faceted dotplot.
am trying to produce two dot plot figures in ggplot2. So far the first one (p) in the program below is working fine.
However when I want to move to a faceted plot (p1) I seem to lose my ordering or, more likely, I'm just getting an ordering I am not expecting and I always have trouble understanding ordering in R!
What I would like is the 2011 panel to be ordered in descending order as is
2016 Apr 20
2
overlay two facet_grid
Hi all,
Does anyone know how to overlay two facet_grids? I have two facet grids as following:
ggplot(data=df,aes(x=TE,y=TR,color="orange"))+geom_point()+facet_grid(FS+TRJ~OR+INV,labeller=label_both)+xlim(0,200)+ylim(0,10000)
ggplot(data=df,aes(x=TE,y=TR))+geom_point(aes(color=TST))+facet_grid(FS+TRJ~OR+INV,labeller=label_both)+xlim(0,200)+ylim(0,10000)
Thanks for any help!
Elahe
2010 Aug 23
2
change order of plot panels in faceted ggplot/qplot
Hi,
I have a 5-paneled figure that i made using the facet function in
qplot (ggplot). I've managed to arrange the panels into two rows/
three columns, but for the sake of easy visual comparisons between
panels in my particular dataset, I want to have the two plots on the
bottom align on the right hand side of the figure instead of the left.
Here's an example:
m <-
2010 Nov 09
1
ggplot2: facet_grid with different vertical lines on each facet
Hello,
I am plotting many histograms together using facet_grid in ggplot2. However,
I want to then add a vertical line to each histogram, or facet, each of
which vertical lines are at different x-values.
The following example adds all vertical lines to each facet:
ggplot(data,aes(values)) + geom_histogram() + facet_grid(.~variable) +
geom_vline(xintercept=c(5,10,15))
How can I add a vertical
2011 Jun 26
1
changing graphs in qqplot2
This is what I have now so far.
p=ggplot(data = test, aes(x = YEAR, y = TOTAL, colour = TREATMENT)) +
geom_point() + geom_smooth(method = "lm", se=FALSE) + facet_wrap(~COUNTRY)
> p +scale_x_continuous(limits=c(1,4))
http://r.789695.n4.nabble.com/file/n3626510/graph.gif
I would also like to:
1.) change the headline for the faced wraps ?high? and ?low?. Is there any
other way of
2009 Oct 06
1
ggplot2: mapping categorical variable to color aesthetic with faceting
Hello Again... I?m making a faceted plot of a response on two categorical
variables using ggplot2 and having troubles with the coloring. Here is a
sample that produces the desired plot:
compareCats <- function(data, res, fac1, fac2, colors) {
require(ggplot2)
p <- ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2)
jit <- position_jitter(width = 0.1)
p <- p +
2010 Sep 11
1
Setting scales for ggplot2 with facets
Faceting in ggplot2 seems to permit different scales for different
facets, but I fail
to see how one could control ylim and xlim ranges for each facet
separately.
For instance, I would like to set the ylim = c(0,10) for facet "A"
and ylim = c(42,102) for facet "B". Since the data is out of these
ranges,
setting facet_grid(factor ~ ., scales = "free_y") does not
2012 Mar 21
3
Unable to specify order of a factor
Hi all:
I'm attempting to create a faceted plot with ggplot2 and I'm having issues
with a factor's order that is used to define the facet_grid().
The factor (named total.density) has three levels - 8, 16, and 32 - and I
would like them presented in that order. Running
order(levels(total.density)) yields the incorrect order of the facet grid -
2 3 1, corresponding with 16, 32, and 8.
2013 Jan 24
1
Insert segment only on particular facets in ggplot
Dear R users,
I am working on a data-set with 3 species. They are apple, orange and
banana.
I want to annotate the facets only on the bottom panel. However, by default
I am getting annotations on all the plots. I was able to get text
annotation only on the desired plot. However, I am confused what I need to
do for the arrows / segments.
Here is my code:
library(ggplot2)
library(grid)
tempobs
2011 Feb 16
1
Faceting article
Hi,
I've been involved in developing a fairly complex site at
http://tilt.ft.com recently, and have acquired an unhealthy interest in
faceting. I couldn't find any good non-academic guides to faceting
strategy on the web, so I thought I'd have a stab at writing one.
I'm not completely happy with it, but it's been sitting in my drafts for
long enough that I thought it
2016 Apr 20
0
overlay two facet_grid
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Overlaying aesthetics is possible. Overlaying graphs is not. Without sample data, concrete examples will be unlikely to appear, so read the above link and pay attention to the dput function.
--
Sent from my phone. Please excuse my brevity.
On April 20, 2016 3:01:43 PM PDT, "ch.elahe via R-help"
2011 Nov 15
1
Plot alignment with mtext
I would like the text plotted with 'mtext' to be alighned like it is for
printing on the console. Here is what I have:
> print(emt)
ME RMSE MAE
MPE MAPE MASE
original -1.034568e+07 1.097695e+08 2.433160e+07 -31.30554 37.47713
1.5100050
xreg 1.561235e+01 2.008599e+03 9.089473e+02 267.05490 280.66734
2011 May 28
1
ggplot pale colors
Hello i am new to ggplot and i observed a strange behavior.
I want to display two groups of points, each group with a different color.
But i encountered a problem with the colors.
Here is a first example:
dataset <- data.frame(Main = c("A", "A", "B", "B"), Detail = c( "b", "c", "1", "2"), resp = runif(4, min