MazamaScience / PWFSLSmoke

Utilities for working with air quality monitoring data (e.g. federal regulatory monitors)
http://mazamascience.github.io/PWFSLSmoke/
GNU General Public License v3.0
18 stars 5 forks source link

Function to add a legend with custom icons #44

Open helenmiller16 opened 5 years ago

helenmiller16 commented 5 years ago

There are a few places where we might use custom icons: adding fires, warning symbols, markers, etc. It is very difficult to create a legend with them in R. We should be able to create a function which will add a legend to a base R plot with whatever icons we want. If it proves too difficult to allow the user to include whatever icons they want, there could be just a few options for legends to add, so you would just specify the location of the legend and which type of legend (eg fires, monitors, outlook). I'm guessing this would be easier to do in ggplot but since most of our plotting uses base plotting functionality instead let's start with that.

A custom legend with custom icons would involve at least the following:

  1. convert user coordinates into something more useful like inches or pixels
  2. determine the size of the legend based on request
  3. draw a rectangle for the background of the legend
  4. add icons etc
  5. add text
helenmiller16 commented 5 years ago

A first pass for adding a fire legend exists in the monitor-map service in sharedUtils.