MCPcopy Create free account
hub / github.com/cpmech/plotpy / draw_rectangle

Method draw_rectangle

src/canvas.rs:591–604  ·  view source on GitHub ↗

Draws a rectangle (2D only) # Input `x`, `y` -- bottom-left corner coordinates `width` -- rectangle width `height` -- rectangle height

(&mut self, x: T, y: T, width: T, height: T)

Source from the content-addressed store, hash-verified

589 /// * `width` -- rectangle width
590 /// * `height` -- rectangle height
591 pub fn draw_rectangle<T>(&mut self, x: T, y: T, width: T, height: T) -> &mut Self
592 where
593 T: std::fmt::Display + Num,
594 {
595 let opt = self.options_shared();
596 write!(
597 &mut self.buffer,
598 "p=pat.Rectangle(({},{}),{},{}{})\n\
599 plt.gca().add_patch(p)\n",
600 x, y, width, height, &opt
601 )
602 .unwrap();
603 self
604 }
605
606 /// Draws text at (x, y) in a 2D graph using the primary text style
607 ///

Callers 2

test_canvas_rectangleFunction · 0.80

Calls 1

options_sharedMethod · 0.80

Tested by 2

test_canvas_rectangleFunction · 0.64