Question

Is it possible to plot a matrix(histogram) like [v(1);...;v(i-1);v(i)] in gnuplot. This is the standard output with stringstream << cv::Mat(). This is the y values for hue values 0 to 180.

[25; 0; 0; 0; 0; 0; 1; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 4; 0; 0; 0; 5; 0; 0; 0; 0; 0; 16; 0; 0; 0; 0; 0; 3; 0; 0; 0; 4; 0; 10; 0; 0; 1; 0; 0; 4; 0; 37; 3; 3; 0; 0; 11; 10; 7; 0; 0; 47; 0; 0; 16; 0; 18; 91; 8; 41; 34; 101; 22; 15; 149; 223; 45; 94; 25; 0; 312; 745; 53; 28; 166; 413; 253; 47; 682; 144; 63; 630; 48; 92; 222; 3; 253; 175; 1; 62; 7; 1; 80; 0; 40; 9; 0; 1; 0; 0; 2; 12; 0; 0; 0; 9; 1; 0; 0; 0; 0; 2; 0; 0; 0; 0; 0; 5; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 7; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0]

A short guide on how to present data for gnuplot would be nice.

Was it helpful?

Solution

You have several choices (1) Use the GNUPLOT-CPP wrapper (download here: http://code.google.com/p/gnuplot-cpp/) This will guide itself through its tutorial/docs

(2) Simple solution. Save your values to a file, say "DATA.txt" then invoke, from cpp (exec command), a script like "plot.plt" Which looks something like:

    #!/usr/bin/gnuplot -persist

set terminal postscript
set output "TXTFILE.ps"
unset key

#set title "Titel"
set xlabel "cy/px"
set ylabel "SFR"
(...)
set grid

plot "DATA.txt" using 1:2 smooth csplines w l ls 1,\
    "DATA.txt" using 3:4 smooth csplines w l ls 2
#    EOF

As you can see, it will plot the DATA.txt that you did just output. Use google for all of the previous on gnuplot scripts f.e.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top