0

I am trying to use Plotnine: https://plotnine.readthedocs.io/en/stable/index.html with PyScript. My code looks as follows:

<html>
<head>
    <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
    <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<py-env>
    - scipy
    - matplotlib
    - plotnine
    - pandas
    - mizani
    - statsmodels
</py-env>
<body>
    <py-script>
    from plotnine import ggplot, geom_point, aes, stat_smooth, facet_wrap
    from plotnine.data import mtcars

    print(ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)'))
    + geom_point()
    + stat_smooth(method='lm')
    + facet_wrap('~gear'))
    </py-script>
</body>
</html>

The Plotnine syntax is a direct copy-paste from the Plotnine main page.

However, when I open this HTML, at first everything loads just fine with no errors, but instead of the plot the following Pandas warnings are printed (yes, twice):

/lib/python3.10/site-packages/plotnine/utils.py:371: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. /lib/python3.10/site-packages/plotnine/utils.py:371: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

What am I doing wrong?

  • 1
    It [looks like a related issue](https://github.com/has2k1/plotnine/pull/571) was reported back in March and an updated plotnine version was released around May. I don't know if that is the version of plotnine that pyscript uses though. It would appear not. – Wayne Jun 10 '22 at 15:22
  • 1
    PyScript downloads the version stored on pypi.org – John Hanley Jun 10 '22 at 17:35
  • So I just need to wait until Plotnine gets updated on pypi.org? – Aku-Ville Lehtimäki Jun 11 '22 at 12:54

0 Answers0