larskotthoff / gnuplottex

Gnuplot graphs in LaTeX. See http://www.ctan.org/pkg/gnuplottex
3 stars 1 forks source link

When setting a size different to 1,1, the plot itself gets too small #19

Open kaschpal opened 3 years ago

kaschpal commented 3 years ago

After updating to Ubuntu 21.04, the gnuplot-figure included to my tex-files get the wrong size, when I set a size different to 1,1:

grafik

The ticmarks and the labels "x" and "y" are placed correctly. I found the version (I thtink):

\ProvidesPackage{gnuplottex} [2020/03/19 v0.9.5 gnuplot graphs in LaTeX]

This is how I created the Plot:

    \begin{gnuplot}[terminal=cairolatex, terminaloptions=color]
        set size .6,.7
        xmin = -3;   xmax = 4
        ymin = -3;  ymax = 4
        alabel = '$x$' 
        olabel = '$y$' 

        load "./gnuplotinit.gnu"

        set xtics 1
        set ytics 1

        x1 = 0 
        x2 = -1

        f(x) = (x - 1)**2 -2
        g(x) = f(abs(x))
        f1(x)=( x>0 ? f(x) : 1/0 ) 
        f2(x)=( x<0 ? f(x) : 1/0 ) 

        set label '$\rot{(|x| - 1)^2 -2}$' at 0.2, -2.9

        plot f(x)  lt 2 lc rgb 'red' lw 4 dashtype 2 ,\
             g(x)  lt 2  lc rgb 'red' lw 4 
    \end{gnuplot}

The included file "gnuplotinit.gnu" is:

  set sample 200
  unset border
  unset key
  set grid
  set tmargin 5
  set rmargin 10 
  set xr [xmin:xmax]
  set yr [ymin:ymax]
  set xzeroaxis lt -1
  set yzeroaxis lt -1
  set xtics axis
  set ytics axis
  set decimalsign ','
  xarrowdist = ((abs(xmin) + abs(xmax)) / 2) * 0.15 
  yarrowdist = ((abs(ymin) + abs(ymax)) / 2) * 0.2
  set arrow from 0, graph 0 to 0,ymax+yarrowdist, graph 1 filled
  set arrow  to xmax+xarrowdist,0, graph 1 filled

  alocx = xmax+xarrowdist
  alocy = yarrowdist*.3

  olocx =  xarrowdist*.3
  olocy =  ymax+yarrowdist

  set grid

  set label alabel at alocx, alocy
  set label olabel at olocx, olocy
kaschpal commented 3 years ago

I found a workaround: specifying the size (absolute) in the terminaloptions works. Not a fix, but a workaround ...

larskotthoff commented 3 years ago

Thanks, I'll have a closer look at this when I get a chance.