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

How to not connect null values in line plot (geomLine)? #269

Open
parrotcar00 opened this issue Jan 26, 2025 · 2 comments
Open

How to not connect null values in line plot (geomLine)? #269

parrotcar00 opened this issue Jan 26, 2025 · 2 comments
Labels

Comments

@parrotcar00
Copy link

I have this plot:
val testData = mapOf(
"x" to listOf(1, 2, 3, 4, 5, 6),
"y" to listOf(4, null, 6, null, 2, 3),
)
letsPlot(testData) { x = "x"; y = "y" } + ggsize(1300, 300) + geomLine()

As you can see in the plot produced, the line plot is connecting the last non-null value to the next non-null value.
Is there a way that I can instruct it to not draw connecting lines when it comes across null values in y axis data?

I'm trying to make it more obvious in the plot where the values are missing or NaN.

Image

@parrotcar00
Copy link
Author

Thinking some more about this, if the current behavior is the intended behavior, maybe we can add a config option to only draw lines between non-null values or there can be a new geom like geomDiscontinuousLine() that has this behavior?

@alshan
Copy link
Collaborator

alshan commented Jan 27, 2025

Hi, according to gpplot2 docs - Missing value handling - geom_line indeed skips over missing values.
So it seems LP should probably have this behavior by default as well. And also we can provide an option to interpolate missing value (not present in ggplot2 for some reason).

@alshan alshan added the * label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants