search for: geom_segment

Displaying 20 results from an estimated 47 matches for "geom_segment".

2009 Aug 10
2
ggplot: colours to geom_segments
Just as an exercise I am tying to add colours to a geom_segment command. I can get one colour but not a sequence of colours. Can anyone suggest how I can get the green lines in the plot below to be different colours? I thought I could use a palatte of colours but that did not seem to work. Thanks ============================================================...
2009 Jul 23
1
ggplot2 : commands on one line vs two lines.
...60L)), .Names = c("Name", "Pcode", "Area"), class = "data.frame", row.names = c(NA, -13L)) library(ggplot2) p <- ggplot(provs, aes(x = 0, xend = Area, y = Pcode, yend = Pcode)) # commmand below is on one line pa <- p + geom_point(aes(Area, Pcode)) + geom_segment() + xlab("Area") pa pa1 <- p + geom_point(aes(Area, Pcode)) + geom_segment() + xlab("Area") # Error in +xlab("Area") : invalid argument to unary operator # commmand below is on one line pb <- p + geom_point(aes(Area, Pcode)) + geom_segment() + labs...
2013 Mar 15
0
ggplot2, arrows and polar coordinates
Dear R users, The following issue has been already documented, but, if I am not mistaken, not yet solved. This issue appears while trying to plot arrows with "geom_segment" (package ggplot2), with polar coordinates ("coord_polar"). The direction of some arrows is wrong (red rectangle). Please find herewith an example. Does someone know how to deal with that issue? Best Regards, Pascal Oettli #------------------------------------------------------...
2012 Dec 12
1
ggplot: geom_line with only pairs of points connected
...ple: df <- data.frame(cat=LETTERS[1:4],num=rnorm(4)) ggplot(df, aes(x=cat, y=num)) + geom_point() + geom_line(aes(x=as.numeric(cat), y=num)) In this plot, I would like to be able to make the second line (the one between B and C) not be there. What I've come up with is this (instead using geom_segment): df <- data.frame(cat=LETTERS[1:4],num=rnorm(4)) dfdf <-cbind(df[seq(from=1,by=2,along.with=df),],df[seq(from=2,by=2,along.with=df),]) names(dfdf) <- c("cat","num","cat2","num2") ggplot(df, aes(x=cat, y=num)) + geom_point() + geom_segment(aes(x=ca...
2009 Nov 17
2
Lattice plot
...anel, a similar result could be achieved for the data x2: > x2 chr start1 end1 meth positive 1 1 10 20 1.5 y 4 1 35 70 3.0 y 5 1 120 140 -1.3 n 6 1 180 190 0.2 y ## Code courtesy of BAPTISTE AUGUIE library(ggplot2) ggplot(data=x2) + geom_segment(aes(x=start1, xend=end1, y=meth, yend=meth)) - Can I get lattice to do a similar graph for the panels? thanks! [[alternative HTML version deleted]]
2017 Dec 04
1
ggtern and bquote...
...e.de> wrote: > > reading ?plotmath you might notice that "_" isn't the propper syntax for > subscripts. This will work: > > ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yend = > c(.30,.50,.0),zend =c(.0,.50,0.3)))+ > geom_point()+ > theme_showarrows()+geom_segment(size=.5)+ > geom_text_viewport(x=c(.45,.27,.37),y=c(.32,.29,.22),label=c("P[a]","P[b]","P[c]"), > parse=TRUE) > > cheers. > > Am 04.12.2017 um 15:37 schrieb Levent TERLEMEZ via R-help: >> Hi, >> >> My example code is this; >&gt...
2017 Dec 04
1
YNT: ggtern and bquote...
Hi, My example code is this; x11<-data.frame(A=c(.6,.6,.6),B=c(.20,.20,.20),C=c(0.20,.20,.20)) ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yend = c(.30,.50,.0),zend =c(.0,.50,0.3)))+ geom_point()+ theme_showarrows()+geom_segment(size=.5)+ geom_text_viewport(x=c(.45,.27,.37),y=c(.32,.29,.22),label=as.expression("P_a","P_b","P_c")) ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yend = c(.30,.50,.0),zend =c(.0,.50,0.3)))+ geom_point()+ theme_showarrows()+geom_segment(size=.5)+ g...
2017 Dec 04
0
YNT: ggtern and bquote...
reading ?plotmath you might notice that "_" isn't the propper syntax for subscripts. This will work: ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yend = c(.30,.50,.0),zend =c(.0,.50,0.3)))+ geom_point()+ theme_showarrows()+geom_segment(size=.5)+ geom_text_viewport(x=c(.45,.27,.37),y=c(.32,.29,.22),label=c("P[a]","P[b]","P[c]"), parse=TRUE) cheers. Am 04.12.2017 um 15:37 schrieb Levent TERLEMEZ via R-help: > Hi, > > My example code is this; > > x11<-data.frame(A=c(.6,.6,.6),B=c(....
2007 Sep 27
3
Plotting from different data sources on the same plot (with ggplot2)
Hello everyone (and Hadley in particular), I often need to plot data from multiple datasets on the same graph. A common example is when mapping some values: I want to plot the underlying map and then add the points. I currently do it with base graphics, by recording the maximum region in which my map+point will fit, plotting both with these xlim and ylim parameters, adding par (new=T)
2011 Feb 23
1
ggplot2 directional line type?
I'm doing a path plot with ggplot2, the result is looking very nice, but I want to give some indication of which direction the lines are going. I thought of using colour gradients, but it doesn't look right. What would be ideal is a line type that indicated direction, something like ">>>>>>>". Is there any way to achieve this? Or can anyone suggest another
2016 Apr 18
0
Add a vertical arrow to a time series graph using ggplot and xts
Hi, I am trying to add a vertical arrow (from top to bottom or from bottom to up) to a time series plot using ggplot2 and xts. It seems that the vertical line command "geom_vline" does not work for this purpose (Correct me if I am wrong). I try the command "geom_segment" as follows, but I got an error message at the last line "Error: Invalid input: date_trans works with objects of class Date only". Sometimes the error message occurs when I run the program, sometimes it does not occur until I call the plot "p1". How could I add a verti...
2024 Jan 11
4
arrow on contour line
Hello, I am drawing contour lines for a function of 2 variables at one level of the value of the function and want to include a small arrow in any direction of increase of the function. Is there some way to do that? Below is an example that creates the contour lines. How do I add one small arrow on each line in the direction of increase of the function (at some central point of the contour
2019 Jul 18
4
Gráfico tiempos de supervivencia
...---------- set.seed(20) DATOS <- data.frame ( ID = c (1:10) , TIEMPO = sample(1:40, 10, replace=F) , DEF = as.factor(sample(c(0,1), 10, replace=T)) ) library(ggplot2) ggplot( data = DATOS ) + geom_point( aes(x = TIEMPO, y = ID , shape = DEF, color = DEF), size = 5 ) + geom_segment( aes( x = 0, y = ID, xend = TIEMPO, yend = ID ) ) + guides(colour = FALSE) + labs(shape = 'LEGEND') + scale_y_discrete() + theme_minimal() #----------------- E incluso puedes reproducirlo usando fuentes parecidas a la de los comics con el paquete "xkcd". Saludos,...
2012 Feb 29
1
ggplot2 dot chart-start at zero
...t;, "Potatoes", "Rice"), Expense = c(25L, 49L, 34L, 15L)), .Names = c("Food", "Expense" ), class = "data.frame", row.names = c(NA, -4L)) p <- ggplot(xx, aes(Expense, Food)) pa <- p + geom_point(aes(Expense, Food, colour=Food)) + geom_segment(aes(x = 0, xend = Expense, y = Food, yend = Food,colour=Food)) + opts(legend.position = "none") pa # so far so good p1 <- pa + scale_x_continuous(expand=c(0,0)) #======================================= R version 2.13.1 (2011-07-08) Platform: i686-pc-linux-gnu...
2017 Dec 04
2
ggtern and bquote...
>>>>> peter dalgaard <pdalgd at gmail.com> >>>>> on Mon, 4 Dec 2017 14:55:19 +0100 writes: >> On 4 Dec 2017, at 11:58 , Levent TERLEMEZ via R-help >> <r-help at r-project.org> wrote: >> >> Dear Users, >> >> What is the proper way to write symbol, superscript, >> subscript in
2011 May 20
2
Variability plot in R
Is there a package in R that can do a variability plot? A variability plot is a kind of categorized dot plot. (If there is a lot of data in each category, box plots are used rather than dot plots.) Usually, the categories are factor level combinations. All the dot plots appear in the same window; below the x-axis a hierarchy of factors shows which dot plot corresponds to which factor-level
2008 Nov 21
0
ggplot2 - version 0.8
...rid: new support for varying scales in rows and columns * facet_wrap: new faceter which wraps a 1d ribbon of panels into 2d, in a similar way to lattice * geom_bin: gains a drop argument to control whether or not 0 count bins should be removed * geom_path and geom_line gain arrows argument to match geom_segment * ggsave now checks that you are using it with a ggplot plot * ggsave now produces postscript files that are suitable for embedding in another document * ggsave now recognises the .svg extension and will produce svg files, if possible * ggsave: default dpi changed to 300, on the assumption that you...
2008 Nov 21
0
ggplot2 - version 0.8
...rid: new support for varying scales in rows and columns * facet_wrap: new faceter which wraps a 1d ribbon of panels into 2d, in a similar way to lattice * geom_bin: gains a drop argument to control whether or not 0 count bins should be removed * geom_path and geom_line gain arrows argument to match geom_segment * ggsave now checks that you are using it with a ggplot plot * ggsave now produces postscript files that are suitable for embedding in another document * ggsave now recognises the .svg extension and will produce svg files, if possible * ggsave: default dpi changed to 300, on the assumption that you...
2011 Aug 16
5
ggplot2
Cordial saludo. Estoy tratando de hacer un gráfico con qplot de la libreria ggplot2, en ella tengo dos vectores un "x" y un "y" de tal forma que el gráfico seria qlot(x,y...), ahora quiero añadir un nuevo gráfico con un vector "y1" pero en el mismo cuadro algo parecido a lo que hace la funcion "lines", es decir, que en en mismo cuadro me queden las dos
2012 Jul 13
2
alternate tick labels and tick marks with lattice xyplot
Hi, I would like to use xyplot to create a figure. Unfortunately, I cannot find documentation in xyplot to specify alternating the x-axis tick labels with the x-axis tick marks. I can do this with the regular R plot function as follows. #A small version of my data looks like this data<-data.frame(matrix(ncol=3,nrow=12)) data[,1]<-rep(c(1,2,3),c(4,4,4)) data[,2]<-rep(c(1,2,3,4),3)