Home > Software engineering >  Rounded dashed lines are plotted in the preview but are not saved - Gnuplot
Rounded dashed lines are plotted in the preview but are not saved - Gnuplot

Time:01-01

I am trying to plot some data as rounded dashed lines for my paper. When loading my Gnuplot script, the preview shows the rounded dashes. However, after saving the plot as SVG or PDF does not save the round dashed linetype. I am using Gnuplot 5.4 with terminal wxt round enhanced. Here is the image in the preview window and the saved svg plot

Thank you. Your help is much appreciated.

CodePudding user response:

Thank you for clarifying. Yes, I can reproduce this problem in the gnuplot 5.4 wxt terminal. The "export to file" widget in the tool bar does not preserve the linecap linejoin settings from the main window. In principle you could repair this by editing the output svg file to do a global search and replace changing the text from

stroke-linecap:butt;stroke-linejoin:miter;

to

stroke-linecap:round;stroke-linejoin:round;

A better solution might be to use the qt terminal rather than the wxt terminal for your initial work. The export-to-file widget attached to the qt plot window does preserve rounded line ends. Note that in the qt terminal the rounded/flat style setting can be toggled in the toolbar widget; this is different from wxt where it can only be changed by a new set term command.

Another reasonable work-around is to get your entire script working to your your satisfaction in the wxt terminal itself. Then run the script again using instead the svg terminal:

# Confirm that the script works correctly
set terminal wxt
load 'myfigure.script'
print "If everything looks OK, hit <cr> to write an svg file"
pause -1

# Make sure we are back to a clean starting point     
reset session
set terminal svg standalone size 5in, 3in
set output 'myfigure.svg'
load 'myfigure.script'
unset output
print "All done"
exit gnuplot
  • Related