Gnuplot timestamp color? - colors

I have a system doing several plots with gnuplot and after a platform-change went to black background in graphics. Problem is, I'm not able to get the text on timestamp to be white.
Would love to have a timestamp but black text on black background is, well, a bit dull :)
This is frim my .plot:
#set colors
set border linecolor rgbcolor "white"
set key textcolor rgbcolor "white"
set ylabel textcolor rgbcolor "white"
set y2label textcolor rgbcolor "white"
set xlabel textcolor rgbcolor "white"
set title textcolor rgbcolor "white"
set timestamp color rgbcolor "white"
set obj 1 rectangle behind from screen 0,0 to screen 1,1
set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "black"
And timestamp is at the moment
#insert timestamp to upper left corner
set timestamp "%d.%m.%Y - %H:%M:%S" top offset -1,-1 font ",10"
I've tried everything possible in my mind, so do You have any ideas left?

It's strange, that set timestamp doesn't support textcolor. As workaround you can set a label and format the time with strftime:
set label left at character 1, graph 1.05 strftime("%d.%m.%Y - %H:%M:%S", time(0)) tc rgb "white"
That works fine with 4.6.3.
That may need some tweaking of the position an maybe of the top margin (I don't know if the timestamp is considered when calculating the top margin, a label is definitely not).

Related

Set background of boxes in boxplot to a specific color with gnuplot

I've got the following data:
# id min 1st quart median 3rd quart max sum std-dev name
1 0.00029 0.02590 0.06331 0.12910 6.50177 1524.58705 0.13483 spec
2 1.50041 1.59762 1.67226 1.79827 13.45151 26583.69935 0.48373 schema
3 0.00206 0.01292 0.02505 0.09679 116.93156 5337.36854 2.06006 truss
And the following gnuplot script:
set terminal png enhanced background rgb 'white' size 1920,1200 font "Verdana 10"
set output "charts/summary.png"
set boxwidth 0.2 absolute
set title "Validating all data"
set xrange[0:4]
set yrange[0.00005:50]
set logscale y
set grid y
set tics scale 0
set xtics rotate by -45
set xtics nomirror
set ytics nomirror
set border 2
set style fill solid 0.25 border -1
set style data boxplot
plot "data/summary" using 1:3:2:6:5:(0.6):xticlabels(9) with candlesticks title 'Quartiles' whiskerbars, \
'' using 1:4:4:4:4:(0.6) with candlesticks lt -1 notitle
The output of which looks like:
The problem being that I can't figure out how to set the background color of the boxes in the boxplot. I can only seem to turn on and off the fill-in color by removing the set style fill solid 0.25 border -1 line.
Although the name of keyword doesn't suggest so, the linecolor seems to affect the color of the boxes, thus for example:
plot "data/summary" using 1:3:2:6:5:(0.6):xticlabels(9) with candlesticks lc rgb 'blue' title 'Quartiles' whiskerbars, \
'' using 1:4:4:4:4:(0.6) with candlesticks lt -1 notitle

Customizing gnuplot clustered histogram x-axis labels

I have a gnuplot script
set terminal qt size 850,500 enhanced font 'Verdana,12' persist
set boxwidth 0.9 absolute
set ylabel "Duration in milliseconds" #font "Arial 14"
set tics font "Monospaced,bold 14"
set style fill solid 1.00 border lt -1
set key inside right top vertical Right noreverse noenhanced autotitle nobox
set style histogram cluster gap 1 title textcolor lt -1
set minussign
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45 autojustify
set xtics norangelimit
set xtics ()
set title "Integer d-ary heap performance"
set yrange [0:*]
set style line 1 lt 1 lc rgb "#000000"
set style line 2 lt 2 lc rgb "green"
plot 'integer_heap_benchmark_dary.dat' using 2:xtic(1) linecolor rgb "#5555ff" title col, \
'' using 3:xtic(1) linecolor rgb "#f4dc42" title col, \
'' using 4:xtic(1) title col
which looks like this:
What I want to achieve is:
Move each x-axis label a little bit to the left so that it "points" to the center of each cluster,
Change the font and size of the x-axis labels.
I have put an effort to find the answers on my own, yet without any success.
Try something like
set tics font "Courier,24"
to set the font.
To center the labels, try something like
set xtics offset -3
You'll have to experiment with the values.

Gnuplot won't clip my circle plot. Does set clip works?

I am trying to plot a "fat bands" bandstructure and I am having some trouble with gnuplot.
set terminal pngcairo size 1600,1200 enhanced font "Verdana, 40"
set output 'bandplot.png'
set ylabel 'Energy (eV)'
set yrange [-3:3] # set x range of the plot
set border lw 4
set key font ",25" spacing 1.0 samplen 0 at screen 0.55,0.8
set clip
plot 'bands.dat' u ($1):($2) with lines lt -1 lw 5 notitle,\
'bands.dat' u ($1):($2):(0.0015*$3) with circles lc rgb "blue" fs transparent solid 0.25 noborder title "test"
This data is basically a function in black line and over that there is a similar data with variable sized circles. The thing is set clip is not avoiding some of the circles to be drawn outside the graph. Does anyone know how to do it?
Also, I have seen some bug pages and this might not be possible to be accomplished. Thanks!
Works fine for me even without using set clip (tested with 5.0 and 4.6.6):
set xrange [-pi:pi]
set samples 21
plot '+' using 1:(cos($1)):(0.1) with circles fs solid

Gnuplot: how to fill a bar with both a color background and a pattern

I want to fill a bar with both a color background and a pattern. Is it possible in Gnuplot?
I am using Gnuplot 4.6.5
The code I have now:
# set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 500, 350
# set output 'histograms.2.png'
set boxwidth 0.9 absolute
set style fill solid 1.00 border lt -1
set key inside right top vertical Right noreverse noenhanced autotitles nobox
set style histogram clustered gap 1 title offset character 0, 0, 0
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45 offset character 0, 0, 0 autojustify
set xtics norangelimit font ",8"
set xtics ()
set title "US immigration from Northern Europe\nPlot selected data columns as histogram of clustered boxes"
i = 22
set yrange [0:2000]
set style line 1 lc rgb 'orange';
set style line 2 lc rgb 'pink';
plot for [i=2:7] 'data.dat' using i:xtic(1) ti col ls i%2+1;
The data file:
Region Denmark France Demark-Women France-women Demark-man France-men
1891-1900 1000 1100 500 600 500 500
1901-1910 1500 1600 1000 600 500 1000
Here are the links to download the script: https://dl.dropboxusercontent.com/u/45318932/histograms2.plt and data file: https://dl.dropboxusercontent.com/u/45318932/data.dat
The script gives me:
What I want is:
It would be much appreciated if someone can help me improve the code to produce the second figure. Thanks.
That one is very tricky because you cannot change the background color of the fill patterns. And by default the background color of the patterns is white, and not transparent or empty.
The only terminal which can be manipulated adequately is the lua tikz terminal. Here, I first draw all the color boxes, and later in a second iteration the fill patterns. To have a new iteration, I use the newhistogram option, which however causes a gap in the legend.
To remove the white background of the fill patterns, I remove the relevant parts from the output stream with sed. Quite hacky, but it works:
set terminal lua tikz standalone size 5in, 3in color
set output '| sed ''s/\\gpfill{color=gpbgfillcolor}//g'' > histograms.tex'
set boxwidth 0.9 absolute
set style fill solid 1.00 border lt -1
set key inside right top vertical Right noreverse noenhanced autotitles nobox
set style histogram clustered gap 1 title offset character 0, 0, 0
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45 offset character 0, 0, 0 autojustify
set xtics norangelimit font ",8"
set xtics ()
set title "US immigration from Northern Europe\nPlot selected data columns as histogram of clustered boxes"
i = 22
set yrange [0:2000]
set xrange [-1:2]
set style line 1 lc rgb 'orange';
set style line 2 lc rgb 'pink';
plot for [i=2:7] 'data.dat' using i:xtic(1) ti columnhead(i > 3 ? 10 : i) ls i%2+1 fillstyle solid noborder,\
newhistogram at -1, \
'' using 2 ti 'total' lt -1 fillstyle empty,\
'' using 3 notitle lt -1 fillstyle empty,\
'' using 4 title 'women' lt -1 fillstyle pattern 5,\
'' using 5 notitle lt -1 fillstyle pattern 5,\
'' using 6 title 'men' lt -1 fillstyle pattern 6,\
'' using 7 notitle lt -1 fillstyle pattern 6
set output
system('pdflatex histograms.tex')
Result with 4.6.5:
Just found out, that you can specify the patterns to have no background color like
... fillstyle pattern 6 transparent
For which terminals that works depends on the gnuplot version:
plot x with filledcurves x1 fillstyle solid fc rgb '#990000',\
x with filledcurves x1 fillstyle pattern 4 transparent lc rgb 'white'
Result (with svg terminal and version 4.6.5):

gnuplot - Colored tic marks

Is there any way to have gnuplot color the tic marks in the x and/or y axis? I'm using a background png file which is quite dark and I'd like the inner tics to show in white over it, not the default black.
The tics seem to inherit their color from the border:
set style line 50 lt 1 lc rgb "red" lw 2
set border ls 50
plot sin(x)
The tic labels get their color from the textcolor option of tics:
set tics textcolor rgb "red"
(The string "white" should work too, but that wouldn't look very nice in my demonstration since my background is white).
There is no way to change just the tic-color. However, if you want, you can change the tic/border color and then add a new border on top:
set arrow from graph 0,graph 1 to graph 1,graph 1 nohead ls -1 lc rgb "black" front
set arrow from graph 1,graph 1 to graph 1,graph 0 nohead ls -1 lc rgb "black" front
set arrow from graph 1,graph 0 to graph 0,graph 0 nohead ls -1 lc rgb "black" front
set arrow from graph 0,graph 0 to graph 0,graph 1 nohead ls -1 lc rgb "black" front
Whilst this post is quite old, I though I'd offer my 2cents because I have a valid addition to the above.
If you immediately follow the set border command with unset border, then the colour of the tics & their labels remains in the colour you set, and the border just gets removed. For example,
set border linecolor rgb "gray75"
unset border
This way, you can at least change the colour of the tics & their labels (here, off-white), & your background remains dark & untainted by an unsightly (off-white) border, which is what the OP asked for?
Thus, no need to manually redraw the border in the previous answer. Still, the best answer above was useful to me so I will uptick!

Resources