File: plotdemo5.py

package info (click to toggle)
scitools 0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 17,252 kB
  • ctags: 2,871
  • sloc: python: 28,744; sh: 112; makefile: 15
file content (28 lines) | stat: -rw-r--r-- 559 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from scitools.std import *
from time import sleep

x = seq(0, 15, 0.2)
y = sin(x)*x
v = sin(x)*sqrt(x)
w = sin(x)*x**0.33333333

plot(x, y, 'r-', x, v, 'b--', x, w, 'g--',
     legend=('sin(x)*x', 'sin(x)*sqrt(x)', 'sin(x)*x**(1/3)'),
     title='plot demo 5', xlabel='X', ylabel='Y')
sleep(3)

# get backend and fine-tune the plot:
g = get_backend()
print type(g), g  # Gnuplot instance
g('set key left box')
g('set grid')
g('set xlabel "X" font "Helvetica,14"')
g('set ylabel ""')
g.replot()
g('set output "tmp.png"')
g('set term png small')
g.replot()