Hi:

This isn't hard to do with ggplot2. Here's a toy example:

d <- data.frame(gp = LETTERS[1:4], frq = c(10, 25, 30, 20))

library(ggplot2)

# The fill aesthetic colors the bars, the colour aesthetic does the same for
the borders.

# (1) Same color for both, use alpha transparency:
ggplot(d, aes(x = gp, y = frq)) +
   geom_bar(fill = 'blue', colour = 'blue', alpha = 0.2)

# (2) Use related colors (and throw in a white background):
ggplot(d, aes(x = gp, y = frq)) +
    geom_bar(fill = 'blue', colour = 'navyblue', alpha = 0.2) + theme_bw()

# (3) Use different colors:
ggplot(d, aes(x = gp, y = frq)) +
    geom_bar(fill = 'lavender', colour = 'navyblue') + theme_bw()

# (4) Map fill and border colors to values of gp:
ggplot(d, aes(x = gp, y = frq)) +
   geom_bar(aes(fill = gp, colour = gp), alpha = 0.3) + theme_bw()

# (4a) To get rid of the crossbar in the legend, add
last_plot() + scale_colour_discrete(legend = FALSE)

HTH,
Dennis

PS: I would have preferred to send this to the OP rather than the
respondent, but he didn't cc the original message, so...

On Sun, Feb 20, 2011 at 3:36 PM, Jannis <bt_jan...@yahoo.de> wrote:

> The easiest solution may be using par(new=TRUE) and to overlay a coloured
> barplot with a separate shaded barplot....
>
>
> HTH
> Jannis
> On 02/19/2011 10:58 PM, Markus Loecher wrote:
>
>> Dear all,
>> might there be a modified barplot function out there which allows the user
>> to specify a fill color for the bars and independent parameters for the
>> overlaid shading lines ?
>> Currently, when I specify density and col, the fill color for the bars is
>> white.
>>
>> Thanks!
>>
>> Markus
>>
>>        [[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.
>>
>>
> ______________________________________________
> 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