From 057e636e62e10e85eb61efc5e88fd1f184c13555 Mon Sep 17 00:00:00 2001 From: Peter Beno Date: Wed, 11 Oct 2017 21:15:32 +0200 Subject: [PATCH 1/2] add cmake example --- CMakeLists.txt | 9 +++++++++ README.md | 14 +++++++++++++- main.cpp | 17 +++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt create mode 100644 main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6b5afb0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.9) +project(plotpipe) + +# set(CMAKE_CXX_STANDARD 11) + +set(SOURCE_FILES + main.cpp) + +add_executable(plotpipe ${SOURCE_FILES}) \ No newline at end of file diff --git a/README.md b/README.md index dc0eaf4..4e2c9e2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ plotpipe Simple C++ class for quick & dirty real-time plotting via a pipe to gnuplot -Right now it's just a simple header file that allows plotting a vector of one-d or two-d data that can refresh as your program runs. I designed it for scientific computing in mind, but it might be useful in many contexts. +Right now it's just a simple header file **graph.h** that allows plotting a vector of one-d or two-d data that can refresh as your program runs. I designed it for scientific computing in mind, but it might be useful in many contexts. Note: right now it depends on linux (not familiar with windows pipe commands), and requires an installation of gnuplot. @@ -28,3 +28,15 @@ Here's how it's used: } This example will just plot a quadratic function, and scroll over time with a moving window over the function. + +###Example + +```bash +git clone https://github.com/jal278/plotpipe.git +cd plotpipe/ +mkdir build +cd build +cmake .. +make +./plotpipe +``` \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..af96c22 --- /dev/null +++ b/main.cpp @@ -0,0 +1,17 @@ +#include +#include "graph.h" + +using namespace std; + +int main(int argc,char **argv) { + plot p; + for(int a=0;a<100;a++) { + vector x, y; + for (int k = a; k < a + 200; k++) { + x.push_back(k); + y.push_back(k * k); + } + p.plot_data(x, y); + } + return 0; +} \ No newline at end of file From 331b1a3863fb17ead3e1cbb30da21cc1e35da593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Be=C5=88o?= Date: Wed, 11 Oct 2017 21:17:20 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e2c9e2..854d264 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Here's how it's used: This example will just plot a quadratic function, and scroll over time with a moving window over the function. -###Example +### Example ```bash git clone https://github.com/jal278/plotpipe.git @@ -39,4 +39,4 @@ cd build cmake .. make ./plotpipe -``` \ No newline at end of file +```