plotlib icon indicating copy to clipboard operation
plotlib copied to clipboard

Contour plots

Open fishrockz opened this issue 5 years ago • 4 comments

I notice in #3 that @milliams is keen for lots more plot types

A plot I use a lot in matplotlib is the contour plot, i have some ideas as to how to do this in plotlib but before i get too carried away do you have firm ideas as to how to handle this sort of thing?

Would you welcome a PR adding such a plot?

PS I have been really enjoying using your lib so far, thanks to all involved!

fishrockz avatar Jan 12 '20 23:01 fishrockz

I have been creating a little app that uses druid and this lib, druid has a nicely scaling svg widget but did not render plotlib graphs properly, I got a PR merged in druid to allow that and am working on a branch to also allow embedded images.

With that merged i will be able to use a branch of this lib to create things like Screenshot from 2020-01-23 23-56-21

The branch of plotlib i have been working on is https://github.com/fishrockz/plotlib/tree/willsalmon/imshow it is still very ruff and ready but i was wondering how keen others would be on having this? If there is interest then I would like to clean it up and get it merged here. It dose not create contour plots but creates things more like matplotlib imshow()

I would still like to add contour plot functionality but its a fair bit more complex than imshow.

fishrockz avatar Jan 24 '20 08:01 fishrockz

I think that an imshow style feature would be welcome if we can integrate it in well.

For contour plots I think we could do something a bit cleverer and generate the contours automatically as part of the pipeline but apart from that an generic imshow feature could cover a lot of use cases.

milliams avatar Mar 14 '20 18:03 milliams

So I implemented this first time with lots of rect's and it scalled very badly (I mean it was supper slow to to write them all out and then read them back in to something else) My second go was to embbed a png image inside the svg as raw bytes encoded to base64. this worked ok but while embedded images are implemented in most renders lots of them rendered them slightly differently especially if the aspect ratio of the axis did not match that of the underlying data.

fishrockz avatar Mar 23 '20 19:03 fishrockz

From a quick look around, it seems that matplotlib generates the contour lines themselves as (a group of) vector <path> objects and the colours backing it as an <image>.

For example see https://docs.astropy.org/en/stable/visualization/wcsaxes/images_contours-3.svg

milliams avatar Mar 23 '20 20:03 milliams