1#!/usr/bin/env python 2# -*- coding: utf-8; -*- 3 4# Append to effective python path so that can find plplot modules. 5from plplot_python_start import * 6 7import sys 8import plplot as w 9from numpy import * 10 11x = [0.5] 12y = [0.5] 13 14title = [ 15 "Large Circle + Light Diagonal Cross with plptex", 16 "UTF-8 plus", 17 "UTF-8 squared plus", 18 "UTF-8 heavy plus", 19 "UTF-8 minus", 20 "UTF-8 squared minus", 21 "UTF-8 heavy minus", 22 "UTF-8 times", 23 "UTF-8 squared times", 24 "UTF-8 heavy multiplication x", 25 "UTF-8 number sign", 26 "UTF-8 full-width number sign", 27 "UTF-8 asterisk", 28 "UTF-8 four teardrop-spoked asterisk", 29 "UTF-8 8-spoked asterisk", 30 "UTF-8 asterisk operator", 31 "UTF-8 Asterisk operator with plptex", 32 "Plplot Encoded Unicode Indexed Asterisk operator with plptex", 33 "Plplot Encoded Hershey Indexed Asterisk operator with plptex", 34 "Hershey Asterisk operator with plsym", 35 "Hershey Asterisk operator with plpoin", 36 "Plplot Encoded Hershey Indexed Asterisk operator with plstring", 37] 38ifunicode = True 39 40# Parse and process command line arguments 41w.plparseopts(sys.argv, w.PL_PARSE_FULL) 42 43# Initialize plplot 44w.plinit() 45for kind in range(len(title)): 46 w.pladv(0) 47 w.plvpor(0.1, 0.9, 0.1, 0.9) 48 w.plwind(0., 1., 0., 1.) 49 # Just to show edges of viewport 50 w.plcol0(1) 51 w.plbox("bc", 0., 0, "bc", 0., 0) 52 w.plcol0(2) 53 w.plschr(0., 1.) 54 w.plmtex("t", 1., 0.5, 0.5, title[kind]) 55 k=0 56 for size in 2.**arange(2,-3,-1): 57 k+=1 58 w.plcol0(k) 59 if kind==0: 60 if ifunicode: 61 w.plschr(0., 4.*size) 62 # LARGE CIRCLE has a centre of symmetry which is about one-eighth the 63 # radius below the centre of symmetry of the box for DejaVu Sans. 64 w.plptex(0.5, 0.5, 1., 0., 0.5, "#[0x25ef]") 65 # BOX DRAWINGS LIGHT DIAGONAL CROSS is one of the best centred symmetrical 66 # glyphs I have found using gucharmap for DejaVu Sans. 67 w.plptex(0.5, 0.5, 1., 0., 0.5, "#[0x2573]") 68 else: 69 w.plschr(0., 4.*size) 70 # Large circle via Hershey fonts. 71 w.plptex(0.5, 0.5, 1., 0., 0.5, "#(907)") 72 elif kind ==1: 73 # Print a utf-8 plus 74 w.plschr(0., 16.*size) 75 w.plstring(x, y, "+") 76 elif kind ==2: 77 # Print a utf-8 squared plus 78 w.plschr(0., 16.*size) 79 w.plstring(x, y, "⊞") 80 elif kind ==3: 81 # Print a utf-8 heavy plus 82 w.plschr(0., 16.*size) 83 w.plstring(x, y, "➕") 84 elif kind ==4: 85 # Print a utf-8 minus 86 w.plschr(0., 16.*size) 87 w.plstring(x, y, "-") 88 elif kind ==5: 89 # Print a utf-8 squared minus 90 w.plschr(0., 16.*size) 91 w.plstring(x, y, "⊟") 92 elif kind ==6: 93 # Print a utf-8 heay minus 94 w.plschr(0., 16.*size) 95 w.plstring(x, y, "➖") 96 elif kind ==7: 97 # Print a utf-8 times 98 w.plschr(0., 16.*size) 99 w.plstring(x, y, "×") 100 elif kind ==8: 101 # Print a utf-8 squared times 102 w.plschr(0., 16.*size) 103 w.plstring(x, y, "⊠") 104 elif kind ==9: 105 # Print a utf-8 heavy multiplication x 106 w.plschr(0., 16.*size) 107 w.plstring(x, y, "✖") 108 elif kind ==10: 109 # Print a utf-8 number sign 110 w.plschr(0., 16.*size) 111 w.plstring(x, y, "##") 112 elif kind ==11: 113 # Print a utf-8 full-width number sign 114 w.plschr(0., 16.*size) 115 w.plstring(x, y, "#") 116 elif kind ==12: 117 # Print a utf-8 asterisk 118 w.plschr(0., 16.*size) 119 w.plstring(x, y, "*") 120 elif kind ==13: 121 # Print a utf-8 four teardrop-spoked asterisk 122 w.plschr(0., 16.*size) 123 w.plstring(x, y, "✢" ) 124 elif kind ==14: 125 # Print a utf-8 8-spoked asterisk 126 w.plschr(0., 16.*size) 127 w.plstring(x, y, "✳") 128 elif kind ==15: 129 # Print a utf-8 asterisk operator 130 w.plschr(0., 16.*size) 131 w.plstring(x, y, "∗") 132 elif kind ==16: 133 # Print a utf-8 asterisk operator using w.plptex 134 w.plschr(0., 16.*size) 135 w.plptex(0.5, 0.5, 1., 0., 0.5, "∗") 136 elif kind ==17: 137 # Print a (PLplot encoded) unicode indexed asterisk operator using w.plptex 138 w.plschr(0., 16.*size) 139 w.plptex(0.5, 0.5, 1., 0., 0.5, "#[0x2217]") 140 elif kind ==18: 141 # Print a (PLplot encoded) Hershey indexed asterisk operator using w.plptex 142 w.plschr(0., 16.*size) 143 w.plptex(0.5, 0.5, 1., 0., 0.5, "#(728)") 144 elif kind ==19: 145 # Print an asterisk operator using w.plsym 146 w.plssym(0., 16.*size) 147 w.plsym(x, y, 728) 148 elif kind ==20: 149 # Print an asterisk operator using w.plpoin 150 w.plssym(0., 16.*size) 151 w.plpoin(x, y, 3) 152 elif kind ==21: 153 # Print a (PLplot encoded) Hershey indexed asterisk operator using w.plstring 154 w.plschr(0., 16.*size) 155 w.plstring(x, y, "#(728)") 156 else: 157 print("missing kind value: bad code") 158# Terminate plplot 159w.plend() 160 161