juba / pyobsplot

Observable Plot in Jupyter notebooks and Quarto documents
https://juba.github.io/pyobsplot/
MIT License
203 stars 7 forks source link

Plot.rectY not plotting bars #26

Closed harrylojames closed 9 months ago

harrylojames commented 9 months ago

The following produces an empty chart.

import polars as pl
from pyobsplot import Plot

penguins = pl.read_csv("https://github.com/juba/pyobsplot/raw/main/doc/data/penguins.csv")

Plot.plot({
  "marks": [
    Plot.rectY(penguins, Plot.groupX({"y": "count"}, {"x": "species"})),
  ]
})

The following produces the chart as expected.

import polars as pl
from pyobsplot import Plot

penguins = pl.read_csv("https://github.com/juba/pyobsplot/raw/main/doc/data/penguins.csv")

Plot.plot({
  "marks": [
    Plot.barY(penguins, Plot.groupX({"y": "count"}, {"x": "species"})),
  ]
})

Using rectY works via the observable website.

https://observablehq.com/d/1536c13b55654b3e

Apologies if I'm missing something obvious!

juba commented 9 months ago

No, you didn't miss anything, I think the issue came from the fact that the published pyobsplot had an outdated Observable Plot version, and rectY behavior has changed since.

I just published pyobsplot 0.4.2, I think it should solve the issue.

Thanks for taking the time to report the problem !

harrylojames commented 9 months ago

Can confirm this works thank you for the prompt fix!!