mplcyberpunk icon indicating copy to clipboard operation
mplcyberpunk copied to clipboard

Improved the capabilities of add_gradient_fill

Open cedrichol opened this issue 2 years ago • 2 comments

add_gradient_fill() now supports:

  • log plots (solves issue #17)
  • having a tuple(minimum, maximum) alpha instead of a single float (which is still supported)
  • Starting the gradient at:
    • the bottom of the plot (like the underglow, solves issue #16)
    • the minimum of the line (previous behaviour)
    • the top of the plot
    • the max of the line
    • zero (the visual effect is really nice depending on the signification of the data...)
  • choosing the number of sampling points

Other improvements :

  • internally imshow() is called with [interpolation='bilinear'], which helps reduce the necessary sampling points for linear plots
  • xlims and ylims are now saved and restored, as add_underglow() does, for the same reasons

test_plotting_gradient() shows the capabilities of this implementation: test_gradient_fill

cedrichol avatar Aug 08 '22 14:08 cedrichol

My hopes were risen and dashed when I thought this fixed #15! 😭 EDIT: This has inspired me to look into #15 more. I've updated #15 with some findings, it may be doable, however a large iterative project if mplcyberpunk were to work for a larger assortment of plot types! 🤔

That aside, looks amazing. Great work!

diceroll123 avatar Aug 09 '22 23:08 diceroll123

Thanks !

As for #15, I might take a look at it, it might be doable

cedrichol avatar Aug 10 '22 08:08 cedrichol

wow, this looks really awesome, especially with the docstring, tests and detailed PR! Thanks for your contribution. I've made some minor edits (mostly naming), should be fine now!

dhaitz avatar Aug 11 '22 21:08 dhaitz

I've closed #15 and #16 as completed now.

#17 can be closed, me thinks.

diceroll123 avatar Aug 11 '22 21:08 diceroll123

Happy you like it, thanks for this cool project btw

cedrichol avatar Aug 11 '22 21:08 cedrichol