cmap_fill_race | R Documentation |
Pick the function depending on the aesthetic of your ggplot object (fill or color). Specify your dataset's unique race factor names (as case-sensitive strings) in the arguments. All categories are optional in case your dataset does not have some of them or contains the default values of the race palette.
cmap_fill_race(white, black, hispanic, asian, other)
cmap_color_race(white, black, hispanic, asian, other)
cmap_colour_race(white, black, hispanic, asian, other)
white |
Data value to map CMAP's White/Caucasian color onto (case-sensitive). |
black |
Data value to map CMAP's Black/African American color onto (case-sensitive). |
hispanic |
Data value to map CMAP's Hispanic/Latino color onto (case-sensitive). |
asian |
Data value to map CMAP's Asian color onto (case-sensitive). |
other |
Data value to map CMAP's Other/Multiple Races color onto (case-sensitive). |
cmap_fill_race()
: For fill aesthetic
cmap_color_race()
: For color aesthetic
cmap_colour_race()
: For color aesthetic
ggplot(dplyr::filter(traded_emp_by_race, Race!="Regional average" &
variable=="SpecializedTraded")) +
geom_col(aes(x = Race, y = value, fill = Race)) +
cmap_fill_race(white = "White", black = "Black",
hispanic = "Hispanic", asian = "Asian",
other = "Other")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.