search for: scale_x_discrete

Displaying 20 results from an estimated 39 matches for "scale_x_discrete".

2011 Jun 08
3
How to suppress factor labels
I am using ggplot2 to make a boxplot that overlays a scatterplot: pp = qplot(time, error, data=times, size=I(1), geom="jitter", main=title, ylab="Error (min)", xlab="Time before ON (min)", alpha=I(1/10), color=times$runway, ylim=c(-30,40)) pp2 = pp + with(times, facet_wrap(~ runway, ncol=2)) print(pp2 + geom_boxplot(alpha=.5,
2011 Dec 04
1
Polishing my geom_bar for publication
...a<-ggplot(Final2, aes(x=spp, y=CPUE, fill=season)) + geom_bar(position=position_dodge()) + geom_errorbar(aes(ymin=CPUE-cpue.se, ymax=CPUE+cpue.se), size=.3, width=.2, position=position_dodge(.9)) + xlab("Species") + scale_x_discrete(breaks=c("100","102","107","88","90","91","92","93","94","96","98","99"), labels=c("WINTER","SPINYTAIL","BIGELOW'S","SKATES (NS)",&quot...
2011 Jun 10
1
Double x grid in ggplot2
...ot;Error (min)", xlab="Time before ON (min)", alpha=I(1/10), ylim=c(-30,40), geom="jitter") + facet_wrap(~ runway, ncol=2) + geom_boxplot(alpha=.5, color="blue", outlier.colour="green", outlier.size=1) + scale_x_discrete(breaks = seq(from=0, to=60, by=10)) print(pp) But I think ggplot2 is getting confused about factors versus numbers > sapply(dfsub,class) time error runway flight "numeric" "numeric" "factor" "factor" because when I do the plot, th...
2010 Jun 30
2
ggplot qplot bar removing bars when truncating scale
...new job"))) colnames(data)=c("mean","variable","Q") data[,1]=mean #Plot p=qplot(data=data,data$Q,data$mean,fill=data$variable,geom="bar",stat="identity",position="dodge",binwidth=2,ylab=NULL,xlab=NULL,width=.75) #With 0-6 Scale p + scale_x_discrete(expand=c(0,0)) + scale_y_continuous(limits=c(0,7),breaks=seq(from=0,to=6,by=.5),expand=c(0,0)) + coord_flip() + scale_fill_manual(values=c("darkmagenta","lightgoldenrod1")) + opts( panel.background = theme_rect(colour = NA), panel.background = theme_blank(), panel.gr...
2009 Jan 22
1
ggplot seq
...aks but it sorts the seq() in ascending order. Is there a way to workaround it? see scale_x_continuous below: boxP <- ggplot(WFBox, aes(Week, FL,group=Week)) boxP + geom_boxplot(outlier.colour="pink",outlier.size=3,outlier.shape=21,fill="goldenrod",colour="blue") + scale_x_discrete(breaks=c(seq(27,51,2),seq(1,25,2))) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA
2012 Mar 15
2
Ggplot barchart drops factor levels: how to show them with zero counts?
Hello, When plotting a barchart with ggplot it drops the levels of the factor for which no counts are available. For example: library(ggplot) mtcars$cyl<-factor(mtcars$cyl) ggplot(mtcars[!mtcars$cyl==4,], aes(cyl))+geom_bar() levels(mtcars[!mtcars$cyl==4,]) This shows my problem. Because no counts are available for factorlevel '4', the label 4 dissapears from the plot. However, I
2010 Aug 11
2
help to polish plot in ggplot2
...rp1,grp2,grp3,grp4) dat.m <- melt(mydat) p <- qplot(1,value, data=dat.m, geom="bar", xlab="",ylab="Percentage of eco change",stat="identity",fill=variable, position="dodge") p + coord_flip()+ facet_grid(category ~ ., space="free")+scale_x_discrete(breaks=c(2,4))+opts(strip.text.y = theme_text(hjust = 0)) Now the only modification I need from this plot is that I want the grid labels (text) on the left hand side with right justification and white background. My prospective plot should have labels like the the plot generated by the codes belo...
2012 Jan 03
4
Changing X axis of ggplot
...his case, the chron object was created with the times function. It is only a time (H:M:S) with no date attached. The plot shows up fine, but the X axis labels are 0.0 through 1.0. How do I convert this to 0:00 through 23:59 (or whatever may be appropriate given the breaks)? My searches lead me to scale_x_discrete, but I am not clear if that's even the right function. Aren
2009 Oct 26
1
GGPLOT2 Different Layers Different X Values
...lues based on a date and then overlay a histogram also by date. The problem is that both data sets don't have exactly the same dates. So when I add the histogram, any dates that aren't already there from from the scatter plot just get tacked on at the end and are out of order. I tried using scale_x_discrete, but to no avail. Thanks, Jon -- View this message in context: http://www.nabble.com/GGPLOT2-Different-Layers-Different-X-Values-tp26069893p26069893.html Sent from the R help mailing list archive at Nabble.com.
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 can't get this to work. I want to arbitrarily define the breaks/labels because I want to be able t...
2011 Jun 21
2
qplot/ggplot2 Questions
...geom="percent" or something that would do it automatically? Code: library(ggplot2) x<-R.GUI.Poll$Poll q<-qplot(x, main="Most Popular R-GUIs", ylab="Votes Received", xlab="R GUI", fill=I("blue"), colour=I("black"))+coord_flip()+scale_x_discrete( limits=c("R via a data mining tool plugin","Rexcel","JGR (Java Gui for R)","RKWard","Revolution Analytics","R Commander","Rattle GUI","ESS (Emacs Speaks Statistics)","Tinn-R","RapidMiner R extension&quot...
2012 Feb 04
1
GGPLOT2: Distance of discrete values of from each end of x-axis
Hi Group, I have been working with the code below. Everything seems to work okay, except that the discrete values on the x-axis are far from each end of the graph. I've tried several things including changing the discrete values and playing with the limits, but can't get it to work. I tested this on simulated data and do not have the same problem, so I guessing it is how I'm
2012 Jul 01
4
geom_boxplot
Also, it is possible to change "ylim" also? 2012/7/1 li li <hannah.hlx@gmail.com> > Dear all, > I have a few questions regarding the boxplot output from the > "geom_boxplot" function. > Attached is the output I get. Below are my questions: > > 1. How can I define the xlab and ylab myself? > Also I would like to remove
2010 Oct 19
3
plot CI and mortality rate
Dear R Users: I have the individual mortality rate and 95% CI of 100 hospitals, how to do the plot with the individual hospital in the Yaxis, and the mortality rate and 95% CI in the Xais and a overall mean as a reference line? Thanks and regards, Xin [[alternative HTML version deleted]]
2012 Jun 27
0
ggplot2 ordering in a faceted dotplot.
...coord_flip() + opts(title = "Absenteeism among Canadian employees \n 2011", legend.position="none") + scale_y_continuous("Annual number of days absent") + scale_x_discrete("Industry Groups") p # faceted dotplot for 2001 & 2011 mdata <- melt(mdata, id=c("group")) # function to set facet labels. mf_labeller <- function(var, value){ value <- as.character(value) if (var=="variable") { value[value=="a...
2012 Dec 21
2
ggplot2: setting martin
Is it possible to set the margin in ggplot2 to a fixed size? I create many plots, and I want them to look the same. Especially I want them to have the same left margin. But P<-ggplot()+geom_bar(aes(c("short label1","short label2"),runif(2)))+coord_flip() P<-creates a plot with another margin as ggplot()+geom_bar(aes(c("very very very very long
2013 May 14
1
Tamaño plots y calidad en grafico ggplot
...eom_vline(xintercept = k, colour="#0000FF20", lwd=5)+ geom_rect(xmin=-2,xmax=-1, mapping=aes(NULL, NULL, ymin=inicio[3:4],ymax=fin[3:4], fill=Niveles[3:4]), alpha=1, data=niveles)+ geom_text(data=niveles, aes(x=-1.4, y=inicio[3:4]+(fin[3:4]-inicio[3:4])/2, label=Niveles[3:4], size=2)) + scale_x_discrete(labels=Jurisdiction)+ scale_y_continuous(breaks=seq(245, 305, 10))+ geom_errorbar(data=tabla, aes(y=Mean, ymin=Mean - 1.96*Mean.Error, ymax = Mean + 1.96*Mean.Error),col="gray40", width=0.3, size=1) + geom_point(data=tabla, aes(y=Mean), size = 3, colour ="gray30", pch=16) + lab...
2019 Feb 08
2
Ordenar eje en ggplot
Buenas tardes, supongo que será muy sencillo, pero estoy empezando en r y no acabo de dar con la tecla. Estoy intentando hacer un gráfico de líneas con ggplot pero el eje x me sale con los meses ordenados alfabéticamente (abril, agosto, diciembre?) en vez de su orden natural (enero, febrero, marzo?.). Agradezco cualquier pista. Un saludo Jesús
2018 Feb 15
2
Putting 733 discrete categories on Y-axis in qqplot2 as they are
Hi all; I have 733 discrete categories that will go on y-axis in ggplot2. I used the following command to put the name of x-axis. scale_x_discrete (limits = c("SI", "HOMAIR", "AIR","HOMAB","SG","DI","FI","FG")) Since there are only 8 categories on x it was easy to do. Is there any way to do the same for 733 discrete categories for y-axis. Essentially I did not wa...
2012 Aug 04
2
ggplot2 boxplot help
Hello, I have a data set that looks like this: name G-ID test_id g-id g 1 00077464 C_068131 C_068131 OC_068131 - 2 00051728 C_044461 C_044461 OC_044461 - 3 00058738 C_050343 C_050343 OC_050343 - 4 00059239 C_050649 C_050649 OC_050649 - 5 00001761 C_000909 C_000909 OC_000909 - 6 00005119 C_002752 C_002752 OC_002752 - locs