plotters
plotters copied to clipboard
[Feature Request] implement AsRangedCoord for RangeInclusive<A>
What is the feature ?
Add an implementation of AsRangedCoord for RangeInclusive<A>.
It would allow charts to label the final tick mark at the right/top edge of the mesh, rather than having a weird blank spot there.
This doesn't work currently:
error[E0599]: the method `step` exists for struct `RangeInclusive<{float}>`, but its trait bounds were not satisfied
--> src/bin/plot2.rs:51:44
|
51 | .build_cartesian_2d((-20.0..=20.0).step(0.5), -10..50)
| ^^^^ method cannot be called on `RangeInclusive<{float}>` due to unsatisfied trait bounds
|
::: /home/trs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/range.rs:341:1
|
341 | pub struct RangeInclusive<Idx> {
| ------------------------------
| |
| doesn't satisfy `RangeInclusive<{float}>: AsRangedCoord`
| doesn't satisfy `_: IntoLinspace`
|
= note: the following trait bounds were not satisfied:
`RangeInclusive<{float}>: AsRangedCoord`
which is required by `RangeInclusive<{float}>: plotters::prelude::IntoLinspace`
`&RangeInclusive<{float}>: AsRangedCoord`
which is required by `&RangeInclusive<{float}>: plotters::prelude::IntoLinspace`
`&mut RangeInclusive<{float}>: AsRangedCoord`
which is required by `&mut RangeInclusive<{float}>: plotters::prelude::IntoLinspace`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `mip` (bin "plot2") due to previous error
Workaround
A workaround is to use (-20.0..20.000_001).step(0.5), which is a bit of a hassle but does look okay.