-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for bar graphs. Helps with issue #98 #111
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #111 +/- ##
==========================================
- Coverage 67.48% 66.11% -1.38%
==========================================
Files 53 53
Lines 5160 5152 -8
==========================================
- Hits 3482 3406 -76
- Misses 1678 1746 +68
Continue to review full report at Codecov.
|
8d20955
to
a06f868
Compare
Thanks for the PR. I think the PR looks good to me. I am currently working on a new major release shipping with discrete coordinate trait refactor #89 and slice coordinate support #104 . With those changes, One of the related example on this change would be https://github.com/38/plotters/blob/v0.3-pre/examples/nested_coord.rs Though it's not really the bar chart but roughly shows how things work. And here's a quick example use v0.3: use plotters_bitmap::BitMapBackend;
use plotters::prelude::*;
fn main() {
let mut root = BitMapBackend::new("out.png", (800, 600)).into_drawing_area();
root.fill(&WHITE);
let data = ["a", "b", "c", "d", "e"];
let mut chart = ChartBuilder::on(&root)
.set_all_label_area_size(30)
.build_ranged((&data[..]).into_centric(), 0..10)
.unwrap();
chart.configure_mesh().disable_mesh().draw();
let hist = Histogram::vertical(&chart).data(vec![(&"a", 5), (&"b", 2), (&"c", 8), (&"d", 7), (&"e", 4)]).margin(15);
chart.draw_series(hist);
} So if my understand is right, it seems this PR will provide the exactly same feature. Sorry for the confusion. Thanks again for the contribution! Cheers! |
I'll admit it's not a very elegant pull request and won't be offended if you completely redo it.
It allows you to use Category axis in histograms by making them implement PartialEq, Eq, Hash, and DiscreteRanged.
When it implements DiscreteRanged, it just wraps around the ends of the category.
Rough usage example: