Struct plotters_arrows::ThinArrow
source · pub struct ThinArrow<Coord, Size: SizeDesc> { /* private fields */ }
Implementations§
source§impl<Coord> ThinArrow<Coord, i32>
impl<Coord> ThinArrow<Coord, i32>
sourcepub fn new(nock: Coord, tip: Coord, style: impl Into<ShapeStyle>) -> Self
pub fn new(nock: Coord, tip: Coord, style: impl Into<ShapeStyle>) -> Self
Examples found in repository?
examples/thin-arrows.rs (line 31)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
fn main() -> Result<(), DrawingAreaErrorKind<<BitMapBackend<'static> as DrawingBackend>::ErrorType>>
{
let target = Path::new("example.png");
let graph_root = BitMapBackend::new(target, (256, 256)).into_drawing_area();
graph_root.fill(&WHITE)?;
let mut chart = ChartBuilder::on(&graph_root)
.margin(8)
.x_label_area_size(24)
.y_label_area_size(24)
.build_cartesian_2d(0f64..1f64, 0f64..1f64)?;
chart.configure_mesh().draw()?;
let x_count = 16;
let y_count = 16;
let arrow_size = 0.05;
chart.draw_series(
(0..=x_count)
.flat_map(|xi| (0..=y_count).map(move |yi| (xi, yi)))
.map(|(xi, yi)| {
let x = xi as f64 / x_count as f64;
let y = yi as f64 / y_count as f64;
let dx = arrow_size * f64::cos(y * TAU);
let dy = arrow_size * f64::cos(x * TAU);
ThinArrow::new((x, y), (x + dx, y + dy), &RED)
}),
)?;
graph_root.present()?;
Ok(())
}
Trait Implementations§
source§impl<DB: DrawingBackend, Coord, Size: SizeDesc> Drawable<DB, BackendCoordOnly> for ThinArrow<Coord, Size>
impl<DB: DrawingBackend, Coord, Size: SizeDesc> Drawable<DB, BackendCoordOnly> for ThinArrow<Coord, Size>
Auto Trait Implementations§
impl<Coord, Size> RefUnwindSafe for ThinArrow<Coord, Size>where
Coord: RefUnwindSafe,
Size: RefUnwindSafe,
impl<Coord, Size> Send for ThinArrow<Coord, Size>where
Coord: Send,
Size: Send,
impl<Coord, Size> Sync for ThinArrow<Coord, Size>where
Coord: Sync,
Size: Sync,
impl<Coord, Size> Unpin for ThinArrow<Coord, Size>where
Coord: Unpin,
Size: Unpin,
impl<Coord, Size> UnwindSafe for ThinArrow<Coord, Size>where
Coord: UnwindSafe,
Size: UnwindSafe,
Blanket Implementations§
source§impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB, BackendCoordOnly> + 'b,
&'a T: for<'a> PointCollection<'a, Coord, BackendCoordOnly>,
Coord: Clone,
DB: DrawingBackend,
impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB, BackendCoordOnly> + 'b,
&'a T: for<'a> PointCollection<'a, Coord, BackendCoordOnly>,
Coord: Clone,
DB: DrawingBackend,
source§fn into_dyn(self) -> DynElement<'b, DB, Coord>
fn into_dyn(self) -> DynElement<'b, DB, Coord>
Make the conversion