6

UPDATE: this issue has been resolved in newer versions (>5.0) of gnuplot; see @andyras' answer.


I am having difficulty getting gnuplot to create labels with bold and enhanced text in non-postscript terminals. The following script

#!/usr/bin/env gnuplot

reset

set terminal pdfcairo enhanced color lw 3 size 3,2 font 'Arial-Bold'
set output 'output.pdf'

set tics scale 0

plot -x title 'normal text', \
-2*x t 'enhanced_{text}', \
-3*x t '{/Arial-Bold attempt to specify_{font}}'

set terminal pngcairo enhanced color lw 3 size 400,300 font 'Arial-Bold'
set output 'output.png'
replot

set terminal postscript enhanced color lw 3 size 6,4 font 'Arial-Bold'
set output 'output.eps'
replot

reset

Produces the following eps (converted to png with convert output.eps -rotate 90 outputeps.png):

enter image description here

which is fine. However, when I use the pdf or png terminals the result looks like this:

enter image description here

Note that while all the label text should be bold, only the label without any enhanced text is bold. In addition, when I try to manually specify the font (last line title) the font is different (reverts to the default?).

Is this behavior I should expect when not using the postscript terminal? Is there another way to specify fonts (i.e. is the naming scheme different outside of postscript)?

andyras
  • 15,542
  • 6
  • 55
  • 77
  • My gut reaction was to say that it is just indicating that your font-subsystem's bold font file didn't actually look very "bold". However, your "normal text" example blows that hypothesis right out of the water. It looks like a bug to me ... But a reasonable number of the bugs I've reported have come back marked as "Not a bug". Anyway, I would say it's worth reporting. – mgilson May 09 '13 at 15:45
  • I agree. The bugs I reported previously have been marked not to be bugs, so I wanted to make sure no one else had any ideas. – andyras May 09 '13 at 22:17
  • @mgilson Mark them as feature request? :) – Bernhard Aug 12 '13 at 10:32
  • It seems you are not the only one with this problem: http://newsgroups.derkeiler.com/Archive/Comp/comp.graphics.apps.gnuplot/2008-11/msg00061.html – tommy.carstensen Sep 08 '13 at 18:19
  • 1
    Would you mind moving the edit to an answer? I've already wanted to mark other questions as duplicate of this one here, but I can't since there is no accepted or upvoted answer. Thanks! – Christoph Dec 18 '15 at 07:52

2 Answers2

9

Since version 5.0, gnuplot has a new syntax to handle this issue:

 "normal text {/Times:Bold boldface-newfont} {/:Italic slanted-default-font } back to normal text"]

These brackets can also be nested.

andyras
  • 15,542
  • 6
  • 55
  • 77
-2

For Better results in pdf format.

Plot the curves using enhanced eps terminal. Then use Imagemagic to convert your output to pdf format. using the commands

convert myPlot.eps myPlot.pdf

Default resolution with this commands generates a poor output. This can be overcome by using density option with a value of 300. Modified command looks like

convert -density 300 myPlot.eps myPlot.pdf

I found that this preserves all the text formatting of eps file in pdf file.

RAGHU
  • 1
  • 1
    You shouldn't use `convert` for conversion of eps to pdf. This rasterizes your eps vector graphic as you also noted. Use something like `epstopdf` to get proper results. – Christoph Oct 16 '14 at 10:24
  • Right: ps2pdf is a ghostscript alias which converts between vector formats – djconnel Feb 25 '15 at 13:36