search for: scale_x_continuous

Displaying 20 results from an estimated 86 matches for "scale_x_continuous".

2012 Feb 29
1
ggplot2 dot chart-start at zero
...plot in ggplot2 with a solid line from the y-axis to the dot, something I first saw in Cleveland's 1984 book What I would like is to have the graph start at zero on the x-axis but leave some space on the right side of the plot area. I assumed that I should be able to do this with expand() in scale_x_continuous() but either I'm wrong or just don't understand what expand() is doing. So far, I see that scale_x_continuous(expand=c(0,0)) removes the space on the right and left. but I don't understand how to just get the left only to disappear. Any help would be appreciated Code below #========...
2013 Mar 25
2
Plot Matrix with Data
...               labs(x = "MHz", y = "Threshold", fill = "Duty Cycle") +                   geom_raster(alpha=1) +                   scale_fill_discrete(h.start=1,breaks=c(20,30,40,50,60,70,80,90),labels=c(20,30,40,50,60,70,80,90),fill="red") +                   scale_x_continuous(expand = c(0, 0)) +                   scale_y_continuous(expand = c(0, 0)) # End of code part What I wanted to do is to print the values below 20, with an x color between 20-30, with a y clor between 30-40, with a z color and so on.... I would not care now for the color palette. Any wou...
2008 Jun 04
1
ggplot questions
Hello, A few questions about the following examples: 1. Why do the two plotting versions not produce the same result? 2. Is the 'scale_x_continuous' (or *_y_* or *_*_discrete) geom the best way to setup grids (as in visual guide-lines) in polar (or for that matter, any) coordinate system? 3. Why do these commands appear to generate 3 plot pages each? 4. Perhaps more questions to follow ;-) ### the data test <- structure(list(oplt = c(1...
2010 Jan 18
3
add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine
Hi Ruser I'm trying to replicate some SAS code. I have to add a spline to my longitudinal spaghetti plot. I have the plot, but I can't add the spline, a overall trend line. In the SAS code they use the command 'I=SM50S' and I would prefer something similar. I?m using R 2.10.1 on windows XP? I have made this working example. tolerance.pp <-
2011 Nov 15
2
break error bars in ggplot2
...I get an error when the scale limits are narrower than the boundaries of the error bar and hence the CIs are not plotted. library(ggplot2) df <- data.frame(resp=c(1,2), k=c(1,2), se=c(1,2)) ggplot(df, aes(resp,y=k)) + geom_point() + geom_errorbarh(aes(xmax = resp + se, xmin = resp - se)) + scale_x_continuous(limits=c(-1,3)) Is there a way to plot the errorbars anyway? Setting xmax to the scale limit is not so good, I guess, because you couldn't determine whether the CI is wider than the scale limits or not. Thanks a lot, Best, Felix Dr. rer. nat. Dipl.-Psych. Felix Fischer Institut für Sozialm...
2008 May 12
1
Converting qqplot2 qplot() to grammar?
...ng these please let me know) I've come up with the following but it is not behaving the same way as the qplot above: ggplot(data = somdf, mapping = aes(x = pixX, y = pixY)) + layer(data = somdf, geom = "tile", fill=rgb) + scale_y_continuous(name=" ",breaks=" ") + scale_x_continuous(name=" ",breaks=" ") + scale_fill_identity() + coord_cartesian() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY,margins=FALSE) The result is a plot where all tiles are filled with grey50, and not the data values. I've also tried this variation with the same results:...
2008 Dec 24
2
ggplot2 Xlim
...e I use this code: i <- qplot(ForkLength,Number,data=FL,geom="bar") i + geom_bar(colour="blue",fill="grey65") # too crowded FL_dat <- ggplot(FL,aes(x=ForkLength,y=Number)) + geom_bar(colour="green",fill="grey65") FL_dat + scale_x_continuous(limits=c(20,170)) # Can't see anything FL Number 29 22.9 30 63.4 31 199.3 32 629.6 33 2250.1 34 7452.5 35 19352.9 36 17655.5 37 13020.6 38 5856.0 39 2039.4 40 1261.2 41 780.2 42 826.6 43 739.0 44 608.2 45 694.3 46 599.5 47 690.4 48 762.9 49 594.6 50 771.7 51 695.3 52 784.5 53 780.1 54 823....
2012 Dec 12
1
Problems with plot maps
...ot;ggplot2") library(cshapes) cshp.data <- cshp() map <- cshp.data[cshp.data$COWCODE==369,] map_mp<- list( geom_polygon(aes(long, lat, group = group), data = map, fill = "grey70", colour = "grey60", inherit.aes = FALSE, show_guide = FALSE), scale_x_continuous("", breaks = NULL, expand = c(0.02, 0)), scale_y_continuous("", breaks = NULL, expand = c(0.02, 0))) ggplot()+map_mp but I have such error "Error in recordGraphics(drawGTree(x), list(x = x), getNamespace("grid")) : invalid graphics state" What am I d...
2012 Nov 07
1
change colour of geom_step by scale_colour_manual
...),] , aes(x=AFF0, y=cum_rate_AFF0_pooled, group=trt_label))+ geom_step(aes(color=trt_label), direction="hv", size=5.0)+ scale_y_continuous("Rates of initiating first orientation flight", limits=c(0,0.6), expand=c(0,0), breaks=c(0,0.2,0.4,0.6)) + scale_x_continuous("Age of adults (days)", limits=c(0,16), expand=c(0,0), breaks=c(5, 10, 15)) + scale_colour_discrete(name ="Group", breaks=c("ace", "ctrlAM","met"), labels=c("acetone",...
2008 Mar 25
2
ggplot2 - facetting
...9;, 'Class3', 'Class4')))) plotdata2 <- plotdata2[order(plotdata2[,'group']),] plot0<-ggplot() layer1<-layer(data=plotdata2, mapping=aes_string(x='x',y='y'),geom='point', stat='identity') scaleY<-scale_y_continuous() scaleX <- scale_x_continuous() Facets<-facet_grid(group ~ .) plot1<-plot0+layer1 +scaleY + scaleX + facet_grid(group~.) plot1 I always get the error message: Error in check_formula(formula, varnames) : Formula contains variables not in list of known variables Thanks for any help you can provide. Best, Pedro
2011 Jul 10
2
grey colored lines and overwriting labels i qqplot2
...raph 2) until I overwrote the label title for the treatments and the colors came back (graph 1). I used these two commands: p=ggplot(data = test, aes(x = YEAR, y = TOTAL, colour = TREATMENT)) + geom_point() + facet_wrap(~country)+scale_colour_grey()+ scale_y_continuous("number of votes")+ scale_x_continuous("Years")+ scale_x_continuous(breaks=1:4) + scale_colour_hue(breaks='A', labels='label A')+ scale_colour_hue(breaks='B', labels='label B') How can I keep the grey scale, but avoid changing back to colors when using the scale_colour_hue command? http://r.7...
2009 Jan 29
2
Adding vertical line to histogram and qplot "stacked" plot
...ears I am leaning on your knowledge once again.  Is there any way to add a vertical line to a histogram and qplot "stacked" plot?  Here is my current attempt:   "qplot" approach attempt: qplot(Run, data = data_dataframe, breaks = breaks, fill = Temperature, main = short_title) + scale_x_continuous("Data") + scale_y_continuous("Freq") +  scale_fill_discrete("Temperature") + scale_fill_manual(values = c(LOW = "blue", AMB ="black", HIGH = "red")) +  geom_abline(v = HighVal, col = "dodgerblue3", lty="dotdash")     &...
2010 May 11
2
predicting without a model
...uot;data.frame", row.names = c(NA, -52L)) fall$week <- ordered(spring$week,levels=c(48:52,1:47)) fall$WEEK <- 1:52 fallmelt <- melt(fall,id=c("week","WEEK")) ggplot(fallmelt,aes(WEEK,value/1000,linetype=variable,colour=variable)) + geom_line(size=1)+ theme_bw() + ?scale_x_continuous(breaks=seq(1,52,3),labels=levels(fall$week)[seq(1,52,3)],) + ?opts(title="Fall Cumulative") + labs(y="Number of fish X 1,000",x="WEEK") ? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA
2011 Aug 31
2
ggplot2 to create a "square" plot
...code that does that is written below > print(v + geom_tile(aes(fill=dB))+ opts(axis.text.x=theme_text(size=20),axis.text.y=theme_text(size=20), axis.title.x=theme_text(size=25) , axis.title.y=theme_text(size=25), legend.title=theme_text(size=25,hjust=-0.4) , legend.text=theme_text(size=20)) + scale_x_continuous('km')  + scale_y_continuous('km')    ) as you can see from the picture below http://imageshack.us/photo/my-images/171/backupf.jpg/ this squared matrix is printed a bit squeezed with the height being bigger than the width. Would be possible somehow to print that plot by keeping...
2009 May 19
2
Coord_equal in ggplot2
...no avail. Any suggestions to solve this problem? library(ggplot2) ds <- data.frame(x = runif(1000, min = 0, max = 300000), y = runif(1000, min = 140000, max = 260000)) ggplot(ds, aes(x = x, y = y)) + geom_point() + coord_equal() ggplot(ds, aes(x = x, y = y)) + geom_point() + coord_equal() + scale_x_continuous(limits = c(0, 300000)) + scale_y_continuous(limits = c(140000, 260000)) Regards, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologi...
2016 Sep 02
2
Ayuda con gráfico típico de histograma más linea
...<- ggplot( datIn, aes( x = 1:nrow(datIn), y = frec)) + geom_bar(stat = "identity") + xlab(paste("Rango horas: ", datIn$hora[1], "-", datIn$hora[nrow(datIn)], sep = "") ) + ylab("Frecuencia") + scale_x_continuous( breaks = lab_x_idx, labels = lab_x ) + theme_minimal() sha_gg <- ggplot( datIn , aes(x = 1:nrow(datIn), y = Share)) + geom_line() + xlab(paste("Rango horas: ", datIn$hora[1], "-", datIn$hora[nrow(datIn)], sep = "") ) +...
2009 Dec 04
2
[ggplot2] Wind rose orientation
Aloha all, I love using ggplot. It took a while to get used to the grammar of graphics, but it is starting to get easy now that I am thinking in a more structured way. A question. I'm making a wind rose that I'd like to be oriented with due north straight up. I've discovered that the orientation is sensitive to how north is represented. When north is represented as 0,
2008 Apr 04
1
How to access the attributes of a ggplot?
Hi, I am having some hard time figuring how to access (and modify) the properties of an object created by ggplot. I found 'ggopts', but it only returns some of the properties. Say I want to get the x- and y-axis limits, the tickmark locations, legend current position, the legend box and background color and set them to new values. Are these properties easily accessible (and modifiable)
2008 Jun 17
1
ggplot facet spacing, wrapping
...g 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) + scale_y_continuous(limits = c(0,10)) and notice the 10's and the 0's on the respective Y axes are mushing each other. Is there a way to adjust the spacing of facets in a faceted plot? Likewise, what about wrapping, so that if I had say 20 or 30 facets it would make a g...
2008 Oct 23
1
Reversing xlim qplot
I would like to be able to reverse the xlim on qplot this is the code that I am using qplot(a[,"River.Mile"], a[,26] ,ylab=colnames(a)[26], xlab="RiverMile", xlim=rev(c(60, 216)))+geom_smooth()+scale_x_continuous(breaks=c(215,202,198,190,185,179,148,119,61), labels=c("215","202","198","190","185","179","148","119","61")) -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend o...