Skip to content

Commit 2478e9b

Browse files
committed
Render README from template
Signed-off-by: Aaron Erhardt <aaron.erhardt@t-online.de>
1 parent a5605ae commit 2478e9b

File tree

3 files changed

+48
-52
lines changed

3 files changed

+48
-52
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Plotters - A Rust drawing library focusing on data plotting for both WASM and native applications 🦀📈🚀
1+
# Plotters - A Rust drawing library focusing on data plotting for both WASM and native applications 🦀📈🚀
22

33
<a href="https://crates.io/crates/plotters">
44
<img style="display: inline!important" src="https://img.shields.io/crates/v/plotters.svg"></img>
@@ -140,7 +140,7 @@ To view the source code for each example, please click on the example image.
140140
* [Plotting in Rust](#plotting-in-rust)
141141
* [Plotting on HTML5 canvas with WASM Backend](#plotting-on-html5-canvas-with-wasm-backend)
142142
* [What types of figure are supported?](#what-types-of-figure-are-supported)
143-
* [Concepts by example](#concepts-by-examples)
143+
* [Concepts by example](#concepts-by-example)
144144
+ [Drawing Backends](#drawing-backends)
145145
+ [Drawing Area](#drawing-area)
146146
+ [Elements](#elements)
@@ -215,7 +215,7 @@ To learn how to use Plotters in different scenarios, check out the following dem
215215

216216
## Trying with Jupyter evcxr Kernel Interactively
217217

218-
Plotters now supports integration with `evcxr` and is able to interactively drawing plots in Jupyter Notebook.
218+
Plotters now supports integration with `evcxr` and is able to interactively draw plots in Jupyter Notebook.
219219
The feature `evcxr` should be enabled when including Plotters to Jupyter Notebook.
220220

221221
The following code shows a minimal example of this.
@@ -276,8 +276,7 @@ Also, there's a static HTML version of this notebook available at [this location
276276

277277
## Plotting in Rust
278278

279-
Rust is a perfect language for data visualization. Although there are many mature visualization libraries in many different languages,
280-
Rust is one of the best languages fits the need.
279+
Rust is a perfect language for data visualization. Although there are many mature visualization libraries in many different languages, Rust is one of the best languages that fits the need.
281280

282281
* **Easy to use** Rust has a very good iterator system built into the standard library. With the help of iterators,
283282
plotting in Rust can be as easy as most of the high-level programming languages. The Rust based plotting library
@@ -292,17 +291,16 @@ within a single program. You can also integrate the
292291
figure rendering code into your application to handle a huge amount of data and visualize it in real-time.
293292

294293
* **WebAssembly Support** Rust is one of the languages with the best WASM support. Plotting in Rust could be
295-
very useful for visualization on a web page and would have a huge performance improvement compared to Javascript.
294+
very useful for visualization on a web page and would have a huge performance improvement comparing to Javascript.
296295

297296
## Plotting on HTML5 canvas with WASM Backend
298297

299-
Plotters currently supports a backend that uses the HTML5 canvas. To use WASM support, you can simply use
298+
Plotters currently supports a backend that uses the HTML5 canvas. To use WASM, you can simply use
300299
`CanvasBackend` instead of other backend and all other API remains the same!
301300

302301
There's a small demo for Plotters + WASM available at [here](https://github.com/plotters-rs/plotters-wasm-demo).
303302
To play with the deployed version, follow this [link](https://plotters-rs.github.io/wasm-demo/www/index.html).
304303

305-
306304
## What types of figure are supported?
307305

308306
Plotters is not limited to any specific type of figure.
@@ -313,7 +311,7 @@ Currently, we support line series, point series, candlestick series, and histogr
313311
And the library is designed to be able to render multiple figure into a single image.
314312
But Plotter is aimed to be a platform that is fully extendable to support any other types of figure.
315313

316-
## Concepts by examples
314+
## Concepts by example
317315

318316
### Drawing Backends
319317
Plotters can use different drawing backends, including SVG, BitMap, and even real-time rendering. For example, a bitmap drawing backend.
@@ -338,7 +336,7 @@ Plotters uses a concept called drawing area for layout purpose.
338336
Plotters supports integrating multiple figures into a single image.
339337
This is done by creating sub-drawing-areas.
340338

341-
Besides that, the drawing area also allows customized coordinate system, by doing so, the coordinate mapping is done by the drawing area automatically.
339+
Besides that, the drawing area also allows for a customized coordinate system, by doing so, the coordinate mapping is done by the drawing area automatically.
342340

343341
```rust
344342
use plotters::prelude::*;
@@ -626,3 +624,5 @@ pub fn register_font(
626624

627625
In the case that error handling is important, you need manually call the `present()` method before the backend gets dropped.
628626
For more information, please see the examples.
627+
628+

plotters/src/lib.rs

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![warn(missing_docs)]
22
/*!
33
4-
# Plotters - A Rust drawing library focus on data plotting for both WASM and native applications 🦀📈🚀
4+
# Plotters - A Rust drawing library focusing on data plotting for both WASM and native applications 🦀📈🚀
55
66
<a href="https://crates.io/crates/plotters">
77
<img style="display: inline!important" src="https://img.shields.io/crates/v/plotters.svg"></img>
@@ -16,14 +16,14 @@
1616
<img style="display: inline! important" src="https://img.shields.io/badge/docs-development-lightgrey.svg"></img>
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,
19+
Plotters is a drawing library designed for rendering figures, plots, and charts, in pure Rust. Plotters supports various types of back-ends,
2020
including bitmap, vector graph, piston window, GTK/Cairo and WebAssembly.
2121
22-
- A new Plotters Developer's Guide is working in progress. The preview version is available at [here](https://plotters-rs.github.io/book).
23-
- 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.
22+
- A new Plotters Developer's Guide is a work in progress. The preview version is available [here](https://plotters-rs.github.io/book).
23+
- Try Plotters with an interactive Jupyter notebook, or view [here](https://plotters-rs.github.io/plotters-doc-data/evcxr-jupyter-integration.html) for the static HTML version.
2424
- To view the WASM example, go to this [link](https://plotters-rs.github.io/wasm-demo/www/index.html)
25-
- Currently we have all the internal code ready for console plotting, but a console based backend is still not ready. See [this example](https://github.com/38/plotters/blob/master/examples/console.rs) for how to plotting on Console with a customized backend.
26-
- Plotters now moved all backend code to sperate repositories, check [FAQ list](#faq-list) for details
25+
- Currently we have all the internal code ready for console plotting, but a console based backend is still not ready. See [this example](https://github.com/38/plotters/blob/master/examples/console.rs) for how to plot on console with a customized backend.
26+
- Plotters has moved all backend code to separate repositories, check [FAQ list](#faq-list) for details
2727
- Some interesting [demo projects](#demo-projects) are available, feel free to try them out.
2828
2929
## Gallery
@@ -280,8 +280,8 @@ including bitmap, vector graph, piston window, GTK/Cairo and WebAssembly.
280280
* [Plotting in Rust](#plotting-in-rust)
281281
* [Plotting on HTML5 canvas with WASM Backend](#plotting-on-html5-canvas-with-wasm-backend)
282282
* [What types of figure are supported?](#what-types-of-figure-are-supported)
283-
* [Concepts by examples](#concepts-by-examples)
284-
+ [Drawing Back-ends](#drawing-back-ends)
283+
* [Concepts by example](#concepts-by-example)
284+
+ [Drawing Backends](#drawing-backends)
285285
+ [Drawing Area](#drawing-area)
286286
+ [Elements](#elements)
287287
+ [Composable Elements](#composable-elements)
@@ -346,7 +346,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
346346
347347
## Demo Projects
348348
349-
To learn how to use Plotters in different scenarios by checking out the following demo projects:
349+
To learn how to use Plotters in different scenarios, check out the following demo projects:
350350
351351
- WebAssembly + Plotters: [plotters-wasm-demo](https://github.com/plotters-rs/plotters-wasm-demo)
352352
- minifb + Plotters: [plotters-minifb-demo](https://github.com/plotters-rs/plotters-minifb-demo)
@@ -355,7 +355,7 @@ To learn how to use Plotters in different scenarios by checking out the followin
355355
356356
## Trying with Jupyter evcxr Kernel Interactively
357357
358-
Plotters now supports integrate with `evcxr` and is able to interactively drawing plots in Jupyter Notebook.
358+
Plotters now supports integration with `evcxr` and is able to interactively draw plots in Jupyter Notebook.
359359
The feature `evcxr` should be enabled when including Plotters to Jupyter Notebook.
360360
361361
The following code shows a minimal example of this.
@@ -396,7 +396,7 @@ figure
396396
397397
## Interactive Tutorial with Jupyter Notebook
398398
399-
*This tutorial is now working in progress and isn't complete*
399+
*This tutorial is a work in progress and isn't complete*
400400
401401
Thanks to the evcxr, now we have an interactive tutorial for Plotters!
402402
To use the interactive notebook, you must have Jupyter and evcxr installed on your computer.
@@ -406,57 +406,55 @@ After that, you should be able to start your Jupyter server locally and load the
406406
407407
```bash
408408
git clone https://github.com/38/plotters-doc-data
409-
cd plotteres-doc-data
409+
cd plotters-doc-data
410410
jupyter notebook
411411
```
412412
413413
And select the notebook called `evcxr-jupyter-integration.ipynb`.
414414
415-
Also, there's a static HTML version of this notebook available at the [this location](https://plotters-rs.github.io/plotters-doc-data/evcxr-jupyter-integration.html)
415+
Also, there's a static HTML version of this notebook available at [this location](https://plotters-rs.github.io/plotters-doc-data/evcxr-jupyter-integration.html)
416416
417417
## Plotting in Rust
418418
419-
Rust is a perfect language for data visualization. Although there are many mature visualization libraries in many different languages.
420-
But Rust is one of the best languages fits the need.
419+
Rust is a perfect language for data visualization. Although there are many mature visualization libraries in many different languages, Rust is one of the best languages that fits the need.
421420
422421
* **Easy to use** Rust has a very good iterator system built into the standard library. With the help of iterators,
423-
Plotting in Rust can be as easy as most of the high-level programming languages. The Rust based plotting library
422+
plotting in Rust can be as easy as most of the high-level programming languages. The Rust based plotting library
424423
can be very easy to use.
425424
426-
* **Fast** If you need rendering a figure with trillions of data points,
427-
Rust is a good choice. Rust's performance allows you to combine data processing step
425+
* **Fast** If you need to render a figure with trillions of data points,
426+
Rust is a good choice. Rust's performance allows you to combine the data processing step
428427
and rendering step into a single application. When plotting in high-level programming languages,
429428
e.g. Javascript or Python, data points must be down-sampled before feeding into the plotting
430429
program because of the performance considerations. Rust is fast enough to do the data processing and visualization
431430
within a single program. You can also integrate the
432-
figure rendering code into your application handling a huge amount of data and visualize it in real-time.
431+
figure rendering code into your application to handle a huge amount of data and visualize it in real-time.
433432
434-
* **WebAssembly Support** Rust is one of few the language with the best WASM support. Plotting in Rust could be
433+
* **WebAssembly Support** Rust is one of the languages with the best WASM support. Plotting in Rust could be
435434
very useful for visualization on a web page and would have a huge performance improvement comparing to Javascript.
436435
437436
## Plotting on HTML5 canvas with WASM Backend
438437
439-
Plotters currently supports backend that uses the HTML5 canvas. To use the WASM support, you can simply use
438+
Plotters currently supports a backend that uses the HTML5 canvas. To use WASM, you can simply use
440439
`CanvasBackend` instead of other backend and all other API remains the same!
441440
442441
There's a small demo for Plotters + WASM available at [here](https://github.com/plotters-rs/plotters-wasm-demo).
443442
To play with the deployed version, follow this [link](https://plotters-rs.github.io/wasm-demo/www/index.html).
444443
445-
446444
## What types of figure are supported?
447445
448446
Plotters is not limited to any specific type of figure.
449447
You can create your own types of figures easily with the Plotters API.
450448
451-
But Plotters provides some builtin figure types for convenience.
449+
Plotters does provide some built-in figure types for convenience.
452450
Currently, we support line series, point series, candlestick series, and histogram.
453451
And the library is designed to be able to render multiple figure into a single image.
454452
But Plotter is aimed to be a platform that is fully extendable to support any other types of figure.
455453
456-
## Concepts by examples
454+
## Concepts by example
457455
458-
### Drawing Back-ends
459-
Plotters can use different drawing back-ends, including SVG, BitMap, and even real-time rendering. For example, a bitmap drawing backend.
456+
### Drawing Backends
457+
Plotters can use different drawing backends, including SVG, BitMap, and even real-time rendering. For example, a bitmap drawing backend.
460458
461459
```rust
462460
use plotters::prelude::*;
@@ -475,10 +473,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
475473
476474
### Drawing Area
477475
Plotters uses a concept called drawing area for layout purpose.
478-
Plotters support multiple integrating into a single image.
476+
Plotters supports integrating multiple figures into a single image.
479477
This is done by creating sub-drawing-areas.
480478
481-
Besides that, the drawing area also allows the customized coordinate system, by doing so, the coordinate mapping is done by the drawing area automatically.
479+
Besides that, the drawing area also allows for a customized coordinate system, by doing so, the coordinate mapping is done by the drawing area automatically.
482480
483481
```rust
484482
use plotters::prelude::*;
@@ -500,7 +498,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
500498
501499
### Elements
502500
503-
In Plotters, elements are build blocks of figures. All elements are able to draw on a drawing area.
501+
In Plotters, elements are the building blocks of figures. All elements are able to be drawn on a drawing area.
504502
There are different types of built-in elements, like lines, texts, circles, etc.
505503
You can also define your own element in the application code.
506504
@@ -528,9 +526,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
528526
529527
### Composable Elements
530528
531-
Besides the built-in elements, elements can be composed into a logic group we called composed elements.
529+
Besides the built-in elements, elements can be composed into a logical group we called composed elements.
532530
When composing new elements, the upper-left corner is given in the target coordinate, and a new pixel-based
533-
coordinate which has the upper-left corner defined as `(0,0)` is used for further element composition purpose.
531+
coordinate which has the upper-left corner defined as `(0,0)` is used for further element composition.
534532
535533
For example, we can have an element which includes a dot and its coordinate.
536534
@@ -571,7 +569,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
571569
572570
### Chart Context
573571
574-
In order to draw a chart, Plotters need a data object built on top of the drawing area called `ChartContext`.
572+
In order to draw a chart, Plotters needs a data object built on top of the drawing area called `ChartContext`.
575573
The chart context defines even higher level constructs compare to the drawing area.
576574
For example, you can define the label areas, meshes, and put a data series onto the drawing area with the help
577575
of the chart context object.
@@ -582,7 +580,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
582580
let root = BitMapBackend::new("plotters-doc-data/5.png", (640, 480)).into_drawing_area();
583581
root.fill(&WHITE);
584582
let root = root.margin(10, 10, 10, 10);
585-
// After this point, we should be able to draw construct a chart context
583+
// After this point, we should be able to construct a chart context
586584
let mut chart = ChartBuilder::on(&root)
587585
// Set the caption of the chart
588586
.caption("This is our first plot", ("sans-serif", 40).into_font())
@@ -663,13 +661,13 @@ Use `default_features = false` to disable those default enabled features,
663661
and then you should be able to cherry-pick what features you want to include into `Plotters` crate.
664662
By doing so, you can minimize the number of dependencies down to only `itertools` and compile time is less than 6s.
665663
666-
The following list is a complete list of features that can be opt in and out.
664+
The following list is a complete list of features that can be opted in or out.
667665
668666
- Tier 1 drawing backends
669667
670668
| Name | Description | Additional Dependency |Default?|
671669
|---------|--------------|--------|------------|
672-
| bitmap\_encoder | Allow `BitMapBackend` save the result to bitmap files | image, rusttype, font-kit | Yes |
670+
| bitmap\_encoder | Allow `BitMapBackend` to save the result to bitmap files | image, rusttype, font-kit | Yes |
673671
| svg\_backend | Enable `SVGBackend` Support | None | Yes |
674672
| bitmap\_gif| Opt-in GIF animation Rendering support for `BitMapBackend`, implies `bitmap` enabled | gif | Yes |
675673
@@ -744,7 +742,7 @@ pub fn register_font(
744742
745743
* How to draw text/circle/point/rectangle/... on the top of chart ?
746744
747-
As you may realized, Plotters is a drawing library rather than a traditional data plotting library,
745+
As you may have realized, Plotters is a drawing library rather than a traditional data plotting library,
748746
you have the freedom to draw anything you want on the drawing area.
749747
Use `DrawingArea::draw` to draw any element on the drawing area.
750748
@@ -758,10 +756,10 @@ pub fn register_font(
758756
- [HTML5 Canvas Backend](https://github.com/plotters-rs/plotters-canvas.git)
759757
- [GTK/Cairo Backend](https://github.com/plotters-rs/plotters-cairo.git)
760758
761-
* How to check if a backend writes file successfully ?
759+
* How to check if a backend writes to a file successfully ?
762760
763-
The behavior of Plotters backend is consistent with standard library.
764-
When the backend instance is being dropped, [`crate::drawing::DrawingArea::present()`] or `Backend::present()` is called automatically
761+
The behavior of Plotters backend is consistent with the standard library.
762+
When the backend instance is dropped, [`crate::drawing::DrawingArea::present()`] or `Backend::present()` is called automatically
765763
whenever is needed. When the `present()` method is called from `drop`, any error will be silently ignored.
766764
767765
In the case that error handling is important, you need manually call the `present()` method before the backend gets dropped.

plotters/src/style/font/ttf.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ impl FontExt {
8282
_ => unreachable!(),
8383
};
8484
let face = unsafe {
85-
std::mem::transmute::<_, Option<Face<'static>>>(
86-
ttf_parser::Face::parse(data, idx).ok(),
87-
)
85+
std::mem::transmute::<_, Option<Face<'static>>>(ttf_parser::Face::parse(data, idx).ok())
8886
};
8987
Self { inner: font, face }
9088
}

0 commit comments

Comments
 (0)