1
# -*- coding: utf-8; -*-
2
# $Id: xw33.py 11717 2011-04-21 00:47:06Z airwin $
3
# Copyright (C) 2010 Alan W. Irwin
5
# Demonstrate most pllegend capability including unicode symbols.
7
# This file is part of PLplot.
9
# PLplot is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU Library General Public License as published
11
# by the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
14
# PLplot is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU Library General Public License for more details.
19
# You should have received a copy of the GNU Library General Public License
20
# along with PLplot; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
# This example designed just for devices (e.g., the cairo-related and
24
# qt-related devices) where the best choice of glyph is automatically
25
# selected by the related libraries (pango/cairo or Qt4) for each
26
# unicode character depending on what system fonts are installed. Of
27
# course, you must have the appropriate TrueType fonts installed to
28
# have access to all the required glyphs.
30
from plplot_py_demos import *
33
PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE,
34
PL_POSITION_TOP | PL_POSITION_OUTSIDE,
35
PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE,
36
PL_POSITION_RIGHT| PL_POSITION_OUTSIDE,
37
PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE,
38
PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE,
39
PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE,
40
PL_POSITION_LEFT | PL_POSITION_OUTSIDE,
41
PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE,
42
PL_POSITION_TOP | PL_POSITION_INSIDE,
43
PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE,
44
PL_POSITION_RIGHT| PL_POSITION_INSIDE,
45
PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE,
46
PL_POSITION_BOTTOM | PL_POSITION_INSIDE,
47
PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE,
48
PL_POSITION_LEFT | PL_POSITION_INSIDE,
51
# Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦).
60
def plcolorbar_example_1( bar_type, ticks, sub_ticks, values, title ):
62
# Setup color palette 1
63
plspal1( "cmap1_blue_red.pal", 1 )
66
color_step = 1.0 / float(n - 1)
67
colors = color_step*arange(n)
69
opt = PL_POSITION_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | PL_COLORBAR_CAP_HIGH
71
if bar_type & PL_COLORBAR_SHADE_LABEL:
82
plcolorbar( opt, 0.1, 0.1, 0.5, 0.1,
84
axis_opts_1, "Test label - Left, High Cap",
87
opt = PL_POSITION_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_LOW
89
plcolorbar( opt, 0.1, 0.4, 0.5, 0.1,
91
axis_opts_1, "Test label - Right, Low Cap",
94
opt = PL_POSITION_TOP | bar_type | PL_COLORBAR_LABEL_TOP | PL_COLORBAR_CAP_HIGH
96
plcolorbar( opt, 0.1, 0.1, 0.5, 0.1,
98
axis_opts_2, "Test label - Upper, High Cap",
101
opt = PL_POSITION_BOTTOM | bar_type | PL_COLORBAR_LABEL_BOTTOM | PL_COLORBAR_CAP_LOW
103
plcolorbar( opt, 0.4, 0.1, 0.5, 0.1,
105
axis_opts_2, "Test label - Lower, Low Cap",
108
plvpor( 0.0, 1.0, 0.0, 1.0 )
109
plwind( 0.0, 1.0, 0.0, 1.0 )
110
plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title )
112
def plcolorbar_example_2( bar_type, ticks, sub_ticks, values, title ):
114
# Setup color palette 1
115
plspal1( "cmap1_blue_yellow.pal", 1 )
118
color_step = 1.0 / float(n - 1)
119
colors = color_step*arange(n)
120
opt = PL_POSITION_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | PL_COLORBAR_CAP_LOW
122
if bar_type == PL_COLORBAR_SHADE_LABEL:
133
plcolorbar( opt, 0.1, 0.1, 0.5, 0.1,
135
axis_opts_1, "Test label - Left, Low Cap",
138
opt = PL_POSITION_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_HIGH
140
plcolorbar( opt, 0.1, 0.4, 0.5, 0.1,
142
axis_opts_1, "Test label - Right, High Cap",
145
opt = PL_POSITION_TOP | bar_type | PL_COLORBAR_LABEL_TOP | PL_COLORBAR_CAP_LOW
147
plcolorbar( opt, 0.1, 0.1, 0.5, 0.1,
149
axis_opts_2, "Test label - Upper, Low Cap",
152
opt = PL_POSITION_BOTTOM | bar_type | PL_COLORBAR_LABEL_BOTTOM | PL_COLORBAR_CAP_HIGH
154
plcolorbar( opt, 0.4, 0.1, 0.5, 0.1,
156
axis_opts_2, "Test label - Lower, High Cap",
159
plvpor( 0.0, 1.0, 0.0, 1.0 )
160
plwind( 0.0, 1.0, 0.0, 1.0 )
161
plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title )
164
# First page illustrating the 16 standard positions.
166
plvpor(0.25, 0.75, 0.25, 0.75)
167
plwind(0.0, 1.0, 0.0, 1.0)
168
plbox("bc", 0.0, 0, "bc", 0.0, 0)
169
plsfont(PL_FCI_SANS, -1, -1)
170
plmtex("t", 8.0, 0.5, 0.5, "The 16 standard legend positions with")
171
plmtex("t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y")
173
# Set up legend arrays with the correct size, type.
175
opt_array = zeros(nlegend, "int")
176
text_colors = zeros(nlegend, "int")
177
text = zeros(nlegend, "S200")
178
box_colors = zeros(nlegend, "int")
179
box_patterns = zeros(nlegend, "int")
180
box_scales = zeros(nlegend)
181
box_line_widths = zeros(nlegend, "int")
182
line_colors = zeros(nlegend, "int")
183
line_styles = zeros(nlegend, "int")
184
line_widths = zeros(nlegend, "int")
185
symbol_colors = zeros(nlegend, "int")
186
symbol_scales = zeros(nlegend)
187
symbol_numbers = zeros(nlegend, "int")
188
symbols = zeros(nlegend, "S100")
190
# Only specify legend data that are required according to the
191
# value of opt_array for that entry.
192
opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX
193
opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL
196
symbol_scales[0] = 1.
197
symbol_numbers[0] = 4
200
# Use monotype fonts so that all legends are the same size.
201
plsfont(PL_FCI_MONO, -1, -1)
202
plscol0a( 15, 32, 32, 32, 0.70 )
205
position = position_options[k]
207
text[0] = "%2.2d" % k
208
text_colors[0] = 1 + (k % 8)
209
line_colors[0] = 1 + (k % 8)
210
symbol_colors[0] = 1 + (k % 8)
212
(legend_width, legend_height) = \
213
pllegend( opt, position, 0.05, 0.05,
214
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0,
215
1., text_colors, text,
216
box_colors, box_patterns, box_scales, box_line_widths,
217
line_colors, line_styles, line_widths,
218
symbol_colors, symbol_scales, symbol_numbers, symbols )
220
# Second page illustrating effect of nrow, ncolumn for the same legend
223
plvpor(0.25, 0.75, 0.25, 0.75)
224
plwind(0.0, 1.0, 0.0, 1.0)
225
plbox("bc", 0.0, 0, "bc", 0.0, 0)
226
plsfont(PL_FCI_SANS, -1, -1)
227
plmtex("t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,")
228
plmtex("t", 6.0, 0.5, 0.5, "and position for the same legend data")
230
# Set up legend arrays with the correct size, type.
232
opt_array = zeros(nlegend, "int")
233
text_colors = zeros(nlegend, "int")
234
text = zeros(nlegend, "S200")
235
box_colors = zeros(nlegend, "int")
236
box_patterns = zeros(nlegend, "int")
237
box_scales = zeros(nlegend)
238
box_line_widths = zeros(nlegend, "int")
239
line_colors = zeros(nlegend, "int")
240
line_styles = zeros(nlegend, "int")
241
line_widths = zeros(nlegend, "int")
242
symbol_colors = zeros(nlegend, "int")
243
symbol_scales = zeros(nlegend)
244
symbol_numbers = zeros(nlegend, "int")
245
symbols = zeros(nlegend, "S100")
247
# Only specify legend data that are required according to the
248
# value of opt_array for that entry.
249
opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX
250
for k in range(nlegend):
251
opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL
254
symbol_scales[k] = 1.
255
symbol_numbers[k] = 2
257
text[k] = "%2.2d" % k
258
text_colors[k] = 1 + (k % 8)
259
line_colors[k] = 1 + (k % 8)
260
symbol_colors[k] = 1 + (k % 8)
262
# Use monotype fonts so that all legends are the same size.
263
plsfont(PL_FCI_MONO, -1, -1)
264
plscol0a( 15, 32, 32, 32, 0.70 )
266
position = PL_POSITION_TOP | PL_POSITION_OUTSIDE
272
(legend_width, legend_height) = \
273
pllegend( opt, position, x, y,
274
0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0,
275
1., text_colors, text,
276
box_colors, box_patterns, box_scales, box_line_widths,
277
line_colors, line_styles, line_widths,
278
symbol_colors, symbol_scales, symbol_numbers, symbols )
280
position = PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE
286
(legend_width, legend_height) = \
287
pllegend( opt, position, x, y,
288
0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0,
289
1., text_colors, text,
290
box_colors, box_patterns, box_scales, box_line_widths,
291
line_colors, line_styles, line_widths,
292
symbol_colors, symbol_scales, symbol_numbers, symbols )
294
position = PL_POSITION_LEFT | PL_POSITION_OUTSIDE
300
(legend_width, legend_height) = \
301
pllegend( opt, position, x, y,
302
0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0,
303
1., text_colors, text,
304
box_colors, box_patterns, box_scales, box_line_widths,
305
line_colors, line_styles, line_widths,
306
symbol_colors, symbol_scales, symbol_numbers, symbols )
308
position = PL_POSITION_RIGHT | PL_POSITION_OUTSIDE
314
(legend_width, legend_height) = \
315
pllegend( opt, position, x, y,
316
0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0,
317
1., text_colors, text,
318
box_colors, box_patterns, box_scales, box_line_widths,
319
line_colors, line_styles, line_widths,
320
symbol_colors, symbol_scales, symbol_numbers, symbols )
322
position = PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE
328
(legend_width, legend_height) = \
329
pllegend( opt, position, x, y,
330
0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0,
331
1., text_colors, text,
332
box_colors, box_patterns, box_scales, box_line_widths,
333
line_colors, line_styles, line_widths,
334
symbol_colors, symbol_scales, symbol_numbers, symbols )
336
position = PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE
337
opt = opt_base | PL_LEGEND_ROW_MAJOR
342
(legend_width, legend_height) = \
343
pllegend( opt, position, x, y,
344
0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0,
345
1., text_colors, text,
346
box_colors, box_patterns, box_scales, box_line_widths,
347
line_colors, line_styles, line_widths,
348
symbol_colors, symbol_scales, symbol_numbers, symbols )
350
position = PL_POSITION_BOTTOM | PL_POSITION_INSIDE
351
opt = opt_base | PL_LEGEND_ROW_MAJOR
356
(legend_width, legend_height) = \
357
pllegend( opt, position, x, y,
358
0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0,
359
1., text_colors, text,
360
box_colors, box_patterns, box_scales, box_line_widths,
361
line_colors, line_styles, line_widths,
362
symbol_colors, symbol_scales, symbol_numbers, symbols )
364
# Third page demonstrating legend alignment
366
plvpor(0.0, 1.0, 0.0, 0.9)
367
plwind(0.0, 1.0, 0.0, 1.0)
368
plsfont(PL_FCI_SANS, -1, -1)
369
plmtex("t", 2.0, 0.5, 0.5, "Demonstrate legend alignment")
375
position = PL_POSITION_TOP | PL_POSITION_LEFT | PL_POSITION_SUBPAGE
376
opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX
379
# Set up legend arrays with the correct size, type.
384
nlegend = max(1, nlegend)
385
opt_array = zeros(nlegend, "int")
386
text_colors = zeros(nlegend, "int")
387
text = zeros(nlegend, "S200")
388
box_colors = zeros(nlegend, "int")
389
box_patterns = zeros(nlegend, "int")
390
box_scales = zeros(nlegend)
391
box_line_widths = zeros(nlegend, "int")
392
line_colors = zeros(nlegend, "int")
393
line_styles = zeros(nlegend, "int")
394
line_widths = zeros(nlegend, "int")
395
symbol_colors = zeros(nlegend, "int")
396
symbol_scales = zeros(nlegend)
397
symbol_numbers = zeros(nlegend, "int")
398
symbols = zeros(nlegend, "S100")
400
# Only specify legend data that are required according to the
401
# value of opt_array for that entry.
402
for k in range(nlegend):
403
opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL
406
symbol_scales[k] = 1.
407
symbol_numbers[k] = 2
409
text[k] = "%2.2d" % k
410
text_colors[k] = 1 + (k % 8)
411
line_colors[k] = 1 + (k % 8)
412
symbol_colors[k] = 1 + (k % 8)
414
# Use monotype fonts so that all legends are the same size.
415
plsfont(PL_FCI_MONO, -1, -1)
416
plscol0a( 15, 32, 32, 32, 0.70 )
418
nrow = min(3, nlegend)
421
(legend_width, legend_height) = \
422
pllegend( opt, position, x, y,
423
0.025, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5,
424
1., text_colors, text,
425
box_colors, box_patterns, box_scales, box_line_widths,
426
line_colors, line_styles, line_widths,
427
symbol_colors, symbol_scales, symbol_numbers, symbols )
429
position = PL_POSITION_TOP | PL_POSITION_RIGHT | PL_POSITION_SUBPAGE
437
# Fourth page illustrating various kinds of legends
445
plvpor(0.0, 1., 0.0, 0.90)
446
plwind(0.0, 1.0, 0.0, 1.0)
447
# plbox("bc", 0.0, 0, "bc", 0.0, 0)
448
plsfont(PL_FCI_SANS, -1, -1)
449
plmtex("t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends")
451
# Set up legend arrays with the correct size, type.
453
opt_array = zeros(nlegend, "int")
454
text_colors = zeros(nlegend, "int")
455
text = zeros(nlegend, "S200")
456
box_colors = zeros(nlegend, "int")
457
box_patterns = zeros(nlegend, "int")
458
box_scales = zeros(nlegend)
459
box_line_widths = zeros(nlegend, "int")
460
line_colors = zeros(nlegend, "int")
461
line_styles = zeros(nlegend, "int")
462
line_widths = zeros(nlegend, "int")
463
symbol_colors = zeros(nlegend, "int")
464
symbol_scales = zeros(nlegend)
465
symbol_numbers = zeros(nlegend, "int")
466
symbols = zeros(nlegend, "S100")
468
# Only specify legend data that are required according to the
469
# value of opt_array for that entry.
470
position = PL_POSITION_LEFT | PL_POSITION_TOP
471
opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT
473
# Set up None, Box, Line, Symbol, and Line & Symbol legend entries.
474
opt_array[0] = PL_LEGEND_NONE
478
opt_array[1] = PL_LEGEND_COLOR_BOX
484
box_line_widths[1] = 1
486
opt_array[2] = PL_LEGEND_LINE
493
opt_array[3] = PL_LEGEND_SYMBOL
497
symbol_scales[3] = text_scale
498
symbol_numbers[3] = 4
499
symbols[3] = special_symbols[2]
501
opt_array[4] = PL_LEGEND_SYMBOL | PL_LEGEND_LINE
508
symbol_scales[4] = text_scale
509
symbol_numbers[4] = 4
510
symbols[4] = special_symbols[2]
513
plscol0a( 15, 32, 32, 32, 0.70 )
514
(legend_width, legend_height) = \
515
pllegend( opt, position, x, y,
516
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
517
0., text_colors, text,
518
box_colors, box_patterns, box_scales, box_line_widths,
519
line_colors, line_styles, line_widths,
520
symbol_colors, symbol_scales, symbol_numbers, symbols )
521
max_height = max(max_height, legend_height)
523
# Set up symbol legend entries with various symbols.
524
for i in range(nlegend):
525
opt_array[i] = PL_LEGEND_SYMBOL
526
text[i] = "Symbol " + special_symbols[i]
528
symbol_colors[i] = i+1
529
symbol_scales[i] = text_scale
530
symbol_numbers[i] = 4
531
symbols[i] = special_symbols[i]
535
plscol0a( 15, 32, 32, 32, 0.70 )
536
(legend_width, legend_height) = \
537
pllegend( opt, position, x, y,
538
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
539
0., text_colors, text,
540
box_colors, box_patterns, box_scales, box_line_widths,
541
line_colors, line_styles, line_widths,
542
symbol_colors, symbol_scales, symbol_numbers, symbols )
543
max_height = max(max_height, legend_height)
545
# Set up symbol legend entries with various numbers of symbols.
546
for i in range(nlegend):
547
opt_array[i] = PL_LEGEND_SYMBOL
548
text[i] = "Symbol Number %d" % (i+2)
550
symbol_colors[i] = i+1
551
symbol_scales[i] = text_scale
552
symbol_numbers[i] = i+2
553
symbols[i] = special_symbols[2]
557
plscol0a( 15, 32, 32, 32, 0.70 )
558
(legend_width, legend_height) = \
559
pllegend( opt, position, x, y,
560
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
561
0., text_colors, text,
562
box_colors, box_patterns, box_scales, box_line_widths,
563
line_colors, line_styles, line_widths,
564
symbol_colors, symbol_scales, symbol_numbers, symbols )
565
max_height = max(max_height, legend_height)
567
# Set up box legend entries with various colours.
568
for i in range(nlegend):
569
opt_array[i] = PL_LEGEND_COLOR_BOX
570
text[i] = "%s %d" % ("Box Color",i+1)
575
box_line_widths[i] = 1
582
plscol0a( 15, 32, 32, 32, 0.70 )
583
(legend_width, legend_height) = \
584
pllegend( opt, position, x, y,
585
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
586
0., text_colors, text,
587
box_colors, box_patterns, box_scales, box_line_widths,
588
line_colors, line_styles, line_widths,
589
symbol_colors, symbol_scales, symbol_numbers, symbols )
590
max_height = max(max_height, legend_height)
592
# Set up box legend entries with various patterns.
593
for i in range(nlegend):
594
opt_array[i] = PL_LEGEND_COLOR_BOX
595
text[i] = "%s %d" % ("Box Pattern",i)
600
box_line_widths[i] = 1
604
plscol0a( 15, 32, 32, 32, 0.70 )
605
(legend_width, legend_height) = \
606
pllegend( opt, position, x, y,
607
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
608
0., text_colors, text,
609
box_colors, box_patterns, box_scales, box_line_widths,
610
line_colors, line_styles, line_widths,
611
symbol_colors, symbol_scales, symbol_numbers, symbols )
612
max_height = max(max_height, legend_height)
614
# Set up box legend entries with various box pattern line widths.
615
for i in range(nlegend):
616
opt_array[i] = PL_LEGEND_COLOR_BOX
617
text[i] = "%s %d" % ("Box Line Width",i+1)
622
box_line_widths[i] = i+1
626
plscol0a( 15, 32, 32, 32, 0.70 )
627
(legend_width, legend_height) = \
628
pllegend( opt, position, x, y,
629
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
630
0., text_colors, text,
631
box_colors, box_patterns, box_scales, box_line_widths,
632
line_colors, line_styles, line_widths,
633
symbol_colors, symbol_scales, symbol_numbers, symbols )
634
max_height = max(max_height, legend_height)
636
# Set up line legend entries with various colours.
637
for i in range(nlegend):
638
opt_array[i] = PL_LEGEND_LINE
639
text[i] = "%s %d" % ("Line Color",i+1)
650
plscol0a( 15, 32, 32, 32, 0.70 )
651
(legend_width, legend_height) = \
652
pllegend( opt, position, x, y,
653
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
654
0., text_colors, text,
655
box_colors, box_patterns, box_scales, box_line_widths,
656
line_colors, line_styles, line_widths,
657
symbol_colors, symbol_scales, symbol_numbers, symbols )
658
max_height = max(max_height, legend_height)
660
# Set up line legend entries with various styles
661
for i in range(nlegend):
662
opt_array[i] = PL_LEGEND_LINE
663
text[i] = "%s %d" % ("Line Style",i+1)
671
plscol0a( 15, 32, 32, 32, 0.70 )
672
(legend_width, legend_height) = \
673
pllegend( opt, position, x, y,
674
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
675
0., text_colors, text,
676
box_colors, box_patterns, box_scales, box_line_widths,
677
line_colors, line_styles, line_widths,
678
symbol_colors, symbol_scales, symbol_numbers, symbols )
679
max_height = max(max_height, legend_height)
681
# Set up line legend entries with various widths.
682
for i in range(nlegend):
683
opt_array[i] = PL_LEGEND_LINE
684
text[i] = "%s %d" % ("Line Width",i+1)
692
plscol0a( 15, 32, 32, 32, 0.70 )
693
(legend_width, legend_height) = \
694
pllegend( opt, position, x, y,
695
0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0,
696
0., text_colors, text,
697
box_colors, box_patterns, box_scales, box_line_widths,
698
line_colors, line_styles, line_widths,
699
symbol_colors, symbol_scales, symbol_numbers, symbols )
700
max_height = max(max_height, legend_height)
704
values_small = [ 0.0, 1.0 ]
705
values_uneven = [ 0.0, 2.0, 2.6, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 ]
706
values_even = [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ]
707
plcolorbar_example_1( PL_COLORBAR_IMAGE, 0.0, 0, values_small, "Image Color Bars" )
708
plcolorbar_example_2( PL_COLORBAR_IMAGE, 0.0, 0, values_small, "Image Color Bars" )
709
plcolorbar_example_1( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0.0, 0, values_uneven, "Shade Color Bars - Uneven Steps" )
710
plcolorbar_example_2( PL_COLORBAR_SHADE, 3.0, 3, values_even, "Shade Color Bars - Even Steps" )
711
plcolorbar_example_1( PL_COLORBAR_GRADIENT, 0.5, 5, values_small, "Gradient Color Bars" )
712
plcolorbar_example_2( PL_COLORBAR_GRADIENT, 0.5, 5, values_small, "Gradient Color Bars" )