example-spectrum.gp 813 B

123456789101112131415161718192021222324252627282930
  1. set terminal pngcairo size 800,450
  2. set output 'example-spectrum.png'
  3. # Set bar width
  4. set boxwidth 0.5
  5. set style fill solid border -1
  6. set linetype 1 lc rgb "#990000" lw 1
  7. set linetype 2 lc rgb "#009900" lw 1
  8. set linetype 3 lc rgb "#666666" lw 1
  9. set arrow from graph 0,1 to graph 0,1.1 filled
  10. set arrow from graph 1,0 to graph 1.1,0 filled
  11. set tmargin 5
  12. set rmargin 10
  13. set border 3
  14. set tics nomirror
  15. set noxtics
  16. set noytics
  17. set grid
  18. set ylabel "Magnitude"
  19. set xlabel "Frequency"
  20. # Set the range for y-axis
  21. set yrange [0:*]
  22. # Plot the data with different colors
  23. plot "example-spectrum.dat" using 1:2:3 with boxes lc variable notitle, \
  24. "<grep '1$' example-spectrum.dat" u 1:2:(0):(1500) with vectors lc 1 notitle, \
  25. "<grep '2$' example-spectrum.dat" u 1:($2+1500):(0):(-1500) with vectors lc 2 notitle