feat: enhance matplotlib type defs

This commit is contained in:
Shunsuke Shibayama 2023-06-03 12:03:31 +09:00
parent ea132e2345
commit 0b87a49b85
13 changed files with 38 additions and 0 deletions

View file

@ -1 +1,4 @@
.pyplot = pyimport "./pyplot"
.scale = pyimport "./scale"
.use!: Str => NoneType

View file

@ -0,0 +1,3 @@
._axes = pyimport "./_axes"
.Axes! = ._axes.Axes!

View file

@ -0,0 +1,21 @@
.Axes!: ClassType
.Axes!.
scatter!: (
self: RefMut(.Axes!),
x: Num, # TODO: Float | ArrayLike
y: Num,
s := Num,
c := Iterable(Int),
vmin := Float,
vmax := Float,
) => NoneType
set!: (
self: RefMut(.Axes!),
xlabel := Str,
xlim := (Float, Float),
xticks := Iterable(Obj),
ylabel := Str,
ylim := (Float, Float),
yticks := Iterable(Obj),
title := Str
) => NoneType

View file

@ -0,0 +1 @@
.Figure: ClassType

View file

@ -1,6 +1,9 @@
# lines = pyimport "../lines"
text = pyimport "../text"
legend = pyimport "../legend"
.style = pyimport "../style"
figure = pyimport "../figure"
axes = pyimport "../axes"
.plot!: (*args: Obj, scaleX := Bool, scaleY := Bool) => [Obj; _]
.show!: () => NoneType
@ -8,3 +11,8 @@ legend = pyimport "../legend"
.xlabel!: (label: Str) => text.Text
.ylabel!: (label: Str) => text.Text
.legend!: (labels := [Str; _]) => legend.Legend
.subplots!: (() => (figure.Figure, axes.Axes!)) \
and ((nrows: {1}, ncols: {1}) => (figure.Figure, axes.Axes!)) \
and ((nrows: {1}, ncols: Nat) => (figure.Figure, [axes.Axes!; _])) \
and ((nrows: Nat, ncols: {1}) => (figure.Figure, [axes.Axes!; _])) \
and ((nrows: Nat, ncols: Nat) => (figure.Figure, [[axes.Axes!; _]; _]))

View file

@ -0,0 +1 @@
.use!: Str => NoneType

View file

@ -1,5 +1,6 @@
# TODO: dependent (static shaped)
.NDArray = 'ndarray': ClassType
.NDArray <: Iterable Obj
.NDArray <: Num
.NDArray.
shape: [Nat; _]