I am trying to save the Gnuplot plot in PNG that I get with my SDR and a tool named rtl_power_fftw
.
This command displays my plot on the screen but I want to save it in PNG:
rtl_power_fftw -f 900M:950M -n 10 -b 512 -q |
sed -u '/rtl-power-fftw/s/.*/ plot "-"/;/^$/{N;s/^\n$/e/}' |
gnuplot -p
So after a few researches, I tried this:
rtl_power_fftw -f 900M:950M -n 10 -b 512 -q |
sed -u '/rtl-power-fftw/s/.*/ plot "-"/;/^$/{N;s/^\n$/e/}' |
gnuplot -p -e "set term png; set output 'output.png'; replot; set term x11; set output"`
But this command gives me the following error: line 0: no previous plot when I use the command replot.
I would be very thankful if you can help me to save this plot in PNG, no matter the solution: command line, bash script or a mix of the two.
The output from
rtl_power_fftw -f 900M:950M -n 10 -b 512 -q
apparently contains some GnuPlot commands, but we can't know what they are. You want to modify thesed
script to add theset term
andset output
commands at the beginning of the generated script.What exactly works depends on your
sed
dialect. Perhaps on MacOS try(The
-u
option is probably quite unnecessary here, too.)