It opens an interactive commandline window in which you can type in gnuplot commands, and plots are shown in a separate window. On Windows the most convenient exe is wgnuplot.exe. If your script has errors, or if you want to learn how to work with gnuplot, it is better to call gnuplot interactively. If you really want to keep gnuplot open you must prevent destroying its process (prc.Free) - of course, this still must be done a some time, and therefore, you must change the structure of the program considerably. Even flashing up is annoying - it can be suppressed if poNoConsole is added to the options of the process (in addition to poWaitOnExit). So, it is not intended to show the gnuplot window permanenty. Although GnuPlot is best known for plotting scientific data and mathematical expressions, it is excellent in business, particularly for financial data. It likes columnar or tab-separated data, which suits SQL Server. I just tested this old sample again, now with the current 5.2RC2, and it still is working perfectly. GnuPlot runs a script, and generally the data is read from a data file specified by the script in the plot command. Maybe you did not understand what this example is doing: It creates a script for gnuplot, starts gnuplot, executes the script, gnuplot writes its output to a temporary image file, and the program reads the image file and displays it in a TImage. If your data are in a file you can specify the filename instead of the "-" parameter of the "splot" command. Note that this script does contain the data directly. Have a look at the gnuplot docs for further refinements of the script. load image created by the script into the TImage component Prc.Executable := 'd:\programme\gnuplot\bin\gnuplot.exe' Script.Add('end') // this closes the data section Y := YMIN (YMAX - YMIN) * j / (NY - 1) X := XMIN (XMAX - XMIN) * i / (NX - 1) create some data append them to script (by using 'file name' parameter "-")ĭefaultFormatSettings.DecimalSeparator := '.' Script.Add('splot "-" using 1:2:3 with points \') Script.Add('set title "my first 3d plot"') Script.Add(Format('set terminal png size %d, %d', )) One can write a script as a text file containing commands as one would type. Prepare gnuplot to write to a png file Below Ive shortened some of whats found in the real Gnuplot users guide. If file names are given on the command line, gnuplot loads each file with the load command. Pngfile := ExtractFileName(ChangeFileExt(GetTempFilename('.', 'IMG'), '.png')) Gnuplot is a command-driven interactive plotting program. By default, when plotting a file, Gnuplot assumes the. Code: procedure TForm1.BtnPlotClick(Sender: TObject) If youd like to see the plots, click on any of the plot or replot commands.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |