seaborn.objects.Lines#

class seaborn.objects.Lines(artist_kws=<factory>, color=<'C0'>, alpha=<1>, linewidth=<rc:lines.linewidth>, linestyle=<rc:lines.linestyle>)#

用於繪製多條線條的更快但較不靈活的標記。

此標記定義了以下屬性

顏色透明度線寬線條樣式

另請參閱

Line

一個沿著方向軸排序並連接資料點的標記。

範例

類似於Line,此標記在排序過的觀測值之間繪製一條連接線

so.Plot(seaice, "Date", "Extent").add(so.Lines())
../_images/objects.Lines_1_0.png

Line 相比,此標記提供的可設定屬性較少,但在繪製大量線條時,它可以有更好的效能

(
    so.Plot(
        x=seaice["Date"].dt.day_of_year,
        y=seaice["Extent"],
        color=seaice["Date"].dt.year
    )
    .facet(seaice["Date"].dt.year.round(-1))
    .add(so.Lines(linewidth=.5, color="#bbca"), col=None)
    .add(so.Lines(linewidth=1))
    .scale(color="ch:rot=-.2,light=.7")
    .layout(size=(8, 4))
    .label(title="{}s".format)
)
../_images/objects.Lines_3_0.png