File: test_style.py

package info (click to toggle)
plplot 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,280 kB
  • ctags: 13,512
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,210; makefile: 199; lisp: 75; sed: 25; fortran: 7
file content (105 lines) | stat: -rwxr-xr-x 3,244 bytes parent folder | download | duplicates (3)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python
# Test of all line styles and box styles using pllegend.

# Append to effective python path so that can find plplot modules.
from plplot_python_start import *

import sys
from plplot import *
from numpy import *
from math import *

# Parse and process command line arguments
plparseopts(sys.argv, PL_PARSE_FULL)

xmin,xmax,ymin,ymax = (0., 1., 0., 1.)
# Initialize plplot
plinit()

# Set up legend arrays with the correct size, type.
# pllsty takes integers from 1 to 8.
nlegend = 8

opt_array = zeros(nlegend, "int")
text_colors = zeros(nlegend, "int")
text = zeros(nlegend, "S200")
box_colors = zeros(nlegend, "int")
box_patterns = zeros(nlegend, "int")
box_scales = zeros(nlegend)
box_line_widths = zeros(nlegend, "int")
line_colors = zeros(nlegend, "int")
line_styles = zeros(nlegend, "int")
line_widths = zeros(nlegend, "int")
symbol_colors = zeros(nlegend, "int")
symbol_scales = zeros(nlegend)
symbol_numbers = zeros(nlegend, "int")
symbols = zeros(nlegend, "S100")

# Only specify legend data that are required according to the
# value of opt_array for that entry.
opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT

pladv(0)
plvpor(0.1, 0.9, 0.1, 0.9)
plwind(xmin, xmax, ymin, ymax)
text_scale = 0.90

# Set up line legend entries with various styles
for i in range(nlegend):
    opt_array[i] = PL_LEGEND_LINE
    text[i] = "%s %d" % ("Line Style",i+1)
    text_colors[i] = 2
    line_colors[i] = 2
    line_styles[i] = i+1
    line_widths[i] = 1

opt = opt_base
plscol0a( 15, 32, 32, 32, 0.70 )
(legend_width, legend_height) = \
    pllegend( opt, PL_POSITION_LEFT, 0., 0.,
              0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
              0., text_colors, text,
              box_colors, box_patterns, box_scales, box_line_widths,
              line_colors, line_styles, line_widths,
              symbol_colors, symbol_scales, symbol_numbers, symbols )

# Set up legend arrays with the correct size, type.
# plpsty takes integers from 0 to 8.
nlegend = 9

opt_array = zeros(nlegend, "int")
text_colors = zeros(nlegend, "int")
text = zeros(nlegend, "S200")
box_colors = zeros(nlegend, "int")
box_patterns = zeros(nlegend, "int")
box_scales = zeros(nlegend)
box_line_widths = zeros(nlegend, "int")
line_colors = zeros(nlegend, "int")
line_styles = zeros(nlegend, "int")
line_widths = zeros(nlegend, "int")
symbol_colors = zeros(nlegend, "int")
symbol_scales = zeros(nlegend)
symbol_numbers = zeros(nlegend, "int")
symbols = zeros(nlegend, "S100")

# Set up box legend entries with various patterns.
for i in range(nlegend):
    opt_array[i] = PL_LEGEND_COLOR_BOX
    text[i] = "%s %d" % ("Box Pattern",i)
    text_colors[i] = 2
    box_colors[i] = 2
    box_patterns[i] = i
    box_scales[i] = 0.8
    box_line_widths[i] = 1

opt = opt_base
plscol0a( 15, 32, 32, 32, 0.70 )
(legend_width, legend_height) = \
    pllegend( opt, PL_POSITION_RIGHT, 0., 0.,
              0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
              0., text_colors, text,
              box_colors, box_patterns, box_scales, box_line_widths,
              line_colors, line_styles, line_widths,
              symbol_colors, symbol_scales, symbol_numbers, symbols )
        
plend()