From 8af3392a03f64b4b5866dafb113ee0caf5651f7b Mon Sep 17 00:00:00 2001 From: Nick Gillian Date: Sun, 1 Jan 2017 15:08:48 -0800 Subject: [PATCH] updated bar plot example --- README.md | 3 +++ example_bar_plot/README.md | 24 ++++++++++++++++++++++++ example_bar_plot/images/bar_plot.png | Bin 0 -> 4826 bytes example_bar_plot/src/ofApp.cpp | 14 +++++++++++--- example_matrix_plot/README.md | 2 +- 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 example_bar_plot/README.md create mode 100644 example_bar_plot/images/bar_plot.png diff --git a/README.md b/README.md index dd72d59..38e0d37 100644 --- a/README.md +++ b/README.md @@ -51,5 +51,8 @@ See the specific examples directories for a full description on each example. [Matrix Plot Example](example_matrix_plot) ![alt text](example_matrix_plot/images/matrix_plot.png "Matrix Plot Example") +[Bar Plot Example](example_bar_plot) +![alt text](example_bar_plot/images/bar_plot.png "Bar Plot Example") + ##License The ofxGRT is available under a MIT license. diff --git a/example_bar_plot/README.md b/example_bar_plot/README.md new file mode 100644 index 0000000..c80adaa --- /dev/null +++ b/example_bar_plot/README.md @@ -0,0 +1,24 @@ +##Bar Plot Example + +This example demonstrates the how to use ofxGrt Bar Plot class. + +The example will generate a basic sine wave signal and plot this using the bar plot class. + +![alt text](images/bar_plot.png "Bar Plot Example") + +##Building and running the example +On OS X and Linux, you can build this example by running the following command in terminal: + +```` +cd THIS_DIRECTORY +make -j4 +```` + +To run the example, run the following in terminal: + +```` +make run +```` + +##Using the example +To use this example, simply build and run it. \ No newline at end of file diff --git a/example_bar_plot/images/bar_plot.png b/example_bar_plot/images/bar_plot.png new file mode 100644 index 0000000000000000000000000000000000000000..c3965ae11373067068b5111b15d45b6f687f5650 GIT binary patch literal 4826 zcmeAS@N?(olHy`uVBq!ia0y~yU&5q4@4fFtPPSegrp7+`=CuZQx<)2&z`Qtm^ub*$j4ivMyfBKBs{_F?*c@6RD-~44+Y_8aS-c)rs z^!S;bRX_v%6aI@Hc>kGQV&2(pRR==X1Fdb)SH!S{#QK+P1oHX6;vCj6W!(mOW&J zDOElFf%DtU=~t!KS*4x3Dh*62lNi{3$N)VbzLzV3LBWkKiG->iBA6|4#$A0pBGN1R z8UF3tHuLr?-f&st->-NsY^^alS+It084L7g92TX7uYUbI1%KHc6L{v7^cN}t6He^k& z+mM?Uz4zg&;%6~?fz?0IANDuQih&}0&tEYzTu>ptJ|#PnhebF7n=^RRz=uMH_r}|g zzyA?){LDU3^W^~l*8gXC{!EZg0H$R8dNEs0c&!?_$|I7I+ENX>ITILwB0GU4Mmwl& zx?}ce$qQ+Clbw7Xe12=J53bARtTwlq0t(NHj@+*etK(Qf&1@US(Sn%B(ro%$t{fg(Wcx_ZcMT&nOB+kzyQ&@lzH7V5&s}9^s1rN@OsUXO57JG?K7N6%z4hY&(hy0F zIcU_wZrfV9f~%_;+UkicnII!IKe%9hJ-g|^V*Y`44x+qj@P{-De>{Hs_U+xnk1f9c z{mOkE=)(iGacSFX=ilCa-nUNrfN`_!q$8-u5-pUXO@geCwNR0>D{ literal 0 HcmV?d00001 diff --git a/example_bar_plot/src/ofApp.cpp b/example_bar_plot/src/ofApp.cpp index ac0283c..51edfec 100644 --- a/example_bar_plot/src/ofApp.cpp +++ b/example_bar_plot/src/ofApp.cpp @@ -14,7 +14,6 @@ void ofApp::setup(){ //Setup the plot plot1.setup( NUM_DIMENSIONS, "sine data"); plot1.setRanges( -1.0, 1.0, true ); - } @@ -33,11 +32,10 @@ void ofApp::update(){ //-------------------------------------------------------------- void ofApp::draw(){ - int zoom = 5; int plotX = 10; int plotY = 10; int plotW = ofGetWidth() - plotX*2; - int plotH = 100; + int plotH = ofGetHeight() - 20; ofSetColor(255,255,255); ofFill(); @@ -52,6 +50,16 @@ void ofApp::draw(){ //-------------------------------------------------------------- void ofApp::keyPressed(int key){ + switch(key){ + case 'q': + { + ofImage img; + img.grabScreen(0, 0 , ofGetWidth(), ofGetHeight()); + img.save( ofToDataPath( "screenshot_" + Util::timeAsString() + ".png") ); + } + break; + } + } //-------------------------------------------------------------- diff --git a/example_matrix_plot/README.md b/example_matrix_plot/README.md index bfda11c..e7583ee 100644 --- a/example_matrix_plot/README.md +++ b/example_matrix_plot/README.md @@ -1,6 +1,6 @@ ##Matrix Plot Example -This example demonstrates the how to use GRT Matrix Plot class. +This example demonstrates the how to use ofxGrt Matrix Plot class. The example will generate three matrices, and plot them with the default grayscale plot and using a heatmap texture.