search for: ggplot

Displaying 20 results from an estimated 1444 matches for "ggplot".

Did you mean: ggplot2
2014 Jan 30
2
objecto ggplot
Carlos, mi intencion es entender el codigo: https://github.com/woobe/blenditbayes/blob/master/2013-06-street-level-crime/analysis.R Para luego hacer mi trabajo, algo similar a esto, pero adaptado a mi región. Si te fijas en las lineas 141-161, esta esto: ## Convert the base map into a ggplot object ## All added Cartesian coordinates to enable more geom options later on map.ggmap <- ggmap(map.base, extend = "panel") + coord_cartesian() ## Display a message cat("Creating a ggplot object ...\n") ## Various display settings for the ggplot object main.p...
2014 Jan 30
2
objecto ggplot
Para este ejemplo especifico: Deseo saber si tmp genera un objecto ggplot > tmp <- ggplot(mtcars, aes(x = hp, y=mpg)) + geom_point() El objecto o variable tmp, devuelve una lista y un gráfico, la clase dice ser ggplot, >class(tmp) [1] "gg" "ggplot" > typeof(tmp) [1] "list" El 30 de enero de 2014, 13:00, daniel...
2010 May 10
1
ggplot: Trouble with xlim() and discrete scales
I'm learning ggplot and am a little confused. Sometimes discrete scales work like I'd expect, and sometimes they don't. For example... This works exactly like one would expect: df<-data.frame(names=c("Bob","Mary","Joe","Bob","Bob")) ggplot(df,aes(names))+...
2006 Jul 03
1
ggplot: a new system for drawing graphics in R
ggplot provides a new system for drawing graphics in R, based on the Grammar of Graphics. It combines the advantages of both base and lattice graphics: conditioning and shared axes are handled automatically, and you can still build up a plot step by step from multiple data sources. It also implements a mo...
2006 Jul 03
1
ggplot: a new system for drawing graphics in R
ggplot provides a new system for drawing graphics in R, based on the Grammar of Graphics. It combines the advantages of both base and lattice graphics: conditioning and shared axes are handled automatically, and you can still build up a plot step by step from multiple data sources. It also implements a mo...
2006 Aug 02
4
ggplot facet label font size
How do I change the font size in the facet labels along the edges of the plot? For example (from the ggplot help file): p<-ggplot(tips, sex ~ smoker, aesthetics=list(x=tip/total_bill)) gghistogram(p) In this plot, the facet labels are "smoker: No", "smoker: Yes", "sex: Female", "sex: Male". What command can I use to reduce the font size of these labe...
2014 Jan 30
2
objecto ggplot
Daniel, Disculpa si no entiendo, pero, entonces un objecto ggplot en en realidad una función y no un gráfico El 30 de enero de 2014, 11:09, Marta Garcia <marta000garcia@gmail.com>escribió: > Sí, devuelve Error: No layers in plot, no le he agregado capas > por eso el error, la funcion me dice que es un gráfico > > > El 30 de enero de 2014,...
2012 Jul 02
5
ggplot: dodge positions
Dear all, I want to get a series of boxplots (grouped by two factors) and I want to overlay the original observations and the following code does almost what I want: library(ggplot) ddf <- data.frame(x=factor(rep(LETTERS[1:4], each=30)), y = runif(120,0,10), grp = factor(rep(rep(1:3, 10), 4))) ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() + geom_point() Yet the position of the points and the position of the boxes on the x-axis is not the same. I would like that the...
2009 Sep 11
1
bar chart with means - using ggplot
Like this? # example using qplot library(ggplot2) meanprice <- tapply(diamonds$price, diamonds$cut, mean);meanprice cut <- factor(levels(diamonds$cut), levels = levels(diamonds$cut)) qplot(cut, meanprice, geom="bar", stat="identity", fill = I("grey50")) dev.new() # create a new graph to compare with qplot # E...
2009 Feb 02
1
Broke ggplot...
It appears I broke ggplot in my script, but that maybe it is because the caffeine has worn off or maybe it is late in the day.   I thought I was beginning to understand ggplot, but I have encountered a silly little issue.   For some reason the following does not produce a histogram with fill due to the Person's charact...
2023 Nov 24
1
ggplot adjust two y-axis
Hi, I don't know the axis mecanism well enough in ggplot but using the original barplot function you can add an axis on the right using the axis function. Here is an example: test <- as.table(matrix(c(2,10,3,11), 2,2)) barplot(test, beside = TRUE, col = scales::brewer_pal(palette = 1)(2)) axis(4, at = c(0, 5, 10), labels = c(0,50,100)) -----Mess...
2009 May 27
2
Object-oriented programming in R
Dear R-users, I have very recently started learning about object-oriented programming in R. I am far from being an expert in programming, although I do have an elementary C++ background. Please take a look at these lines of code. > some.data = data.frame(V1 = 1:5, V2 = 6:10) ; > p.plot = ggplot(data=some.data,aes(x=V1, y=V2)) ; > class(p.plot) ; > [1] "ggplot" My understanding is that the object p.plot belongs to the "ggplot" class. However, a new class definition like > setClass("AClass", representation(mFirst = "numeric", mSecond = >...
2010 Nov 20
2
Merge two ggplots
Hello everyone. I am using ggplot and I need some help to merge these two plots into one. plot_CR<-function(x,y,agentid,CRagent){   library(ggplot2)     agent<-CRagent[[agentid]] # To make following expression shorter   ggplot((data.frame(x=CRX,y=CRY,sr=agent$sr)))+   geom_point(aes(x,y,colour=cut(sr,c(0,-10,-20,-30,-40,-50...
2011 Aug 15
1
ggplot in a function confusion!
Whats going on here? df<-data.frame(x=1:10,y=1:10) ggplot()+geom_point(data=df,aes(x=x,y=y)) ## this is the normal usage right? ggplot()+geom_point(data=df,aes(x=df[,1],y=df[,2])) ## but I can also feed it column indices ggplot()+geom_point(aes(x=df[,'x'],y=df[,'y'])) ## or column names. ## but if i wrap it in a function... plot.func...
2023 Nov 24
1
ggplot adjust two y-axis
...= c(0,500,1000,1500,2000,2500), labels = c(0,500,1000,1500,2000,2500)) Kind regards Sibylle -----Original Message----- From: Charles-?douard Gigu?re <ce.giguere at gmail.com> Sent: Friday, November 24, 2023 3:57 PM To: sibylle.stoeckli at gmx.ch; r-help at r-project.org Subject: RE: [R] ggplot adjust two y-axis Hi, I don't know the axis mecanism well enough in ggplot but using the original barplot function you can add an axis on the right using the axis function. Here is an example: test <- as.table(matrix(c(2,10,3,11), 2,2)) barplot(test, beside = TRUE, col = scales::brewer_...
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, ymin = K_avg - K_stdev, ym...
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...
2013 Jan 08
1
ggplot not showing all the years on the x-axis
Dear R helpers, I am currently having hard time fixing the values on the x-axis of a plot with ggplot: even though I have 12 years, ggplot plots only 3 of them. Here is my example: library(ggplot2) ii <- 2000:2011 ss <- rnorm(12,0,1) pm <- data.frame(ii,ss) tmpplot <- ggplot(pm, aes(x = ii, y = ss)) plot <- tmpplot + geom_line() plot In my case, ggplot reports on the year 2000, 200...
2023 Nov 24
1
ggplot adjust two y-axis
...1500,2000,2500), labels = c(0,500,1000,1500,2000,2500)) -----Message d'origine----- De?: sibylle.stoeckli at gmx.ch <sibylle.stoeckli at gmx.ch> Envoy??: 24 novembre 2023 11:27 ??: 'Charles-?douard Gigu?re' <ce.giguere at gmail.com>; r-help at r-project.org Objet?: RE: [R] ggplot adjust two y-axis Dear Charles-Edouard Thanks a lot. Yes indeed barplot sounds excellent. Unfortunately, the scale of the smaller axis is fixed, even If I am able to draw to axes. The idea is to expand the scale to the scale to the second axis for comparison. F1 <- as.table(matrix(c(50,11,6,1...
2010 Sep 10
3
ggplot bar geom: control the filling in the colour legend
Hi all, Is it possible to change the filling of the squares used to represent the colour legend in a bar plot with ggplot? in this example, fillings are raven black, I'd like them white. ggplot(diamonds, aes(clarity, colour = cut)) + geom_bar() Regards -- ------------- Benoit Boulinguiez Ph.D student Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes&quot...