similar to: ggplot2: behaviour with empty datasets

Displaying 20 results from an estimated 10000 matches similar to: "ggplot2: behaviour with empty datasets"

2011 Sep 24
1
ggplot2: expression() in legend labels?
Is there any way to use expression() in legend labels with ggplot2? It seems that things like > scale_shape_manual(value = c( > x = expression(italic(x)), > y = expression(italic(y)) > )) don't work. Thanks very much :) -- Using GPG/PGP? Please get my current public key (ID: 0xAEF6A134, valid from 2010 to 2013) from a key server. -------------- next part --------------
2010 Feb 14
2
Problems with boxplot in ggplot2:qplot
Dataframe closed contains balances of closed accounts: each row has month of closure (Date-type column month) and latest balance. I would like to plot by-month distributions of balances. A qplot call below produces several warnings and no output. Can anyone help? Thank you. PS. A really basic task, very similar to the examples on p. 71 of the ggplot2 book, apart from a Date grouping column; I
2009 Jul 23
1
ggplot2 : commands on one line vs two lines.
I have just started using ggplot2 and I seem to be doing something stupid in writing ggplot2 commands on more than one line. In the example below the commands on one line are working fine, but as soon as I put them on two lines I get an error. Can any one point out what I am doing wrong? It must be something blindingly simple. Thanks Example
2008 Jan 11
1
ggplot2, coord_equal and aspect ratio
Hi everyone, Hi Hadley, I am a heavy user of coord_equal() in ggplot2 since most of my data is spatial, on x,y coordinates. Everything works. However by enforcing an aspect ratio of 1 for the plotting region, coord_equal() usually wastes a lot of space if the region of interest is not a perfect square. For example: x=runif(10) a=data.frame(x=x*3,y=x) ggplot(data=a, aes(x=x,y=y)) +
2008 Sep 10
1
ggplot2: edge outlines on points
The graphic design elements in ggplot2 are so well done for color graphics. Thank you! For BW publication graphs, there are a few options I would like to be able to tweak, but can't seem to find the grob handles necessary OR the right plotting strategy. Here's one problem I've been puzzling over: Q> How do you plot points with a grey fill and a black outline around the
2008 Sep 22
2
adding layers in ggplot2 (data and code included)
Here is some sample data: mydata <- read.table(textConnection("Est Group Tri 0 0 4.639644 1 0 4.579189 2 0 4.590714 0 1 4.443696 1 1 4.588243 2 1 4.650505 0 2 4.296608 1 2 4.826036 2 2 4.765386"),header=TRUE); closeAllConnections(); I can form two plots,
2009 Jul 23
2
param:qsec in ggplot2
Hii i have been trying to do a scatter plot with ggplot2, like the plot 6 here (http://had.co.nz/ggplot2/geom_point.html) .. where the points size vary with values > p + geom_point(aes <http://had.co.nz/ggplot2/aes.html>(size = qsec)) but am not sure how to setup the parameter - qsec could anyone please give some pointers on how to define that thanks Mo. [[alternative HTML
2023 Aug 02
2
Choosing colours for lines in ggplot2
Hello - I am trying to plot flows in a number of rivers within the same plot, and need to colour the lines differently, using a colour-blind palette. Code beneath works but has colours assigned by the program I have made some simple dummy data: ## code 1 cb8<- c("#000000", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2",
2013 Mar 08
2
ggplot2: modifying line width and background fill color for stat_smooth()
In the example below, from http://www.ling.upenn.edu/~joseff/rstudy/summer2010_ggplot2_intro.html I'd like to make (a) the fitted line thicker and (b) change the background fill color for the confidence envelope around each fitted line to a low-alpha transparent version of the same color used for the separate fitted lines for GENDER, rather than grey for both. How can I do this?
2009 Oct 29
1
multiple pages with ggplot2 facet_wrap?
I currently use lattice functions to produce multiple pages of plots using the "layout" argument to specify the number of rows and columns of panels, e.g., xyplot(price ~ carat | clarity, diamonds, layout = c(2, 2)) This results in 2 pages of 4 panels each. "diamonds" is a data.frame distributed with ggplot2. I would like to do the same with ggplot2 but have been
2011 Apr 03
1
another question on shapefiles and geom_point in ggplot2
Manuel: I changed your variable names from x to 'long' and y to 'lat' on the riqueza_out.csv file. The code below should do what you want. Also, since the legend title is kind of long, I broke it down into three lines so you can see more plot area. I am cc'ing the other groups so more people use it if needed. library(rgdal) library(ggplot2) library(sp) library(maptools)
2012 Jul 03
2
ggplot2: legend
Dear all, I produced the following graph with ggplot which is almost fine, yet I don't like that the legend for "Means" and "Observations" includes a line, though no line is used in the plot for those two (the line for "Overall Mean" on the other hand is wanted): library(ggplot2) ddf <- data.frame(x = factor(rep(LETTERS[1:2], 5)), y = rnorm(10)) p <-
2012 Mar 20
1
passing xlim to coord_map in ggplot2
I'm sure this is smack-head moment, but I haven't been able to find an example of this on Nabble or SO, so thought I'd ask. This works: michigan <- map_data('county', 'michigan') mich_points <- data.frame(x = rnorm(n = 200, median(michigan[,1]), 0.75), y = rnorm(n = 200, median(michigan[,2]), 0.75)) ggplot() + geom_path(aes(long, lat, group = group), data =
2009 Jan 07
1
Problem with ggplot2 - facet_wrap and boxplot
Hello R users and Hadley, Back again with a little problem in ggplot2 =o) (ggplot 0.8.1, R 2.8.0) Here the problem : library(ggplot2) df <- data.frame(id = 1:100, x1 = c(rnorm(50), rnorm(50, 1)), x2 = c(rnorm(50), rnorm(50, 1.5)), x3 = c(rnorm(50, 0.5), rnorm(50, 2.5)), group = as.factor(rep(c("a", "b"), each = 50))) df.melt <- melt(df, id = c("id",
2009 May 19
2
Coord_equal in ggplot2
Dear all, I'm plotting some points on a graph where both axes need to have the same scale. See the example below. Coord_equal does that trick but in this case it wastes a lot of space on the y-axis. Setting the limits of the y-axis myself was no avail. Any suggestions to solve this problem? library(ggplot2) ds <- data.frame(x = runif(1000, min = 0, max = 300000), y = runif(1000, min =
2008 Jun 16
1
sizing non-vector point shapes in ggplot2
Dear all, With normal plotting, one can size a set of points in a plot using a vector argument to cex in the points() function. This works whether you are using one of the standard R symbols (i.e. 19+) or some ascii symbol, such as '/' eg: plot(1:10, 1:10, type='n'); points(1:10, 1:10, cex = 1:10, pch = '/') Trying to make the transition to ggplot2, I find that the
2020 Oct 23
2
How to shade area between lines in ggplot2
also from this site: https://plotly.com/ggplot2/geom_ribbon/ I get the answer is geom_ribbon but I am still missing something ``` #! plot p = ggplot(data = trainset, aes(x=x, y=y, color=z)) + geom_point() + scale_color_manual(values = c("red", "blue")) # show support vectors df_sv = trainset[svm_model$index, ] p = p + geom_point(data = df_sv, aes(x=x, y=y),
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi What about something like p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2], ymax = slope_1*x + intercept_1 + 1/w[2], fill = "grey70", alpha=0.1)) Cheers Petr > -----Original Message----- > From: Luigi Marongiu <marongiu.luigi at gmail.com> > Sent: Friday, October 23, 2020 11:11 AM > To: PIKAL Petr <petr.pikal at precheza.cz> > Cc: r-help
2011 Oct 03
4
Question about ggplot2 and stat_smooth
I'm interested in creating a graphic -like- this: c <- ggplot(mtcars, aes(qsec, wt)) c + geom_point() + stat_smooth(fill="blue", colour="darkblue", size=2, alpha = 0.2) but I need to show 2 sets of bands (with different shading) using 5%, 25%, 75%, 95% limits that I specify and where the heavy blue line is the median. I don't understand how to do this with
2008 Nov 19
2
ggplot2; dot plot, jitter, and error bars
With this data x <- c(0,0,1,1,2,2) y <- c(5,6,4,3,2,6) lwr <- y-1 upr <- y+1 xlab <- c("Low","Low","Med","Med","High","High") mydata <- data.frame(x,xlab,y,lwr,upr) I would like to make a dot plot and use lwr and upr as error bars. Above 0=Low. I would like there to be some space between the 5 and the 6 corresponding