As ggplot2
produces nice colored graphs but sometimes it is required to have black and white graphs with pattern fills. I wonder how to do this in ggplot2
, say for this code:
ggplot(diamonds, aes(cut, fill=cut)) + geom_bar()
Edit
Is there any function in R
to do pattern fills for graphs?
To see this at work select a chart and choose Chart Tools > Layout Tab and select the series to edit from the dropdown box at the top left of the ribbon. Choose Format Selection (just below this on the ribbon) and choose Fill > Pattern Fill.
A full-color pattern fill (also known as “vector pattern”) is a more complex vector graphic that can be composed of lines and fills. A full-color fill can have color or transparent background. A bitmap pattern fill is a bitmap image whose complexity is determined by its size, image resolution, and bit depth.
Apply a pattern or fill effectsClick Home > Format Cells dialog launcher, or press Ctrl+Shift+F. On the Fill tab, under Background Color, pick the color you want. To use a pattern with two colors, pick a color in the Pattern Color box, and then pick a pattern in the Pattern Style box.
have a look at the 6th plot of example(barplot).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With