This is a fantastic idea, Alex. (While I'm at it, thanks for all your other projects related to the GUI, they are really cool.)
I'm *very* much in favour of all your points, (1) to (4). I've had uses of different colors scheme for academic papers, and the default palette doesn't work well for me. I haven't tried the matplotlib palettes, but my various attempts have never been entirely satisfactory. Here's an excerpt from some of my stabs: https://github.com/Metaxal/bazaar/blob/master/plot.rkt#L133 (this includes a palette generator to maximize color difference, line 376+, which I find much better than the default palette, but it doesn't take into account the specifics of the human eye.) Just a side note: the #:color argument is already quite flexible and accepts things like '(10 20 30), which is pretty nice. On Wed, Mar 20, 2019 at 4:17 AM Alex Harsanyi <[email protected]> wrote: > > > On Wednesday, March 20, 2019 at 10:35:51 AM UTC+8, Ben Greenman wrote: >> >> > Could you (or Ben or Matt) elaborate on how do you see this work for >> non >> > plot programs? >> >> I'm thinking a color-map% object would define a possibly-infinite >> sequence of colors that look nice in some way. The colors might be >> useful anywhere where someone wants a "rainbow" of colors ... maybe >> for: >> >> - fonts in a slideshow (colorblind-friendly? grayscale-friendly?), >> - coloring the error messages made by a linter or program analyzer, >> - drawing a sunset, etc. >> > > The examples listed above might be better served by other color choosing > mechanisms, for example, I have implemented some color manipulation code > based > on https://tallys.github.io/color-theory/, you can find it here: > https://github.com/alex-hhh/data-frame/blob/master/private/colors.rkt . > In > particular the `pick-color` function might do something similar to what > Pyret > is using (as suggested by Justin Zamora). > > Other solutions are also possible, including using gradient color maps, but > this is a larger scope that I originally planned for and I don't have > the time to prepare and submit a patch for such changes. > > My proposal is more limited, to allow plot users to produce good looking > plots > with minimum effort. What I propose is: > > (1) Add a mechanism (via parameters) to replace the `pen-colors` and > `brush-colors` vectors in the plot package with custom defined colors. > This > means that the existing `->pen-color` and `->brush-color` functions would > now > return a different color depending on what `pen-colors` or `brush-colors` > are > installed. This also has the benefit that the existing mechanism of > specifying numbers for colors will now work with color maps: > > (plot (list (function sin -5 5 #:color 1))) > > (2) "Borrow" the qualitative color maps from matplotlib, so the user has > some > nice predefined set of colors to choose from for their plots. > > Also, possibly the following backwards incompatible changes: > > (3) change the default set of `pen-colors` and `brush-colors` to one of the > new color maps, so the nicer colors are on by default. > > (4) change the default plot behavior so that a different color is chosen > for > each renderer, this means that things like the code below would result in > different colors used for the `sin` and `cos` functions: > > (plot (list (function sin -5 5) (function cos -5 5))) > > If others think that (1) and (2) are worthwhile doing, I will submit a PR, > so > we can discuss the API an implementation over something more concrete. I > am > open discussion for points (3) and (4). > > For the more broader color map changes, if the improvements are split up in > small incremental tasks, I will be happy to help out, as time allows. > > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

