I have a R plot of the following sort
regionalPlot <- ggplot(data = analyzed) +
geom_polygon(aes(x = long, y = lat, fill = income, group = group), color = "white") +
coord_fixed(1.3) +
theme_bw()
The plot is generated by plotting the longitude and latitudes of a certain region grouped by the region name, and the region is being filled by some data value for that region (say income
). This value is provided to the fill attribute as well for geom_polygon
as fill=value
.
However, I have 2 extra conditioning parameters say state_tax
and sales_tax
, both of which have true/false
values.
I want to fill the polygons using the same values, but by choosing a color scale based on the two conditioning parameters.
So here I'll have 4 such combinations
state_tax == 'true' and sales_tax == 'true'
state_tax == 'true' and sales_tax == 'false'
state_tax == 'false' and sales_tax == 'true'
state_tax == 'false' and sales_tax == 'false'
Essentially I am looking for a way such that all states with a the same combination of values for state and sales tax, should be colored in different shades of same color interpolated by the value of income.
Can anybody point me to a way which would allow me to do this? Let me know in the comments if more information is needed.