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

ggplot labs does not recognize color #167

Open
jhchou opened this issue Jan 24, 2025 · 2 comments
Open

ggplot labs does not recognize color #167

jhchou opened this issue Jan 24, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@jhchou
Copy link

jhchou commented Jan 24, 2025

Is it an expected behavior, a bug, or a not yet implemented feature, that the following reprex is unable to use color as a labs label?

If I run the following code, I get the expected plot.

If I uncomment the # color = "Cylinders" line, I would expect the figure legend to have a header of Cylinders, but instead I get the error ERROR: KeyError: key "color" not found

I originally encountered this error from the TidierCourse example, where the page shows Gender at the top of the figure legend, but the code would not execute for me, so I created this shorter reprex. I am VERY new to Tidier.jl (installed it 2 hours ago) and inexperienced at Julia (come from an R / tidyverse background), so apologies if I'm just being dumb.

Reproducible example

using Tidier, RDatasets

mtcars = @chain dataset("datasets", "mtcars") begin
    @clean_names
    @mutate(cyl_factor = string(cyl))
end

@chain mtcars begin
	ggplot(@aes(x = wt, y = mpg, color = cyl_factor))
	geom_point()
	geom_smooth()
	labs(
		# color = "Cylinders",
		x = "Weight",
		y = "Miles per gallon"
	)
end
@jhchou jhchou added the bug Something isn't working label Jan 24, 2025
@kdpsingh
Copy link
Member

kdpsingh commented Jan 25, 2025

Thank you for flagging. From reading the code, I think support for this just hasn't been added back yet. Since the TidierCourse was published to GitHub, TidierPlots has undergone a number of changes to the backend. We used to wrap AlgebraOfGraphics, and now we directly wrap Makie, which has a number of other advantages. I'll let @rdboyes speak to this, but it looks like we would need to add the color title to the legend portion of AxisOptions, and then to deal with any weirdness between color/fill in Makie.

I do plan to spend some time on TidierCourse. Thanks for diving in!

@jhchou
Copy link
Author

jhchou commented Jan 25, 2025

Thank you!

Certainly NOT a high priority to add / fix this (data cleaning and manipulation comes first). I just wanted to check I wasn’t confused.

Although I’m only just starting to scratch the surface of Tidier.jl, it looks great! Thanks for all your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants