https://us02web.zoom.us/meeting/register/RQW4PGPcT0ixadrHwD0-aQ
Rphotons each with different wavelength/energyWang and Yu 2023
Wang and Yu 2023

datacolor.com
colorBlindnes simulatorcolorBlindnes simulatorcolorBlindnes simulatorviridis and okabe-ito familiesggplot color scale functionsscale_*aes*_*name_of_color_function*scale_color_xxxx controls color (usually border)scale_fill_xxxx controls fillxxxx is usually the name of a package or color scheme| Command | Package | Color Safety? |
|---|---|---|
scale_fill_hue |
ggplot2 |
No |
scale_fill_brewer |
RColorBrewer |
Some |
scale_fill_paleteer_d |
paleteer |
Many |
scale_fill_okabe_ito |
ggokabeito |
Yes |
scale_fill_OkabeIto |
colorblindr |
Yes |
RColorBrewerRColorBrewerSet2 and Dark2) or 4 categories (Paired)RColorBrewerp1 = neighborhood_df |>
ggplot(aes(x=fct_reorder(neighborhood,mean_revenue),
y=mean_revenue,
fill = borough)) +
geom_col() +
scale_y_continuous(
name = "Revenue Per Day"
) +
coord_flip() +
theme_minimal(base_size=16) +
theme(axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.length = unit(0, "pt"),
#axis.text.y = element_text(size = 10, color = borough_colors),
legend.background = element_rect(fill = "#ffffffb0")) +
labs(title = "Mean Revenue Per Day of Airbnb Listings in\n Selected NYC Neighborhoods")RColorBrewerscale_fill_brewer()palette can choose from list of palettesname gives legend labelRColorBrewerRColorBrewerdirection=-1 to reverse the colorsRColorBrewerdirection=-1 to reverse the colorsRColorBrewertype="qual" and palette= number:RColorBrewertype="qual" and palette= number:RColorBrewerna.value="grey70" tells us the color for missing valuesguide = colorbar, legend, or colorsteps says type of colorbarRColorBrewerggokabeitoscale_fill_okabe_itoscale_fill_brewerggokabeitoscale_fill_okabe_itoggokabeito ordercolorspace package is really nice and brings a bit of orderlibrary(palmerpenguins)
point = penguins |> ggplot(aes(bill_length_mm, bill_depth_mm)) +
geom_point(aes(colour = species)) +
theme_minimal(base_size=16) +
labs(x = "Bill Length (mm)", y =
"Bill Depth (mm)")
# three palettes
#point + scale_colour_brewer(palette = "Set1")
#point + scale_colour_brewer(palette = "Set2")
#point + scale_colour_brewer(palette = "Pastel1")plot = nyc_bnb |> group_by(borough) |> filter(number_of_reviews_ltm>20) |>
summarise(revenue = mean(revenue/accommodates,na.rm=TRUE)) |>
ggplot(aes(x=fct_reorder(borough,desc(revenue)),y=revenue,fill=borough)) +
geom_col() +
theme_minimal(base_size=16) +
labs(x = "Borough", y =
"Mean Revenue",
title = "Revenue per person across boroughs")alpha modifies the colors and creates fill vectorneighborhood_df |> filter(!is.na(borough) & num_listings>20) |>
ggplot(aes(x=mean_occupancy,y=mean_revenue,color=borough,shape=borough,fill=borough)) +
geom_point(size=4) +
scale_y_continuous(limits = c(0,275)) +
scale_shape_manual(values = 21:25) +
scale_color_manual(values = colors) +
scale_fill_manual(values = fills) +
theme_minimal(base_size = 16) +
labs(title = "Revenue and Occupancy Across NYC Neighborhoods")+
xlab("Mean Occupancy") +
ylab("Mean Revenue")scale_fill_manualplot_2 +
scale_color_manual(values =
c("Manhattan"="#BD3828",
"Brooklyn" = "#92540040",
"Staten Island" = "#92540040",
"Queens" = "#92540040",
"Bronx" = "#92540040")) +
scale_fill_manual(values =
c("Manhattan"="#BD3828",
"Brooklyn" = "#92540040",
"Staten Island" = "#92540040",
"Queens" = "#92540040",
"Bronx" = "#92540040")) | Name | Hex code |
|---|---|
| orange | #E69F00 |
| sky blue | #56B4E9 |
| bluish green | #009E73 |
| yellow | #F0E442 |
| blue | #0072B2 |
| vermilion | #D55E00 |
| reddish purple | #CC79A7 |
| black | #000000 |
[1] "#A6CEE3" "#1F78B4" "#B2DF8A" "#33A02C" "#FB9A99" "#E31A1C" "#FDBF6F"
[8] "#FF7F00" "#CAB2D6" "#6A3D9A" "#FFFF99" "#B15928"
[1] "#E69F00" "#56B4E9" "#009E73" "#F0E442" "#0072B2" "#D55E00" "#CC79A7"
[8] "#999999" "#000000"
[1] "#F4BA73" "#ABC7DE" "#0BC490" "#F2EBAE" "#589BDB" "#E78F72" "#C9AABA"
[8] "#B7B7B7"