0
votes

I am working on gnuplot with bar-stacked. I tried to create an ideal size on graphs. any breaks on the left and the top of graph. I think it is not problems because my latex file can show perfect graph without any breaks. But when I tried run in other OS, it has error in latex. It can't handle the graphs. After I found the root cause of this, it is happen because I am use:

font ",40"

So, latex can't process it and break on this graph. I guess it have related with my break in my *.eps files.

This is my data:

desc    is-1    is-2    is-3    is-4    is-5    is-6    is-7    is-8
A   37.01   24.80   28.39   2.65    3.70    1.10    2.20    0.14
B   58.16   22.19   9.95    3.06    3.32    3.32    0.00    0.00
C   40.46   18.72   18.49   6.45    14.27   1.04    0.33    0.24
D   30.29   31.59   22.39   9.69    1.30    2.37    1.57    0.80
E   35.41   15.88   24.71   14.67   7.18    1.52    0.32    0.32
F   29.91   30.36   18.29   9.46    8.29    1.26    1.89    0.54
Tot 37.41   22.61   21.76   7.71    7.66    1.52    0.99    0.34

This is my Gnuplot File:

set term pos eps font 20
set style data histogram
set style histogram rowstacked
set style fill solid border -1

set key reverse above Left width 3 height -2.5 font ",40" autotitle columnheader
set key outside top spacing 2.5 
set boxwidth 0.7
set format y "%.0f%%"
set yrange [0:100]
set size 0.9 , 2
set ytics out nomirror
#set offset -0.3,-0.6,0,0 

#label count
set label 1 "854" at 0,102 rotate by 90 font ",40"  
set label 2 "274" at 1,102  rotate by 90 font ",40"
set label 3 "1564" at 2,102 rotate by 90 font ",40"
set label 4 "740" at 3,102  rotate by 90 font ",40"
set label 5 "979" at 4,102  rotate by 90 font ",40"
set label 6 "204" at 5,102  rotate by 90 font ",40"
set label 7 "4625" at 6,102 rotate by 90 font ",40"

set xtics font ",40"
set ytics font ",40"

set bmargin 3
set xtics offset 0,-1,0

set notitle
set noylabel
set noxlabel
set border 3 lw 2
set output 'output.eps'
plot 'datafile' \
    using($2):xtic(1)   lt -1 fs pattern 3, \
''  using($3)           lt -1 fs pattern 2, \
''  using($4)           lt -1 fs pattern 5, \
''  using($5)           lt -1 fs pattern 9, \
''  using($6)           lt -1 fs pattern 3, \
''  using($7)           lt -1 fs pattern 7, \
''  using($8)           lt -1 fs pattern 3, \
''  using($5)           lt -1 fs pattern 4

This is my output:

enter image description here

I am guessing latex error because of Gnuplot Font, It will clear if the output in*.eps file show the perfect graph. Could you help me, what is wrong with my border gnuplot script? Thanks or any suggestion for my problems?

*ps: graphs looks good on Ubuntu 12.04 but break in mac os. Thanks Thanks Thanks

after I set lmargin =10:

enter image description here

1
@indi61 I suppose if you play around with lmargin and tmargin along with key spacing, then you should be able to put the graph in place!Zahaib Akhtar
@ZahaibAkhtar Thanks for answer. I have tried margin options. if we use lmargin it will sliding to left side and lmargin can't be negative value. I also tried to thinker using rmargin. The maximum as my image above. Could I resize the canvas? I expect the *.eps file show the graph without break.indi60
Try this value: set lmargin 10Zahaib Akhtar
great @ZahaibAkhtar I play with set key outside top spacing 2.5 and also height -2.5 but the same. Are you sure only set key?indi60
Okay I'm going to add an answer, but really these you can work out by playing around with the values, there is no magic trick here.Zahaib Akhtar

1 Answers

2
votes

I added the following:

set lmargin 10
set tmargin 15

These will just add a left margin and top margin to your plot so that you have enough space.

And changed this line:

set key reverse above Left width 3 height 1 font ",40" autotitle columnheader

I changed the height to a small positive number in the above