I'm trying to get some eps files from the following lines. The problem is that legend (key) does not pop up when I follow the procedure for making output files. (In my case, \lambda=2 is not shown in ps files.) Any idea or help will be appreciated.
filename0 = sprintf('/home/hyogeon/ETH/ETH_with_Pf.T/result/data_plot/data_plot_result/Fp_index0_%d_%d,000000_%d,000000_%d_sOkP.tex',9, 5 ,2, 10)
set terminal epslatex size 8, 6 standalone color colortext 10
set output filename0
set xlabel '${\large E}$'
set ylabel '$p$' offset 2
set ylabel rotate by 0
set format '$%g$'
set key at 37, 0.9
filename1 = sprintf('/home/hyogeon/ETH/ETH_with_Pf.T/result/data_refine/p_index0_%d_%f_%f_%d_sOkP',9, 5, 2, 10)
filename2 = sprintf('/home/hyogeon/ETH/ETH_with_Pf.T/result/data_refine/p_index1_%d_%f_%f_%d_sOkP',9, 5, 2, 10)
color1 = '#FF0000'
color2 = '#FF9933'
plot filename1 u 1:2:3 with yerrorbars pt 6 ps 2 lc rgb color1 title '$\lambda = 2$',\
filename2 u 1:2:3 with yerrorbars pt 6 ps 2 lc rgb color2 notitle
I think the problem is that you manually place the key at (37, 0.9), but do not specify the x- and yrange – these are automatically adjusted. Without your data I can't verify, but supposedly your data lies within [-20:20] in x, then your key is placed far outside the graph and therefore not visible.
As a first step you could try deleting the line set key...
, see whether the auto placement suits you, and only then fine tune it. Or alternatively, explicitly use set xrange ...
and set yrange ...
By the way, you can directly define variables as strings, you don't necessarily need to call sprintf
(although you might have reasons to do so):
filename0 = 'home/hyogeon/ETH/ETH_with_Pf.T/result/data_plot/data_plot_result/Fp_index0_9_5,000000_2,000000_10_sOkP.tex'