跳转到主要内容

某些plotly图表的Seaborn-like API

项目描述

Bornly

Screenshot 2021-12-11 at 19 42 47

交互式plotly可视化的Seaborn-like API

安装

注意:命令中的$不是命令的一部分

$ pip install -U bornly

示例

折线图

import bornly as bns

fmri = bns.load_dataset("fmri")
ax = bns.lineplot(data=fmri, x="timepoint", y="signal", hue="event")
ax.figure

lineplot

条形图

import bornly as bns

tips = bns.load_dataset("tips")
ax = bns.barplot(x="day", y="total_bill", data=tips, hue="time")
ax.figure

barplot

散点图

import bornly as bns

diamonds = bns.load_dataset("diamonds")
ax = bns.scatterplot(
    x="carat",
    y="price",
    hue="clarity",
    size="depth",
    palette="ch:r=-.2,d=.3_r",
    sizes=(1, 8),
    data=diamonds,
)
ax.figure

scatterplot

Kdeplot

import bornly as bns

iris = bns.load_dataset("iris")
ax = bns.kdeplot(data=iris)
ax.figure

kdeplot

from string import ascii_letters
import numpy as np
import pandas as pd
import bornly as bns
import matplotlib.pyplot as plt

# Generate a large random dataset
rs = np.random.RandomState(33)
d = pd.DataFrame(data=rs.normal(size=(100, 26)), columns=list(ascii_letters[26:]))
# Compute the correlation matrix
corr = d.corr()
# Generate a mask for the upper triangle
mask = np.triu(np.ones_like(corr, dtype=bool))
# Generate a custom diverging colormap
cmap = bns.diverging_palette(230, 20, as_cmap=True)
# Draw the heatmap with the mask and correct aspect ratio
ax = bns.heatmap(corr, mask=mask, cmap=cmap, vmax=0.3, center=0)
ax.figure

heatmap

配对图

import bornly as bns

penguins = bns.load_dataset("penguins")
bns.pairplot(penguins, hue="species")

pairplot

直方图

import bornly as bns

penguins = bns.load_dataset("penguins")
ax = bns.histplot(data=penguins, x="flipper_length_mm", hue="species")
ax.figure

histplot

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

bornly-0.3.0.tar.gz (7.2 MB 查看哈希值)

上传时间:

构建分布

bornly-0.3.0-py3-none-any.whl (319.5 kB 查看哈希值)

上传时间: Python 3

由以下支持