similar to: ggplot question

Displaying 20 results from an estimated 3000 matches similar to: "ggplot question"

2013 Apr 14
1
Problem plotting continuous and discrete series in ggplot with facet
I have data that plots over time with four different variables. I would like to combine them in one plot using facet_grid, where each variable gets its own sub-plot. The following code resembles my data require(ggplot2) require(reshape2) subm <- melt(economics, id='date', c('psavert','uempmed','unemploy')) mcsm <- melt(data.frame(date=economics$date,
2010 May 09
1
Is it possible to rearrange the facets in ggplot while keeping everything else the same?
Hello, First, ggplot2 is great! Second, sorry for the basic nature of my question. I have data in the form of a melt table like this: Subject Day Ab Variable Value 1 1 Yes A 3 1 3 Yes A 5 1 5 Yes A 7 2 1 No A 2 2 3 No A 4 2 5 No A 6 3 1 Yes A 1 3 3 Yes A 3 3 5 Yes A 5 4 1 No A 4 4 3 No A 6 4 5 No A 8 1 1 Yes B 3 1 3 Yes B 5 1 5 Yes B 7 2 1 No B 2 2 3 No B 4 2 5 No B 6 3 1 Yes B 1 3 3 Yes B 3 3 5
2009 Jan 22
1
ggplot2 example
I need to plot two graphics just like the example below but for some reason your example crashes. Using facet_wrap seems to be the cause: library(ggplot2) upper <- with(economics, data.frame(date,value = psavert, position = "upper")) upper lower <- with(economics, data.frame(date,value = unemploy,position = "lower")) lower #upper$date <-
2011 Dec 23
1
simple ggplot2 question
Hello, I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n' through 'z' are shown, while in the lower part, only places 'a' through 'm' are shown. I thought 'free_y'
2009 Oct 06
2
ggplot cumsum refined question (?)
OK, so maybe last night was a little too much at one throw, so I have reduced the data to two stations- one that has precipitation and one that does not. This is going to be in the context of a larger data set. I would like to be able to issue a ggplot command and have cum sum just act on the facets (factors) to apply this. library(chron) library(ggplot2) DF <- structure(list(date_time =
2009 Jun 01
2
ggplot2 and Date class
I'm trying to plot a time series in ggplot, but a date column in my data frame is causing errors. Rather than provide my own data, I'll just refer to the scale_date example at: http://had.co.nz/ggplot2/scale_date.html , which reproduces the error. > df <- data.frame( date = seq(Sys.Date(), len=100, by="1 day")[sample(100, 50)], price = runif(50) ) > dt <- qplot(date,
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
2010 May 18
2
Function that is giving me a headache- any help appreciated (automatic read )
note: whole function is below- I am sure I am doing something silly. when I use it like USGS(input="precipitation") it is choking on the precip.1 <- subset(DF, precipitation!="NA") b <- ddply(precip.1$precipitation, .(precip.1$gauge_name), cumsum) DF.precip <- precip.1 DF.precip$precipitation <- b$.data part, but runs fine outside of the function: days=7
2009 Feb 05
1
A way to "lock down" the order of bars for ggplot "dodged" histogram
It appears that ggplot reorder the data for a "dodged" histogram based on whether or not a specific variable has a value in the first bin.   I would like to be able to absolutely force the order of the variables in the bin.  For example, say I have three variables Me, You, and Them.   Me_df<-data.frame(Data = c(1:15), Person = "Me") You_df<-data.frame(Data = c(10:20),
2010 Nov 04
5
ggplot output
Dear All, I have this script: dat <- data.frame(Month = hstat$Date,C_avg = hstat$C.avg,C_stdev = hstat$C.stdev) ggplot(data = dat, aes(x = Month, y = C_avg, ymin = C_avg - C_stdev, ymax = C_avg + C_stdev)) + geom_point() + geom_line() + geom_errorbar() dat <- data.frame(Month = hstat$Date,K_avg = hstat$K.avg,K_stdev = hstat$K.stdev) ggplot(data = dat, aes(x = Month, y = K_avg,
2009 Jul 23
1
Another question on gplot
I am getting following strange error : library(sn) library(ggplot2) dat1 <- as.matrix(rsn(1000, 0, 1, 0))[,1] ggplot() + geom_histogram(aes(x = dat1, y = ..density.., fill = ..count..)) + xlab("Distribution") + scale_y_continuous("") Error: No data for layer Can anyone please tell me why it is coming? -- View this message in context:
2011 Jan 10
1
Basic ggplot question
Hello R-Group, I am trying plotting simple time-series with ggplot2 because the output looks better and I've heard its richer in features. I have the following dataset. > dput(dat) structure(list(Date = structure(c(14970, 14971, 14972, 14973, 14974, 14977, 14978, 14979, 14980, 14981), class = "Date"), Close = c(5998.1, 5996, 6060.35, 6101.85, 6134.5, 6157.6, 6146.35, 6079.8,
2011 Jun 30
1
Italicized greek symbols in PDF plots
I know that this has been asked before in other variations but I just can't seem to figure out my particular application from previous posts. My apologies if I have missed the answer to this question somewhere in the archives. I have indeed looked. I am running Ubuntu 11.04, with R 2.12.1 and ESS+Emacs. For journal formatting requirements, I need to italicize all the greek letters in any
2009 Oct 06
1
ggplot2 applying a function based on facet
Look at the bottom of the message for my question #here is a little function that I wrote USGS <- function(input="discharge", days=7){ library(chron) library(gsubfn) #021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS) #02102908 is the Flat Creek Gauge (ftbrfcms) #02133500 is the Drowning Creek (ftbrbmcm) #02341800 is the Upatoi Creek Near Columbus (ftbn) #02342500 is
2010 Sep 07
3
Something similar to layout in lattice or ggplot
Hi, Is there a function similar to the layout function in base graphics in either lattice or ggplot? I'm hoping someone has written a function wrapper to the appropriate commands in grid that would make this easier :) Abhijit [[alternative HTML version deleted]]
2010 Oct 27
3
ggplot - unwanted sorted X values
Hi, I have this script: dat <- data.frame(X = halistat$Date,Y1 = halistat$avg,Y2 = halistat$stdev) ggplot(data = dat, aes(x = X, y = Y1, ymin = Y1 - Y2, ymax = Y1 + Y2)) + geom_point() + # points at the means geom_line() + # if you want lines between pints geom_errorbar() # error bars, Y1 - Y2 and Y1 + Y2 halistat$Date values: 29/1/10 21/2/10 30/3/10 30/4/10 30/5/10 In the resulted
2009 Sep 25
3
Problem on plotting TS using GGPLOT
Hi, I have following codes : library(zoo); library(ggplot2); library(plyr) dat <- rnorm(306); vv <- letters[1:6]; dat1 <- data.frame(dat, vv) dat2 = zooreg(rnorm(51), as.yearmon(as.Date("2000-01-01")), frequency=12) ggplot(dat1) + geom_line(aes(y=dat, x=index(dat2), colour=vv), group=vv, size = 1.3) However I got error while plotting them :
2020 Nov 24
2
Cambiar nombre de topic en análisis LDA
Buenas tardes Estoy haciendo un análisis LDA y me gustaría cambiar el nombre de los topics a la hora de visualizarlos y en vez de que se llamen 1,2,3...darles un nombre. ¿Es posible en este código? lda22 <- LDA(reviews_dtm, k = 22, control = list(seed = 1234)) lda22 %>% tidy() %>% group_by(topic) %>% top_n(10, beta) %>% ungroup() %>% mutate(term =
2010 Jun 28
2
Stacked Histogram, multiple lines for dates of news stories?
Dear colleagues, I have extracted the dates of several news stories from a newspaper data base to chart coverage trends of an issue over time. They are in a data frame that looks just like one generated by the reproducible code below. I can already generate a histogram of the dates with various intervals (months, quarters, weeks years) using hist.Date. However, there are two other
2009 Apr 10
1
png with ggplot on windows xp
Hi Group, I posted this question on the ggplot list and was advised to try here also. The code below produces a plot as a png and pdf. The pdf looks great, and I cannot make the png look this way. I've tried various combinations of height, width, and dpi, but it has not worked out so far. Any suggestions to make the png look like the pdf? I received a response that the problem does not occur