OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | --[[ $Id: x07.lua 11032 2010-05-27 22:34:40Z andrewross $ |
| 2 | |
| 3 | Font demo. |
| 4 | |
| 5 | Copyright (C) 2008 Werner Smekal |
| 6 | |
| 7 | This file is part of PLplot. |
| 8 | |
| 9 | PLplot is free software you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Library Public License as published |
| 11 | by the Free Software Foundation either version 2 of the License, or |
| 12 | (at your option) any later version. |
| 13 | |
| 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. |
| 18 | |
| 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 |
| 22 | --]] |
| 23 | |
| 24 | -- initialise Lua bindings for PLplot examples. |
| 25 | dofile("plplot_examples.lua") |
| 26 | |
| 27 | base = { 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, |
| 28 | 2000, 2100, 2200, 2300, 2400, 2500, |
| 29 | 2600, 2700, 2800, 2900 } |
| 30 | |
| 31 | ---------------------------------------------------------------------------- |
| 32 | -- main |
| 33 | -- |
| 34 | -- Displays the entire "plsym" symbol (font) set. |
| 35 | ---------------------------------------------------------------------------- |
| 36 | |
| 37 | -- Parse and process command line arguments |
| 38 | pl.parseopts(arg, pl.PL_PARSE_FULL) |
| 39 | |
| 40 | -- Initialize plplot |
| 41 | pl.init() |
| 42 | |
| 43 | pl.fontld(0) |
| 44 | for l = 1, 20 do |
| 45 | |
| 46 | if l == 3 then |
| 47 | pl.fontld(1) |
| 48 | end |
| 49 | pl.adv(0) |
| 50 | |
| 51 | -- Set up viewport and window |
| 52 | pl.col0(2) |
| 53 | pl.vpor(0.15, 0.95, 0.1, 0.9) |
| 54 | pl.wind(0, 1, 0, 1) |
| 55 | |
| 56 | -- Draw the grid using plbox |
| 57 | |
| 58 | pl.box("bcg", 0.1, 0, "bcg", 0.1, 0) |
| 59 | |
| 60 | -- Write the digits below the frame |
| 61 | |
| 62 | pl.col0(15) |
| 63 | for i = 0, 9 do |
| 64 | pl.mtex("b", 1.5, (0.1 * i + 0.05), 0.5, tostring(i)) |
| 65 | end |
| 66 | |
| 67 | k = 0 |
| 68 | x = {} |
| 69 | y = {} |
| 70 | for i = 0, 9 do |
| 71 | -- Write the digits to the left of the frame |
| 72 | pl.mtex("lv", 1.0, (0.95 - 0.1 * i), 1.0, tostring(base[l] + 10 * i)) |
| 73 | for j=0, 9 do |
| 74 | x[1] = 0.1 * j + 0.05 |
| 75 | y[1] = 0.95 - 0.1 * i |
| 76 | |
| 77 | -- Display the symbols |
| 78 | pl.sym(x, y, base[l] + k) |
| 79 | k = k + 1 |
| 80 | end |
| 81 | end |
| 82 | |
| 83 | if l <= 2 then |
| 84 | pl.mtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)") |
| 85 | else |
| 86 | pl.mtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)") |
| 87 | end |
| 88 | end |
| 89 | |
| 90 | pl.plend() |
| 91 |
