Streamlit的欺骗性简单绘图库
项目描述
:tomato: PLost
Streamlit的Streamlit的欺骗性简单绘图库。
因为你一直写错了图表。
👇 真正的README实际上在这里:
👆 你可以在上面的应用中找到交互式示例、文档等等。
我们的目标
- 你99%的时间需要的极其简单
- 其余的1%是不可能的。使用Vega-Lite代替!
入门指南
pip install plost
基础知识
PLost使您能够通过Vega-Lite库轻松构建常见图表,而无需深入研究Vega-Lite规范(除非您正在做些棘手的事情),也无需将您的DataFrame从长格式熔化成宽格式(这是大多数Vega-Lite图表的痛点!)
例如,假设您有一个这样的“长格式”表格
时间 | 股票名称 | 股票价值 |
---|---|---|
... | 股票1 | 1 |
... | 股票2 | 2 |
... | 股票1 | 100 |
... | 股票2 | 200 |
然后,您可以通过使用一些列名调用line_chart()
来简单地绘制折线图
import plost
plost.line_chart(
my_dataframe,
x='time', # The name of the column to use for the x axis.
y='stock_value', # The name of the column to use for the data itself.
color='stock_name', # The name of the column to use for the line colors.
)
足够简单!但如果您有一个类似这样的“宽格式”表格,这在现实中非常常见呢
时间 | 股票1 | 股票2 |
---|---|---|
... | 1 | 100 |
... | 2 | 200 |
通常您需要首先使用Pandas的melt()
熔化表格,或者创建一个复杂的Vega-Lite分层图表。但使用PLost,您只需指定您要完成的事情,它就会为您内部熔化数据
import plost
plost.line_chart(
my_dataframe,
x='time',
y=('stock1', 'stock2'), # 👈 This is magic!
)
好的,现在让我们添加一个迷你图来使平移/缩放更加容易
import plost
plost.line_chart(
my_dataframe,
x='time',
y=('stock1', 'stock2'),
pan_zoom='minimap', # 👈 This is magic!
)
但我们只是触及了表面。基本思想是,PLost允许您为最常用的需求创建美观的由Vega-Lite驱动的图表,而无需学习Vega-Lite背后的强大而复杂的语言。
查看示例应用/文档,感受你可以做的一些其他令人惊叹的事情!
丰富的示例
查看文档应用!
文档
这也在文档应用中!
项目详情
关闭
Plost-0.2.5.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 19c33cb0bb2f03bb00d9b106c1a5e413d0b368001669ebdf11d64b1491a67bfb |
|
MD5 | 96849a4cb023a03950112645c5ab7111 |
|
BLAKE2b-256 | 1ed2b5eb51b5c1e267de49bee5edd0062e1f6c38079daf486bbeb77137a38aa3 |