From: Andrew R. <and...@us...> - 2006-11-27 17:13:24
|
Update of /cvsroot/plplot/plplot/bindings/octave/demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7326/bindings/octave/demos Modified Files: CMakeLists.txt Added Files: x23c.m x24c.m x25c.m x26c.m Log Message: Add octave versions of examples 23-26. Add x23 to the list of default tests. --- NEW FILE: x24c.m --- ## $Id: x24c.m,v 1.1 2006/11/27 17:13:21 andrewross Exp $ ## ## Unicode Pace Flag ## ## Copyright (C) 2005 Rafael Laboissiere ## ## ## 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 ## ## ## In Debian, run like this: ## ## ( TTFDIR=/usr/share/fonts/truetype ; \ ## PLPLOT_FREETYPE_SANS_FONT=$TTFDIR/arphic/bkai00mp.ttf \ ## PLPLOT_FREETYPE_SERIF_FONT=$TTFDIR/freefont/FreeSerif.ttf \ ## PLPLOT_FREETYPE_MONO_FONT=$TTFDIR/ttf-devanagari-fonts/lohit_hi.ttf \ ## PLPLOT_FREETYPE_SCRIPT_FONT=$TTFDIR/unfonts/UnBatang.ttf \ ## PLPLOT_FREETYPE_SYMBOL_FONT=$TTFDIR/ttf-bengali-fonts/JamrulNormal.ttf \ ## ./x24c -dev png -drvopt smooth=0 -o x24c.png ) ## ## Packages needed: ## ## ttf-arphic-bkai00mp ## ttf-freefont ## ttf-devanagari-fonts ## ttf-unfonts ## ttf-bengali-fonts ## 1; function ix24c red = [240; 204; 204; 204; 0; 39; 125]; green = [240; 0; 125; 204; 204; 80; 0]; blue = [240; 0; 0; 0; 0; 204; 125]; px = [0.0; 0.0; 1.0; 1.0]; py = [0.0; 0.25; 0.25; 0.0]; sx = [ 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 ]; sy = [ 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 ]; ## Taken from http://www.columbia.edu/~fdc/pace/ peace = [ ## Mandarin "#<0x00>åå¹³"; ## Hindi "#<0x20>शाà¤à¤¤à¤¿"; ## English "#<0x10>Peace"; ## Hebrew "#<0x10>ש×××"; ## Russian "#<0x10>ÐиÑ"; ## German "#<0x10>Friede"; ## Korean "#<0x30>íí"; ## French "#<0x10>Paix"; ## Spanish "#<0x10>Paz"; ## Arabic "#<0x10>ﺳﻼ٠"; ## Turkish "#<0x10>BarıÅ"; ## Kurdish "#<0x10>Hasîtî" ]; ## plparseopts (&argc, argv, PL_PARSE_FULL); plinit; pladv (0); plvpor (0.0, 1.0, 0.0, 1.0); plwind (0.0, 1.0, 0.0, 1.0); plcol0 (0); plbox ("", 1.0, 0, "", 1.0, 0); plscmap0n (7); plscmap0 (red, green, blue); plschr (0, 4.0); plfont (1); for i = 1:4 plcol0 (i); plfill (px, py); py += 1.0 / 4.0; endfor plcol0 (0); for i=1:12 plptex (sx (i), sy (i), 1.0, 0.0, 0.5, peace (i)); endfor ## Restore defaults plcol0(1); plend1; end ix24c --- NEW FILE: x25c.m --- ## $Id: x25c.m,v 1.1 2006/11/27 17:13:21 andrewross Exp $ ## ## Bar chart demo. ## ##-------------------------------------------------------------------------- ## main ## ## Test program for filling polygons and proper clipping ##-------------------------------------------------------------------------- 1; function ix25c npts = 0; ## Parse and process command line arguments ## plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plssub(3,3); plinit; xextreme = [-120,120;-120,120;-120,120;-80,80;-220,-120;-20,20;-20,20;-80,80;20,120]; yextreme = [-120,120;20,120;-20,120;-20,120;-120,120;-120,120;-20,20;-80,80;-120,120]; for j=0:3 if ( j == 0 ) ## Polygon 1: a diamond x0 = [0;-100;0;100]; y0 = [-100;0;100;0]; npts = 4 ; endif if ( j == 1 ) ## Polygon 1: a diamond - reverse direction x0 = [100;0;-100;0]; y0 = [0;100;0;-100]; npts = 4 ; endif if ( j == 2 ) ## Polygon 2: a square with punctures x0 = [-100;-100;80;-100;-100;-80;0;80;100;100]; y0 = [-100;-80;0;80;100;100;80;100;100;-100]; npts = 10 ; endif if ( j == 3 ) ## Polygon 2: a square with punctures - reversed direction x0 = [100;100;80;0;-80;-100;-100;80;-100;-100]; y0 = [-100;100;100;80;100;100;80;0;-80;-100]; npts = 10 ; endif for i = 1:9 pladv(0); plvsta; plwind(xextreme(i,1), xextreme(i,2), yextreme(i,1), yextreme(i,2)); plbox("bc", 1.0, 0, "bcnv", 10.0, 0); plcol0(1) ; plpsty(0) ; plfill(x0,y0) ; plcol0(2) ; pllsty(1) ; plline(x0,y0) ; endfor endfor ## Don't forget to call plend() to finish off! plend1; end ix25c Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/plplot/plplot/bindings/octave/demos/CMakeLists.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CMakeLists.txt 14 Nov 2006 18:12:11 -0000 1.3 +++ CMakeLists.txt 27 Nov 2006 17:13:21 -0000 1.4 @@ -63,6 +63,7 @@ x18c.m x19c.m x22c.m +x23c.m lena.img ) --- NEW FILE: x23c.m --- ## $Id: x23c.m,v 1.1 2006/11/27 17:13:21 andrewross Exp $ ## ## Displays Greek letters and mathematically interesting Unicode ranges ## Copyright (C) 2005 Alan Irwin ## Copyright (C) 2005 Andrew Ross ## ## ## 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 ## 1; ## Displays Greek letters and mathematically interesting Unicode ranges function ix23c Greek = [\ "#gA";"#gB";"#gG";"#gD";"#gE";"#gZ";"#gY";"#gH";"#gI";"#gK";"#gL";"#gM";\ "#gN";"#gC";"#gO";"#gP";"#gR";"#gS";"#gT";"#gU";"#gF";"#gX";"#gQ";"#gW";\ "#ga";"#gb";"#gg";"#gd";"#ge";"#gz";"#gy";"#gh";"#gi";"#gk";"#gl";"#gm";\ "#gn";"#gc";"#go";"#gp";"#gr";"#gs";"#gt";"#gu";"#gf";"#gx";"#gq";"#gw";\ ]; Type1 = [\ 0x0020,0x0021,0x0023,0x0025,0x0026,\ 0x0028,0x0029,0x002b,0x002c,0x002e,\ 0x002f,0x0030,0x0031,0x0032,0x0033,\ 0x0034,0x0035,0x0036,0x0037,0x0038,\ 0x0039,0x003a,0x003b,0x003c,0x003d,\ 0x003e,0x003f,0x005b,0x005d,0x005f,\ 0x007b,0x007c,0x007d,0x00a9,0x00ac,\ 0x00ae,0x00b0,0x00b1,0x00d7,0x00f7,\ 0x0192,0x0391,0x0392,0x0393,0x0394,\ 0x0395,0x0396,0x0397,0x0398,0x0399,\ 0x039a,0x039b,0x039c,0x039d,0x039e,\ 0x039f,0x03a0,0x03a1,0x03a3,0x03a4,\ 0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,\ 0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,\ 0x03b6,0x03b7,0x03b8,0x03b9,0x03ba,\ 0x03bb,0x03bc,0x03bd,0x03be,0x03bf,\ 0x03c0,0x03c1,0x03c2,0x03c3,0x03c4,\ 0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,\ 0x03d1,0x03d2,0x03d5,0x03d6,0x2022,\ 0x2026,0x2032,0x2033,0x203e,0x2044,\ 0x2111,0x2118,0x211c,0x2122,0x2126,\ 0x2135,0x2190,0x2191,0x2192,0x2193,\ 0x2194,0x21b5,0x21d0,0x21d1,0x21d2,\ 0x21d3,0x21d4,0x2200,0x2202,0x2203,\ 0x2205,0x2206,0x2207,0x2208,0x2209,\ 0x220b,0x220f,0x2211,0x2212,0x2215,\ 0x2217,0x221a,0x221d,0x221e,0x2220,\ 0x2227,0x2228,0x2229,0x222a,0x222b,\ 0x2234,0x223c,0x2245,0x2248,0x2260,\ 0x2261,0x2264,0x2265,0x2282,0x2283,\ 0x2284,0x2286,0x2287,0x2295,0x2297,\ 0x22a5,0x22c5,0x2320,0x2321,0x2329,\ 0x232a,0x25ca,0x2660,0x2663,0x2665,\ 0x2666,\ ]; title = {\ "#<0x10>PLplot Example 23 - Greek Letters";\ "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)";\ "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)";\ "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)";\ "#<0x10>PLplot Example 23 - Number Forms Unicode Block";\ "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)";\ "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)"\ }; lo = [\ 0x0,\ 0x0,\ 0x40,\ 0x80,\ 0x2153,\ 0x2190,\ 0x21d0,\ 0x2200,\ 0x2240,\ 0x2280,\ 0x22c0,\ ]; hi = [\ 0x30,\ 0x40,\ 0x80,\ 0xA6,\ 0x2184,\ 0x21d0,\ 0x2200,\ 0x2240,\ 0x2280,\ 0x22c0,\ 0x2300,\ ]; nxcells = [\ 12,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ ]; nycells = [\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ ]; ## non-zero values Must be consistent with nxcells and nycells. offset = [\ 0,\ 0,\ 64,\ 128,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ ]; ## plparseopts(&argc, argv, PL_PARSE_FULL); plinit; for page=1:11 pladv(0); ## Set up viewport and window plvpor(0.02, 0.98, 0.02, 0.90); plwind(0.0, 1.0, 0.0, 1.0); [xmin, xmax, ymin, ymax] = plgspa; plschr(0., 0.8); ycharacter_scale = (1.0 - 0.0)/(ymax-ymin); ## Factor should be 0.5, but heuristically it turns out to be larger. [chardef, charht] = plgchr; yoffset = 1.0*charht*ycharacter_scale; ## Draw the grid using plbox plcol0(2); deltax = 1.0/nxcells(page); deltay = 1.0/nycells(page); plbox("bcg", deltax, 0, "bcg", deltay, 0); plcol0(15); length=hi(page)-lo(page); slice = 0; for j=nycells(page)-1:-1:0; y = (0.5+j)*deltay; for i=0:nxcells(page)-1; x = (0.5+i)*deltax; if (slice < length) if (page == 1) cmdString = sprintf("#%s",Greek(slice+1,:)); elseif ((page >= 2) && (page <= 4)) cmdString = sprintf("##[0x%.4x]",Type1(offset(page)+slice+1)); elseif (page >= 5) cmdString = sprintf("##[0x%.4x]",lo(page)+slice); end strlen = size(cmdString)(2); plptex(x,y+yoffset,1.,0.,0.5, cmdString(2:strlen)); plptex(x,y-yoffset,1.,0.,0.5, cmdString); end slice += 1; end end plschr(0., 1.0); ## Page title plmtex("t", 1.5, 0.5, 0.5, title(page,:)); end ## Restore defaults plcol0(1); plend1; end ix23c --- NEW FILE: x26c.m --- ## -*- coding: utf-8; -*- ## ## $Id: x26c.m,v 1.1 2006/11/27 17:13:21 andrewross Exp $ ## ## Multi-lingual version of the first page of example 4. ## ## Copyright (C) 2006 Alan Irwin ## Copyright (C) 2006 Andrew Ross ## ## Thanks to the following for providing translated strings for this example: ## Valery Pipin (Russian) ## ## 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 the psttf-related devices(i.e., -dev psttfc ## and -dev psttf). No other devices will work. These devices ## use liblasi (version 1.0.5 or later!) to render the fonts. liblasi uses ## libpango to deal with CTL issues, and libfontconfig to deal with font ## selection. Because of libfontconfig, the best choice of glyph is ## automatically rendered for each unicode character in this example. ## Of course, you must have the appropriate TrueType fonts installed to have ## access to all the glyphs. ## ## Translation instructions: The strings to be translated are given by ## x_label, y_label, alty_label, title_label, and line_label below. The ## encoding used must be UTF-8. ## ## The following strings to be translated involve some scientific/mathematical ## jargon which is now discussed further to help translators. ## ## (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . ## (2) degrees is an angular measure, see ## http://en.wikipedia.org/wiki/Degree_(angle) . ## (3) low-pass filter is one that transmits (passes) low frequencies. ## (4) pole is in the mathematical sense, see ## http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" ## means a particular mathematical transformation of the filter function has ## a single pole, see ## http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . ## Furthermore, a single-pole filter must have an inverse square decline ## (or -20 db/decade). Since the filter plotted here does have that ## characteristic, it must by definition be a single-pole filter, see also ## http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm ## (5) decade represents a factor of 10, see ## http://en.wikipedia.org/wiki/Decade_(log_scale) . ## 1; function ix26c x_label = [ "Frequency"; "ЧаÑÑоÑа"; ]; y_label = [ "Amplitude (dB)"; "ÐмплиÑÑда (dB)"; ]; alty_label = [ "Phase shift (degrees)"; "ФазовÑй Ñдвиг (гÑадÑÑÑ)"; ]; title_label = [ "Single Pole Low-Pass Filter"; "ÐднополÑÑнÑй Ðизко-ЧаÑÑоÑнÑй ФилÑÑÑ"; ]; line_label = [ "-20 dB/decade"; "-20 dB/деÑÑÑок"; ]; ## Illustration of logarithmic axes, and redefinition of window. ## Parse and process command line arguments ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plinit; plfont(2); ## Make log plots using two different styles. for i = 1:size(x_label)(1); plot1(0, deblank(x_label(i,:)), deblank(y_label(i,:)), deblank(alty_label(i,:)), deblank(title_label(i,:)), deblank(line_label(i,:))); endfor plend1; end ## Log-linear plot. function plot1(plottype, x_label, y_label, alty_label, title_label, line_label) pladv(0); ## Set up data for log plot */ f0 = 1.0; i=0:100; freql = -2.0 + i / 20.0; freq = 10.0 .^ freql; ampl = 20.0 * log10(1.0 ./ sqrt(1.0 + (freq ./ f0).^ 2.)); phase = -(180.0 / 3.141592654) * atan(freq ./ f0); plvpor(0.15, 0.85, 0.1, 0.9); plwind(-2.0, 3.0, -80.0, 0.0); ## Try different axis and labelling styles. */ plcol0(1); switch (plottype) case 0 plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); case 1 plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); endswitch ## Plot ampl vs freq */ plcol0(2); plline(freql', ampl'); plcol0(1); plptex(1.6, -30.0, 1.0, -20.0, 0.5, line_label); ## Put labels on */ plcol0(1); plmtex("b", 3.2, 0.5, 0.5, x_label); plmtex("t", 2.0, 0.5, 0.5, title_label); plcol0(2); plmtex("l", 5.0, 0.5, 0.5, y_label); ## For the gridless case, put phase vs freq on same plot */ if (plottype == 0) plcol0(1); plwind(-2.0, 3.0, -100.0, 0.0); plbox("", 0.0, 0, "cmstv", 30.0, 3); plcol0(3); plline(freql', phase'); plcol0(3); plmtex("r", 5.0, 0.5, 0.5, alty_label); endif end ix26c |