Skip to content

Commit 673a23d

Browse files
committed
fix tests
1 parent 52f3da4 commit 673a23d

26 files changed

+56
-56
lines changed

README.md

+23-23
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<img src="https://codecov.io/gh/38/plotters/branch/master/graph/badge.svg" />
1717
</a>
1818

19-
Plotters is drawing library designed for rendering figures, plots, and charts, in pure rust. Plotters supports various types of back-ends,
20-
including bitmap, vector graph, piston window, GTK/Cairo and WebAssembly.
19+
Plotters is drawing library designed for rendering figures, plots, and charts, in pure rust. Plotters supports various types of back-ends,
20+
including bitmap, vector graph, piston window, GTK/Cairo and WebAssembly.
2121

2222
- A new Plotters Developer's Guide is working in progress. The preview version is available at [here](https://plotters-rs.github.io/book).
2323
- To try Plotters with interactive Jupyter notebook, or view [here](https://plotters-rs.github.io/plotters-doc-data/evcxr-jupyter-integration.html) for the static HTML version.
@@ -147,7 +147,7 @@ And the following code draws a quadratic function. `src/main.rs`,
147147
```rust
148148
use plotters::prelude::*;
149149
fn main() -> Result<(), Box<dyn std::error::Error>> {
150-
let root = BitMapBackend::new("plotters-doc-data/0.png", (640, 480)).into_drawing_area();
150+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/0.png", (640, 480)).into_drawing_area();
151151
root.fill(&WHITE)?;
152152
let mut chart = ChartBuilder::on(&root)
153153
.caption("y=x^2", ("sans-serif", 50).into_font())
@@ -225,7 +225,7 @@ figure
225225
*This tutorial is now working in progress and isn't complete*
226226

227227
Thanks to the evcxr, now we have an interactive tutorial for Plotters!
228-
To use the interactive notebook, you must have Jupyter and evcxr installed on your computer.
228+
To use the interactive notebook, you must have Jupyter and evcxr installed on your computer.
229229
Follow the instruction on [this page](https://github.com/google/evcxr/tree/master/evcxr_jupyter) below to install it.
230230

231231
After that, you should be able to start your Jupyter server locally and load the tutorial!
@@ -249,23 +249,23 @@ But Rust is one of the best languages fits the need.
249249
Plotting in Rust can be as easy as most of the high-level programming languages. The Rust based plotting library
250250
can be very easy to use.
251251

252-
* **Fast** If you need rendering a figure with trillions of data points,
253-
Rust is a good choice. Rust's performance allows you to combine data processing step
252+
* **Fast** If you need rendering a figure with trillions of data points,
253+
Rust is a good choice. Rust's performance allows you to combine data processing step
254254
and rendering step into a single application. When plotting in high-level programming languages,
255-
e.g. Javascript or Python, data points must be down-sampled before feeding into the plotting
256-
program because of the performance considerations. Rust is fast enough to do the data processing and visualization
257-
within a single program. You can also integrate the
255+
e.g. Javascript or Python, data points must be down-sampled before feeding into the plotting
256+
program because of the performance considerations. Rust is fast enough to do the data processing and visualization
257+
within a single program. You can also integrate the
258258
figure rendering code into your application handling a huge amount of data and visualize it in real-time.
259259

260-
* **WebAssembly Support** Rust is one of few the language with the best WASM support. Plotting in Rust could be
260+
* **WebAssembly Support** Rust is one of few the language with the best WASM support. Plotting in Rust could be
261261
very useful for visualization on a web page and would have a huge performance improvement comparing to Javascript.
262262

263263
## Plotting on HTML5 canvas with WASM Backend
264264

265-
Plotters currently supports backend that uses the HTML5 canvas. To use the WASM support, you can simply use
265+
Plotters currently supports backend that uses the HTML5 canvas. To use the WASM support, you can simply use
266266
`CanvasBackend` instead of other backend and all other API remains the same!
267267

268-
There's a small demo for Plotters + WASM under `examples/wasm-demo` directory of this repo.
268+
There's a small demo for Plotters + WASM under `examples/wasm-demo` directory of this repo.
269269
To play with the deployed version, follow this [link](https://plumberserver.com/plotters-wasm-demo/index.html).
270270

271271

@@ -288,7 +288,7 @@ Plotters can use different drawing back-ends, including SVG, BitMap, and even re
288288
use plotters::prelude::*;
289289
fn main() -> Result<(), Box<dyn std::error::Error>> {
290290
// Create a 800*600 bitmap and start drawing
291-
let mut backend = BitMapBackend::new("plotters-doc-data/1.png", (300, 200));
291+
let mut backend = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/1.png", (300, 200));
292292
// And if we want SVG backend
293293
// let backend = SVGBackend::new("output.svg", (800, 600));
294294
backend.draw_rect((50, 50), (200, 150), &RED, true)?;
@@ -309,7 +309,7 @@ Besides that, the drawing area also allows the customized coordinate system, by
309309
use plotters::prelude::*;
310310
fn main() -> Result<(), Box<dyn std::error::Error>> {
311311
let root_drawing_area =
312-
BitMapBackend::new("plotters-doc-data/2.png", (300, 200)).into_drawing_area();
312+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/2.png", (300, 200)).into_drawing_area();
313313
// And we can split the drawing area into 3x3 grid
314314
let child_drawing_areas = root_drawing_area.split_evenly((3, 3));
315315
// Then we fill the drawing area with different color
@@ -335,7 +335,7 @@ To learn more about the element system, please read the [element module document
335335
```rust
336336
use plotters::prelude::*;
337337
fn main() -> Result<(), Box<dyn std::error::Error>> {
338-
let root = BitMapBackend::new("plotters-doc-data/3.png", (300, 200)).into_drawing_area();
338+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/3.png", (300, 200)).into_drawing_area();
339339
root.fill(&WHITE)?;
340340
// Draw an circle on the drawing area
341341
root.draw(&Circle::new(
@@ -352,7 +352,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
352352
### Composable Elements
353353

354354
Besides the built-in elements, elements can be composed into a logic group we called composed elements.
355-
When composing new elements, the upper-left corner is given in the target coordinate, and a new pixel-based
355+
When composing new elements, the upper-left corner is given in the target coordinate, and a new pixel-based
356356
coordinate which has the upper-left corner defined as `(0,0)` is used for further element composition purpose.
357357

358358
For example, we can have an element which includes a dot and its coordinate.
@@ -361,7 +361,7 @@ For example, we can have an element which includes a dot and its coordinate.
361361
use plotters::prelude::*;
362362

363363
fn main() -> Result<(), Box<dyn std::error::Error>> {
364-
let root = BitMapBackend::new("plotters-doc-data/4.png", (640, 480)).into_drawing_area();
364+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/4.png", (640, 480)).into_drawing_area();
365365

366366
root.fill(&RGBColor(240, 200, 200))?;
367367

@@ -400,7 +400,7 @@ of the chart context object.
400400
```rust
401401
use plotters::prelude::*;
402402
fn main() -> Result<(), Box<dyn std::error::Error>> {
403-
let root = BitMapBackend::new("plotters-doc-data/5.png", (640, 480)).into_drawing_area();
403+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/5.png", (640, 480)).into_drawing_area();
404404
root.fill(&WHITE);
405405
let root = root.margin(10, 10, 10, 10);
406406
// After this point, we should be able to draw construct a chart context
@@ -475,7 +475,7 @@ This behavior can also be turned off by setting `default_features = false`.
475475

476476
### List of Features
477477

478-
This is the full list of features that is defined by `Plotters` crate. Use `default_features = false` to disable those default enabled features, and then you should be able to cherry-pick what features you want to include into `Plotters` crate.
478+
This is the full list of features that is defined by `Plotters` crate. Use `default_features = false` to disable those default enabled features, and then you should be able to cherry-pick what features you want to include into `Plotters` crate.
479479

480480
| Name | Description | Additional Dependency |Default?|
481481
|---------|--------------|--------|------------|
@@ -495,12 +495,12 @@ This is the full list of features that is defined by `Plotters` crate. Use `defa
495495

496496
The WASM example requires using `wasm32` target to build. Using `cargo build` is likely to use the default target
497497
which in most of the case is any of the x86 target. Thus you need add `--target=wasm32-unknown-unknown` in the cargo
498-
parameter list to build it.
498+
parameter list to build it.
499499

500500
* How to draw text/circle/point/rectangle/... on the top of chart ?
501-
502-
As you may realized, Plotters is a drawing library rather than a traditional data plotting library,
501+
502+
As you may realized, Plotters is a drawing library rather than a traditional data plotting library,
503503
you have the freedom to draw anything you want on the drawing area.
504-
Use `DrawingArea::draw` to draw any element on the drawing area.
504+
Use `DrawingArea::draw` to draw any element on the drawing area.
505505

506506

doc-template/examples/chart.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use plotters::prelude::*;
22
fn main() -> Result<(), Box<dyn std::error::Error>> {
3-
let root = BitMapBackend::new("plotters-doc-data/5.png", (640, 480)).into_drawing_area();
3+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/5.png", (640, 480)).into_drawing_area();
44
root.fill(&WHITE);
55
let root = root.margin(10, 10, 10, 10);
66
// After this point, we should be able to draw construct a chart context

doc-template/examples/composable_elements.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use plotters::prelude::*;
22

33
fn main() -> Result<(), Box<dyn std::error::Error>> {
4-
let root = BitMapBackend::new("plotters-doc-data/4.png", (640, 480)).into_drawing_area();
4+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/4.png", (640, 480)).into_drawing_area();
55

66
root.fill(&RGBColor(240, 200, 200))?;
77

doc-template/examples/drawing_area.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use plotters::prelude::*;
22
fn main() -> Result<(), Box<dyn std::error::Error>> {
33
let root_drawing_area =
4-
BitMapBackend::new("plotters-doc-data/2.png", (300, 200)).into_drawing_area();
4+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/2.png", (300, 200)).into_drawing_area();
55
// And we can split the drawing area into 3x3 grid
66
let child_drawing_areas = root_drawing_area.split_evenly((3, 3));
77
// Then we fill the drawing area with different color

doc-template/examples/drawing_backends.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use plotters::prelude::*;
22
fn main() -> Result<(), Box<dyn std::error::Error>> {
33
// Create a 800*600 bitmap and start drawing
4-
let mut backend = BitMapBackend::new("plotters-doc-data/1.png", (300, 200));
4+
let mut backend = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/1.png", (300, 200));
55
// And if we want SVG backend
66
// let backend = SVGBackend::new("output.svg", (800, 600));
77
backend.draw_rect((50, 50), (200, 150), &RED, true)?;

doc-template/examples/elements.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use plotters::prelude::*;
22
fn main() -> Result<(), Box<dyn std::error::Error>> {
3-
let root = BitMapBackend::new("plotters-doc-data/3.png", (300, 200)).into_drawing_area();
3+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/3.png", (300, 200)).into_drawing_area();
44
root.fill(&WHITE)?;
55
// Draw an circle on the drawing area
66
root.draw(&Circle::new(

doc-template/examples/quick_start.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use plotters::prelude::*;
22
fn main() -> Result<(), Box<dyn std::error::Error>> {
3-
let root = BitMapBackend::new("plotters-doc-data/0.png", (640, 480)).into_drawing_area();
3+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/0.png", (640, 480)).into_drawing_area();
44
root.fill(&WHITE)?;
55
let mut chart = ChartBuilder::on(&root)
66
.caption("y=x^2", ("sans-serif", 50).into_font())

examples/animation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn snowflake_iter(points: &[(f64, f64)]) -> Vec<(f64, f64)> {
1818
}
1919

2020
fn main() -> Result<(), Box<dyn std::error::Error>> {
21-
let root = BitMapBackend::gif("plotters-doc-data/animation.gif", (800, 600), 1_000)?
21+
let root = BitMapBackend::<image::Rgb<u8>>::gif("plotters-doc-data/animation.gif", (800, 600), 1_000)?
2222
.into_drawing_area();
2323

2424
for i in 0..8 {

examples/area-chart.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
};
1818

1919
let root =
20-
BitMapBackend::new("plotters-doc-data/area-chart.png", (1024, 768)).into_drawing_area();
20+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/area-chart.png", (1024, 768)).into_drawing_area();
2121

2222
root.fill(&WHITE)?;
2323

examples/blit-bitmap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::io::BufReader;
77

88
fn main() -> Result<(), Box<dyn std::error::Error>> {
99
let root =
10-
BitMapBackend::new("plotters-doc-data/blit-bitmap.png", (1024, 768)).into_drawing_area();
10+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/blit-bitmap.png", (1024, 768)).into_drawing_area();
1111
root.fill(&WHITE)?;
1212

1313
let mut chart = ChartBuilder::on(&root)

examples/chart.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use plotters::prelude::*;
22

33
fn main() -> Result<(), Box<dyn std::error::Error>> {
44
let root_area =
5-
BitMapBackend::new("plotters-doc-data/sample.png", (1024, 768)).into_drawing_area();
5+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/sample.png", (1024, 768)).into_drawing_area();
66

77
root_area.fill(&WHITE)?;
88

examples/console.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ where
175175

176176
fn main() -> Result<(), Box<dyn Error>> {
177177
draw_chart(TextDrawingBackend(vec![PixelState::Empty; 5000]).into_drawing_area())?;
178-
let b = BitMapBackend::new("plotters-doc-data/console-example.png", (1024, 768))
178+
let b = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/console-example.png", (1024, 768))
179179
.into_drawing_area();
180180
b.fill(&WHITE)?;
181181
draw_chart(b)?;

examples/errorbar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1212
let down_sampled = down_sample(&data[..]);
1313

1414
let root =
15-
BitMapBackend::new("plotters-doc-data/errorbar.png", (1024, 768)).into_drawing_area();
15+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/errorbar.png", (1024, 768)).into_drawing_area();
1616

1717
root.fill(&WHITE)?;
1818

examples/histogram.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use plotters::prelude::*;
22
fn main() -> Result<(), Box<dyn std::error::Error>> {
33
let root =
4-
BitMapBackend::new("plotters-doc-data/histogram.png", (640, 480)).into_drawing_area();
4+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/histogram.png", (640, 480)).into_drawing_area();
55

66
root.fill(&WHITE)?;
77

examples/mandelbrot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ops::Range;
33

44
fn main() -> Result<(), Box<dyn std::error::Error>> {
55
let root =
6-
BitMapBackend::new("plotters-doc-data/mandelbrot.png", (800, 600)).into_drawing_area();
6+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/mandelbrot.png", (800, 600)).into_drawing_area();
77

88
root.fill(&WHITE)?;
99

examples/matshow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use plotters::prelude::*;
22

33
fn main() -> Result<(), Box<dyn std::error::Error>> {
4-
let root = BitMapBackend::new("plotters-doc-data/matshow.png", (1024, 768)).into_drawing_area();
4+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/matshow.png", (1024, 768)).into_drawing_area();
55

66
root.fill(&WHITE)?;
77

examples/normal-dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rand_distr::{Distribution, Normal};
55

66
fn main() -> Result<(), Box<dyn std::error::Error>> {
77
let root =
8-
BitMapBackend::new("plotters-doc-data/normal-dist.png", (1024, 768)).into_drawing_area();
8+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/normal-dist.png", (1024, 768)).into_drawing_area();
99

1010
root.fill(&WHITE)?;
1111

examples/normal-dist2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1616
};
1717

1818
let root =
19-
BitMapBackend::new("plotters-doc-data/normal-dist2.png", (1024, 768)).into_drawing_area();
19+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/normal-dist2.png", (1024, 768)).into_drawing_area();
2020

2121
root.fill(&WHITE)?;
2222

examples/relative_size.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn draw_chart<B: DrawingBackend>(root: &DrawingArea<B, Shift>) -> DrawResult<(),
3030

3131
fn main() -> Result<(), Box<dyn std::error::Error>> {
3232
let root =
33-
BitMapBackend::new("plotters-doc-data/relative_size.png", (1024, 768)).into_drawing_area();
33+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/relative_size.png", (1024, 768)).into_drawing_area();
3434

3535
root.fill(&WHITE)?;
3636

examples/sierpinski.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use plotters::prelude::*;
33

44
pub fn sierpinski_carpet(
55
depth: u32,
6-
drawing_area: &DrawingArea<BitMapBackend, Shift>,
6+
drawing_area: &DrawingArea<BitMapBackend<image::Rgb<u8>>, Shift>,
77
) -> Result<(), Box<dyn std::error::Error>> {
88
if depth > 0 {
99
let sub_areas = drawing_area.split_evenly((3, 3));
@@ -21,7 +21,7 @@ pub fn sierpinski_carpet(
2121

2222
fn main() -> Result<(), Box<dyn std::error::Error>> {
2323
let root =
24-
BitMapBackend::new("plotters-doc-data/sierpinski.png", (1024, 768)).into_drawing_area();
24+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/sierpinski.png", (1024, 768)).into_drawing_area();
2525

2626
root.fill(&WHITE)?;
2727

examples/slc-temp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::error::Error;
77

88
fn main() -> Result<(), Box<dyn Error>> {
99
let root =
10-
BitMapBackend::new("plotters-doc-data/slc-temp.png", (1024, 768)).into_drawing_area();
10+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/slc-temp.png", (1024, 768)).into_drawing_area();
1111

1212
root.fill(&WHITE)?;
1313

examples/snowflake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn snowflake_iter(points: &[(f64, f64)]) -> Vec<(f64, f64)> {
1919

2020
fn main() -> Result<(), Box<dyn std::error::Error>> {
2121
let root =
22-
BitMapBackend::new("plotters-doc-data/snowflake.png", (1024, 768)).into_drawing_area();
22+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/snowflake.png", (1024, 768)).into_drawing_area();
2323

2424
root.fill(&WHITE)?;
2525

examples/stock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn parse_time(t: &str) -> Date<Local> {
99
}
1010
fn main() -> Result<(), Box<dyn std::error::Error>> {
1111
let data = get_data();
12-
let root = BitMapBackend::new("plotters-doc-data/stock.png", (1024, 768)).into_drawing_area();
12+
let root = BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/stock.png", (1024, 768)).into_drawing_area();
1313
root.fill(&WHITE)?;
1414

1515
let (to_date, from_date) = (

examples/two-scales.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use plotters::prelude::*;
22

33
fn main() -> Result<(), Box<dyn std::error::Error>> {
44
let root =
5-
BitMapBackend::new("plotters-doc-data/twoscale.png", (1024, 768)).into_drawing_area();
5+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/twoscale.png", (1024, 768)).into_drawing_area();
66
root.fill(&WHITE)?;
77

88
let mut chart = ChartBuilder::on(&root)

src/element/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
}
5252
5353
fn main() -> Result<(), Box<dyn std::error::Error>> {
54-
let root = BitMapBackend::new(
54+
let root = BitMapBackend::<image::Rgb<u8>>::new(
5555
"plotters-doc-data/element-0.png",
5656
(640, 480)
5757
).into_drawing_area();
@@ -72,7 +72,7 @@
7272
```rust
7373
use plotters::prelude::*;
7474
fn main() -> Result<(), Box<dyn std::error::Error>> {
75-
let root = BitMapBackend::new(
75+
let root = BitMapBackend::<image::Rgb<u8>>::new(
7676
"plotters-doc-data/element-1.png",
7777
(640, 480)
7878
).into_drawing_area();
@@ -120,7 +120,7 @@
120120
}
121121
fn main() -> Result<(), Box<dyn std::error::Error>> {
122122
let root =
123-
BitMapBackend::new("plotters-doc-data/element-3.png", (640, 480))
123+
BitMapBackend::<image::Rgb<u8>>::new("plotters-doc-data/element-3.png", (640, 480))
124124
.into_drawing_area();
125125
root.fill(&WHITE)?;
126126
let mut chart = ChartBuilder::on(&root)

0 commit comments

Comments
 (0)