yaplotlib 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yaplotlib-0.1.3/PKG-INFO +15 -0
- yaplotlib-0.1.3/README.md +0 -0
- yaplotlib-0.1.3/pyproject.toml +15 -0
- yaplotlib-0.1.3/yaplotlib.py +171 -0
- yaplotlib-0.1.1/PKG-INFO +0 -15
- yaplotlib-0.1.1/setup.cfg +0 -10
- yaplotlib-0.1.1/setup.py +0 -35
- yaplotlib-0.1.1/yaplotlib.egg-info/PKG-INFO +0 -15
- yaplotlib-0.1.1/yaplotlib.egg-info/SOURCES.txt +0 -7
- yaplotlib-0.1.1/yaplotlib.egg-info/dependency_links.txt +0 -1
- yaplotlib-0.1.1/yaplotlib.egg-info/top_level.txt +0 -1
- yaplotlib-0.1.1/yaplotlib.py +0 -75
yaplotlib-0.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: yaplotlib
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: A tiny library to generate Yaplot file.
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: vitroid
|
|
7
|
+
Author-email: vitroid@gmail.com
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "yaplotlib"
|
|
3
|
+
version = "0.1.3"
|
|
4
|
+
description = "A tiny library to generate Yaplot file."
|
|
5
|
+
authors = ["vitroid <vitroid@gmail.com>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "^3.11"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
[build-system]
|
|
14
|
+
requires = ["poetry-core"]
|
|
15
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# even: stable; odd: develop
|
|
3
|
+
__version__ = "0.1.3"
|
|
4
|
+
|
|
5
|
+
import colorsys
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plaintext(a):
|
|
9
|
+
s = ""
|
|
10
|
+
for x in a:
|
|
11
|
+
s += "{0:.4f} ".format(x)
|
|
12
|
+
return s
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def Line(v0,v1):
|
|
16
|
+
return "l " + plaintext(v0) + plaintext(v1) + "\n"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def Text(v,txt):
|
|
20
|
+
return "t " + plaintext(v) + " " + txt + "\n"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def Circle(v0):
|
|
24
|
+
return "c " + plaintext(v0) + "\n"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def Arrow(v0,v1):
|
|
28
|
+
return "s " + plaintext(v0) + plaintext(v1) + "\n"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def Polygon(vertices):
|
|
33
|
+
s = f"p {len(vertices)} "
|
|
34
|
+
for v in vertices:
|
|
35
|
+
s += plaintext(v)
|
|
36
|
+
return s + "\n"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def Color(x):
|
|
41
|
+
return f"@ {int(x)}\n"
|
|
42
|
+
|
|
43
|
+
# R,G,B in range 0..255
|
|
44
|
+
def SetPalette(x,R,G=None,B=None,maxval=255):
|
|
45
|
+
if G is None:
|
|
46
|
+
R,G,B = R
|
|
47
|
+
r = int(R*255/maxval)
|
|
48
|
+
g = int(G*255/maxval)
|
|
49
|
+
b = int(B*255/maxval)
|
|
50
|
+
return f"@ {int(x)} {r} {g} {b}\n"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def Size(x):
|
|
54
|
+
return f"r {float(x)}\n"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def Layer(x):
|
|
58
|
+
return f"y {int(x)}\n"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def ArrowType(x):
|
|
62
|
+
return f"a {int(x)}\n"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def NewPage():
|
|
66
|
+
return "\n"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def RandomPalettes(N, offset=10):
|
|
70
|
+
omega = 2 / (5**0.5 - 1)
|
|
71
|
+
s = ""
|
|
72
|
+
for i in range(N):
|
|
73
|
+
hue = (omega * i) % 1.0
|
|
74
|
+
sat = 0.5
|
|
75
|
+
bri = 1.0
|
|
76
|
+
r,g,b = colorsys.hsv_to_rgb(hue, sat, bri)
|
|
77
|
+
s += SetPalette(i+offset, r,g,b, maxval=1.0)
|
|
78
|
+
return s
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def RainbowPalettes(N, offset=10):
|
|
82
|
+
s = ""
|
|
83
|
+
for i in range(N):
|
|
84
|
+
hue = i / N
|
|
85
|
+
sat = 0.5
|
|
86
|
+
bri = 1.0
|
|
87
|
+
r,g,b = colorsys.hsv_to_rgb(hue, sat, bri)
|
|
88
|
+
s += SetPalette(i+offset, r,g,b, maxval=1.0)
|
|
89
|
+
return s
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def GradationPalettes(N, color, color1=None, offset=10, maxval=255):
|
|
93
|
+
"""
|
|
94
|
+
いずれ、dictやlistでも与えられるようにする。
|
|
95
|
+
"""
|
|
96
|
+
s = ""
|
|
97
|
+
for i in range(N):
|
|
98
|
+
ratio = i / (N-1)
|
|
99
|
+
r = color[0]*(1-ratio) + color1[0]*ratio
|
|
100
|
+
g = color[1]*(1-ratio) + color1[1]*ratio
|
|
101
|
+
b = color[2]*(1-ratio) + color1[2]*ratio
|
|
102
|
+
s += SetPalette(i+offset, r, g, b, maxval)
|
|
103
|
+
return s
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class Yaplot():
|
|
107
|
+
def __init__(self):
|
|
108
|
+
self.s = ""
|
|
109
|
+
self.layer = 1
|
|
110
|
+
self.color = 2
|
|
111
|
+
self.size = 1
|
|
112
|
+
self.arrowtype = 1
|
|
113
|
+
def Layer(self, layer):
|
|
114
|
+
if layer < 0:
|
|
115
|
+
return
|
|
116
|
+
if layer != self.layer:
|
|
117
|
+
self.s += Layer(layer)
|
|
118
|
+
self.layer = layer
|
|
119
|
+
def Color(self, color):
|
|
120
|
+
if color < 0:
|
|
121
|
+
return
|
|
122
|
+
if color != self.color:
|
|
123
|
+
self.s += Color(color)
|
|
124
|
+
self.color = color
|
|
125
|
+
def Size(self, size):
|
|
126
|
+
if size < 0:
|
|
127
|
+
return
|
|
128
|
+
if size != self.size:
|
|
129
|
+
self.s += Size(size)
|
|
130
|
+
self.size = size
|
|
131
|
+
def ArrowType(self, arrowtype):
|
|
132
|
+
if arrowtype < 0:
|
|
133
|
+
return
|
|
134
|
+
if arrowtype != self.arrowtype:
|
|
135
|
+
self.s += ArrowType(arrowtype)
|
|
136
|
+
self.arrowtype = arrowtype
|
|
137
|
+
def Line(self, a, b, layer=-1, color=-1):
|
|
138
|
+
if layer > 0:
|
|
139
|
+
self.s += self.Layer(layer)
|
|
140
|
+
if color >= 0:
|
|
141
|
+
self.s += self.Color(color)
|
|
142
|
+
self.s += Line(a, b)
|
|
143
|
+
def Arrow(self, a, b, layer=-1, color=-1, size=-1, arrowtype=-1):
|
|
144
|
+
self.s += self.Layer(layer)
|
|
145
|
+
self.s += self.Color(color)
|
|
146
|
+
self.s += Line(a, b)
|
|
147
|
+
def Polygon(self, p, layer=-1, color=-1):
|
|
148
|
+
self.s += self.Layer(layer)
|
|
149
|
+
self.s += self.Color(color)
|
|
150
|
+
self.s += Polygon(p)
|
|
151
|
+
def Circle(self, c, layer=-1, color=-1, size=-1):
|
|
152
|
+
self.s += self.Layer(layer)
|
|
153
|
+
self.s += self.Color(color)
|
|
154
|
+
self.s += self.Size(size)
|
|
155
|
+
self.s += Circle(c)
|
|
156
|
+
def SetPalette(self, x, R, G=None, B=None, maxval=255):
|
|
157
|
+
self.s += SetPalette(x, R, G, B, maxval)
|
|
158
|
+
def GradationPalettes(self, N, color, color1=None, offset=10, maxval=255):
|
|
159
|
+
self.s += GradationPalettes(N, color, color1, offset, maxval)
|
|
160
|
+
def RandomPalettes(self, N, offset=10):
|
|
161
|
+
self.s += RandomPalettes(N, offset)
|
|
162
|
+
def RainbowPalettes(self, N, offset=10):
|
|
163
|
+
self.s += RainbowPalettes(N, offset)
|
|
164
|
+
def NewPage(self):
|
|
165
|
+
self.s += NewPage()
|
|
166
|
+
self.layer = 1
|
|
167
|
+
self.color = 2
|
|
168
|
+
self.arrowtype = 1
|
|
169
|
+
self.size = 1
|
|
170
|
+
def dumps(self):
|
|
171
|
+
return self.s
|
yaplotlib-0.1.1/PKG-INFO
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: yaplotlib
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: A tiny library to generate Yaplot file.
|
|
5
|
-
Home-page: https://github.com/vitroid/yaplotlib/
|
|
6
|
-
Author: Masakazu Matsumoto
|
|
7
|
-
Author-email: vitroid@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: UNKNOWN
|
|
10
|
-
Keywords: yaplot
|
|
11
|
-
Platform: UNKNOWN
|
|
12
|
-
Classifier: Development Status :: 4 - Beta
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Programming Language :: Python
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.5
|
yaplotlib-0.1.1/setup.cfg
DELETED
yaplotlib-0.1.1/setup.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
# from distutils.core import setup, Extension
|
|
4
|
-
from setuptools import setup, Extension
|
|
5
|
-
from numpy.distutils.misc_util import get_numpy_include_dirs
|
|
6
|
-
import os
|
|
7
|
-
import codecs
|
|
8
|
-
import re
|
|
9
|
-
|
|
10
|
-
#Copied from wheel package
|
|
11
|
-
here = os.path.abspath(os.path.dirname(__file__))
|
|
12
|
-
|
|
13
|
-
with codecs.open(os.path.join(os.path.dirname(__file__), 'yaplotlib.py'),
|
|
14
|
-
encoding='utf8') as version_file:
|
|
15
|
-
metadata = dict(re.findall(r"""__([a-z]+)__ = "([^"]+)""", version_file.read()))
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
setup(
|
|
19
|
-
name='yaplotlib',
|
|
20
|
-
version=metadata['version'],
|
|
21
|
-
py_modules=['yaplotlib'],
|
|
22
|
-
description='A tiny library to generate Yaplot file.',
|
|
23
|
-
#long_description=README + '\n\n' + CHANGES,
|
|
24
|
-
classifiers=[
|
|
25
|
-
"Development Status :: 4 - Beta",
|
|
26
|
-
"Intended Audience :: Developers",
|
|
27
|
-
"Programming Language :: Python",
|
|
28
|
-
"Programming Language :: Python :: 3.5",
|
|
29
|
-
],
|
|
30
|
-
author='Masakazu Matsumoto',
|
|
31
|
-
author_email='vitroid@gmail.com',
|
|
32
|
-
url='https://github.com/vitroid/yaplotlib/',
|
|
33
|
-
keywords=['yaplot',],
|
|
34
|
-
license='MIT',
|
|
35
|
-
)
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: yaplotlib
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: A tiny library to generate Yaplot file.
|
|
5
|
-
Home-page: https://github.com/vitroid/yaplotlib/
|
|
6
|
-
Author: Masakazu Matsumoto
|
|
7
|
-
Author-email: vitroid@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: UNKNOWN
|
|
10
|
-
Keywords: yaplot
|
|
11
|
-
Platform: UNKNOWN
|
|
12
|
-
Classifier: Development Status :: 4 - Beta
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Programming Language :: Python
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
yaplotlib
|
yaplotlib-0.1.1/yaplotlib.py
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# even: stable; odd: develop
|
|
3
|
-
__version__ = "0.1.1"
|
|
4
|
-
|
|
5
|
-
import colorsys
|
|
6
|
-
|
|
7
|
-
def plaintext(a):
|
|
8
|
-
s = ""
|
|
9
|
-
for x in a:
|
|
10
|
-
s += "{0:.4f} ".format(x)
|
|
11
|
-
return s
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def Line(v0,v1):
|
|
15
|
-
return "l " + plaintext(v0) + plaintext(v1) + "\n"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def Text(v,txt):
|
|
19
|
-
return "t " + plaintext(v) + " " + txt + "\n"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def Circle(v0):
|
|
23
|
-
return "c " + plaintext(v0) + "\n"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def Arrow(v0,v1):
|
|
27
|
-
return "s " + plaintext(v0) + plaintext(v1) + "\n"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def Polygon(vertices):
|
|
32
|
-
s = "p {0} ".format(len(vertices))
|
|
33
|
-
for v in vertices:
|
|
34
|
-
s += plaintext(v)
|
|
35
|
-
return s + "\n"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def Color(x):
|
|
40
|
-
return "@ {0}\n".format(int(x))
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def SetPalette(x,R,G,B):
|
|
44
|
-
return "@ {0} {1} {2} {3}\n".format(int(x),R,G,B)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def Size(x):
|
|
48
|
-
return "r {0}\n".format(float(x))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def Layer(x):
|
|
52
|
-
return "y {0}\n".format(int(x))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def ArrowType(x):
|
|
56
|
-
return "a {0}\n".format(int(x))
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def NewPage():
|
|
60
|
-
return "\n"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def RandomPalettes(N, offset=10):
|
|
64
|
-
omega = (5**0.5 - 1)/2
|
|
65
|
-
s = ""
|
|
66
|
-
for i in range(N):
|
|
67
|
-
hue = (omega * i) % 1.0
|
|
68
|
-
sat = 0.5
|
|
69
|
-
bri = 1.0
|
|
70
|
-
r,g,b = colorsys.hsv_to_rgb(hue, sat, bri)
|
|
71
|
-
r = int(r*255)
|
|
72
|
-
g = int(g*255)
|
|
73
|
-
b = int(b*255)
|
|
74
|
-
s += SetPalette(i+offset, r,g,b)
|
|
75
|
-
return s
|