gnuplot
gnuplot 2D polar plot with heatmap from 3D dataset – possible?
The image plotting works only for equally distributed rectangular grids, just like any bitmap image is arranged. Otherwise you must use splot with pm3d. The set grid polar works only for 2D, so you must use multiplot to overlay your heatmap with the polar grid. Here a, quite lengthy, example to show you how it … Read more
multiplot – stacking 3 graphs on a larger canvas
In order to use a bigger canvas, you must use the size option when setting the terminal, e.g.: set terminal postscript eps enhanced size 10cm,15cm set size just changes the plot size relative to your canvas. To see this, consider set terminal wxt set size 1.0,1.5 plot sin(x) Parts of the plot disappear, because it … Read more
How to plot data without a separate file by specifying all points inside the Gnuplot script?
You can use the syntax for inline data – filename ‘-‘. The following example produces a simple plot in a GIF image (bash script): gnuplot << EOF set terminal gif set output ‘plot1.gif’ plot ‘-‘ using 1:2 1 10 2 20 3 32 4 40 5 50 e EOF
pipe plot data to gnuplot script
If you are on a Unix system (i.e. not Windows) you can use ‘<cat’ instead of ‘-‘ to read from stdin: plot ‘<cat’ using … Then you can do cat data.txt | gnuplot script.gp. However, in the specific case you mention in your question, with the plot in the for loop, you read the input … Read more
How to get the distance between automatic generated gnuplot tics?
To get the distance between auto-placed tics, use the following code (save as ticstep.gp): xr = abs(max_value – min_value) power = 10.0 ** floor(log10(xr)) xnorm = xr / power # approximate number of decades posns = 20.0 / xnorm; if (posns > 40) { tics = 0.05 } else { if (posns > 20) { … Read more
create heatmap2d from txt file
If you’re willing to do everything in Python, you can compute the histogram and build a contour plot in one script : import numpy as np import matplotlib.pyplot as plt # load the data M = np.loadtxt(‘datafile.dat’, skiprows=1) # compute 2d histogram bins_x = 100 bins_y = 100 H, xedges, yedges = np.histogram2d(M[:,0], M[:,1], [bins_x, … Read more
Gnuplot: How to load and display single numeric value from data file
Lets start with extracting a single cell at (row,col). If it is a single values, you can use the stats command to extract the values. The row and col are specified with every and using, like in a plot command. In your case, to extract the total value, use: # extract the ‘total’ cell stats … Read more
gnuplot store one number from data file into variable
You have a few options… FIRST OPTION: use columnheader plot file using 1:3 title columnheader(6) I haven’t tested it, but this may prevent the first row from actually being plotted. SECOND OPTION: use an external utility to get the title: TITLE=”`head -1 datafile | awk ‘{print $6}’`” plot ‘datafile’ using 1:3 title TITLE If the … Read more
Plotting labeled intervals in matplotlib/gnuplot
Updated: Now includes handling the data sample and uses mpl dates functionality. import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter, MinuteLocator, SecondLocator import numpy as np from StringIO import StringIO import datetime as dt ### The example data a=StringIO(“””a 10:15:22 10:15:30 OK b 10:15:23 10:15:28 OK c 10:16:00 10:17:10 FAILED b 10:16:30 10:16:50 OK “””) … Read more