search for: scale_x_d

Displaying 14 results from an estimated 14 matches for "scale_x_d".

Did you mean: scale_x
2010 Apr 21
1
ggplot and scale_x_date
Hi all, I have a question about setting arbitrary breaks/labels when using GGPLOT and date/time data on the x-axis. I want to specify the breaks/limits arbitrarily rather than using scale_x_date(major = 'blah'), much like when arbitrarily defining breaks/labels using scale_x_discrete(breaks = blah, labels = blah) I have tried variants such as: scale_x_date(major = seq(from = as.Date('2000-01-01'), to = as.Date('2009-01-01'), by = 'months')); etc but c...
2012 Jan 06
1
ggplot using scale_x_date gives Error in seq.int(r1$year, to$year, by)
...Yield 9.7 304 2011-12-23 CDS Spread 580.1 305 2011-12-30 CDS Spread 576.9 306 2012-01-06 CDS Spread 573.6 > gp<-ggplot(g,aes(x=Date,y=value,group=variable,lty=variable)) +geom_line() > gp > #THIS WORKS FINE (BUT AXIS LABELLING NOT VISIBLE WITH MORE DATA, HENCE I WOULD LIKE TO USE SCALE_X_DATE) > gp<-gp+ scale_x_date() > gp Error in seq.int(r1$year, to$year, by) : 'from' must be finite In addition: Warning messages: 1: In get(x, envir = this, inherits = inh)(this, ...) : NAs introduced by coercion 2: In min(x) : no non-missing arguments to min; returning Inf 3: In...
2012 Mar 05
2
ggplot2
...uot; "2.14.0" This example is taken from pg 101 in the ggplot book. > plot <- qplot(date, psavert, data = economics, geom = "line") + > ylab("Personal savings rate") + geom_hline(xintercept = 0, colour = > "grey50")' > plot + scale_x_date(major = "10 years") Error in continuous_scale(aesthetics, "date", identity, breaks = breaks, : unused argument(s) (major = "10 years")> plot + scale_x_date(limits = as.Date(c("2004-01-01", "2005-01-01")),format = "%Y-%m-%d") >...
2011 Dec 07
2
plotting and coloring longitudinal data with three time points (ggplot2)
...call it my working example), library(ggplot2) df <- data.frame( ?date = seq(Sys.Date(), len=104, by="1 day")[sample(104, 52)], ? patient = factor(rep(1:26, 2), labels = LETTERS) ) df <- df[order(df$date), ] dt <- qplot(date, patient, data=df, geom="line") dt + scale_x_date() df[ which(df$patient=='E'), c("patient", "date")] But, if I have three time points, R, for some reason I do not yet understand, add the two second time points in some funny way. Finally, when that is solved; how do I colorize the different parts of the line so the...
2007 Jun 08
3
Barplots: Editing the frequency x-axis names
Hi I have a timeSeries object (X) with monthly returns. I want to display the returns with a barplot, which I can fix easily. But my problem is labaling the x-axis, if I use the positions from the timeseries It gets very messy. I have tried rotating and changing the font size but it doesn't do the trick. I think the optimal solution for my purpose is too only display every second or third
2009 Jun 01
2
ggplot2 and Date class
...ple 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, price, data=df, geom="line") + opts(aspect.ratio = 1/4) > dt + scale_x_date() Error in aesdefaults(data, .$geom$default_aes(), compact(.$mapping)) : could not find function "as_df" My ggplot2 package is up to date. Am I missing something else, maybe in my default aesthetics? Thanks, Matt Frost
2023 Jan 13
1
Customise Plot tick label on time series plot using date series
...quot;zoo" time series dt_ts <- zoo(dt$cnt_charge_events, order.by = dt$time) # the x axis labels are right, quarterly date breaks are automatic # and plot the object dt_ts, not its second column dt_ts[,2] autoplot(dt_ts) + xlab("Daily") + ylab("Charge counts") # scale_x_date allows for custom breaks and labels, # here monthly breaks and the same labels format # with more axis labels they need to be rotated in order to be readable # (as a side note I have displayed the axis labels in one instruction only) autoplot(dt_ts) + labs(x = "Daily", y = "Cha...
2008 Jul 03
1
ggplot2: scaling and tick mark of x-axis
...;2 weeks") var<-rnorm(27, 10000, 2500) err<-rnorm(27, 3000, 1000) df<-data.frame(cbind(Date, var, err)) library(ggplot2) g <- ggplot(df, aes(x=Date, y=var, min=(var - err), max=(var + err))) g1 <- g + geom_line() + geom_point() + geom_errorbar(width=2, linetype=1) g2<-g1+scale_x_date(format="%d.%b.%Y") It works, however i am not satisfied with the output. I would like to have the x-axis starting at "2006-08-01" and ending at "2007-08-31" with tick marks and labels and each 1st of the months. I managed to do this with a trellis plot by defini...
2023 Jan 13
1
Customise Plot tick label on time series plot using date series
Hi, I would like to customise my date series on the plot. I tried this: dt_ts <- ts(dt) autoplot(dt_ts[,2]) + ylab("Charge counts") + xlab("Daily") but the label is not the date series. Tqvm for any help given. > dput(dt) structure(list(time = c("1/1/2014", "2/1/2014", "3/1/2014", "4/1/2014", "5/1/2014",
2010 Feb 03
2
ggplot2/qplot question regarding reducing the no. of x-axis labels
All: I am using the command: qplot(date,MAE,data=data,facets=INTERVAL~type) which works fine except that the dates for my date axes are crunched together so much that they are unreadable. I can not find an option that I can set that will automatically reduce the x-axis labels to fit the available space. regards to all? -- Thomas E Adams National Weather Service Ohio River Forecast Center
2016 Dec 21
2
Modificación de ejes con ggplot
Hola, Estoy haciendo unas gráficas de evolución temporal con el paquete "ggplot" y me he encontrado con una dificultad que no logro resolver. En el eje "x" tengo las fechas y en el "y" la concentración de un parámetro. En el eje x me sale de forma predeterminada intervalos en años (de 2012 a 2016), y unicamente salen 3 etiquetas (una cada 2 años). Necesito
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 Nov 14
2
formatting dates in axis labels (ggplot2)
...quot;, color="black") + # set scale so area ~ Deaths scale_y_sqrt() # A coxcomb plot = bar chart + polar coordinates cxc1 + coord_polar(start=3*pi/2) + opts(title="Causes of Mortality in the Army in the East") + xlab("") # why doesn't this work? cxc1 <- cxc1 + scale_x_date(format="%b %Y", major="months") cxc1 stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this. OK, I tried formatting Date first, in different ways. Each time, I get a graphical result, but I don't know how to use format() for dates to make t...
2010 Oct 05
2
is there a way to avoid "traveling" grid?
Hello! If you run the whole code below, it'll produce a stacked diagram. And it looks good - because the tick-marks are aligned with the grid. However, if I stretch the graph window, grid becomes misaligned with the tickmarks. Or, rather, it seems aligned for the first and the last tick mark, but not for tickmarks in between. Can it be addressed? Thank you! Dimitri ### Creating a data set