geom_path with linetype gets colours wrong

36 views
Skip to first unread message

baptiste auguie

unread,
Mar 13, 2012, 7:23:02 PM3/13/12
to ggplot2
Dear list,

Am I going crazy or is there a nasty bug in the following?

test <- structure(list(wavenumber = c(300.00421, 699.57959, 300.00421,
699.57959, 300.00421, 699.57959, 300.00421, 699.57959, 300.00421,
699.57959, 300.00421, 699.57959, 300.00421, 699.57959),
value = c(3603.1196, 18581.346, 3465.0432, 17274.926, 3105.0808,
15216.968, 2840.4031, 13451.2, 2609.5703, 12048.06, 3286.9226,
16321.607, 3371.0754, 16780.48), temperature = structure(c(1L, 1L, 4L,
4L, 5L, 5L, 6L, 6L, 7L, 7L, 3L, 3L, 2L, 2L), .Label = c("23.6",
"24", "25.1", "32.2", "38.8", "49.2", "55.4"), class = "factor"),
stage = c("heating", "heating", "heating", "heating", "heating",
"heating", "heating", "heating", "heating", "heating", "cooling",
"cooling", "cooling", "cooling")), .Names = c("wavenumber",
"value", "temperature", "stage"), row.names = c(41L,
672L, 1065L, 1696L, 2089L, 2720L, 3113L, 3744L, 4137L, 4768L,
5161L, 5792L, 6185L, 6816L), class = "data.frame")

ggplot(test, aes(wavenumber, value, colour=temperature))+
geom_path(aes(linetype=stage)) +
geom_point(aes(shape=stage)) +
scale_colour_brewer(palette="Set1")

The colour of the lines do not correspond to the legend, but it works
as expected for the points.

Thanks,

baptiste

sessionInfo()
R version 2.14.2 Patched (2012-02-29 r58572)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8

attached base packages:
[1] graphics grDevices utils datasets stats grid
methods base

other attached packages:
[1] ggplot2_0.9.0

loaded via a namespace (and not attached):
[1] colorspace_1.1-1 dichromat_1.2-4 digest_0.5.1
MASS_7.3-17 memoise_0.1 munsell_0.3 plyr_1.7.1
proto_0.3-9.2
[9] RColorBrewer_1.0-5 reshape2_1.2.1 scales_0.2.0
stringr_0.6 tools_2.14.2

Screen shot 2012-03-14 at 12.14.07 PM.png

Ista Zahn

unread,
Mar 13, 2012, 8:53:35 PM3/13/12
to baptiste auguie, ggplot2
Hi Baptiste,

It works properly here:

R version 2.14.1 (2011-12-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] ggplot2_0.9.0

loaded via a namespace (and not attached):

[1] colorspace_1.1-1 dichromat_1.2-4 digest_0.5.1 grid_2.14.1
[5] MASS_7.3-17 memoise_0.1 munsell_0.3 plyr_1.7.1
[9] proto_0.3-9.2 RColorBrewer_1.0-5 reshape2_1.2.1 scales_0.2.0
[13] stringr_0.6
>

Best,
Ista

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2

baptiste auguie

unread,
Mar 13, 2012, 9:06:47 PM3/13/12
to Ista Zahn, ggplot2
Hi,

Thanks Ista. I must have been running a strange version of ggplot2
from github as the CRAN version and a fresh install from hadley's
github both produce correct output now. Oh well, sorry for the noise,
it must have been broken and fixed again recently.

Thanks,

b.

Reply all
Reply to author
Forward
0 new messages