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

Unable to display or save graph when using geom_path #1168

Closed
chameroy opened this issue Sep 2, 2024 · 7 comments
Closed

Unable to display or save graph when using geom_path #1168

chameroy opened this issue Sep 2, 2024 · 7 comments
Assignees
Labels
failure Crash, exception occurs
Milestone

Comments

@chameroy
Copy link

chameroy commented Sep 2, 2024

I've been trying out lets-plot through a Jupyter notebook on Windows 11.

I'm experiencing an issue that comes up when I use geom_path. I receive this error message both when trying to view a plot in Jupyter and when trying to save the image using ggsave, regardless of file format:

Exception: Internal error: NullPointerException : <no message>

Unfortunately, that's all I receive. Using geom_line in place of geom_path produces a graph, but not always with the desired result.

@IKupriyanov-HORIS
Copy link
Collaborator

Hi!
Could you please provide an example? This will help us a lot.

@chameroy
Copy link
Author

chameroy commented Sep 2, 2024

Sure. Here is an example of some code I've been trying to run:

plot = (
ggplot(core_10004_1A_1, aes("value", "depth_m", group="section_no")) +
    ggsize(150, 500) +
    geom_line() +
    facet_grid(x="channel", scales="free") +
    scale_y_reverse() +
    labs(x="Values", y="Depth (m)") +
    theme(legend_position="none")
)

ggsave(plot, "plot_test.png")

I've tried to get the resulting plot to show in Jupyter as well as save it locally in case this is a Jupyter issue. I get the same outcome in either case.

This is what I get when I use geom_line:
plot_test

However, when I use geom_path, I get the error message I previously mentioned.

Running the same code using geom_path (and some minor tweaks due to library differences) using plotnine gives me closer to what I'm looking for:
plot9_test

@IKupriyanov-HORIS
Copy link
Collaborator

Thanks! The code is totally fine. Could you please attach your data (core_10004_1A_1) if possible? Looks like it is the key for fixing the issue.

@chameroy
Copy link
Author

chameroy commented Sep 2, 2024

Sure. Here it is. FYI, it's tab-delimited and has about 200,000 records. The original has close to 500,000, but it's too large for me to upload here. Hopefully, this should be good enough.

core_10004_1A_1.csv

@IKupriyanov-HORIS
Copy link
Collaborator

Thank you! I'v reproduced the issue.
To workaround the problem add sampling='none' to geom_path(...).
Full code:

plot = (
ggplot(core_10004_1A_1, aes("value", "depth_m", group="section_no")) +
    ggsize(150, 500) +
    geom_path(sampling='none') +
    facet_grid(x="channel", scales="free") +
    scale_y_reverse() +
    labs(x="Values", y="Depth (m)") +
    theme(legend_position="none")
)
plot

@IKupriyanov-HORIS IKupriyanov-HORIS self-assigned this Sep 2, 2024
@chameroy
Copy link
Author

chameroy commented Sep 3, 2024

That works! Thanks!

You referred to this as a workaround. I assume that this is not intended behavior? Will this be addressed in a future version?

Thank you again!

@IKupriyanov-HORIS IKupriyanov-HORIS added the failure Crash, exception occurs label Sep 3, 2024
@IKupriyanov-HORIS
Copy link
Collaborator

IKupriyanov-HORIS commented Sep 3, 2024

I assume that this is not intended behavior? Will this be addressed in a future version?

Definitely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failure Crash, exception occurs
Projects
None yet
Development

No branches or pull requests

3 participants