Skip to content

Commit 634a9b1

Browse files
committed
Update docs
1 parent fac11a2 commit 634a9b1

File tree

150 files changed

+911
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+911
-199
lines changed

README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
[![Documentation](https://img.shields.io/website-up-down-green-red/http/alandefreitas.github.io/matplotplusplus.svg?label=Documentation)](https://alandefreitas.github.io/matplotplusplus/)
66
[![Discussions](https://img.shields.io/website-up-down-green-red/http/alandefreitas.github.io/matplotplusplus.svg?label=Discussions)](https://github.com/alandefreitas/matplotplusplus/discussions)
77

8+
![](docs/img/matplotcover.png)
9+
810
Data visualization can help programmers and scientists identify trends in their data and efficiently communicate these results with their peers. Modern C++ is being used for a variety of scientific applications, and this environment can benefit considerably from graphics libraries that attend the typical design goals toward scientific data visualization. Besides the option of exporting results to other environments, the customary alternatives in C++ are either non-dedicated libraries that depend on existing user interfaces or bindings to other languages. **Matplot++** is a graphics library for data visualization that provides interactive plotting, means for exporting plots in high-quality formats for scientific publications, a compact syntax consistent with similar libraries, dozens of plot categories with specialized algorithms, multiple coding styles, and supports generic backends.
911

1012
<!-- https://github.com/bradvin/social-share-urls -->
@@ -1966,25 +1968,25 @@ A more complete example of the reactive mode would be:
19661968

19671969
```cpp
19681970
// Reactive mode
1969-
auto f = gcf(false);
1971+
auto f = figure(false);
19701972
auto ax = f->gca();
19711973
auto p = ax->plot(ax, x, y); // draws once
19721974
p->color("red").line_width(2); // draws twice more
1973-
wait(); // pause console
1975+
show(); // pause console
19741976
```
19751977
1976-
For convenience, the examples in Section [Examples](#examples) use the reactive mode. The `wait` function pauses the console until the user interacts with the plot window. If the backend is based on process pipes, because these are unidirectional, closing the window is not enough to resume. The user needs to use the console to unblock execution. A similar example is quiet mode would be
1978+
For convenience, the examples in Section [Examples](#examples) use the reactive mode. The `show` function pauses the console until the user interacts with the plot window. If the backend is based on process pipes, because these are unidirectional, closing the window is not enough to resume. The user needs to use the console to unblock execution. A similar example is quiet mode would be
19771979
19781980
```cpp
19791981
// Quiet mode
1980-
auto f = gcf(true);
1982+
auto f = figure(true);
19811983
auto ax = f->gca();
19821984
auto p = ax->plot(x,y); // does not draw
19831985
p->color("red").line_width(2); // does not draw
19841986
f->show(); // draw only once and pause console
19851987
```
19861988

1987-
In this example, the figure is only updated once. The user could replace the `show` function with the `draw` function, but the window would close as soon as execution completes. It is important to use `wait()` and `show()` with caution. These functions are meant for some particular executables so that an interactive plot does not close before the user can see it. It is probably unreasonable to call these functions inside a library because the user would have to manually interfere with the execution to continue.
1989+
In this example, the figure is only updated once. The user could replace the `show` function with the `draw` function, but the window would close as soon as execution completes. It is important to use `show()` with caution. These functions are meant for some particular executables so that an interactive plot does not close before the user can see it. It is probably unreasonable to call these functions inside a library because the user would have to manually interfere with the execution to continue.
19881990

19891991
### Method Chaining
19901992

@@ -2032,11 +2034,12 @@ Unfortunately, because of how templated functions work, one exception is initial
20322034
### Common Utilities
20332035

20342036
The headers `common.h` and `colors.h` include a number of utilities we use in our examples. These include naive functions to generate and manipulate vectors and strings; handle RGBA color arrays; convert points to and from polar coordinates; read files to strings; write strings to files; calculate gradients; read, write, and manipulate images; and generate vectors with random numbers. Although some of these functions might be helpful, most functions only operate on `vector<double>` and they are not intended to be a library of utilities. The sole purpose of these algorithms is to simplify the examples.
2035-
2037+
2038+
<!-- START mdsplit-ignore -->
20362039
## Motivation and Details
20372040

20382041
If you are interested in understanding how the library works, you can read the details in the complete [article](docs/README.md). It describes the relationship between its main objects, the backend interface, how to create new plot categories, limitations, and compares this library with similar alternatives.
2039-
2042+
<!-- END mdsplit-ignore -->
20402043
## Integration
20412044

20422045
### Binary Packages

docs/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
_site
22
.jekyll-metadata
3-
Gemfile.lock
3+
Gemfile.lock
4+
!integration/build-from-source

docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
3-
title: Documentation
4-
nav_exclude: true
3+
title: White Paper
4+
nav_exclude: false
55
---
66
# Matplot++: A C++ Graphics Library for Data Visualization
77

docs/coding-styles.md

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ has_toc: false
1414
- [Method Chaining](coding-styles/method-chaining.md)
1515
- [Ranges](coding-styles/ranges.md)
1616
- [Common Utilities](coding-styles/common-utilities.md)
17+
18+
19+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/coding-styles/common-utilities.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ has_toc: false
99
# Common Utilities
1010

1111
The headers `common.h` and `colors.h` include a number of utilities we use in our examples. These include naive functions to generate and manipulate vectors and strings; handle RGBA color arrays; convert points to and from polar coordinates; read files to strings; write strings to files; calculate gradients; read, write, and manipulate images; and generate vectors with random numbers. Although some of these functions might be helpful, most functions only operate on `vector<double>` and they are not intended to be a library of utilities. The sole purpose of these algorithms is to simplify the examples.
12-
1312

13+
<!-- START mdsplit-ignore -->
1414

15+
16+
17+
18+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/coding-styles/member-vs-free-standing-functions.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ ax->plot(x, y)->color("red").line_width(2);
4343
my_function(ax);
4444
```
4545

46-
Both examples would generate the same plot. All free-standing functions are templated functions that use meta-programming to call the main function on the current `axes` object. If the first parameter is not an `axes_handle`, it will get an `axes_handle` from the figure registry with `gca` (Section [Axes Object](../examples/appearance/axes-object.md)) and forward all parameters to the function in this `axes` object. If the first parameter is an `axes_handle`, the template function will forward all parameters, but the first one, to this `axes` object. This use of templates for the free-standing functions keeps both coding styles maintainable by the developers.
46+
Both examples would generate the same plot. All free-standing functions are templated functions that use meta-programming to call the main function on the current `axes` object. If the first parameter is not an `axes_handle`, it will get an `axes_handle` from the figure registry with `gca` (Section [Axes Object]()) and forward all parameters to the function in this `axes` object. If the first parameter is an `axes_handle`, the template function will forward all parameters, but the first one, to this `axes` object. This use of templates for the free-standing functions keeps both coding styles maintainable by the developers.
4747

4848
Note that, because the example needs the `axes` object for the function `my_function`, we also need to get a reference to the `axes` object with the free-standing functions. In that case, the free-standing functions are not less verbose than the object-oriented interface.
4949

5050
To adhere to free-standing functions, we could create two versions of `my_function`: one that receives an `axes_handle`, and a second version that would get an `axes_handle` from the figure registry and call the first version. If `my_function` is going to be exposed to other users as a library, this could be a convenience to these users. However, notice that this is only moving the verbosity from the main function to `my_function`. In fact, this is how the free-standing functions in **Matplot++** work.
5151

5252

5353

54+
55+
56+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/coding-styles/method-chaining.md

+3
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ The first code snippet works because `plot` returns a `line_handle` to the objec
3030

3131

3232

33+
34+
35+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/coding-styles/ranges.md

+3
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ Unfortunately, because of how templated functions work, one exception is initial
2929

3030

3131

32+
33+
34+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/coding-styles/reactive-figures.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ has_toc: false
1111
There are also two modes for figures: reactive (or interactive) mode and quiet mode. Figures in reactive mode are updated whenever any of their child objects change. This happens through the `touch` function, that gets called on any child object when it changes its appearance. This creates an interactive mode in which figures are updated as soon as we adjust their properties. If we combine interactive figures with free-standing functions, we have a "Matlab-like style" for plots. This is a coding pattern where the figure registry works as a stream for plots.
1212
The problem with this coding style is that the user might unnecessarily create useless intermediary plots.
1313

14-
Figures in quiet mode are updated by calling the functions `draw()` or `show()` (Section [Reactive Figures](reactive-figures.md)). Unless these functions are called, nothing changes in the figure. The combination of the object-oriented coding style and quiet mode is the "OO-Matplotlib-like style" for plots. This is a coding style in which the user explicitly decides when the plot is shown or updated. This is beneficial to applications that cannot waste computational resources on intermediary figures that might not be valuable to the application.
14+
Figures in quiet mode are updated by calling the functions `draw()` or `show()` (Section [Reactive Figures]()). Unless these functions are called, nothing changes in the figure. The combination of the object-oriented coding style and quiet mode is the "OO-Matplotlib-like style" for plots. This is a coding style in which the user explicitly decides when the plot is shown or updated. This is beneficial to applications that cannot waste computational resources on intermediary figures that might not be valuable to the application.
1515

1616
We generally use free-standing functions with reactive mode and the object-oriented interface with quiet mode. By default, new figures are in reactive mode, unless it is using an non-interactive backend. One can turn this reactive mode on and off with:
1717

@@ -24,25 +24,28 @@ A more complete example of the reactive mode would be:
2424

2525
```cpp
2626
// Reactive mode
27-
auto f = gcf(false);
27+
auto f = figure(false);
2828
auto ax = f->gca();
2929
auto p = ax->plot(ax, x, y); // draws once
3030
p->color("red").line_width(2); // draws twice more
31-
wait(); // pause console
31+
show(); // pause console
3232
```
3333
34-
For convenience, the examples in Section [Examples](../examples.md) use the reactive mode. The `wait` function pauses the console until the user interacts with the plot window. If the backend is based on process pipes, because these are unidirectional, closing the window is not enough to resume. The user needs to use the console to unblock execution. A similar example is quiet mode would be
34+
For convenience, the examples in Section [Examples]() use the reactive mode. The `show` function pauses the console until the user interacts with the plot window. If the backend is based on process pipes, because these are unidirectional, closing the window is not enough to resume. The user needs to use the console to unblock execution. A similar example is quiet mode would be
3535
3636
```cpp
3737
// Quiet mode
38-
auto f = gcf(true);
38+
auto f = figure(true);
3939
auto ax = f->gca();
4040
auto p = ax->plot(x,y); // does not draw
4141
p->color("red").line_width(2); // does not draw
4242
f->show(); // draw only once and pause console
4343
```
4444

45-
In this example, the figure is only updated once. The user could replace the `show` function with the `draw` function, but the window would close as soon as execution completes. It is important to use `wait()` and `show()` with caution. These functions are meant for some particular executables so that an interactive plot does not close before the user can see it. It is probably unreasonable to call these functions inside a library because the user would have to manually interfere with the execution to continue.
45+
In this example, the figure is only updated once. The user could replace the `show` function with the `draw` function, but the window would close as soon as execution completes. It is important to use `show()` with caution. These functions are meant for some particular executables so that an interactive plot does not close before the user can see it. It is probably unreasonable to call these functions inside a library because the user would have to manually interfere with the execution to continue.
4646

4747

4848

49+
50+
51+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/contributing.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ has_toc: false
1010
There are many ways in which you can contribute to this library:
1111

1212
* Testing the library in new environments <sup>see [1](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22cross-platform+issue+-+windows%22), [2](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22cross-platform+issue+-+linux%22), [3](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22cross-platform+issue+-+macos%22) </sup>
13-
* Contributing with interesting examples <sup>see [1](../source/examples)</sup>
14-
* Designing new backends <sup>see [1](../source/matplot/backend/backend_interface.h), [2](../test/backends/ogl_main.cpp), [3](integration/backends.md), [4](README.md#backends)</sup>
13+
* Contributing with interesting examples <sup>see [1](https://github.com/alandefreitas/matplotplusplus/blob/master/source/examples)</sup>
14+
* Designing new backends <sup>see [1](https://github.com/alandefreitas/matplotplusplus/blob/master/source/matplot/backend/backend_interface.h), [2](https://github.com/alandefreitas/matplotplusplus/blob/master/test/backends/ogl_main.cpp), [3](), [4](docs/README.md#backends)</sup>
1515
* Finding problems in this documentation <sup>see [1](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22enhancement+-+documentation%22) </sup>
1616
* Writing algorithms for new plot categories <sup>see [1](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22enhancement+-+plot+categories%22) </sup>
1717
* Finding bugs in general <sup>see [1](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22bug+-+compilation+error%22), [2](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22bug+-+compilation+warning%22), [3](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22bug+-+runtime+error%22), [4](https://github.com/alandefreitas/matplotplusplus/issues?q=is%3Aopen+is%3Aissue+label%3A%22bug+-+runtime+warning%22) </sup>
@@ -29,3 +29,6 @@ Example: CLion
2929

3030

3131
- [Contributors](contributing/contributors.md)
32+
33+
34+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/contributing/contributors.md

+3
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ has_toc: false
5858

5959

6060

61+
62+
63+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples.md

+3
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,6 @@ The examples assume we are in the `matplot` namespace. Use these examples to und
131131
- [Exporting](examples/exporting.md)
132132
- [Saving (Manually)](examples/exporting/saving-manually.md)
133133
- [Saving (Programatically)](examples/exporting/saving-programatically.md)
134+
135+
136+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ has_toc: false
88
---
99
# Annotations
1010

11-
[Text](annotations/text.md) | [Text with Arrow](annotations/text-with-arrow.md) | [Rectangle](annotations/rectangle.md) | [Filled Polygon](annotations/filled-polygon.md) | [Ellipse](annotations/ellipse.md) | [Textbox](annotations/textbox.md) | [Arrow](annotations/arrow.md) | [Line](annotations/line.md)
11+
[Text]() | [Text with Arrow](#text-with-arrow) | [Rectangle]() | [Filled Polygon](#filled-polygon) | [Ellipse]() | [Textbox](#textbox) | [Arrow]() | [Line](#line)
1212

1313
The annotations category is meant to create individual objects on the plot rather than representations of data sets. An important difference between the annotations category and other categories is that, by default, the annotations do not replace the plot that already exists in the `axes` object, even if the user does not call the `hold` function.
1414

@@ -22,3 +22,6 @@ The annotations category is meant to create individual objects on the plot rathe
2222
- [Textbox](annotations/textbox.md)
2323
- [Arrow](annotations/arrow.md)
2424
- [Line](annotations/line.md)
25+
26+
27+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/arrow.md

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ More examples:
2525
2626
2727
28+
29+
30+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/ellipse.md

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ See result
2222
2323
2424
25+
26+
27+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/filled-polygon.md

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ See result
2222
2323
2424
25+
26+
27+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/line.md

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ See result
2222
2323
2424
25+
26+
27+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/rectangle.md

+3
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ The rectangle object can have a border curvature from $0$ to $1$. We can also an
2727
2828
2929
30+
31+
32+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/text-with-arrow.md

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ More examples:
2525
2626
2727
28+
29+
30+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/text.md

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ More examples:
2525
2626
2727
28+
29+
30+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/examples/annotations/textbox.md

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ See result
2222
2323
2424
25+
26+
27+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

0 commit comments

Comments
 (0)