Note that there are some explanatory texts on larger screens.

plurals
  1. POgnuplot Real Time Plotting C Implementation
    primarykey
    data
    text
    <p>I'm completely new to gnuplot and have only learned the basics to start plotting. I'm writing a C program that does DSP and needs to plot the result in real time. In addition, I've setup my program in such following manner to incorporate the plot '-' feature from gnuplot. The parent process will perform the DSP computation constantly, and sends the result to the child using pipe in real time. The child will receive a signal from parent, wake up, and sends the result to gnuplot via pipe.</p> <p>Basically, the path of data goes as such:</p> <p>Parent(Computation) -> Pipe -> Child (Wait on Input from parent) -> Pipe -> gnuplot (Plotting)</p> <p>For example, in the child, enclosed in a conditional wait</p> <pre><code>getline(&amp;lineBuffer, lineSize, stdin); printf("%s", lineBuffer); fflush(stdout); </code></pre> <p>where <code>lineBuffer</code> can be any arbitrary <code>char*</code>, will redirect data from parent to gnuplot. I have all the necessary data for plotting, and it can be formatted in any format. However, after trying the following, there has been no success. </p> <p>If not yet defined appearances and label,</p> <pre><code>set terminal x11 persist noraise set xlabel "Frequency" set ylabel "Decibel" set xrange [0:2000] set yrange [-100:100] set style data lines </code></pre> <p>Start initial plot command,</p> <pre><code>plot '-' using 1:2 smooth unique </code></pre> <p>Start sending data, each point is a new line, where I formatted my data to be</p> <pre><code>Frequency Decibel </code></pre> <p>at a particular time, for example</p> <pre><code>1000 -30.00 1001 -31.00 .... </code></pre> <p>End data by sending</p> <pre><code>e\n </code></pre> <p>Then I restart the process sending the data, and end it with </p> <pre><code>replot </code></pre> <p>Does this seem right? On the other hand, I'm also interested in plotting the time series of a particular frequency, and after numerous searches, apparently I need a buffer or a temporary file to accomplish this, is that correct also?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload