FAQ Database Discussion Community

## How to select subplot in gnuplot multiplot mode

gnuplot,subplot
is there any way to select a subplot in gnuplot's multiplot mode as in subplot(n,m,x) in Matlab where x is the one I want to plot at? I am plotting three points using linespoints on a graph in red color at first, then I want to plot a single point...

## Plot all files in a directory simultanously with gnuplot?

gnuplot
I want to do something similar to this question: gnuplot : plotting data from multiple input files in a single graph. I want to plot simultaneously all the files in a directory, without having to explicitly write their names. The column numbers are the same for all the files. What...

## Gnuplot command with multiple “with” arguments

command-line,plot,gnuplot
Plotting in Gnuplot: For example if one tries to both set the datapoint type and the errorbars into one command, there's a conflict of "with" arguments, i.e.: plot "test.csv" using 1:2:3 with points pointtype 5 with yerrorbars The error message is as follows: duplicated or contradicting arguments in plot options....

## To plot stacked histogram in Gnuplot from this data

plot,gnuplot
Data Year Water Power Wood Power 2025 58.1 41.9 2035 55.8 44.2 2050 50.6 49.4 Code set style histogram columnstacked; set terminal qt size 560,270; set grid; set offset 1,1,0,0; plot 'RES.dat' u 1:3; which gives where it somehow omits the first sentence of the command. I tried to set...

## Gnuplot graph with circles, color and radius dependent on input

gnuplot
I have to make graph with gnuplot from some kind of input data. There is date, score and count for every entry. Graph should be with x axis representing date (I'll probably have question for that in the future too :/ ), y axis score and count should be represented...

## GNUPLOT: Joining different series of points with vectors

function,vector,gnuplot,points
I have a file with data in 2 columns X and Y. There are some blocks and they are separated by a blank line. I want to join the points (given by their coordenates x and y in the file) in each block using vectors. I'm trying to use these...

## Two Boxplots for one X position using gnuplot

graph,gnuplot,boxplot
I have 2 sets of data A and B, each with a y value for x=100, 200, 300. I want to create one graph which shows the difference between these two data sets. As such this means that for each x, there will be two boxplots(one for data A and...

## gnuplot: scale axis of matrix plot

gnuplot
I have a matrix, output.dat: 0 0 0 0 0 0 3 7 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 16 6 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

## gnuplot: plotting with image, how to add a contour

gnuplot
I have the following scenario: I plot data using with image to plot a map of intensity levels. They are already binned. Now I am looking for a way to plot the same data such that I can get a contour plot. I want to this so that I can...

key,gnuplot,histogram,legend
I have a simple gnuplot script to plot a histogram with differently colored bars, with each color representing a group. How can I show 3 different keys (1 red, 1 green and 1 blue)? This is my script: unset title set key left set yrange [0:10] set ylabel 'Score' set...

## Gnuplot: plotting from string skips the first line

string,plot,echo,gnuplot,popen
Here's my minimal Gnuplot script: data="3.000000\t49.200000\n3.500000\t42.800000\n4.000000\t37.800000\n4.500000\t33.800000\n5.000000\t30.400000\n5.500000\t28.000000\n" plot '< echo -e '.sprintf('"%s"', data) using 1:2 title 'there is no data point for x=3.0?' w linespoints In my actual script, of course, I populate the data string in a different way (using the stats command), so saving the data to a file...

## gnuplot - How can I count the number of entries in a csv file column?

csv,plot,gnuplot,function-fitting
I have a gnuplot code which includes a function fitting routine. This routine is slow when a large number of data points must be fitted. The number of data points in my input file is variable depending on the parameters of some simulations I am running. I wish to fit...

## Creating a hexplot

r,matlab,matplotlib,gnuplot,matlab-figure
I am trying to create a figure like the one depicted in the third column of the following image: Link for the image in case of backup. Basically I have x and y positions of 200 particles and I have the MSD data for these 200 positions. I'd like MSD...

## gnuplot, multidimensional array, plotting, matrix,

arrays,matrix,multidimensional-array,plot,gnuplot
I am new to GNUPLOT and, I have encountered a problem which I do not know how to deal with. Any help from your side will be appreciated. The problem is: I have two files, say "A.dat" and "B. dat". Both are multidimensional array data. To be exact, A.dat has...

## gnuplot - splot inline data and point labels

gnuplot,labels
Hi Im using this data to get a 3d/2d like histogram. I want to label each histogram column with a 'dx cx' label preferable on top of the column. With my example the graph is drawing correctly, but there are no labels. if I'm using only the using 1:2:3:4 with...

## Offset gnuplot grid lines so that they match xtics

gnuplot
How do I move the vertical grid lines so that they match the horizontal labels/xtics? In the following image, the vertical grid lines don't line up with the xtics: I tried setting the xtics offset before setting the grid, but that doesn't seem to work.Here's my current script: #!/usr/bin/gnuplot -persist...

## Define font style as a variable

gnuplot
Is it possible to define different font styles (in gnuplot), so that I can refer to them later by an index instead of repeating them all every time, for example: font1 = font "Helvetica,12" ; font2 = font "Verdana, 12" and so on

## gnuplot rowstacked histogram: how to put sum above bars

label,gnuplot,histogram
This question is related to gnuplot histogram: How to put values on top of bars. I have a datafile file.dat: x y1 y2 1 2 3 2 3 4 3 4 5 and the gnuplot: set style data histogram; set style histogram rowstacked; plot newhistogram 'foo', 'file.dat' u 2:xtic(1) t...

## How to plot columns numbered greater than 1000 in gnuplot

plot,gnuplot
I have a file with 1600 columns. plot "file" using 1:999 title columnhead(999) plots column 999, but plot "file" using 1:1000 title columnhead(1000) produces column 100 instead of 1000, producing the same result as plot "file" using 1:100 title columnhead(100) Apparently large column numbers are wrapped. Is there a work-around...

## Extend x-axis beyond xrange in gnuplot

gnuplot,axis
I am trying to draw a larger x-axis than my xrange. I.e. my xrange is [0:10] I plot f(x)=sin(x) But I want the x-scale to be from 0 to 15 xtics doesn't solve this problem as it will not extent beyond the set xrange. jlinkels...

## Gnuplot plotting all datafiles automatically

bash,gnuplot
I have multiple *.data files each has same format and can be plotted with this simple script: cat << __EOF | gnuplot -persist set terminal pdf set output 'out.pdf' set datafile separator ";" set boxwidth 0.5 set style fill solid plot "xxx.dat" using 1:3:xtic(2) with boxes __EOF How can i...

## Application of Gnuplot figure as transparent on top of image

plot,gnuplot
I would like plot on the top of png figure as transparent and no axes in Gnuplot. If legend can be fitted there, it would be great. Its code which is based on many discussions of mine in gnuplot here set xrange [2014:2050]; set yrange [40:125]; set datafile separator "...

## Unable to plot bargraph using gnuplot

gnuplot
I'm seeing an issue while plotting the bar graph using gnuplot. Im using gnuplot version 4.6 on Windows 7. I'm seeing an error message ";" expected. Here is the logic: # bar graph #set title "Programming language" set xlabel "Programming" set ylabel "Execution time" set auto x set yrange [0:120]...

## C++ Gnuplot pipe input from C++ defined variables

c++,pipe,gnuplot
I am using C++ to pipe commands to gnuplot using the following code: FILE *gnuplotPipe = popen("gnuplot -persist", "w"); // Open a pipe to gnuplot if (gnuplotPipe) { // If gnuplot is found fprintf(gnuplotPipe, "reset\n"); //gnuplot commands fprintf(gnuplotPipe, "n='500'\n"); fprintf(gnuplotPipe, "max='1500'\n"); fprintf(gnuplotPipe, "min='-1500\n"); fprintf(gnuplotPipe, "width=(max-min)/n\n"); fprintf(gnuplotPipe, "hist(x,width)=width*floor(x/width)+width/2.0\n"); fprintf(gnuplotPipe, "set term...

## gnuplot wxt not working anymore

gnuplot
I have recently upgraded to Debian jessie, meaning that I have upgraded from gnuplot 4.6.0 to gnuplot 4.6.6 (issue is the same with gnuplot 5.0). I have bash scripts automating things, and launching gnuplot terminal. I was using either: gnuplot -persist -e "set title 'Sine curve'; plot sin(x)" or gnuplot...

## How to Set Precision in GNU Plot Graph Range?

gnuplot
I set the range in my plot like such set yrange[ 0.000 : 0.040 ] and the graph's interval is 0.005 on the y-axis. The y-axis reads like 0.04 0.035 0.03 0.025 0.02 0.015 0.01 0.005 0 on the side of the graph. This looks totally inconsistent. How can I...

## Lost Data Point in Gnuplot

gnuplot
I have a simple time series: 2015-05-03 07:00,58 2015-05-03 08:00,61 2015-05-03 09:00,65 2015-05-03 10:00,69 2015-05-03 11:00,72 2015-05-03 12:00,74 2015-05-03 13:00,76 2015-05-03 14:00,78 2015-05-03 15:00,78 2015-05-03 16:00,78 2015-05-03 17:00,77 2015-05-03 18:00,76 2015-05-03 19:00,73 2015-05-03 20:00,70 2015-05-03 21:00,67 2015-05-03 22:00,66 2015-05-03 23:00,64 2015-05-04 00:00,63 2015-05-04 01:00,62 2015-05-04 02:00,62 2015-05-04 03:00,61 2015-05-04 04:00,61...

## Gnuplot: Fitting asymptotic curve to data

gnuplot
I am trying to fit an asymptotic curve to my data using gnuplot. It is a dataset showing reaction time results over a testing period. I have been able to plot the data and fit a straight line through it using the following code. f(x) = a*x + c; fit...

## plotting points in 3d surface using x,y,z coordinates

3d,gnuplot
I need to plot some points in 3d surface based on x,y,z coordiantes values in a file named as test.dat test.dat file contains At-No X Y Z 6 3.532210 -2.171743 0.921140 7 1.164869 -1.418981 0.782133 1 2.454732 2.332989 -0.907213 6 -3.246376 -1.047325 -0.602590 6 -2.620684 0.053348 -0.013310 6 -4.569969 -1.249720...

## Is it possible to “print” gnuplot's output directly to STDOUT?

c++,gnuplot
I am using a third-parter utility named gnuplot-iostream to invoke gnuplot from C++ in the back-end of a web application. That web application is executed under CGI, so anything that goes to STDOUT is the result to browser. In this case, the web request will be for the image itself,...

## Plotting multiple columns with a for loop in gnuplot, key doesn't work

for-loop,gnuplot
I have file with many columns that I'd like to plot as follows: plot for [i=1:30] 'test' using 1:i w lp This gives the plot I want, but when I do set key, then the key I see has all lines labeled as 1:i: How can I make this output...

## gnuplot: plotting points with color based iris data

gnuplot,classification,svm,libsvm
I have this iris data ... 5.1 3.5 1.4 0.2 Iris-setosa 4.9 3 1.4 0.2 Iris-setosa 7 3.2 4.7 1.4 Iris-versicolor 6.4 3.2 4.5 1.5 Iris-versicolor 7.1 3 5.9 2.1 Iris-virginica 6.3 2.9 5.6 1.8 Iris-virginica . . . and I got graph using gnuplot (plot 'c:\iris.data') but I want...

## Is it possible to read the value of a label in gnuplot from a file

gnuplot
Creating labels in gnulot is quite simple set label "<value>" at <x,y> ... But I want to read the value of a label in gnuplot from a file. The lines in the file look this way: ... 400 300 8 0.200214 1.00193 7.42157 8.623714 86.06 13.94 1.26 800 600 1...

## Passing variable to gnuplot via -e causes not persistent window

bash,shell,gnuplot
I want to run either persistent gnuplot or write output to file. This behavior should be affected by passing variable. Here is my test.plg: #!/usr/bin/gnuplot -p if (exists("file")) set term png; set output "test.png"; if (!exists("name")) exit; set title name plot sin(x) If I run script this way it is...

## Counting number of plotted points in gnuplot

gnuplot
The data file contains values in the following format: 0 0 50 0 1 70 1 0 40 1 1 70 2 0 110 2 1 60 3 0 60 3 1 120 4 0 50 4 1 50 5 0 70 5 1 70 This is a code snippet...

## Can I have multiple colors in a gnuplot label?

label,gnuplot
I have this graph in gnuplot: I want to include totals for each of the three colored line graphs. One possibility is to replace the key with this: Can I plot this with a single label that switches colors? If not then I'd have to use six labels. In that...

## Plotting the inverse of the numbers in columns in gnuplot with for loop

for-loop,gnuplot
I want to plot the inverse of the numbers in a number of columns against the first column: plot for [i=1:30] 'file' using 1:(1/i) w lp which results in all the y values to be zero. It works when I remove the for loop and just pick a column to...

gnuplot,javaplot

gnuplot

## Distinct bars of different group in Gnuplot for printing

plot,gnuplot,histogram
The problem for me is how plot (using gnuplot) bars with different styles in a figure so that they can be print. Take data from http://www.ibm.com/developerworks/aix/library/au-gnuplot/ for example, the data is: #Disk.txt hdisk2 420 425 410 hdisk3 700 780 760 hdisk4 450 450 452 hdisk5 680 702 690 hdisk6 320...

## Gnuplot plot two data with different time format

plot,gnuplot,time-format
I have two data with different time format: file1 (%Y %j %H %M %S vel): 2011 170 0 0 0 0.017042 2011 170 0 30 0 0.002124 2011 170 1 0 0 0.061001 2011 170 1 30 0 0.096256 2011 170 2 0 0 0.073920 2011 170 2 30 0...

## Gnuplot exit on window close

gnuplot
I use the following script to print readings from a .csv file. The plot is refreshed every second to show new data when a simulation is running. This works kinda nice, although is a little ugly since the whole dataset is reread (if you have a better solution please let...

## Animating a single data file using gnuplot

animation,gnuplot
I use FORTRAN 77 code to generate data (saved as filename.dat) of simple physics situations containing x-y co-ordinates like a projectile. My data files usually have 2 or 3 columns like so: 1 1 2 2 3 3 4 4 5 5 I can plot (2d and 3d) using Gnuplot...

## Set with lines in gnuplot

gnuplot
I can connect the dots of a data file by including with lines in the plot command. Is there a way to set this fixed (I was hoping for set with lines) so I don't have to explicitly include it in every call of plot?

## Gnuplot, normalize over x axis

gnuplot
I've got two datasets referring to the same process executed in two different ways. The execution A is slower than the execution B with respect to real time, but the two graphs represent the same phenomena.. I can plot the two together as follows: plot 'A' using 1:2, 'B' using...

## Whether is it possible to plot normal probability distribution in gnuplot

linux,shell,plot,gnuplot
My data file is as- 2 3 4 1 5 2 0 3 4 5 3 2 0 3 4 0 5 4 3 2 3 4 4 0 5 3 2 3 4 5 1 3 4 My requirement is to plot normal PDF in gnuplot. I could do...

## To fill space between these two curves in Gnuplot

plot,gnuplot
Code set xrange [2014:2050]; set yrange [80:110]; set terminal qt size 560,270; set grid; set offset 1,1,0,0; inc(x) = 0.439 * x - 800.65; re(x) = 1.0025 * 83.3 * 1.005**(-2014 + x); plot re(x) w filledcurves, inc(x) w filledcurves; and I get which is wrong. The parameter selection must...

## gnuplot - get errors on fit parameters, get fit output values as variables, print variable to screen

variables,gnuplot,curve-fitting,data-fitting,function-fitting
Initial Question (Partially Answered) I am using gnuplot's fitting routines to fit a function to some data, and extract a "characteristic decay time constant". (I call this parameter d in my fitting function.) I have used the script code set fit quiet to prevent reams of text being printed to...

## gnuplot: draw polygon from data

gnuplot
How can I plot polygons with data coming from a file? For example if I have a file containing coordinates of the edges of a four-point polygon for each data point, how would I proceed? e.g. a data file containing 0 0 0 1 1 1 1 0 2 2...

## Set arbitrary base of logarithm in gnuplot

gnuplot
I would like to ask how can I set arbitrary base of logarithm in gnuplot (I would need f(x)=x^{1+9log2(x)} function to plot).

## Lua Error: “Gnuplot terminal is not set”

lua,gnuplot
In LuaJIT or in the Torch REPL, I run the commands require 'gnuplot' gnuplot.figure() and I get the error "Gnuplot terminal is not set". I tried using gnuplot.setterm() with some guesses such as 'x11' and 'qt' as arguments, but get the error "gnuplot does not seem to have this term"....

## about drawing sinus function in gnuplot when it is pressed a keyboard

gnuplot
Is it possible to draw sinus function on the interval: [-2*pi, 2*pi] in the following way: when I press right arrow on the keyboard to produce sinus function on the interval: [-2*pi, -pi] when I press again to plot sinus function on the interval [-pi, 0] .... Is it possible?...

## Does anyone know how to get rid of the “small bar” in a gnuplot graph?

gnuplot
Below is my gnuplot code. set term pdf enhanced set output "plot/test.pdf" set datafile separator "," set xtics norangelimit set ytics nomirror set termoption dashed set xlabel "times" set yrange [0:100] set xtics nomirror set grid ytics set key right bottom plot 'plot/test.csv' using 2:xtic((int($0)%20)==0?sprintf("%d",$0*10):"") title "Comparing with the...

## GNUplot: How to make a plot unclosed?

gnuplot
I'm drawing plots from a file in gnuplot like this: plot "plots.txt" using 1:2 with lines lw 2 and I get something like this: How can I draw a plot without enclosing it (without the line connecting the leftmost and the rightmost points)? Thank you!...

## gnuplot highlighting points when with lines

plot,gnuplot,highlight
I have 4 points I would like to plot using gnuplot, but with lines. The problem is, I can't find how to highlight these 4 points on the drawn line. I would like for the plot to be a line through the points, but that these points are also clearly...

## Gnuplot lc palette not working with timefmt

timestamp,gnuplot,palette
I am plotting a graph with regular variables on the x and y axis and I want the line to change color with respect a time variable. I have tried using lc palette after defining one and even the colorbox appears but the line doesn't change color. I also tried...

## Surface plot piping to gnuplot from C

c,2d,gnuplot,surface,piping
I've made a function which successfully pipes data from my C program to gnuplot: void gnuprintabs(FILE *gp,double **RE,double **IM, double x[], int N) { int i,j; fprintf(gp, "splot '-'\n"); for (i=0; i<N; i++) { for(j=0; j<N; j++) { fprintf(gp, "%g %g %g\n", x[i],x[j],sqrt(RE[i][j]*RE[i][j]+IM[i][j]*IM[i][j])); } } fflush(gp); fprintf(gp, "e\n"); } The...

## Changing title within loop

gnuplot
I am using gnuplot 5.0, and I have a data set I would like to plot using key1 = 'Some title with multiple words' key2 = 'Some other descriptive title ' key3 = '...and a third title' plot for[i=1:3] datafile index i-1 using 1:2 with lines title eval('key'.i) This is...

## gnuplot command line arguments and call arguments

gnuplot,command-line-interface,interactive
following up from the question on SO about command line parameters to gnuplot scripts, and its corresponding answer, I see that I can make a script myscript.gp like if(!exist("parameters")) parameters="" plot "< myprog ".parameters u 1:2 and call it with \$ gnuplot -e "parameters='-m 5'" myscript.gp However, I could achieve...

## Gnuplot: plot 2D graph with variable points sizes and colors

plot,colors,gnuplot,javaplot
I have been trying to plot scatter data with points where the size and colors depend on the input. I have check some others examples and I get to write this, but then I get that error message plot '-' using 1:2:3:4:5 with labels hypertext point pt 7 ps var...

## Set label on group multiplot in gnuplot

linux,graph,plot,gnuplot
Im plotting one picture with 4 different graphs using gnuplot. Labels for their x and y axes have the same meaning. If Im plotting it like this: set multiplot layout 2,2 rowsfirst set xlabel "x" set ylabel "y" set title offset -3,-3 set xrange [20:70] set yrange [0:15000] set title...

## How to get my Mac OS X terminal to control gunplot properly?

gnuplot
I am using gunplot on mac os x (Yosemite). I can plot data, but I can't do a lot of customization: commands like: set tics "", or rotate by ... don't work. Do you think it's a problem from the installation or terminal? Thanks!...

## Generating a Heatmap Table in gnuplot

matrix,gnuplot,heatmap
I am trying to generate a Heatmap with gnuplot but with a two distinct information for each entry in the heatmap. While heatmap shows the value as color, I want each block in the heatmap to show textual information as well. The following script creates half of what I have...

## Plotting in matlab / octave by grouping numbers into a range

matlab,plot,gnuplot,octave
I'm trying to have the data be the x-axis and the y-axis be the amount of values grouped by 10. See Plot below as example I tried using bar(x) but I'm not sure how you get the numbers in the correct categories for plotting. example: if the data is x=1,5.3,9,10.5,12,13,15.2,25,191,192.4...

## Remove redundant file names in gnuplot figure

gnuplot
I wrote a simple gnuplot shell script #!/usr/bin/gnuplot reset set terminal png set xlabel "Time" set ylabel "Prime and Probe #" plot "file.dat" with points Notice that there is an annoying "file.dat" on the upper right corner. How can I remove that? gnuplot Version 4.6 patchlevel 4 ...