plotnine icon indicating copy to clipboard operation
plotnine copied to clipboard

Area chart with gradient

Open jrr96 opened this issue 3 years ago • 4 comments

Is there any way to achieve a gradient in the filling of an area chart?

Capture

I have not been able to find anything in the docs.

If not, how feasible would it be to add this feature? I think it greatly improves the aesthetics of area charts.

Thanks a lot in advance!

jrr96 avatar May 19 '22 11:05 jrr96

It is not possible, and I do not know if it can be implemented cleanly (without trying).

has2k1 avatar May 19 '22 12:05 has2k1

If I am understanding the philosophy, the code should look something like this right?

(
ggplot(df, aes(x='date', y='value', alpha='value'))
+ scale_alpha(range=(0, 1))
+ geom_area()
)

jrr96 avatar Sep 06 '22 18:09 jrr96

If I am understanding the philosophy, the code should look something like this right?

(
ggplot(df, aes(x='date', y='value', alpha='value'))
+ scale_alpha(range=(0, 1))
+ geom_area()
)

Maybe or maybe not only that. The gradient may come from the alpha or from the fill (the continuous colour range) or even both. The key to implementing though, is that it should be supported by the underlying drawing system; that is the hard part!

has2k1 avatar Sep 07 '22 11:09 has2k1