#include "../matplotlibcpp.h" #include namespace plt = matplotlibcpp; int main() { std::vector 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 keywords; keywords.insert(std::pair("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(); }