FAQ Database Discussion Community

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

## Can I plot times when they're given as UNIX timestamps with added milliseconds?

datetime,gnuplot
I'm using gnuplot 4.4 on CentOS 6.6. I've found many examples online showing that the following (note the use of %.3S) will enable timestamps like "12:42:51.047" to be parsed and used as X axis values: set xdata time set format x "%H:%M:%.3S" set timefmt "%H:%M:%S" However, my input is not...

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

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

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

## How to plot histograms from rows in data file gnuplot

gnuplot,histogram
t.dat file looks like this: 260.37 260.04 261.53 261.32 260.19 260.49 260.43 260.59 260.26 260.68 260.28 259.93 260.82 259.50 260.29 260.52 260.30 259.91 262.24 260.58 260.74 260.22 261.66 260.31 260.99 259.79 260.90 259.88 260.19 261.50 259.32 260.79 259.94 260.35 260.03 260.07 261.86 261.09 260.60 260.15 75.17 75.16 75.33 75.31 75.34...

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

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

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

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

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

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

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

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

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

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

## how to plot a graph using gnuplot from C++ program

c++,gnuplot
Following is the code I have used to write data (x and y coordinates)into a file. void display(){ fstream out; outfile.open("Co_ordinates.txt",fstream::out | fstream::trunc); outfile.precision(6); for(int i=0;i<3000; i++){ outfile<<fixed<<x[i]<<" "<<fixed<<y[i]<<endl; } out.close(); } I want to plot the graph using the x and y coordinates from the above file "Co_ordinates.txt" I...

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

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

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

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

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

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

## histogram in gnuplot vs histogram in unix utilities

csv,gnuplot,histogram

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

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

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

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

## How can I plot several charts from a set of sample data?

gnuplot
I've got a dataset that I'd like to generate a set of plots from, and I'm having trouble getting gnuplot to do it. I've got a dataset with the following columns: time (timestamp in ISO-8601 format YYYY-MM-DDTHH:mm:ss.sssZ) client (hostname of the client; two distinct clients in the dataset) server (hostname...

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

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

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

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

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

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

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

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

## 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 two x-axis from different files

gnuplot,axis
I want to plot data in a plot with two different x-axes. One should be Time in years the other one time in MJD. This is an example from file 1 (x in years): 2011.27466 0.012 2011.71704 0.019 2011.71716 0.021 2011.87012 0.045 This is an example from file 2 (x...

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

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