BUG: update_geom_defaults fails to change default outlier aesthetics of geom_boxplot

49 views
Skip to first unread message

Ernest Adrogué

unread,
Jan 11, 2013, 10:41:18 AM1/11/13
to ggp...@googlegroups.com
Hi,

The following lines produce a boxplot with colour='blue', but outliers still
have shape=16 and size=2.

update_geom_defaults("boxplot",
list(colour='blue', outlier.shape=1, outlier.size=5))

ggplot(diamonds, aes(depth, carat)) + geom_boxplot()

So, it seems that the default values of outlier parameters are not updated
by update_geom_defaults. I would consider this a bug.

Sorry if this isn't the right place to report bugs.

System info:

R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

other attached packages:
[1] ggplot2_0.9.2.1

loaded via a namespace (and not attached):
[1] colorspace_1.1-0 compiler_2.15.1 dichromat_1.2-4 digest_0.5.1
[5] grid_2.15.1 gtable_0.1.1 labeling_0.1 MASS_7.3-19
[9] memoise_0.1 munsell_0.4 plyr_1.6 proto_0.3-9.2
[13] RColorBrewer_1.0-5 reshape2_1.2.1 scales_0.2.2 stringr_0.6.1
[17] tools_2.15.1

Brian Diggs

unread,
Jan 11, 2013, 1:15:32 PM1/11/13
to nfdisco-Re5JQEe...@public.gmane.org, ggplot2
On 1/11/2013 7:41 AM, Ernest Adrogu� wrote:
> Hi,
>
> The following lines produce a boxplot with colour='blue', but outliers still
> have shape=16 and size=2.
>
> update_geom_defaults("boxplot",
> list(colour='blue', outlier.shape=1, outlier.size=5))
>
> ggplot(diamonds, aes(depth, carat)) + geom_boxplot()
>
> So, it seems that the default values of outlier parameters are not updated
> by update_geom_defaults. I would consider this a bug.

It is not really a bug, but it does look like one (and maybe things
should be changed so that it does work this way). update_geom_defaults
updates the default values that an aesthetic will take when it is not
mapped to a variable. In geom_boxplot, the aesthetics are listed as:
lower, middle, upper, x, ymax, ymin, alpha, colour, fill, linetype,
shape, size, and weight. outlier.colour, outlier.shape, and outlier.size
are not aesthetics but rather arguments to geom_boxplot. That means that
they can not be mapped to a variable, but it also means that their
default values can not be changed by update_geom_defaults. It also means
that the value of those must be the same for an entire layer.

> Sorry if this isn't the right place to report bugs.

The bug reporting system is at https://github.com/hadley/ggplot2/issues

However, it is fine to inquire here on the mailing list if you are not
sure if something is a bug or if something does not behave as you
expect. If it is a bug, then you may be asked to file a formal bug
report, but if it is not then it does not clutter the bug database.

> System info:
>
> R version 2.15.1 (2012-06-22)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=ca_ES.utf8 LC_NUMERIC=C
> [3] LC_TIME=ca_ES.utf8 LC_COLLATE=ca_ES.utf8
> [5] LC_MONETARY=ca_ES.utf8 LC_MESSAGES=ca_ES.utf8
> [7] LC_PAPER=C LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=ca_ES.utf8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] ggplot2_0.9.2.1
>
> loaded via a namespace (and not attached):
> [1] colorspace_1.1-0 compiler_2.15.1 dichromat_1.2-4 digest_0.5.1
> [5] grid_2.15.1 gtable_0.1.1 labeling_0.1 MASS_7.3-19
> [9] memoise_0.1 munsell_0.4 plyr_1.6 proto_0.3-9.2
> [13] RColorBrewer_1.0-5 reshape2_1.2.1 scales_0.2.2 stringr_0.6.1
> [17] tools_2.15.1
>


--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University

Ernest Adrogué

unread,
Jan 12, 2013, 8:43:43 AM1/12/13
to ggplot2
11-01-2013, 10:15 (-0800); Brian Diggs escriu:
> On 1/11/2013 7:41 AM, Ernest Adrogué wrote:
> >Hi,
> >
> >The following lines produce a boxplot with colour='blue', but outliers still
> >have shape=16 and size=2.
> >
> >update_geom_defaults("boxplot",
> > list(colour='blue', outlier.shape=1, outlier.size=5))
> >
> >ggplot(diamonds, aes(depth, carat)) + geom_boxplot()
> >
> >So, it seems that the default values of outlier parameters are not updated
> >by update_geom_defaults. I would consider this a bug.
>
> It is not really a bug, but it does look like one (and maybe things
> should be changed so that it does work this way).
> update_geom_defaults updates the default values that an aesthetic
> will take when it is not mapped to a variable. In geom_boxplot, the
> aesthetics are listed as: lower, middle, upper, x, ymax, ymin,
> alpha, colour, fill, linetype, shape, size, and weight.
> outlier.colour, outlier.shape, and outlier.size are not aesthetics
> but rather arguments to geom_boxplot. That means that they can not
> be mapped to a variable, but it also means that their default values
> can not be changed by update_geom_defaults. It also means that the
> value of those must be the same for an entire layer.

I see. Do you think it would make sense for these outlier parameters to use
the same defaults as geom_point? So that, when the user changes the default
aesthetics for geom_point, it also affects the outliers' appearance of
geom_boxplot. I think it shouldn't be difficult to do. Maybe I could write a
patch.

>
> >Sorry if this isn't the right place to report bugs.
>
> The bug reporting system is at https://github.com/hadley/ggplot2/issues
>
> However, it is fine to inquire here on the mailing list if you are
> not sure if something is a bug or if something does not behave as
> you expect. If it is a bug, then you may be asked to file a formal
> bug report, but if it is not then it does not clutter the bug
> database.

Nice to know, thanks!
Reply all
Reply to author
Forward
0 new messages