1
votes

I'm using GNUPlot to draw the graph of five real-valued functions. I think it is easy to solve, but I am a beginner. My x-axis has problems with its label. All the xtics numbers are overlapping, and I have no idea why. My .plt plots 3 files: an .eps, an pb .eps and a .png. It receives a .100 file, which is 6 columns of numbers. The first column represents values for t and the other five columns represent values for each function at respective t.

My .plt file is:

reset
set terminal windows

set style line 1 lt 1 linewidth   3
set style line 2 lt 2 linewidth   3 
set style line 3 lt 3 linewidth   3 
set style line 4 lt 4 linewidth   3 
set style line 5 lt 5 linewidth   3
set style line 6 lt 6 linewidth   3


set border linewidth 3

set xzeroaxis
set yzeroaxis

set xlabel '{/Helvetica-Oblique t (dias)}' enhanced font ',28'

set key center top
set key center right
set key top right
set key box

set tics scale 1.5

set grid ytics
set grid xtics

set xtics 0,250,3500

set ytics 0,0.1,1


set title 'Simulacao' font ',26'

set samples 100

plot "./fort.100"  using 1:2 with lines title 'Ms' linestyle 1, \
     "./fort.100"  using 1:3 with lines title 'Mi' linestyle 2, \
     "./fort.100"  using 1:4 with lines title 'A ' linestyle 3, \
     "./fort.100"  using 1:5 with lines title 'H ' linestyle 4, \
     "./fort.100"  using 1:6 with lines title 'I ' linestyle 5

pause -1

set terminal postscript eps enhanced
set termoption enhanced
set output "xsol-pb.eps"

replot

set terminal postscript eps enhanced color font ',22'
set termoption enhanced
set output "xsol.eps"

replot

set terminal png giant size 900,600 enhanced 
set termoption enhanced
set output "xsol.png"

replot

Link for my .eps graph:

enter image description here

How can I fix this problem?

I am also having a problem with the table, at the right top corner of the image. How to fix that?

1
what is the x-range of your data? - theozh
@theozh 0 to 3500 - Mateus Rocha
strange. Well, just let gnuplot autoscale the x-axis, i.e. remove the line set xtics 0,250,3500. How does it change? - theozh
It solved my problem. Thank you! Now I just need to solve the legend table problem. The graph is overlapping the legend - Mateus Rocha

1 Answers

1
votes

Two possibilities to avoid "collisions" of data and key:

  1. adjust your scale such that the curve is below the key, in your case e.g. set yrange[0:1.5]
  2. shift the positon of your key, e.g. set key center right or set key at graph 0.8, graph 0.8. Check help key for more information.