Open ralsei opened 3 years ago
You can do these kinds of plots in plot
, but perhaps it is more complex than necessary (see image below). While the legend generated by plot will not be able to use a "continuous color map", you can generate those using the pict package and attach them to the side of the plot (for bitmap plots) or just float them over the plot snip in interactive plots (ActivityLog2 has those kinds of custom legends as well).
The first step to making this easier using the plot package would be to define an API for this type of functionality and work out the implementation from there...
Yes, I was referring more specifically to the legend. The actual plot can be created using points
and one of the maps from the colormaps
package.
I think we have two options, and it is possible to take both:
points
renderer, and vary its output in the legend#:label
wouldn't be the only way to set itbut regardless, it is still necessary to modify the way the legend is drawn to facilitate a "gradient continuous color" as shown in the attached image.
Hi @ralsei, this is not exactly what you were looking for, but it may be of interest for creating the legend: https://alex-hhh.github.io/2021/07/shaded-area-plot.html
To adapt the legend from the above post to a continuous gradient, you could draw a rectangle using a special brush%
with a linear-gradient%
. This is not supported directly in the pict package, but the racket/draw
facilities can be accessed from the pict package using the dc
pict constructor. Note that I have not tried doing this, so I don't know if it would work or not...
Currently, the legend only appears to be controllable with the
#:label
argument. Sometimes, however, this is not what is wanted. Namely, for example, take Figure 3.17 in socviz:Due to the legend, this is not reproducible in plot, as the "color interval" effect towards the right is not controllable with just
#:label
(or at all, for that matter). It would be nice if this was the case.