 |
Annotation. Symbols and characters of type II for HPlot canvases
Source code name: "symbols2.py"
Programming language: Python
Topic: Graphics/Annotation
DMelt Version 1. Last modified: 07/23/2017. License: Pro
https://datamelt.org/code/cache/symbols2_6035.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
# S.Chekanov
from java.awt import Font,Color
from jhplot import HPlot,HLabel
c1 = HPlot("Canvas",600,750)
c1.visible()
c1.setGridAll(0,0)
c1.setGridAll(1,0)
c1.setGTitle("jHPlot symbols II")
c1.removeAxes()
c1.setRange(0,100,0,100)
c1.setName("Add \'&\' in front and terminate by \';\'")
from jhplot import *
http='http://datamelt.org/examples/data/'
file='characters.txt'
print Web.get(http+file)
d=[]
# read file
f=open(file, 'r')
data=f.readlines()
f.close()
font=Font("Lucida Sans", Font.BOLD, 14)
# run over all supported charcters
for i in range(len(data)):
s=data[i]
kk=s.find(',');
if (kk>1):
a1=s[1:kk-1]
ss='&'+a1+';';
d.append([a1,ss]);
print "character=",ss
max=20
max1=8*max
if (max1>len(d)): max1=len(d)
i=1
for j in range(7*max,max1):
a=d[j]
t=a[1]+" "+a[0]
y=100-10*i
hh = HLabel(t,0,y)
hh.setFont(font)
c1.add(hh)
i=i+1
max1=9*max
if (max1>len(d)): max1=len(d)
i=1
for j in range(8*max,max1):
a=d[j]
t=a[1]+" "+a[0]
y=100-10*i
hh = HLabel(t,20,y)
hh.setFont(font)
c1.add(hh)
i=i+1
max1=10*max
if (max1>len(d)): max1=len(d)
i=1
for j in range(9*max,max1):
a=d[j]
t=a[1]+" "+a[0]
y=100-10*i
hh = HLabel(t,40,y)
hh.setFont(font)
c1.add(hh)
i=i+1
max1=11*max
if (max1>len(d)): max1=len(d)
i=1
for j in range(10*max,max1):
a=d[j]
t=a[1]+" "+a[0]
y=100-10*i
hh = HLabel(t,60,y)
hh.setFont(font)
c1.add(hh)
i=i+1
max1=12*max
if (max1>len(d)): max1=len(d)
i=1
for j in range(11*max,max1):
a=d[j]
t=a[1]+" "+a[0]
y=100-10*i
hh = HLabel(t,80,y)
hh.setFont(font)
c1.add(hh)
i=i+1
max1=13*max
if (max1>len(d)): max1=len(d)
i=1
for j in range(13*max,max1):
a=d[j]
t=a[1]+" "+a[0]
y=100-10*i
hh = HLabel(t,100,y)
hh.setFont(font)
c1.add(hh)
i=i+1
c1.update()
You see the box below because you did not login.