Hi:

On Fri, Sep 10, 2010 at 11:24 AM, Benoit Boulinguiez <
benoit.boulingu...@ensc-rennes.fr> wrote:

> Hi all,
>
> Is it possible to change the filling of the squares used to represent the
> colour legend in a bar plot with ggplot?
>
> in this example, fillings are raven black, I'd like them white.
>

Ista answered the question you posed, but let's try some alternatives - I'm
not saying they're any better, but it gives you more options.

# library(ggplot2)

# Using the diamonds data set, part of the ggplot2 package.

 # Reference plot (from Ista):
ggplot(diamonds, aes(clarity, colour = cut)) + geom_bar(fill="white")

# Change the background fill color:
last_plot() + opts(panel.background = theme_rect(fill = 'lavender')) +
  opts(panel.grid.major = theme_blank(), panel.grid.minor = theme_blank())

# Change the fill color:
ggplot(diamonds, aes(clarity, fill = cut)) + geom_bar()

# Change the outline color to white:
ggplot(diamonds, aes(clarity, fill = cut)) + geom_bar(colour = 'white')

HTH,
Dennis


ggplot(diamonds, aes(clarity, colour = cut)) + geom_bar()
>
> Regards
>
> --
> -------------
> Benoit Boulinguiez
> Ph.D student
> Ecole de Chimie de Rennes (ENSCR) Bureau 1.20
> Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
> Avenue du Général Leclerc
> CS 50837
> 35708 Rennes CEDEX 7
> Tel 33 (0)2 23 23 80 83
> Fax 33 (0)2 23 23 81 20
> http://www.ensc-rennes.fr/
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to