FAQ Database Discussion Community

## 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...

## How to make gnuplot to NOT plot multiple lines?

plot,scripting,gnuplot
I am plotting some data and I am getting multiple lines streaking across the plot. There should be one line, so I imagine that gnuplot is trying to fit the data and is joining points or something in a strange way. How can I get gnuplot to plot one like...

## 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 - Graphic appears and disappears when zooming

graphics,gnuplot
I'm trying to plot some graphics in gnuplot, and I find out that canvas doesn't show the whole curve. It shows different graphics for different zooms. What could I do to solve this?...

## 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...

## Remove thing from gnuplot's legend

gnuplot
I have to plot three implicit functions using gnuplot, I use this: set contour set cntrparam levels discrete 0 set view map unset surface set isosamples 1000,1000 set xrange [-5:7] set yrange [-15:15] set xlabel "x" set ylabel "y" splot y**2-x**3+15*x-13 t "t1", y**2-x**3+15*x-sqrt(4.*15.**3/27.) t "singular", y**2-x**3+15*x-30 t "t2", y**2-x**3+15*x-13...

## 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...

## 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...

## 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...

## 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...

## 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...

## Symbols in Gnuplot label

plot,gnuplot
Code in terminal qt and gnuplot 5.0 plot x; set xlabel 'Magnetic field {/Symbol Mu}_0' which works in gnuplot prompt. However, {/Symbol mu}_0 is not working in Commandline script /usr/local/bin/gnuplot -e "plot x; set xlabel 'Magnetic field {/Symbol m}_0 H / mT'; I get gdImageStringFT: No character set found while...

## 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...

## 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]...

## Gnuplot: Plotting different functions in a loop

function,loops,gnuplot
I'd like to plot the Hermite polynomials in the same graph without having to type them one by one using a loop. I've tried something like this: H0(x) = 1 H1(x) = 2*x H2(x) = 4*x*x-2 H3(x) = 8*x**3-12*x H4(x) = 16*x**4-48*x**2+12 H5(x) = 32*x**5-160*x**3+120*x plot for[i=0:5] H.i(x) but It...

## Gnuplot: Conditional splot of a function

conditional,gnuplot
I want to splot the function exp(-(x²+y²)) alone and under the constraint of x+y-1=0. The result should be the surface alone as well as a line with a maximum at x=y=0.5. Or in other words, it's the intersection of the function with a (110)-plane. What I came up so far...

## gnuplot: strange pattern on color palette

gnuplot
I am using a color palette like this: set palette defined (0 '#0000ff', 1 '#ff0000') I expect the color palette on the plot to be a smooth transition from blue to red but what I get is this: As you can see there are like more transparent steps in between....

## 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, 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...

## 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...

## Matching a Color Gradient to Data in Gnuplot

I have data showing a change over time, and I have used Gnuplot 4.6 to generate the following plot: Here, I have manually defined eleven line styles to change the color gradually from red (#ff0000) to dark red (#5f0000) as `time' progresses. Here was my input: # svg set terminal...

## Gnuplot: how to mimic sketch graphs

gnuplot,sketching
I want to plot a figure like this one: but with only sketched data curves. The x and y axes should not be sketched. Is this possible using Gnuplot?...

## 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).

## 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...

## How to get labels on top of bars in gnuplot

gnuplot
I want a barchart with labels on top of the bars, showing a group of bars, with errors, and labels on top of the bars indicating how much this bar differs from the first one. Although i get the positioning about right, it is always a little off. Y seems...

## 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...

## 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...

## how to automatically sort the x values in gnuplot

sorting,gnuplot
When I try to plot something with linespoints, unless the values that go to the x axis are already sorted within the file, each point gets connected to the point that is on the next line of the file: Only when I sort the values in the file I can...

## Gnuplot bar chart from this CSV input

bash,gnuplot
I have csv file data.dat for example with these values: #W=1 0;sqlite;11500 1;hsql;14550 2;h2;17550 #W=2 0;sqlite;11000 1;hsql;13800 2;h2;16500 #W=3 0;sqlite;11000 1;hsql;13800 2;h2;16500 #W=4 0;sqlite;11000 1;hsql;13800 2;h2;16500 I need to plot bar charts into pdf. each data for each graph starts with title #W1,#W2.... i have tried this script: cat <<...

## 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...

## 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"....

## 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...

## How do I skip rows in Gnuplot when plotting a heat map?

gnuplot,heatmap
I'm trying to plot a heat map in Gnuplot: set view map set size square set cbrange [0:1] splot "input.dat" 1:4:8 w pm3d But I want to skip the rows with the data in the first & fourth column in a particular range without changing xrange and yrange. How can...

## 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...

## Calling Gnuplot in Swift

I'm trying to call gunplot from swift to produce some plots in .png. However, the program below does not work --- the resulting 1.png file is empty. If I leave the "set term aqua" though, it does call the aqua window with the plot in it. However when I try...

## 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...

## 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...

## 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 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...

## 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...

## Can I set a default Y range in gnuplot?

gnuplot
My graphs will be generated based on runtime data, such as user-provided time ranges. I can't know ahead of time whether data within the requested xrange will actually exist. In the case that it's not, I'd like to show a blank plot (with X=time range as requested, but arbitrary Y...

## gnuplot command line arguments and call arguments

gnuplot,command-line-interface,interactive

gnuplot

## How to draw a histogram with broken x-axis and string labels?

gnuplot,histogram
I am trying to draw a histogram with broken x-axis. I learnt the basic solution from this post. However, the x-axis of my histogram is based on strings, not number. It's like this: set terminal pdf set output "test-bar.pdf" set boxwidth 1.0 absolute set style fill solid 1 border 0...

## 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 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....

## 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...

## Running gnuplot from Fortran program under Windows

windows,fortran,gnuplot
I need to make a Fortran program(.exe) that analyses data and builds a plot. I've decided to do this by calling gnuplot from my Fortran program along with a gnuplot settings file. When I do this from Windows Command Line: wgnuplot -persist input.txt it works fine. But when I call...

## 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 ...

## 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...

## 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: 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...

## 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...

## C++ Pass a string into a pipe to gnuplot

c++,string,pipe,gnuplot
I'm having a small problem passing a string to gnuplot from c++ I can pass integers easily enough, but when I try a string (user defined as "title" earlier in the code): fprintf(gnuplotPipe, "set title %s\n", title); I get the error: error: cannot pass objects of non-trivially-copyable type ‘std::string {aka...

## 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...

## How to highlight regions of plot with gnuplot

I'd appreciate if somebody can help with this question. I am working with a radar (or spiderweb) plot with gnuplot 5.0.0: The scale and range in all axes is the same. The numbers at and beyond 1 have a special meaning and I would like to highlight that. I am...

## 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,...

## histogram in gnuplot vs histogram in unix utilities

csv,gnuplot,histogram
I have csv file, I want to create histogram from column 6. Using Linux utilities this is simple: └──> cut -f6 -d, nupic_out.csv | grep -vi [a-z] | grep -v '^\$' | sort | uniq -c | sort -k2,2n 563 0.0 72 0.025 35 0.05 22 0.075 14 0.1 21...

## 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...

## 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!...