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

scaleFillManual doesn't work correctly with numbers #266

Open
AndreiKingsley opened this issue Dec 16, 2024 · 2 comments
Open

scaleFillManual doesn't work correctly with numbers #266

AndreiKingsley opened this issue Dec 16, 2024 · 2 comments

Comments

@AndreiKingsley
Copy link
Contributor

If domain of scale is numerical, scaleFillManual works like a continuous scale, even though it should work as discrete:

val yy = listOf(1, 2, 1, 2)
val cc = listOf(1, 2, 3, 4)

letsPlot() + geomTile() {
    x = xx
    y = yy
    fill = cc
} + scaleFillManual(values = listOf("red", "green", "blue", "yellow"), limits = listOf(1, 2, 3, 4))
image
@AndreiKingsley AndreiKingsley changed the title scaleFillManual doesn't work correct with numbers scaleFillManual doesn't work correctly with numbers Dec 16, 2024
@AndreiKingsley
Copy link
Contributor Author

If limits are not specified, it works correctly:
image

@alshan
Copy link
Collaborator

alshan commented Dec 16, 2024

This is expected behavior: scales created for a continuous (numeric) domain are continuous. Try asDiscrete() to annotate the domain as discrete.

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

No branches or pull requests

2 participants