Difference between revisions of "Gnuplot"

From orch
Jump to: navigation, search
(Macros)
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== First script ==
  
==== Macros ====
+
<code>
 +
  set terminal postscript eps enhanced color "Times-Roman" 20
 +
</code>
 +
 
 +
<code>
 +
  set style line 1 linetype 1 linecolor rgb "696969" linewidth 3.0 pointtype 1
 +
  set style line 2 linetype 1 linecolor rob "FF6600" linewidth 3.0 pointtype 1
 +
</code>
 +
 
 +
<code>
 +
  set output "graph.eps"
 +
</code>
 +
 
 +
<code>
 +
  a = 0.8
 +
  f(x) = a * cos(x)
 +
  g(x) = a * sin(x)
 +
</code>
 +
 
 +
<code>
 +
  pi = 3.14159265359
 +
</code>
 +
 
 +
<code> 
 +
  set xrange [0:3*pi]
 +
  set yrange [-1:1]
 +
</code>
 +
 
 +
<code>
 +
  set xlabel "x coordinate"
 +
  unset ylabel
 +
</code>
 +
 
 +
<code>
 +
  plot f(x) with points title 'sin(x)' ls 1,\
 +
        g(x) with points notitle ls 2
 +
</code>
 +
 
 +
== Macros ==
 +
 
 +
<code>
 +
  set macros
 +
</code>
 +
 
 +
<code>
 +
  T_GRAPH = "set tmargin at screen 0.99; set bmargin at screen 0.81"
 +
  B_GRAPH = "set tmargin at screen 0.74; set bmargin at screen 0.56"
 +
</code>
 +
 
 +
<code>
 +
  L_GRAPH = "set lmargin at screen 0.12; set rmargin at screen 0.45"
 +
  R_GRAPH = "set lmargin at screen 0.61; set rmargin at screen 0.94"
 +
</code>
 +
 
 +
== Multiplot ==
  
 
<code>
 
<code>
T_GRAPH = "set tmargin at screen 0.99; set bmargin at screen 0.81" //
+
  set multiplot
B_GRAPH = "set tmargin at screen 0.74; set bmargin at screen 0.56"
+
  unset multiplot
 
</code>
 
</code>

Latest revision as of 16:03, 11 March 2016

First script

  set terminal postscript eps enhanced color "Times-Roman" 20

  set style line 1 linetype 1 linecolor rgb "696969" linewidth 3.0 pointtype 1
  set style line 2 linetype 1 linecolor rob "FF6600" linewidth 3.0 pointtype 1

  set output "graph.eps"

  a = 0.8
  f(x) = a * cos(x)
  g(x) = a * sin(x)

  pi = 3.14159265359

  set xrange [0:3*pi]
  set yrange [-1:1]

  set xlabel "x coordinate"
  unset ylabel

  plot f(x) with points title 'sin(x)' ls 1,\
       g(x) with points notitle ls 2

Macros

  set macros

  T_GRAPH = "set tmargin at screen 0.99; set bmargin at screen 0.81"
  B_GRAPH = "set tmargin at screen 0.74; set bmargin at screen 0.56"

  L_GRAPH = "set lmargin at screen 0.12; set rmargin at screen 0.45"
  R_GRAPH = "set lmargin at screen 0.61; set rmargin at screen 0.94"

Multiplot

  set multiplot
  unset multiplot