plotters-rs / plotters

A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀
https://plotters-rs.github.io/home/
MIT License
3.89k stars 281 forks source link

Enable macro usage for users to define colormaps #481

Closed jonaspleyer closed 8 months ago

jonaspleyer commented 1 year ago

This PR enables the user to leverage the macro define_linear_interpolation_color_map to easily create custom colormaps.

In addition, I have hidden the documentation of macros in the crate root and instead included them in the correct module.

Some functionalities which are required are hidden since they are not meant to be used by the end-user.

jonaspleyer commented 1 year ago

It seems that one of the checks was canceled. I cannot see any apparent reason as to why It could have happened.

AaronErhardt commented 1 year ago

I've re-run the canceled check. I've no idea why it was canceled either.

Anyway, I wonder whether it makes sense to use #[doc(hidden)] followed by doc comments. AFAIK there will be no docs generated for hidden items so using doc comments on such items doesn't really make sense, or am I wrong? Can you maybe show how the docs look for you locally?

jonaspleyer commented 1 year ago

The documentation is hidden on my machine. To me it makes sense if another developer is looking at your code and trying to understand it. Maybe I was too motivated in writing doc-tests. Since they present an actual computational overhead, it might be reasonable to omit them.

jonaspleyer commented 8 months ago

To advance this PR: I moved the relevant docstrings to be inline comments only. Furthermore, I hid the count! macro since it is only being used as a helper macro and shortened the macro to define colormaps in order to be easier to use and not having to write such a long name.

Please let me know if this fixes your previously mentioned concern.

AaronErhardt commented 8 months ago

The code looks good, but I think there are a couple of plots that should not be part of the commits.

jonaspleyer commented 8 months ago

Sorry this was a total oversight on my part. I have rebased my master branch to not include the plots in the git history at all.