Displaying 20 results from an estimated 2000 matches similar to: "ggplot: colours to geom_segments"
2012 Feb 29
1
ggplot2 dot chart-start at zero
I am trying to create a simple dot-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
2020 Apr 01
2
añadir líneas verticales con ggplot
Buenos días, hago un mapa con ggplot:
world<-map_data('world')
windows();ggplot(legend=FALSE) +
...
geom_point(data=Data,aes(x=lon,y=lat,color=Clst),size=1.25) +
scale_color_manual(values=c("grey45","navy","skyblue","gold","green3","darkgreen"))
+
geom_path( data=world, aes(x=long, y=lat,group=group)) +
labs(title =
2012 Dec 12
1
ggplot: geom_line with only pairs of points connected
Dear list,
I've been using plotmeans {gplots} a lot before, and found the
"connect" argument to be quite useful.
I've moved to ggplot for several reasons, but would still like to
connect lines conditionally, somehow.
Is it possible to do?
Small example:
df <- data.frame(cat=LETTERS[1:4],num=rnorm(4))
ggplot(df, aes(x=cat, y=num)) + geom_point() +
2013 May 14
1
Tamaño plots y calidad en grafico ggplot
Hola a tod en s,
bueno, un poco al hilo de un mensaje anterior, reformulo la pregunta y
pongo código completamente reproducible, a ver si hay más suerte.
Estoy con un informe y hay que hacer algunos gráficos con datos
diferentes con ggplot2, y hay que poner el mismo tamaño para todos
ellos.
El problema es que R cambia automáticamente el tamaño del área de
trazado y el margen en función de
2009 Jul 23
1
ggplot2 : commands on one line vs two lines.
I have just started using ggplot2 and I seem to be doing something stupid
in writing ggplot2 commands on more than one line.
In the example below the commands on one line are working fine, but as
soon as I put them on two lines I get an error. Can any one point out
what I am doing wrong? It must be something blindingly simple.
Thanks
Example
2017 Dec 04
1
ggtern and bquote...
D'oh! Thanks for pointing this out. I blame caffeine depletion at the time...
-pd
> On 4 Dec 2017, at 15:48 , Eik Vettorazzi <E.Vettorazzi at uke.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
2009 Nov 17
2
Lattice plot
Hi,
I was trying to get a graph in lattice with the following data frame (7 rows, 5 cols):
chr start1 end1 meth positive
1 1 10 20 1.5 y
2 2 12 18 -0.7 n
3 3 22 34 2.0 y
4 1 35 70 3.0 y
5 1 120 140 -1.3 n
6 1 180 190 0.2 y
7 2 220 300 0.4 y
I wanted the panels to be organized by 'chr' -
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"))
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)
2010 Nov 09
1
ggplot2: facet_grid with different vertical lines on each facet
Hello,
I am plotting many histograms together using facet_grid in ggplot2. However,
I want to then add a vertical line to each histogram, or facet, each of
which vertical lines are at different x-values.
The following example adds all vertical lines to each facet:
ggplot(data,aes(values)) + geom_histogram() + facet_grid(.~variable) +
geom_vline(xintercept=c(5,10,15))
How can I add a vertical
2020 Jun 05
3
líneas sobre un mapa
Gracias Emilio y Jorge. Tengo que explicarlo mejor. Mostrando a una
audiencia cómo hacer un tipo de análisis, se hace un loop (abajo) que
analiza un mapa por regiones longitudinales. Tal y como está el script,
print(i) te indica la longitud por la que va (de 10º en 10º) pero me
gustaría que en vez de eso te fuese representando una línea vertical sobre
el mapa, que he representado previamente con
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
2020 Jun 05
2
líneas sobre un mapa
Buenos días ¿sabéis si hay alguna forma de añadir una recta vertical sobre
un mapa hecho previamente con ggplot? Lo que hago ahora es cargar
nuevamente el mapa con la línea añadida (una serie de líneas añadidas
secuencialmente en un loop) pero me gustaría que añadiese las líneas sin
cargar nuevamente el mapa.
Gracias,
Manuel
[[alternative HTML version deleted]]
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
2019 Jul 18
4
Gráfico tiempos de supervivencia
Hola,
Sí, lo puedes hacer de esta forma...
#-----------------
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 =
2013 Oct 11
1
behaviour of read.xls (gdata package) when worksheet usesuser-defined cells formats
(I'm afraid this post didn't reach the list on last Wednesday, here it is again )
hi R-list,
And sorry for my frenglish !
I am running R < Good Sport > release ( i386-w64-mingw32/i386 (32-bit) ) ) under Windows 7 Professional, Service Pack 1.
My perl executable is ActivePerl build 817 [257965] (i.e. version 5.8.8.817). Usually it is working fine.
Using the gdata ::read.xls
2009 May 27
1
ggplot2 adding vertical line at a certain date
library(ggplot2)
melt.updn <- (structure(list(date = structure(c(11808, 11869, 11961, 11992,
12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057,
13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418,
12600, 12631, 12753, 12996, 13057, 13149), class = "Date"), variable =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L,
2013 Jan 16
1
How to plot this simple step function?
Hi everyone,
I am trying to graph a step function in R Studio. I just learned about R
today and decided to try it! The following is what I want it to look like.
I graphed it using
x <- 0:5
y <- c(0, .2, .3, .6, .9, 1.0)
plot(x, y, type = "s")
And used Microsoft Paint to get it to how I wanted it to look, but I want to
do it in R Studio completely.
2009 Oct 09
1
Placing text in a ggplot
I am attempting to graph 12 months of temperatures, delineate the months with a vline and place the names of the months at the top of the graph.
So far I have gotten everything to work except the names, despite getting a similar graph to work yesterday the day before yesterday with Baptise A's help. Can anyone suggest what I am doing wrong. Data set is below code.
Thanks.
Code
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)