scale_fill_brewer() recently unreliable?

15 views
Skip to first unread message

Christian Lindig

unread,
Mar 20, 2009, 4:29:58 AM3/20/09
to ggplot2

I have noticed that scales returned by scale_fill_brewer(type='seq')
are not always sequential and in general vary a lot between
invocations. The code below will result in different scales when
executed multiple times.

library(ggplot2)
d <- factor(floor(rnorm(50,mean=5)))
qplot
(x=c('foo','bar'),geom="histogram",stat="bin",fill=d,position='stack') +
scale_fill_brewer(type="seq", palette=1,
name="foo",
breaks=rev(c(1,2,3,4,5)),
labels=rev(c("1","2","3","4","5"))
)

This only happened recently - so does scale_fill_brewer depend on the
online service? What could I use as a workaround to end up with
identical scales?

-- Christian

hadley wickham

unread,
Mar 20, 2009, 9:57:41 AM3/20/09
to Christian Lindig, ggplot2
Hi Christian,

This is related to the bug that others have reported with rearranged
categorical order on the x axis. It will be fixed in the next
version, which I'm trying to release asap.

Hadley

On Fri, Mar 20, 2009 at 3:29 AM, Christian Lindig <lin...@gmail.com> wrote:
>
> I have noticed that scales returned by scale_fill_brewer(type='seq') are not
> always sequential and in general vary a lot between invocations. The code
> below will result in different scales when executed multiple times.
>
> library(ggplot2)
> d <- factor(floor(rnorm(50,mean=5)))

> qplot(x=c('foo','bar'),geom="histogram",stat="bin",fill=d,position='stack')


> +
>        scale_fill_brewer(type="seq", palette=1,
>                name="foo",
>                breaks=rev(c(1,2,3,4,5)),
>                labels=rev(c("1","2","3","4","5"))
>                )
>
> This only happened recently - so does scale_fill_brewer depend on the online
> service? What could I use as a workaround to end up with identical scales?
>
> -- Christian

--
http://had.co.nz/

Reply all
Reply to author
Forward
0 new messages