Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
c:c_에_matplotlib_라이브러리_추가해서_그래프_그리기 [2022/01/16 21:55] – created jonghoon | c:c_에_matplotlib_라이브러리_추가해서_그래프_그리기 [2023/09/05 15:46] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
다음은 간단히 sin 그래프를 그리는 예제코드다. | 다음은 간단히 sin 그래프를 그리는 예제코드다. | ||
- | < | + | < |
+ | |||
+ | #include < | ||
#include < | #include < | ||
#include < | #include < | ||
+ | #include < | ||
using std:: | using std:: | ||
using std::sin; | using std::sin; | ||
- | using std::pi; | + | using std::cout; |
+ | |||
+ | namespace plt = matplotlibcpp; | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | const double | ||
+ | |||
+ | vector< | ||
+ | vector< | ||
+ | |||
+ | for(int i = 1; i < x.capacity(); | ||
+ | { | ||
+ | x[i] = x[i-1] + pi/10; | ||
+ | y[i] = sin(x[i]); | ||
+ | } | ||
+ | |||
+ | plt:: | ||
+ | plt:: | ||
+ | plt::show(); // show figure | ||
+ | } | ||
</ | </ | ||
+ | |||
+ | 컴파일할 때는 | ||
+ | < | ||
+ | g++ example.cpp -I/ | ||
+ | </ | ||
+ | |||
+ | 로 하면 된다. | ||
+ | |||
+ | <color # | ||
+ | {{: |