Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| c:c_에_matplotlib_라이브러리_추가해서_그래프_그리기 [2022/01/17 15:54] – jonghoon | c:c_에_matplotlib_라이브러리_추가해서_그래프_그리기 [2026/03/24 16:38] (current) – removed admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | 이 문서는 Ubuntu-20.04 LTS 버전 기준으로 작성되었다. | ||
| - | - git clone을 이용하든 [[https:// | ||
| - | - sudo apt install python-numpy를 터미널에서 실행한다. | ||
| - | |||
| - | 다음은 간단히 sin 그래프를 그리는 예제코드다. | ||
| - | < | ||
| - | |||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | |||
| - | using std:: | ||
| - | using std::sin; | ||
| - | using std::cout; | ||
| - | |||
| - | namespace plt = matplotlibcpp; | ||
| - | |||
| - | int main() | ||
| - | { | ||
| - | const double pi = M_PI; | ||
| - | | ||
| - | vector< | ||
| - | vector< | ||
| - | |||
| - | for(int i = 1; i < x.capacity(); | ||
| - | { | ||
| - | x[i] = x[i-1] + pi/10; | ||
| - | y[i] = sin(x[i]); | ||
| - | } | ||
| - | |||
| - | plt:: | ||
| - | plt:: | ||
| - | plt:: | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | 컴파일할 때는 | ||
| - | < | ||
| - | g++ example.cpp -I/ | ||
| - | </ | ||
| - | |||
| - | 로 하면 된다. | ||
| - | |||
| - | <color # | ||
| - | {{: | ||