-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatplotExample.cpp
More file actions
53 lines (46 loc) · 1.51 KB
/
MatplotExample.cpp
File metadata and controls
53 lines (46 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* runcpp2
OverrideCompileFlags:
Windows:
msvc:
Append: "/wd4251"
Defines: ["MATPLOT_BUILD_HIGH_RESOLUTION_WORLD_MAP"]
Dependencies:
- Name: matplotplusplus
Platforms: [DefaultPlatform]
Source:
Git:
URL: "https://github.com/alandefreitas/matplotplusplus.git"
Branch: "v1.2.2"
LibraryType: Shared
IncludePaths: ["./source", "./build/source/matplot"]
LinkProperties:
SearchLibraryNames: ["matplot"]
ExcludeLibraryNames: ["libmatplot.so.1.2.0"]
SearchDirectories: ["./build/source/matplot", "./build/source/matplot/debug"]
Setup:
- "mkdir build"
- "cd build && cmake .. -DMATPLOTPP_BUILD_WITH_SANITIZERS=OFF -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_INSTALLER=OFF -DMATPLOTPP_BUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=ON"
- "cd build && cmake --build . -j 16"
*/
#include "matplot/matplot.h"
#include <cstdlib>
#include <iostream>
int main()
{
//NOTE: Alternatively, you can put this under "Setup" section in runcpp2 build settings
#ifdef _WIN32
if(system("where gnuplot") != 0)
#else
if(system("which gnuplot") != 0)
#endif
{
std::cout << "Failed to find gnuplot, please install it on the system" << std::endl;
return 1;
}
auto f1 = matplot::figure();
matplot::plot(matplot::vector_1d{1., 2., 3.}, matplot::vector_1d{2., 4., 6.});
auto f2 = matplot::figure();
matplot::scatter(matplot::iota(1, 20), matplot::rand(20, 0, 1));
matplot::show();
return 0;
}