Description
Changed Request to Proposal in the title, as I'm thinking about working on this if I find some time during December and January. But maybe first have a discussion about it, as I'm just a new user of plotters and not very aware with its history nor its roadmap.
What is the feature ?
Better default behaviors and wrappers that reduce the need to interact with the API regarding styling and backend when just starting out. A ideal solution would allow easy calls to a free function like plot(x,y) to work with a good result out of the box.
(Optional) Why this feature is useful and how people would use the feature ?
I think many new users want to have shorter example code with better defaults. I propose to update the examples such that we have a short version which is more optimized on LOC and keep the longer versions around to show how to change those defaults. By defaults I mean things like:
- Background / Margin / Label Size / Mesh
- Default Styling, e.g. 3 Series without styling --> just go through a list of colors / shapes (dashed, dotted, etc.)
- Conclude axis Sizes from Data if no sizes are given
(Optional) Additional Information
I think some of that can be done by just adapting the builders and use default methods when concluding them.
// But wrappers of the form would be nice:
plotters::draw_lines(point_vec); // into_iter?
plotters::draw_lines(x, y); // impl uses simple zip to generate the right iterator
// same for draw_points(...)
If we want to reach this, we need a wrapping type that allows for lazy evaluation of the backend and is somehow meaningful coupled to the Ownership of the instances of Backend/Chart/xyzSeries. Controversial may be how much of the state idea hold on/off
of popular libs in other languages should be used. What are your opinions on this?
Activity
AaronErhardt commentedon Nov 22, 2023
That sounds like a good idea. The list of default properties should reduce the amount of LOC in most use-cases while requiring no or few changes to existing code.
I'd be happy to review and merge your contribution. Please note that
master
is the branch for stable development andnext-release-devel
is for breaking changes.