|
5 | 5 | [](https://alandefreitas.github.io/matplotplusplus/)
|
6 | 6 | [](https://github.com/alandefreitas/matplotplusplus/discussions)
|
7 | 7 |
|
| 8 | + |
| 9 | + |
8 | 10 | 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.
|
9 | 11 |
|
10 | 12 | <!-- https://github.com/bradvin/social-share-urls -->
|
@@ -1966,25 +1968,25 @@ A more complete example of the reactive mode would be:
|
1966 | 1968 |
|
1967 | 1969 | ```cpp
|
1968 | 1970 | // Reactive mode
|
1969 |
| -auto f = gcf(false); |
| 1971 | +auto f = figure(false); |
1970 | 1972 | auto ax = f->gca();
|
1971 | 1973 | auto p = ax->plot(ax, x, y); // draws once
|
1972 | 1974 | p->color("red").line_width(2); // draws twice more
|
1973 |
| -wait(); // pause console |
| 1975 | +show(); // pause console |
1974 | 1976 | ```
|
1975 | 1977 |
|
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 |
1977 | 1979 |
|
1978 | 1980 | ```cpp
|
1979 | 1981 | // Quiet mode
|
1980 |
| -auto f = gcf(true); |
| 1982 | +auto f = figure(true); |
1981 | 1983 | auto ax = f->gca();
|
1982 | 1984 | auto p = ax->plot(x,y); // does not draw
|
1983 | 1985 | p->color("red").line_width(2); // does not draw
|
1984 | 1986 | f->show(); // draw only once and pause console
|
1985 | 1987 | ```
|
1986 | 1988 |
|
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. |
1988 | 1990 |
|
1989 | 1991 | ### Method Chaining
|
1990 | 1992 |
|
@@ -2032,11 +2034,12 @@ Unfortunately, because of how templated functions work, one exception is initial
|
2032 | 2034 | ### Common Utilities
|
2033 | 2035 |
|
2034 | 2036 | 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 --> |
2036 | 2039 | ## Motivation and Details
|
2037 | 2040 |
|
2038 | 2041 | 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 --> |
2040 | 2043 | ## Integration
|
2041 | 2044 |
|
2042 | 2045 | ### Binary Packages
|
|
0 commit comments