title: Gnuplot tikz terminal, how to add commands to the picture?
body: <p>I have some gnuplot code that makes a graph using the tikz terminal. However, I want to add to the generated <code>.tex</code> file some tikz code. </p>
  
  <p>As a MWE, consider the following gnuplot code:</p>
  
  <pre><code>set term tikz standalone
  set output "out.tex"
  plot sin(x)
  </code></pre>
  
  <p>Let's say I want to draw a circle on the plot generated, which I can do using <code>\draw (2,2) circle [radius = 2cm]</code>. Adding this line to the <code>.tex</code> file generated yields the following code:</p>
  
  <pre><code>\documentclass[10pt]{article}
  \usepackage[T1]{fontenc}
  \usepackage{textcomp}
  
  \usepackage[utf8x]{inputenc}
  
  \usepackage{gnuplot-lua-tikz}
  \pagestyle{empty}
  \usepackage[active,tightpage]{preview}
  \PreviewEnvironment{tikzpicture}
  \setlength\PreviewBorder{\gpbboxborder}
  \begin{document}
  
  \begin{tikzpicture}[gnuplot]
  
  
  %!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  %!! ADDED BY HAND
  \draw (2,2) circle [radius = 2cm];
  %!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
  %% generated with GNUPLOT 5.0p3 (Lua 5.1; terminal rev. 99, script rev. 100)
  ...
  </code></pre>
  
  <p>Is there any way to tell gnuplot that I want some tikz code on the picture, so it outputs a <code>.tex</code> file similar to the one I made? Reading the docs I've found that with this terminal you can set a preamble but you can't include tikz code there.
  Another option I was considering was using <code>set print output_file</code> and then <code>print</code> the code I want, however, either that code gets printed first in the file and gnuplot overwrites it or printing it after gnuplot has printed the output overwrites it.</p>