Hot answers tagged

13

Put an empty record (blank line) where there is no data. From the docs: Single blank records designate discontinuities in a plot; no line will join points separated by a blank records (if they are plotted with a line style).


12

Supposing that the x values are in the first column of the file 'test.dat' and the y values are in the second column of the same file, than you can operate on the values in the following way: plot 'test.dat' using ($1/n):($2) See the manual for more information and examples on the 'using' keyword. Note that this will not change the values of your data ...


8

Change the last line to plot f(x)*(x<0.8) + g(x) * (x>=0.8)*(x<0.93) + h(x)*(x>=0.93) I find that easy to read, but it has the disadvantage that all f(x), g(x) and h(x) will always be evaluated. You can also use the ternary conditional operator: condition ? case1 : case2 will evaluate to case1 if condition is true and to case2 if ...


8

You can use any string that is not a number as value for the missing data points or explicitly specify a missing data string using the set datafile missing command. If you then plot the lines using plot "vikt_ma.txt" using 1:($2) with lines title "first line" then Gnuplot will leave a gap.


6

I think you might want to take a look at the following two: GNUplot Gnuplot is a portable command-line driven graphing utility for linux, OS/2, MS Windows, OSX, VMS, and many other platforms It's probably the number one graphing tool for scientific data (at least where I come from). Here's a list of demos. You sometimes have to prepare the data for it ...


6

I don't think the above answer is very helpful because, as I am writing this, the first google result method is extremely unsatisfactory. It uses gnuplot's ability to read stdout to generate data, so that plot "< echo '1 2'" will put a single data point at the point x=1, y=2. This has several shortcomings that make it just about unusable. First, ...


6

You can put labels at a specified offset from the points using the following gnuplot command: echo "plot 'file.dat' using 2:3 pt 2 notitle, '' using 2:3:1 with labels offset 0.5,0.5 notitle;" | gnuplot -persist NB: works only if gnuplot has been compiled with --enable-datastrings (thanks to DaveParillo for the clarification)


6

Basically, you plot surfaces with the splot command. data_file contains your example data points. gnuplot> splot 'data_file' As you want a smooth surface, you have to specify that you want gnuplot to interpolate the data. Here is an example, see http://www.gnuplot.info/demo/dgrid3d.html for some others. gnuplot> set hidden3d gnuplot> set ...


5

If you feed gnuplot its commands from the unix command line, you can also pipe data to it from another program, like zcat which reads in a gzipped file and prints it out, e.g.: zcat datafile.gz | gnuplot -p -e 'plot "-" u 1:2' EDIT: Apparently, in place of a filename, you can give gnuplot's plot command a shell command to run and use the output of. Just ...


5

gnuplot has a set of commands and a set of options for each command. The name of each command and option can be abbreviated to the shortest unique string that describes it, e.g. p for the plot command, sp for the splot command, t for the title option to plot. Note that you can't, for example, use s for splot because it conflicts with set. The two-letter ...


5

use the following command, for example, plot "foo" u 1:2 smooth bezier the other options instead of bezier are sbezier, csplines, acsplines. I would just test them for my data and see which one works the best for my purpose.


4

xtic, or xticlabels, does not count as a data column. That is why yerrorlines is complaining about not enough columns. You can provide the implicit column 0 for an enumeration. plot "./data.dat" using 0:2:3:xticlabels(1) with yerrorlines


4

This sets the unit length of both axes to the same value: set size ratio -1 Here is an excerpt from the documentation: set size ratio <r> ... The meaning of a negative value for <r> is different. If <r>=-1, gnuplot tries to set the scales so that the unit has the same length on both the x and y axes. This is equivalent ...


3

Assume your data is in the format: data = { # partition: (frac of disk, frac full) "/": (0.3, 0.9), "/home": (0.7, 0.1), } Try using the reportlab.graphics library (available from the Ubuntu and Fedora repositories as python-reportlab): from reportlab.graphics.shapes import Drawing from reportlab.graphics.charts.piecharts import Pie from ...


3

This is really late, but as I happened across this post, I'll put in my two pennies. Without installing R, we can use call awk within gnuplot: plot "<awk '{print $1, $3}' logfile" u 1:2 where the output of the awk command in the double quotes is used by gnuplot to plot your data. The awk command simply prints out the first and third column. You can ...


3

Use the smooth option of plot, with csplines : plot "DATA" smooth csplines, "DATA" with points You should not use bezier if you want to have the curve going through the points, as it will make a best fit with a minimal number of degrees of freedom.


2

Gnu plot can't do this alone. I doesn't know what to do with the text. If your data exists in a file named file.dat, then: perl -ane 'print "set label \"($F[0])\" at $F[1],$F[2]\n"' file.dat > label.plt will produce a label file you can use in gnuplot. You can then produce a (very basic) plot like this: gnuplot> load "label.plt" gnuplot> plot ...


2

Here's an example of a pie-chart created with gnuplot. Also, on the same site, you can find another example, including the script used for creating the pie-chart.


2

Turn off X-Windows warnings Report this as a bug to ddd@gnu.org. Give them everything needed to reproduce it.


2

This is straight out of the gnuplot documentation ("help ternary"): f(x) = (x>=0 && x <=a)?x:-2 After setting a value for a, you will be able to plot this function over any range you want.


2

Yes: gzcat datafile.gz | plot '-' u 1:2


2

It can also be done quite simply in Mathematica (tested on the Linux version): data = {{"/", 0.3, 0.9}, {"/home", 0.7, 0.1}}; PieChart[{ Labeled[#[[2]], #[[1]]] & /@ data, Flatten[{Labeled[#[[2]] * #[[3]] , "used"], Labeled[#[[2]] * (1-#[[3]]), "free"]} & /@ data] }, SectorSpacing -> 0] Or if you want the colors to match: ...


2

plot "DATA" using 1:2:($3-$1):($4-$2) with vectors nohead The vectors style reads four columns (x, y, dx, dy) and draws a vector from (x, y) to (x + dx, y + dy). nohead prevents gnuplot from drawing the arrow head.


2

The fix is here, in Octave 3.4.0 GNU Octave Repository - 2011-04-21 binary of Octave 3.4.0 at SourceForge.net


2

Found the right syntax, the command is: \$22


2

I experimented a bit more and I finally created something that more or less fits my needs! graphmem.sh #!/bin/bash cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$cwd" for iuser in $(ps haxo user | sort -u); do [[ $iuser == "root" ]] && continue ps haxo user:64,pmem | awk -v tnow="`date -u +'%H:%M:%S'`" -v user="$iuser" ...


2

If you can write a command that can calculate the function you need, then you're done: gnuplot> f(x) = real(system(sprintf("echo %f", x))) gnuplot> plot f(x) (see help system) So you can use e.g. octave to calculate your value. E.g., if your system is linux, you can have directly: gnuplot> bJ(a,x) = real(system(sprintf("echo 'besselj(%f,%f)' | ...


1

You can open use the -geometry option of gnuplot to supply the size of the window. If you use gnuplot inside a script, you can do something like this: resolution=$(xrandr | grep '*') && resolution=${resolution% *} gnuplot -persist -geometry $resolution << EOF plot sin(x) EOF As an alternative you can make this alias in your .bashrc or ...


1

Had the same problem. I think the issue is that I hadn't installed gnuplot correctly. I got around this by downloading Maxima, which has another binary installation of gnuplot. http://sourceforge.net/projects/maxima/files/Maxima-MacOS/ Once this was installed, I had to make sure that the environment was set to x11, because aquaterm was also giving me ...


1

GNUPlot seems to work for me on Mac OS X v10.7.3 with an up-to-date MacPorts installation. I didn't have any plot files handy to open, but it launched okay. Make sure your MacPorts environment is completely up-to-date: sudo port selfupdate sudo port upgrade outdated $ gnuplot G N U P L O T Version 4.4 patchlevel 4 last modified November ...



Only top voted, non community-wiki answers of a minimum length are eligible