"use gnuplot to plot sqlite database" Code Answer


to extract the data from your sqlite database, you can use the sqlite3 command line tool to extract the data on-the-fly. this is done with gnuplot by using a < which spawns a shell and uses the output of the given shell commands for plotting.

plot '< sqlite3 myfile.db3 "select temp1, temp2, pressure, humidity from mytable;"' using 0:1 title 'temp1', 
     '' using 0:2 title 'temp2'

this would extract all four fields for each plot ('' repeats the previous file name / shell command). you could also use function to format the shell command:

sqlitefield(f) = '< sqlite3 myfile.db3 "select '.f.' from mytable;"'
fields = 'temp1 temp2 pressure humidity'
plot for [f in fields] sqlitefield(f) using 0:1 title f
By Rob Farley on August 7 2022

Answers related to “use gnuplot to plot sqlite database”

Only authorized users can answer the Search term. Please sign in first, or register a free account.