I am trying to plot 9 curves in a single plot. Now I have some
difficulties about the legends and need your help. I'd like to have
them arranged into 2 rows. I looked up the manual and wrote the 'key'
option like this:
set key box linestyle 1 right top Left reverse samplen 1 spacing 1
height 4 width 0
but it doesn't work well. The box I get in the final output have 2
rows, but the spacing in the box controlled by 'height' cannot be
eliminated. when decrease this parameter, the legends in the box fall
back into only 1 row. What should I do to raise the legend box to
avoid overlapping
with the curves?
I placed the resulted picture here: http://pem.freeshell.org/pem-gunplot.jpg
Thank you in advance for any comments and suggestions.
Bests,
pem
Hello Vadim, thank you for your reply.
I am running gnuplot 4.4 patchlevel 0, on a Linux amd64 desktop, the
result is set to an eps file.
The script I am using is as follow:
##########################################################
set term postscript eps enhanced color
set grid
set style data linespoints
set output "pem-gnuplot.eps"
set key box linestyle 1 right top Left reverse samplen 1 spacing 1
height 4 width 0
set size 1,0.5
set xra [-3:3]
set xtics -4,1,4
set mxtics 5
set xlabel "Energy (eV)"
set yra [0:90 ]
set ylabel "Transmisson"
set ytics 0,10,90
set mytics 2
plot "data_15.txt" title "15%" linetype 1 linewidth 0.2 pointtype 1
pointsize 0.2 linecolor 1, \
"data_10.txt" title "10%" linetype 1 linewidth 0.2 pointtype
2 pointsize 0.2 linecolor 2, \
"data_5.txt" title "5%" linetype 1 linewidth 0.2 pointtype
3 pointsize 0.2 linecolor 3, \
"data_2.txt" title "2%" linetype 1 linewidth 0.2 pointtype
4 pointsize 0.2 linecolor 4, \
"data_0.txt" title "0%" linetype 1 linewidth 0.2 pointtype
7 pointsize 0.2 linecolor 7, \
"data_m2.txt" title "-2%" linetype 1 linewidth 0.2 pointtype
4 pointsize 0.2 linecolor 4, \
"data_m5.txt" title "-5%" linetype 1 linewidth 0.2 pointtype
3 pointsize 0.2 linecolor 3, \
"data_m10.txt" title "-10%" linetype 1 linewidth 0.2 pointtype
2 pointsize 0.2 linecolor 2, \
"data_m15.txt" title "-15%" linetype 1 linewidth 0.2 pointtype
1 pointsize 0.2 linecolor 1
##########################################################
Bests,
pem
set key box linestyle 1 right top Left reverse samplen 1 spacing 0.5 height 10 width 0
It does not look nice as the letterings from adjacent keys overlap, but may be that is what you need?
If not, then exactly what?
- V
pem wrote:
On 5月1日, 下午7时50分, Vadim Biktashev <biktas...@ntlworld.com> wrote:
> The next thing is to understand what exactly do you want to achieve.
> Do I understand right that you want to have the keys in two columns (rather than two rows as you say?)
Yes, I mean have the keys in 2 columns. Sorry for the mistake.
> And you want them closer to each other in the vertical direction, right?
Yes.
> Are there any other constraints?
> For instance, I have managed to get them closer to each other, and still in two columns, by using
> set key box linestyle 1 right top Left reverse samplen 1 spacing 0.5 height 10 width 0
> It does not look nice as the letterings from adjacent keys overlap, but may be that is what you need?
> If not, then exactly what?
From the results you can see there are large spacing between *the edge
of the box* and *the keys* in the vetical direction. I expect this
spacing also be decreased. Using "height 10", this spacing become
larger so that the space also becomes larger. I have tried decreaing
the "height", this spacing decrease, that's what I expected. but the
number of columns changes. e.g. when height=3 or smaller, there is
only one column.
I would like there's always two columns in the box, while keeping the
size of the box suit the keys well. If the room in the box are filled
efficiently by the keys, the box can be smaller in the vertical
direction, thus it will not overlap with the curves. I don't know
whether this can be achived in gnuplot.
Bests,
pem
The only chance to get what you want would be to try and cheat gnuplot into thinking that it has smaller vertical space for the
key than
it actually has. But I have not been able to do that, so it is cleverer than me. Sorry!
- V.
pem wrote:
> Thanks a lot, Vadim.
>
Thank you all the same, Vadim.
Maybe I should try post-processing the output in an image editor like
GIMP to achive the effect.
Best,
pem