Displaying 20 results from an estimated 600 matches similar to: "ggplot2: specifying legend titles"
2007 Jul 17
1
problem with length()
In the following, can anyone tell me why length(eee) returns 9? I
was expecting 15398, and when I try to add this vector to a data
frame with that many rows, it fails complaining that the vector is of
length 9. In what I thought was an identical situation with a
related dataset, the same code worked as expected.
> length(fff)
[1] 15398
> str(fff)
int [1:15398] 20010102 20010102
2003 Oct 17
7
datetime data and plotting
If I take the following simple data:
YEAR MONTH DAY WEIGHT.KG
2003 10 6 1.2
2003 10 12 1.2
2003 10 16 1.3
and format the date data and plot it:
dates <- strptime(paste(DAY,MONTH,YEAR),"%d%m%Y")
plot(c(min(dates),max(dates)),c(0,max(WEIGHT.KG)),
xlab="Date",ylab="Weight (kg)",type="n")
lines(dates,WEIGHT.KG)
points(dates,WEIGHT.KG)
I find that the
2007 Feb 25
8
Double-banger function names: preferences and suggestions
What do you prefer/recommend for double-banger function names:
1 scale.colour
2 scale_colour
3 scaleColour
1 is more R-like, but conflicts with S3. 2 is a modern version of
number 1, but not many packages use it. Number 3 is more java-like.
(I like number 2 best)
Any suggestions?
Thanks,
Hadley
2023 May 31
1
scale_colour_viridis en ggplot2
De acuerdo a Bard;
? scale_colour_viridis_d: Esta función utiliza la paleta de colores "viridis" en una escala continua, donde los colores varían de forma suave y continua. Es adecuada para representar datos en los que se desea resaltar las variaciones sutiles en los valores de la variable.
? scale_colour_viridis_c: Esta función también utiliza la paleta de colores
2013 Mar 07
3
ggpliot2: reordering of factors in facets facet.grid(). Reordering of factor on x-axis no problem.
Hi everyone (again),
before you all start screaming that the reordering of factors has been
discusse on several threads and is not particular to ggplot2, hear me out.
I can easily reorder my x-axis factor in facet.grid() in ggplot2. What I
cannot reorder are the factors represented on the strips. I can see that the
graphs are changing, so I am afraid of what it is I am doing. Why is ggplot2
2008 Jun 10
1
Sweave, ggplot2 and two-page figures
I am using Sweave to generate a document in which ggplot2 figures are
embedded. I am using the following code in a particular plot within a
subfloat environment:
<<qplotARbosreg, echo = FALSE, fig = TRUE>>=
print(qplot(bosday2, Arday2, data= arbostimearonlyNArm,
colour=factor(bos2), shape=factor(bos2), size=factor(cumARscore),
position="jitter", main="Days to BOS by
2008 Nov 17
1
ggplot2: using more than 6 symbols
I'm trying to plot multiple lines using different colours/symbols to
distinguish them. If I try to plot more than 6 lines, I get an error:
> ggplot( dat, aes(x=time,y=value,group=variable,shape=variable) ) +
geom_line()
Error: scale_shape can deal with a maximum of 6 discrete values, but
you have 9. See ?scale_manual for a possible alternative
I find this slightly confusing, as
2009 Jul 23
1
tweak a bit the legend wiht ggplot2
Hi all,
I've this ggplot2 graph
(http://www.4shared.com/file/120101043/f3e9350/isotherm.html).
I'd like to tweak the legend for the adsorbent part. I'd like to have full
square of the colors instead of the full circles.
I guess that I've to work on the scale_color_hue or fill somewhere but I
haven't found my way yet.
Here is my code to get the graph:
2008 Sep 10
1
ggplot2: edge outlines on points
The graphic design elements in ggplot2 are so well done for color
graphics. Thank you! For BW publication graphs, there are a few
options I would like to be able to tweak, but can't seem to find the
grob handles necessary OR the right plotting strategy. Here's one
problem I've been puzzling over:
Q> How do you plot points with a grey fill and a black outline around
the
2008 Nov 04
1
ggplot2 scatterplot matrix
#question is below data
library(ggplot2)
d <- (structure(list(Site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L,
4L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L,
7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 10L,
10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L,
12L, 12L, 12L), .Label =
2009 Apr 10
1
png with ggplot on windows xp
Hi Group,
I posted this question on the ggplot list and was advised to try here
also. The code
below produces a plot as a png and pdf. The pdf looks great, and I cannot
make the png look this way. I've tried various combinations of
height, width, and dpi, but it has not worked out so
far. Any suggestions to make the png look like the pdf? I received a
response that
the problem does not occur
2011 Jul 10
2
grey colored lines and overwriting labels i qqplot2
I created this graph in ggplot and added ablines to the different facets by
specifying with subset commands. As you might see, there are still a few
issues.
1.) I would like to have the diamonds in a grey scale instead of colors. I
accomplished this (see graph 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 =
2013 Sep 18
1
ggplot2: changing strip text in facet_grid and a legend text problem
Hi,
Dummy data script and scripts are attached below.
I would like to change the plot to look like this:
2011 Jan 06
1
Help spruce up a ggplot graph
Given the data structure below and the call to ggplot2, how can I increase the size of the axis scale points, the line weight, and the size of the legend?
ddata <-structure(list(year = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("2003", "2007"), class = "factor"),
area = structure(c(7L, 6L, 1L, 2L, 3L, 4L, 5L, 7L, 6L, 1L,
2008 Feb 05
0
xYplot, error bars, log scale
I'm new to Hmisc and trying to get the following to work, but if I un-
comment the y-scale list (in order to get a log-scale for the hazard
ratio), the error bars become strangely large. The dataframe is
simply ODS output from TPHREG in SAS. Can someone point me towards
what I'm sure is a naive error? Many thanks!
tphreg1_parameterestimates1987$LCL <-
2023 May 31
2
scale_colour_viridis en ggplot2
Hola a todos:
Alguién me podría explicar cuales son las diferencias entre las diferentes
escalas de viridis en ggplot2, es decir en qué se diferencian
scale-colour_viridis_d de scale_colour_viridis_c, scale_colour_viridis_b.
Y cual es la diferencia entre scale-fiil-viridis_d de scale-fill_viridis_c
y de scale_fill_viridis-b.
He estado buscando la diferencia en internet y no he encontrado nada al
2007 Jul 05
1
ggplot2 customizing
Dear all,
I know that ggplot2 documentation is coming along,
but at the moment I can't find how to do the following:
a) change the title of the legend
b) get rid of the closing line at the bottom of the
density line.
I also observed that the density lines (after limiting the
x-scale) extend a little bit into the surrounding of the plot,
which can be seen very strong when plotted as pdf.
2012 Nov 07
1
change colour of geom_step by scale_colour_manual
Hi,
Color of my step plot is now by default. Now I'd like to change the color as
the grey scale I specified. I don't know why I got three black plot. Here I
attach two version of codes. The first one produces a step plot with color
by default. The second one, modified from the first one, is not producing
the grey scale I want. Any help would be highly appreciated.
[version 1- working]
2010 Aug 14
1
is it possible to map 2 plots(c and d) in a single output plot?
is it possible to map 2 plots(c and d) in a single output plot?
library(ggplot2)
c <- ggplot(mtcars, aes(qsec, wt))
d <- ggplot (mtcars, aes(qsec, wt))
c + stat_smooth(fill="darkgrey", colour="blue", size=2, alpha = 0.2)
d + stat_smooth(fill="darkgrey", colour="red", size=2, alpha = 0.2)
--
View this message in context:
2012 Apr 16
1
ggplot2: scale_shape_manual
Hi,
I was trying to replicate one of the graphs given on the ggplot2 website. I
have given a sample code below. I would like to combine the legends, since
each color is uniquely mapped to a shape.
###
library(ggplot2)
leaves <- letters[1:8]
mat <- matrix(sample(1:1000,32),nrow=16,ncol=2)
colnames(mat) <- paste('t',1:2,sep='')
df <-