1 Star 0 Fork 2

sanqima/matplotlib-cpp

forked from lzc/matplotlib-cpp 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
subplot.cpp 587 Bytes
一键复制 编辑 原始数据 按行查看 历史
Cooper Harasyn 提交于 2018-10-06 04:05 +08:00 . Added text and suptitle
#define _USE_MATH_DEFINES
#include <cmath>
#include "../matplotlibcpp.h"
using namespace std;
namespace plt = matplotlibcpp;
int main()
{
// Prepare data
int n = 500;
std::vector<double> x(n), y(n), z(n), w(n,2);
for(int i=0; i<n; ++i) {
x.at(i) = i;
y.at(i) = sin(2*M_PI*i/360.0);
z.at(i) = 100.0 / i;
}
// Set the "super title"
plt::suptitle("My plot");
plt::subplot(1, 2, 1);
plt::plot(x, y, "r-");
plt::subplot(1, 2, 2);
plt::plot(x, z, "k-");
// Add some text to the plot
plt::text(100, 90, "Hello!");
// Show plots
plt::show();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/docplus/matplotlib-cpp.git
git@gitee.com:docplus/matplotlib-cpp.git
docplus
matplotlib-cpp
matplotlib-cpp
master

搜索帮助