FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib-cpp/examples/lines3d.cpp at master · lava/matplotlib-cpp · GitHub
lava
/
matplotlib-cpp
Public
Notifications
You must be signed in to change notification settings
Fork
1.2k
Star
4.8k
Code
Issues
192
Pull requests
31
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib-cpp
/
examples
/
lines3d.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (25 loc) · 850 Bytes
Breadcrumbs
matplotlib-cpp
/
examples
/
lines3d.cpp
Copy path
File metadata and controls
30 lines (25 loc) · 850 Bytes
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
#
define
_USE_MATH_DEFINES
#
include
"
../matplotlibcpp.h
"
#
include
<
cmath
>
namespace
plt
=
matplotlibcpp;
int
main
()
{
std::vector<
double
> x, y, z;
double
theta, r;
double
z_inc =
4.0
/
99.0
;
double
theta_inc = (
8.0
*
M_PI
)/
99.0
;
for
(
double
i =
0
; i <
100
; i +=
1
) {
theta = -
4.0
*
M_PI
+ theta_inc*i;
z.
push_back
(-
2.0
+ z_inc*i);
r = z[i]*z[i] +
1
;
x.
push_back
(r *
sin
(theta));
y.
push_back
(r *
cos
(theta));
}
std::map<std::string, std::string> keywords;
keywords.
insert
(std::pair<std::string, std::string>(
"
label
"
,
"
parametric curve
"
) );
plt::plot3
(x, y, z, keywords);
plt::xlabel
(
"
x label
"
);
plt::ylabel
(
"
y label
"
);
plt::set_zlabel
(
"
z label
"
);
//
set_zlabel rather than just zlabel, in accordance with the Axes3D method
plt::legend
();
plt::show
();
}
Back
|
FazBrowse Home
|
New Git URL