GenerateOutput ( plotFile ) // Close the plot file. AddDataset ( dataset ) // Open the plot file. for ( x = - 5.0 x <= + 5.0 x += 1.0 ) // Add the dataset to the plot. SetStyle ( Gnuplot2dDataset :: LINES_POINTS ) double x double y // Create the 2-D dataset. AppendExtra ( "set xrange " ) // Instantiate the dataset, set its title, and make the points be // plotted along with connecting lines. SetLegend ( "X Values", "Y Values" ) // Set the range for the x axis. SetTerminal ( "png" ) // Set the labels for each axis. SetTitle ( plotTitle ) // Make the graphics file, which the plot file will create when it // is used with Gnuplot, be a PNG file. Works very nice with the font type I used in here.Std :: string fileNameWithNoExtension = "plot-2d" std :: string graphicsFileName = fileNameWithNoExtension + ".png" std :: string plotFileName = fileNameWithNoExtension + ".plt" std :: string plotTitle = "2-D Plot" std :: string dataTitle = "2-D Data" // Instantiate the plot and set its title. The choice of the right type of font is vital so as gnuplot to display correctly not only the letters someone wants, but also other things as the superscripts in labels. If the font path does not complain with errors, then propably you have chosen it correctly, and it will display the fonts you want.Įvery time someone makes a change and wants to save that change to the "name_of_file.png", someone should retype the (*) command first, then give the changes (for example set another xlabel) and finaly replot. Set output "name_of_file.png" (*) -> see below Set term png enhanced font "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf" If you want to have hellenic, or some other fonts in your labels, you have to type the path of the fonts that you want to use: Now, in order to save the above "project" to a png file it suffices to type: Iv)with f(x)=#, where # is a number, we plot a line parallel to the x axis The simplest command line is as follows: gnuplot> splot sin (x)cos (y) As. Iii)with replot we plot a second plot to the same plot (hope this was clear) The basic plot includes a grid, title, subtitle, axis labels, and color. Ii)the lt #, where # is a number, gives the color of the line, I)the linewidth shows "how big" the line will be Replot "file2" u 1:2 w l linewidth 4 lt 1 (the process took place in gutsy gibbon, I think that it will work in most linux boxes) Which allows to choose the fonts we want to use in gnuplot labels and also to extract a plot with multiple sub-plots in a display file. lt 2 lw 3 square root gnuplot> unset label reset label gnuplot> set arrow 0,0 from. This is a how to based on here (in hellenic language): gnuplot>plot 'plot.In order for gnuplot to find the font the environmental variable GDFONTPATH should be able to look where the fonts are installed. Searching further about the error it seems that gnuplot cannot find a font that is needed. GdImageStringFT: Could not find/open font Options are 'nocrop enhanced medium size 640,480 ' I have tried to set both the size for postscirpt files inside gnuplot or via the convert command, yet to no avail. I get the output in png and the label as it should be, yet with the exception that the resolution is not as good as cretaing a png file from gnuplot. Maybe you propose to install something else? 1) Every time I type the plot command inside gnuplot I get a preview of my plot in a new window.Ģ) I have installed many tex packages from synaptic, yet to no avail as far as png files from gnuplot are concerned.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |