-
Notifications
You must be signed in to change notification settings - Fork 1
Description
The viz_imshow() and viz_spy() functions both have a nbcmap parameter you can use to modify the plot colors; see section 2.2 of the tutorial. However, since (from what I remember) imshow() and spy() require different color formats, these differences are propagated to the two nbcmap parameters.
imshow(), from what I remember, is more restrictive -- at least as we are currently using it (?), colors have to be given as RGB triplets. spy() supports a wider range of colors (but not RGB triplets, which makes documenting this kind of awkward).
This situation is confusing to users. Ideally, we would just convert all color formats to whatever matplotlib expects, right?
There are a few issues with trying to be more flexible, though:
-
I don't want to introduce an external dependency just to solve this problem
-
Explicitly just "all formats" or "most formats" or something can turn this into a testing nightmare (versus the current approach, where we just delegate the color-parsing stuff to matplotlib)
-
If we require that the input formats fit a certain specification, this can effectively reduce the scope of supported functionality. If later versions of matplotlib add support for additional color formats (e.g.
"xkcd:baby poop green", everyone's favorite color name), then this will be broken until we fix things on our end (and that sounds like a pain)
Maybe the best solution would be keeping viz_spy() as is, and with viz_imshow() just adding support for hex colors or something? This would not completely solve the problem but would probs be good enough. Or, even better, maybe it will turn out that matplotlib has some internal function we can call to do the dirty work of parsing a color and converting it to an RGB triplet for us.