|
From: <arj...@us...> - 2011-02-22 07:32:50
|
Revision: 11575
http://plplot.svn.sourceforge.net/plplot/?rev=11575&view=rev
Author: arjenmarkus
Date: 2011-02-22 07:32:44 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
Start of the implementation of example 33 in Tcl - conversion is far from complete, only committing it as a backup
Added Paths:
-----------
trunk/examples/tcl/x33
trunk/examples/tcl/x33.tcl
Added: trunk/examples/tcl/x33
===================================================================
--- trunk/examples/tcl/x33 (rev 0)
+++ trunk/examples/tcl/x33 2011-02-22 07:32:44 UTC (rev 11575)
@@ -0,0 +1,44 @@
+#!/bin/sh
+#--------------------------------*- Tcl -*------------------------------------#
+# $Id: x26 11447 2011-01-07 07:46:45Z arjenmarkus $
+#
+# Arjen Markus
+# 08/18/08
+#
+# A front-end to x26.tcl for running directly from the command line, locating
+# pltcl via PATH.
+# Handles all usual plplot command arguments. See "pltcl -h" for info.
+#-----------------------------------------------------------------------------#
+#\
+exec pltcl -f "$0" ${1+"$@"}
+
+#
+# This example uses UTF-8 characters, placed directly in the source code
+#
+if { [encoding system] != "utf-8" } {
+ if { [package vsatisfies [info patch] 8.5] } {
+
+ source -encoding utf-8 x33.tcl
+
+ } else {
+
+ #
+ # Pre-Tcl 8.5
+ #
+ set infile [open "x33.tcl"]
+ set contents [read $infile]
+ close $infile
+ eval [encoding convertfrom utf-8 \
+ [encoding convertto [encoding system] $contents]]
+ }
+} else {
+
+ #
+ # Plain source will do
+ #
+ source x33.tcl
+}
+
+plinit
+x33
+plend
Added: trunk/examples/tcl/x33.tcl
===================================================================
--- trunk/examples/tcl/x33.tcl (rev 0)
+++ trunk/examples/tcl/x33.tcl 2011-02-22 07:32:44 UTC (rev 11575)
@@ -0,0 +1,614 @@
+# $Id: x33c.c 11565 2011-02-13 21:06:58Z airwin $
+#
+# Demonstrate most pllegend capability including unicode symbols.
+#
+# Copyright (C) 2010 Alan Irwin
+#
+# This file is part of PLplot.
+#
+# PLplot is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Library Public License as published
+# by the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# PLplot is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with PLplot; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# This example designed just for devices (e.g., the cairo-related and
+# qt-related devices) where the best choice of glyph is automatically
+# selected by the related libraries (pango/cairo or Qt4) for each
+# unicode character depending on what system fonts are installed. Of
+# course, you must have the appropriate TrueType fonts installed to
+# have access to all the required glyphs.
+
+set position_options [list
+ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_OUTSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE]] \
+ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_INSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}] \
+ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_INSIDE}] ]
+
+// Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦).
+set special_symbols [list
+ "✰" \
+ "✴" \
+ "✱" \
+ "✽" \
+ "✦" ]
+
+set colorbar 0 ;# By default do not plot plcolorbar pages
+ # for now while we are working out the API.
+
+# TODO
+#set options [list {
+# {
+# "colorbar", // Turns on pages showing colorbars
+# NULL,
+# NULL,
+# &colorbar,
+# PL_OPT_BOOL,
+# "-colorbar",
+# "Plot the \"color bar\" pages."
+# },
+# {
+# NULL, // option
+# NULL, // handler
+# NULL, // client data
+# NULL, // address of variable to set
+# 0, // mode flag
+# NULL, // short syntax
+# NULL
+# } // long syntax
+#};
+
+set notes { "Make sure you get it right!" NULL }
+
+# --------------------------------------------------------------------------
+# main
+#
+# Demonstrate most pllegend capability including unicode symbols.
+# --------------------------------------------------------------------------
+
+set MAX_NLEGEND 7
+
+proc x33 {{w loopback}} {
+
+ # Parse and process command line arguments
+ # TODO
+ # plMergeOpts options "x33c options" notes
+ # void plparseopts &argc argv PL_PARSE_FULL
+
+ # Initialize plplot
+ $w cmd plinit
+
+ # First page illustrating the 16 standard positions.
+ $w cmd pladv 0
+ $w cmd plvpor 0.25 0.75 0.25 0.75
+ $w cmd plwind 0.0 1.0 0.0 1.0
+ $w cmd plbox "bc" 0.0 0 "bc" 0.0 0
+ $w cmd plsfont $::PLPLOT::PL_FCI_SANS}] -1 -1
+ $w cmd plmtex "t" 8.0 0.5 0.5 "The 16 standard legend positions with"
+ $w cmd plmtex "t" 6.0 0.5 0.5 "the same 0.05 offset in x and y"
+
+ nlegend = 1
+ // Only specify legend data that are required according to the
+ // value of opt_array for that entry.
+ opt_base = [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}]
+ opt_array[0] = [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}]
+ line_styles[0] = 1
+ line_widths[0] = 1
+ symbol_scales[0] = 1.
+ symbol_numbers[0] = 4
+ symbols[0] = "*"
+
+ // Use monotype fonts so that all legends are the same size.
+ $w cmd plsfont [expr {$::PLPLOT::PL_FCI_MONO}] -1 -1
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ for {set k 0} {$k < 16} {incr k} {
+ set position [lindex $position_options $k]
+ set opt $opt_base
+ sprintf text[0] "%2.2d" k
+ text_colors[0] = 1 + k % 8
+ line_colors[0] = 1 + k % 8
+ symbol_colors[0] = 1 + k % 8
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, 0.05, 0.05,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+ }
+
+ // Second page illustrating effect of nrow, ncolumn for the same legend
+ // data.
+ $w cmd pladv 0
+ $w cmd plvpor 0.25 0.75 0.25 0.75
+ $w cmd plwind 0.0 1.0 0.0 1.0
+ $w cmd plbox "bc" 0.0 0 "bc" 0.0 0
+ $w cmd plsfont [expr {$::PLPLOT::PL_FCI_SANS}] -1 -1
+ $w cmd plmtex "t" 8.0 0.5 0.5 "The effect of nrow ncolumn PL_LEGEND_ROW_MAJOR"
+ $w cmd plmtex "t" 6.0 0.5 0.5 "and position for the same legend data"
+
+ nlegend = 7
+
+ // Only specify legend data that are required according to the
+ // value of opt_array for that entry.
+ opt_base = [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}]
+ for k = 0 k < nlegend; k++
+ {
+ opt_array[k] = [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}]
+ line_styles[k] = 1
+ line_widths[k] = 1
+ symbol_scales[k] = 1.
+ symbol_numbers[k] = 2
+ symbols[k] = "*"
+ sprintf text[k] "%2.2d" k
+ text_colors[k] = 1 + k % 8
+ line_colors[k] = 1 + k % 8
+ symbol_colors[k] = 1 + k % 8
+ }
+
+ // Use monotype fonts so that all legends are the same size.
+ $w cmd plsfont [expr {$::PLPLOT::PL_FCI_MONO}] -1 -1
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ position = [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}]
+ opt = opt_base
+ x = 0.
+ y = 0.1
+ nrow = 1
+ ncolumn = nlegend
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.05, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ position = [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}]
+ opt = opt_base
+ x = 0.
+ y = 0.1
+ nrow = 1
+ ncolumn = nlegend
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.05, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ position = [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_OUTSIDE}]
+ opt = opt_base
+ x = 0.1
+ y = 0.
+ nrow = nlegend
+ ncolumn = 1
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.05, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ position = [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_OUTSIDE}]
+ opt = opt_base
+ x = 0.1
+ y = 0.
+ nrow = nlegend
+ ncolumn = 1
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.05, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ position = [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}]
+ opt = opt_base
+ x = 0.
+ y = 0.
+ nrow = 6
+ ncolumn = 2
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.05, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ position = [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}]
+ opt = [expr {$opt_base | $::PLPLOT::PL_LEGEND_ROW_MAJOR}]
+ x = 0.
+ y = 0.
+ nrow = 6
+ ncolumn = 2
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.05, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ position = [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}]
+ opt = opt_base | $::PLPLOT::PL_LEGEND_ROW_MAJOR}]
+ x = 0.
+ y = 0.
+ nrow = 3
+ ncolumn = 3
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.05, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 2.0,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ // Third page demonstrating legend alignment
+ $w cmd pladv 0
+ $w cmd plvpor 0.0 1.0 0.0 0.9
+ $w cmd plwind 0.0 1.0 0.0 1.0
+ $w cmd plsfont [expr {$::PLPLOT::PL_FCI_SANS}] -1 -1
+ $w cmd plmtex "t" 2.0 0.5 0.5 "Demonstrate legend alignment"
+
+ x = 0.1
+ y = 0.1
+ nturn = 4
+ nlegend = 0
+ position = [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_SUBPAGE}]
+ opt_base = [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}]
+ opt = opt_base
+ for i = 0 i < 9; i++
+ {
+ // Set up legend arrays with the correct size, type.
+ if ( i <= nturn )
+ nlegend += 1
+ else
+ nlegend -= 1
+ nlegend = MAX 1 nlegend
+ // nly specify legend data that are required according to the
+ // value of opt_array for that entry.
+ for k = 0 k < nlegend; k++
+ {
+ opt_array[k] = [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}]
+ line_styles[k] = 1
+ line_widths[k] = 1
+ symbol_scales[k] = 1.
+ symbol_numbers[k] = 2
+ symbols[k] = "*"
+ sprintf text[k] "%2.2d" k
+ text_colors[k] = 1 + k % 8
+ line_colors[k] = 1 + k % 8
+ symbol_colors[k] = 1 + k % 8
+ }
+ // Use monotype fonts so that all legends are the same size.
+ $w cmd plsfont [expr {$::PLPLOT::PL_FCI_MONO}] -1 -1
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ nrow = MIN 3 nlegend
+ ncolumn = 0
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.025, 15, 1, 1, nrow, ncolumn,
+ nlegend, opt_array, 1.0, 1.0, 1.5,
+ 1., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+
+ if ( i == nturn )
+ {
+ position = [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_SUBPAGE}]
+ opt = opt_base
+ x = 1. - x
+ y += legend_height
+ }
+ else
+ {
+ x += legend_width
+ y += legend_height
+ }
+ }
+
+ // Fourth page illustrating various kinds of legends
+ max_height = 0.
+ xstart = 0.0
+ ystart = 0.1
+ x = xstart
+ y = ystart
+ text_scale = 0.90
+ $w cmd pladv 0
+ $w cmd plvpor 0.0 1. 0.0 0.90
+ $w cmd plwind 0.0 1.0 0.0 1.0
+ //$w cmd plbox"bc" 0.0 0 "bc" 0.0 0
+ $w cmd plsfont [expr {$::PLPLOT::PL_FCI_SANS}] -1 -1
+ $w cmd plmtex "t" 2.0 0.5 0.5 "Demonstrate Various Kinds of Legends"
+
+ nlegend = 5
+ // Only specify legend data that are required according to the
+ // value of opt_array for that entry.
+ position = [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP}]
+ opt_base = [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX | $::PLPLOT::PL_LEGEND_TEXT_LEFT}]
+
+ // Set up None, Box, Line, Symbol, and Line & Symbol legend entries.
+ opt_array[0] = [expr {$::PLPLOT::PL_LEGEND_NONE}]
+ sprintf text[0] "%s" "None"
+ text_colors[0] = 1
+
+ opt_array[1] = [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}]
+ sprintf text[1] "%s" "Box"
+ text_colors[1] = 2
+ box_colors[1] = 2
+ box_patterns[1] = 0
+ box_scales[1] = 0.8
+ box_line_widths[1] = 1
+
+ opt_array[2] = [expr {$::PLPLOT::PL_LEGEND_LINE}]
+ sprintf text[2] "%s" "Line"
+ text_colors[2] = 3
+ line_colors[2] = 3
+ line_styles[2] = 1
+ line_widths[2] = 1
+
+ opt_array[3] = [expr {$::PLPLOT::PL_LEGEND_SYMBOL}]
+ sprintf text[3] "%s" "Symbol"
+ text_colors[3] = 4
+ symbol_colors[3] = 4
+ symbol_scales[3] = text_scale
+ symbol_numbers[3] = 4
+ symbols[3] = special_symbols[2]
+
+ opt_array[4] = [expr {$::PLPLOT::PL_LEGEND_SYMBOL | $::PLPLOT::PL_LEGEND_LINE}]
+ sprintf text[4] "%s" "L & S"
+ text_colors[4] = 5
+ line_colors[4] = 5
+ line_styles[4] = 1
+ line_widths[4] = 1
+ symbol_colors[4] = 5
+ symbol_scales[4] = text_scale
+ symbol_numbers[4] = 4
+ symbols[4] = special_symbols[2]
+
+ opt = opt_base
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ box_colors, box_patterns, box_scales, box_line_widths,
+ line_colors, line_styles, line_widths,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+ max_height = MAX max_height legend_height
+
+ // Set up symbol legend entries with various symbols.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_SYMBOL}]
+ sprintf text[i] "%s%s" "Symbol " special_symbols[i]
+ text_colors[i] = i + 1
+ symbol_colors[i] = i + 1
+ symbol_scales[i] = text_scale
+ symbol_numbers[i] = 4
+ symbols[i] = special_symbols[i]
+ }
+
+ opt = opt_base
+ x += legend_width
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+ max_height = MAX max_height legend_height
+
+ // Set up symbol legend entries with various numbers of symbols.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_SYMBOL}]
+ sprintf text[i] "%s %d" "Symbol Number" i + 2
+ text_colors[i] = i + 1
+ symbol_colors[i] = i + 1
+ symbol_scales[i] = text_scale
+ symbol_numbers[i] = i + 2
+ symbols[i] = special_symbols[2]
+ }
+
+ opt = opt_base
+ x += legend_width
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ symbol_colors symbol_scales symbol_numbers const char ** symbols
+ max_height = MAX max_height legend_height
+
+ // Set up box legend entries with various colours.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}]
+ sprintf text[i] "%s %d" "Box Color" i + 1
+ text_colors[i] = i + 1
+ box_colors[i] = i + 1
+ box_patterns[i] = 0
+ box_scales[i] = 0.8
+ box_line_widths[i] = 1
+ }
+
+ opt = opt_base
+ // Use new origin
+ x = xstart
+ y += max_height
+ max_height = 0.
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ box_colors, box_patterns, box_scales, box_line_widths,
+ NULL, NULL, NULL,
+ NULL NULL NULL NULL
+ max_height = MAX max_height legend_height
+
+ // Set up box legend entries with various patterns.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}]
+ sprintf 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
+ x += legend_width
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ box_colors, box_patterns, box_scales, box_line_widths,
+ NULL, NULL, NULL,
+ NULL NULL NULL NULL
+ max_height = MAX max_height legend_height
+
+ // Set up box legend entries with various box pattern line widths.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}]
+ sprintf text[i] "%s %d" "Box Line Width" i + 1
+ text_colors[i] = 2
+ box_colors[i] = 2
+ box_patterns[i] = 3
+ box_scales[i] = 0.8
+ box_line_widths[i] = i + 1
+ }
+
+ opt = opt_base
+ x += legend_width
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ box_colors, box_patterns, box_scales, box_line_widths,
+ NULL, NULL, NULL,
+ NULL NULL NULL NULL
+ max_height = MAX max_height legend_height
+
+ // Set up line legend entries with various colours.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_LINE}]
+ sprintf text[i] "%s %d" "Line Color" i + 1
+ text_colors[i] = i + 1
+ line_colors[i] = i + 1
+ line_styles[i] = 1
+ line_widths[i] = 1
+ }
+
+ opt = opt_base
+ // Use new origin
+ x = xstart
+ y += max_height
+ max_height = 0.
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ NULL NULL NULL NULL
+ max_height = MAX max_height legend_height
+
+ // Set up line legend entries with various styles.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_LINE}]
+ sprintf 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
+ x += legend_width
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ NULL NULL NULL NULL
+ max_height = MAX max_height legend_height
+
+ // Set up line legend entries with various widths.
+ for i = 0 i < nlegend; i++
+ {
+ opt_array[i] = [expr {$::PLPLOT::PL_LEGEND_LINE}]
+ sprintf text[i] "%s %d" "Line Width" i + 1
+ text_colors[i] = 2
+ line_colors[i] = 2
+ line_styles[i] = 1
+ line_widths[i] = i + 1
+ }
+
+ opt = opt_base
+ x += legend_width
+ $w cmd plscol0a 15 32 32 32 0.70
+
+ $w cmd pllegend( &legend_width, &legend_height, position, opt, x, y,
+ 0.1, 15, 1, 1, 0, 0,
+ nlegend, opt_array, 1.0, text_scale, 2.0,
+ 0., text_colors, (const char **) text,
+ NULL, NULL, NULL, NULL,
+ line_colors, line_styles, line_widths,
+ NULL NULL NULL NULL
+ max_height = MAX max_height legend_height
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|