Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that reference lines appear in single value bar/line plots #307

Open
rich-iannone opened this issue Apr 19, 2024 · 1 comment
Open

Comments

@rich-iannone
Copy link
Member

Right now the reference_line= argument does not display a reference line when making a nanoplot from a single value. From question in the gt_package Discord channel, @MarcoGorelli asked to make this example work (and I filled in the GT part here):

import polars as pl
from great_tables import GT

data = pl.DataFrame({
    'Library': ['pandas (including NumPy)', 'pandas (including NumPy and PyArrow)', 'Polars'],
    'Size (MB)': [163, 290, 85],
}).sort('Size (MB)')

GT(data).fmt_nanoplot(columns="Size (MB)", plot_type="bar", reference_line=275)

Currently this results in:

nanoplot_polars

The desired result should instead be something like this:

fmt-nanoplot-ref-line-target
@marcozzxx810
Copy link
Contributor

marcozzxx810 commented May 19, 2024

@rich-iannone, I have tried out to use reference_line="min", resulting the same graph.

image

does it supposed to work when using keywords?

import polars as pl
from great_tables import GT

data = pl.DataFrame({
    'Library': ['pandas (including NumPy)', 'pandas (including NumPy and PyArrow)', 'Polars'],
    'Size (MB)': [163, 290, 85],
}).sort('Size (MB)')

GT(data).fmt_nanoplot(columns="Size (MB)", plot_type="bar", reference_line="min")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants