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..854d264 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 +``` 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