FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
gnuplotpp/examples/two_window_example.cpp at main · watsonryan/gnuplotpp · GitHub
watsonryan
/
gnuplotpp
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
gnuplotpp
/
examples
/
two_window_example.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (39 loc) · 1.28 KB
Breadcrumbs
gnuplotpp
/
examples
/
two_window_example.cpp
Copy path
File metadata and controls
49 lines (39 loc) · 1.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
"
example_common.hpp
"
#
include
"
gnuplotpp/plot.hpp
"
#
include
"
gnuplotpp/presets.hpp
"
#
include
<
vector
>
int
main
(
int
argc,
char
** argv) {
using
namespace
gnuplotpp
;
const
std::filesystem::path out_dir =
example_common::parse_out_dir
(argc, argv,
"
out/two_window_example
"
);
FigureSpec fs;
fs.
preset
= Preset::IEEE_DoubleColumn;
apply_preset_defaults
(fs);
fs.
rows
=
1
;
fs.
cols
=
2
;
fs.
formats
= {OutputFormat::Pdf, OutputFormat::Svg, OutputFormat::Eps};
fs.
title
=
"
Dynamic Compare
"
;
Figure
fig
(fs);
AxesSpec ax0;
ax0.
title
=
"
Position Error
"
;
ax0.
xlabel
=
"
t [s]
"
;
ax0.
ylabel
=
"
||e_p|| [m]
"
;
ax0.
grid
=
true
;
AxesSpec ax1 = ax0;
ax1.
title
=
"
Velocity Error
"
;
ax1.
ylabel
=
"
||e_v|| [m/s]
"
;
fig.
axes
(
0
,
0
).
set
(ax0);
fig.
axes
(
0
,
1
).
set
(ax1);
std::vector<
double
> t;
std::vector<
double
> ep;
std::vector<
double
> ev;
for
(
int
i =
0
; i <
200
; ++i) {
const
double
x =
static_cast
<
double
>(i) *
0.1
;
t.
push_back
(x);
ep.
push_back
(
2.0
/ (
1.0
+ x));
ev.
push_back
(
0.5
/ (
1.0
+
0.4
* x));
}
fig.
axes
(
0
,
0
).
add_series
(SeriesSpec{.
type
= SeriesType::Line, .
label
=
"
SRIF
"
}, t, ep);
fig.
axes
(
0
,
1
).
add_series
(SeriesSpec{.
type
= SeriesType::Line, .
label
=
"
SRIF
"
}, t, ev);
return
example_common::render_figure
(fig, out_dir /
"
figures
"
);
}
Back
|
FazBrowse Home
|
New Git URL