The Python matplotlib package supports the concept of a colormap for 
selecting
colors for each data set that is displayed -- the user uses an index, like
color 0, 1, 2, etc and this is mapped to a RGB value in the color map.  The
visual aspect of a plot can be changed just by switching the color map.

The color maps that are available to the matplotlib user have a nice set of
colors chosen by experts (presumably) and this makes it easy to create nice
looking plots, you can see the colors here:

https://matplotlib.org/examples/color/colormaps_reference.html

The `plot` library from Racket allows specifying colors by using the RGB
triplet, or by using the `->pen-color` function which converts an index 
into a
hardcoded set of colors -- this is similar to the color map concept, except
that the available colors are not as nice and they are hardcoded:

https://docs.racket-lang.org/plot/utils.html?q=-%3Epen-color#%28def._%28%28lib._plot%2Futils..rkt%29._-~3epen-color%29%29

I would like to add support for color maps to the plot package, if others
consider it worthwile.  The way I think it would work is that a new plot
parameter (say `plot-pen-color-map`) would be defined and `->pen-color` 
would
be changed to use the user specified color map instead of the default set of
colors (the default set would still be used if no color map is specified).

I put together some prototype code (including a screenshot of what it would
look like) here:

https://gist.github.com/alex-hhh/8ca14a0890dc2cfa8fc89e0c816d86da

Technically this could be implemented outside the `plot` package, but I 
think
it is much nicer to be readily available when Racket is installed and it 
will
result in much nicer looking plots for a lot less effort.

Do others think this would be useful?

Alex.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to