title: How to modify the color of data using multiple variables
body: <p>So I'm trying to work with some data where I am comparing countries and years on a scatterplot of income vs. infant_mortality across different African regions. I know how to use the color function in ggplot to differentiate based on region - what I'd like to do is then change the brightness or darkness of those various regional colors based on year i.e. if points from countries in Southern Africa are blue, then can those points from 1970 be dark blue and those from 2010 be light blue? Right now I'm doing region by color and year by shape, but I think if I could vary it by darkness/lightness of base color that would be more intuitive visually. Below is the code I'm working with:</p>
  <pre><code>library(dplyr)
  library(ggplot2)
  library(dslabs)
  data(gapminder)
  
  gapminderfirst &lt;- gapminder %&gt;% filter(continent == &quot;Africa&quot; &amp; year %in% c(1970, 2010) &amp; !is.na(gdp) &amp; !is.na(population) &amp; !is.na(infant_mortality)) %&gt;% mutate(dollars_per_day = gdp/population/365)
  
  gapminderfirst$year &lt;- cut(gapminderfirst$year, breaks=c(1950, 2000, 2100), labels=c('1970', '2010'))
  
  gapminderfirst %&gt;% ggplot(aes(dollars_per_day, infant_mortality, color = region, shape = country)) + scale_x_continuous(trans = &quot;log2&quot;) + geom_point(size = 3) + geom_text(nudge_x = 0.2) + theme(legend.position = c(0.8, 0.8), legend.key.size = unit(0.25, &quot;cm&quot;))
  </code></pre>