Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Proposal] Enhanced Default behaviors and Wrappers for immediately Plotting #520

Open
DarthB opened this issue Nov 21, 2023 · 1 comment

Comments

@DarthB
Copy link

DarthB commented Nov 21, 2023

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:

  1. Background / Margin / Label Size / Mesh
  2. Default Styling, e.g. 3 Series without styling --> just go through a list of colors / shapes (dashed, dotted, etc.)
  3. 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?

@AaronErhardt
Copy link
Member

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 and next-release-devel is for breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants