Gnuplot: ylabels + ytics + LaTeX causes too much whitespace

In summary, the problem is that the y-axis label and the y-axis ticks are formatted using LaTeX, but this leads to an excessive amount of white-space between the label and ticks, which results in a squashed plot. Upgrading to the latest version of gnuplot seems to have fixed this issue.
  • #1
Mute
Homework Helper
1,388
12
I'm hoping someone can help me with the following problem. I have a .p file for generating a .eps file using gnuplot. I want both the y-axis label and the y-axis tics to be formatted using LaTeX. Getting this done is no problem. The problem I am having is that having both of these options creates an unreasonable amount of white-space between the label and tics, which squashes the actual plot. Setting the offset for either the y label or the tics just moves them; the plot does not resize itself accordingly. Does anyone know how to fix this issue?

My .p file is

Code:
reset
set term epslatex standalone size 5 in, 3 in color colortext # 5 in, 3 in is default
set output "output.tex"

#set autoscale
set xrange [0:11]
set yrange [0:pi]
set key right bottom
set key spacing 1.3
set xtics 0,1,10
set ytics ('$0$' 0, '$\frac{\pi}{12}$' pi/12, '$\frac{\pi}{6}$' pi/6, '$\frac{\pi}{4}$' pi/4, '$\frac{\pi}{3}$' pi/3, '$\frac{5\pi}{12}$' 5*pi/12,  '$\frac{\pi}{2}$' pi/2, '$\frac{7\pi}{12}$' 7*pi/12, '$\frac{2\pi}{3}$' 2*pi/3, '$\frac{3\pi}{4}$' 3*pi/4)
set style line 1 lt 1 lw 9 pt 0 ps 0
set style line 2 lt 3 lw 9 pt 0 ps 0
set xlabel 'Frequency $\omega$' #offset 0.0,0.5
set ylabel 'Phase $\varphi$' #offset 15,0.0
plot 'phasevomega.txt' u 1:(atan2($4,$3)) every ::(47*384)::(48*384-1) w lines ls 1 lc rgb"red" title 'Simulation data'

set output

Thanks for any suggestions.
 
Physics news on Phys.org
  • #2
I tried your script and adjusting the offset of the ylabel seems to do exactly what it is supposed to do. The plot even resizes (unsquashes) itself. I'm using gnuplot 4.4.3 on linux. Perhaps your version behaves differently?



Lee Phillips
----------------------------
gnuplot Cookbook:
Available on Amazon
 
  • #3
Sorry it took so long to reply to this. I've been attending to a number of other projects, so this got put on the backburner for a while since the squashed version wasn't terrible or anything, I just wanted to figure out how to fix the file.

Anywho, upgrading the version of gnuplot to the latest version (4.6) did appear to fix the squashing issue, although the ylabel text does look somewhat... aliased? Kind of like a bad-photocopy. Not a big issue, hopefully, unless the text becomes hard to see in publications.
 

Related to Gnuplot: ylabels + ytics + LaTeX causes too much whitespace

1. Why is there too much whitespace when using Gnuplot with ylabels, ytics, and LaTeX?

When using Gnuplot with ylabels, ytics, and LaTeX, the default settings may cause too much whitespace to appear on the graph. This is because the ylabels and ytics are placed outside of the graph area, leaving extra space.

2. How can I reduce the whitespace when using Gnuplot with ylabels, ytics, and LaTeX?

To reduce the whitespace, you can adjust the margin settings in Gnuplot. The command "set lmargin" and "set rmargin" can be used to adjust the left and right margins, while "set tmargin" and "set bmargin" can be used to adjust the top and bottom margins. By decreasing these values, you can reduce the whitespace around the graph.

3. Can I change the position of the ylabels and ytics in Gnuplot?

Yes, you can change the position of the ylabels and ytics by using the "set ylabel" and "set ytics" commands in Gnuplot. By specifying a positive value, the labels and tics will be placed outside the graph, while a negative value will place them inside the graph.

4. Why is it recommended to use LaTeX when labeling the y-axis in Gnuplot?

Using LaTeX for ylabels in Gnuplot allows for more customization and better formatting options. It also allows for the use of mathematical symbols and equations, making it easier to label the y-axis with complex data.

5. Are there any other options besides LaTeX for labeling the y-axis in Gnuplot?

Yes, besides LaTeX, you can also use the "set format y" command to format the y-axis labels. This allows for basic formatting options, such as specifying the number of decimal places or using scientific notation. However, it does not offer the same customization and flexibility as using LaTeX.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
376
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
322
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top