-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(python): add plot namespace (which defers to hvplot) (#13238)
- Loading branch information
1 parent
cc72524
commit 2341372
Showing
17 changed files
with
232 additions
and
7 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
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
==== | ||
Plot | ||
==== | ||
|
||
Polars does not implement plotting logic itself, but instead defers to | ||
hvplot. Please see the `hvplot reference gallery <https://hvplot.holoviz.org/reference/index.html>`_ | ||
for more information and documentation. | ||
|
||
Examples | ||
-------- | ||
Scatter plot: | ||
|
||
.. code-block:: python | ||
df = pl.DataFrame( | ||
{ | ||
"length": [1, 4, 6], | ||
"width": [4, 5, 6], | ||
"species": ["setosa", "setosa", "versicolor"], | ||
} | ||
) | ||
df.plot.scatter(x="length", y="width", by="species") | ||
Line plot: | ||
|
||
.. code-block:: python | ||
from datetime import date | ||
df = pl.DataFrame( | ||
{ | ||
"date": [date(2020, 1, 2), date(2020, 1, 3), date(2020, 1, 3)], | ||
"stock_1": [1, 4, 6], | ||
"stock_2": [1, 5, 2], | ||
} | ||
) | ||
df.plot.line(x="date", y=["stock_1", "stock_2"]) | ||
For more info on what you can pass, you can use ``hvplot.help``: | ||
|
||
.. code-block:: python | ||
import hvplot | ||
hvplot.help('scatter') | ||
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 |
---|---|---|
|
@@ -15,3 +15,4 @@ Attributes | |
Series.shape | ||
Series.str | ||
Series.flags | ||
Series.plot |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
==== | ||
Plot | ||
==== | ||
|
||
Polars does not implement plotting logic itself, but instead defers to | ||
hvplot. Please see the `hvplot reference gallery <https://hvplot.holoviz.org/reference/index.html>`_ | ||
for more information and documentation. | ||
|
||
Examples | ||
-------- | ||
Histogram: | ||
|
||
.. code-block:: python | ||
s = pl.Series([1, 4, 2]) | ||
s.plot.hist() | ||
KDE plot (note: in addition to ``hvplot``, this one also requires ``scipy``): | ||
|
||
.. code-block:: python | ||
s.plot.kde() | ||
For more info on what you can pass, you can use ``hvplot.help``: | ||
|
||
.. code-block:: python | ||
import hvplot | ||
hvplot.help("hist") |
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
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
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
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
Oops, something went wrong.