Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kaschpal opened this issue Jun 10, 2021 · 2 comments
Open

Comments

@kaschpal
Copy link

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
Copy link
Author

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

@larskotthoff
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants