How to produce dashed lines in gnuplot 5 using TikZ terminal? - gnuplot

I have recently upgraded to gnuplot 5 and have been unable to produce dashed lines using the TikZ terminal. Running these commands:
set term tikz
set output "test.tex"
test
produce dashed line types in gnuplot 4.6 (first image), but only solid ones in gnuplot 5 (second image). Is there a way to fix this without downgrading?
I have tried setting different values for the dashlength terminal option, but that didn't help.

With 5.0 gnuplot has changed its way to deal with dashed lines. All line types are solid by default, this is what the test command shows you.
To enable dashed lines, use the new dashtype keyword, e.g
plot for [i=1:4] i*x dashtype i
That works for all terminals which support dashed lines.
Note, that with dashtype you can also specify your own dash patterns.
Example script:
set terminal lua tikz linewidth 3 standalone
set output 'dash.tex'
unset key
set linetype 1 dashtype 2
set linetype 2 dashtype '..-'
set linetype 3 dashtype (2,2,4,4,6,6)
plot for [i=1:3] i*x

Related

How to make a frame with border in gnuplot?

I am trying to make a frame for a density plot. I start with
set terminal pngcairo size 400,400 enhanced
set output 'test.png'
set view map
unset tics
unset colorbox
set size ratio 1
set border 15 front lw 20
#set border 15 back lw 20
splot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2) w pm3d notitle
If I use front the border looks continuous, but it eats a portion of the plot. If I use back, it no longer looks like a frame.
How can I make a proper frame such that it stays out of the plot region?
Using the square option for the line endings of the pngcairo terminal might help:
set terminal pngcairo size 400,400 enhanced square
set output 'test.png'
set view map
unset tics
unset colorbox
set size ratio 1
set border 15 back lw 20
splot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2) w pm3d notitle
This produces:
One might also want to slightly increase the isosamples, e.g., set isosamples 100 to get a smoother plot:

How to color arrows using the epslatex terminal and 'with vectors'

I know from Gnuplot coloring 3D-vectors how one is supposed to color arrows. However, under Windows Gnuplot 4.6 Patchlevel 5 the following MWE does not produce red arrows but simply black ones.
reset
set terminal epslatex size 15cm,9.27cm color colortext 8 dashed
set style arrow 1 linecolor rgb "red"
file = 'OutputSetting0'
set output 'Setting0/test.tex'
set xrange [-1:1]
set yrange [-1:1]
set zrange [-1:1]
set arrow 1 from -1,0,0 to 1,0,0 arrowstyle 1
splot file u (0):(0):(0):2:3:4 with vectors arrowstyle 1
reset
exit
The extra arrow added by hand (set arrow ...) is colored red. However, the one with position data read from file is still black.
Is there another way how one could achieve colored arrows from file (except changing the terminal which is out of the question)?
As requested here is also a MWE of LaTeX code:
\documentclass{scrreprt}
\usepackage{color}
\usepackage{graphicx}
\usepackage{epstopdf}
\begin{document}
\begin{figure}[H]
\input{Setting0/test}
\end{figure}
\end{document}
Ok, it seems to be a bug?
Adding set hidden3d made my arrows go red. I promise I didn't touch any other part of my script.

Is there anyway to set the window position for TERM WXT?

There is no SET TERM POSITION option in gnuplot.
I am using cygwin on windows 7.
Is there some kind of work-around?
Gnuplot version 5.0 knows a position option for the interactive terminals:
set terminal wxt 0 position 0,0
plot x
set terminal wxt 1 position 200,200
plot x**2

Unset pm3d map in gnuplot

I know I can make a color map of a splot with
set pm3d map
but how can I unset this option?
unset pm3d map
gives an error and
unset pm3d
unset map
both result in an splot with a fixed "top-down" view, making it impossible to see anything.
Should unset the view variable, use
unset view
also would be useful to
unset pm3d
should be back again to normal if you are using GNU Plot 4.x :)

Why is line solid?

I type in gnuplot "plot cos(x) lt 2" and want to take dashed line, but I take only solid line.
I use gnuplot 4.2 and ubuntu 10.04
It depends on the Terminal being used via
set term TYPE_OF_TERMINAL OPTIONS
Some Terminals are unable to display dashed lines.
You would see Terminal being set at the start: Terminal type set to 'TYPE_OF_TERMINAL'
example for ps/eps : set term postscript eps enhanced
At least this way you can include it in your TeX documents.

Resources