-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c86d46
commit 042c198
Showing
2 changed files
with
26 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
from typing import List # Python native | ||
import matplotlib.pyplot as plt # the de facto standard for plotting in Python | ||
from matplotlib.figure import Figure # the matplotlib figure class | ||
|
||
import matplotlib.figure, matplotlib.pyplot# the de facto standard for plotting in Python | ||
|
||
import funix | ||
@funix.funix(widgets={"a": "sheet", "b": ["sheet", "slider[0,5,0.2]"]}) | ||
def table_plot( | ||
a: List[int] = [5, 17, 29], b: List[float] = [3.1415, 2.6342, 1.98964] | ||
) -> Figure: | ||
fig = plt.figure() | ||
plt.plot(a, b) | ||
return fig | ||
|
||
# @funix.funix(widgets={"a": "sheet", "b": ["sheet", "slider[0,5,0.2]"]}) | ||
# def table_plot( | ||
# a: List[int] = [5, 17, 29], b: List[float] = [3.1415, 2.6342, 1.98964] | ||
# ) -> Figure: | ||
# fig = matplotlib.pyplot.figure() | ||
# matplotlib.pyplot.plot(a, b) | ||
# return fig | ||
|
||
|
||
# Future Implementation | ||
# New Implementation after FEP 11 | ||
|
||
# import pandas # the de facto standard for tabular data in Python | ||
# import pandera # the typing library for pandas dataframes | ||
import pandas # the de facto standard for tabular data in Python | ||
import pandera # the typing library for pandas dataframes | ||
|
||
# class MySchema(pandera.DataFrameModel): | ||
# a: pandera.typing.Series[int] | ||
# b: pandera.typing.Series[float] | ||
class MySchema(pandera.DataFrameModel): | ||
a: pandera.typing.Series[int] | ||
b: pandera.typing.Series[float] | ||
|
||
# funix.funix() | ||
# def table_plot(df: pandera.typing.DataFrame[MySchema] = \ | ||
# pandas.DataFrame({"a": [5, 17, 29], | ||
# "b": [3.1415, 2.6342, 1.98964]}) | ||
# ) -> Figure: | ||
# fig = plt.figure() | ||
# plt.plot(a, b) | ||
# return fig | ||
@funix.funix() | ||
def table_plot(df: pandera.typing.DataFrame[MySchema] = \ | ||
pandas.DataFrame({"a": [5, 17, 29], # default values | ||
"b": [3.1415, 2.6342, 1.98964]}) | ||
) -> matplotlib.figure.Figure: | ||
fig = matplotlib.pyplot.figure() | ||
matplotlib.pyplot.plot(df["a"], df["b"]) | ||
return fig |