koaning / fh-matplotlib

Making it easier to show matplotlib charts in FastHTML
MIT License
36 stars 1 forks source link

Remove hardcoded format #6

Open joelsewhere opened 1 week ago

joelsewhere commented 1 week ago

The current decorator hard codes 'jpg' as the format. Can we make that setting configurable? Probably two ways of doing this

  1. (Easiest) Set all savefig configurations with matplotlib.rcParams
  2. (Harder, but more user friendly) Alter the decorator so it can receive arguments
koaning commented 1 week ago

This seems fair. Open to implementation suggestions for sure.

I guess practically, is there a good reason why some charts need to be png and other charts need to be jpg? I can imagine SVG being a use-case, though.

joelsewhere commented 1 week ago

I just had an instance where I needed the background to be transparent. All documented examples of creating a transparent output failed until I switched the format to png. SVG would probably work great too!