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

Accept a uer-defined domain of variable #469

Closed
lassepe opened this issue Aug 3, 2023 · 0 comments · Fixed by #505
Closed

Accept a uer-defined domain of variable #469

lassepe opened this issue Aug 3, 2023 · 0 comments · Fixed by #505

Comments

@lassepe
Copy link

lassepe commented Aug 3, 2023

Currently, AoG derives the domain of a value from the observed data. However, if a certain value is never observed in the data, the corresponding value element of the domain is also missing in the visualization.

For example, consider the following case:

using AlgebraOfGraphics
df = [(; x = rand([0, 1]), y = rand(["a", "b"])) for _ in 1:10]
data(df) * mapping(:x, col = :y) * frequency() |> draw

Ideally, this should produce a plot with two columns (for "a" and "b") and each column has two bars (for the frequency of "0" an "1"). However, if we get "unlucky" during sampling, some values may never be observed. For example, y = "a" may never be sampled or x = "0" is never sampled (or the some joint sample, say, (; x = 0, y = "a") may never be observed). All of these cases would lead to either a bar or an entire column missing in the plot.

Of course, AoG cannot know when such a value is missing. Hence, I would like to be able to provide the domain of that variable; e.g.

data(df) * mapping(:x, col = :y; x_domain = [0,1], col_domain = ["a", "b"]) * frequency() |> draw()

I could not find support for this case in the docs. Is this already possible potentially via some low-level tweaks with raw Makie?

@jkrumbiegel jkrumbiegel linked a pull request Jul 16, 2024 that will close this issue
7 tasks
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

Successfully merging a pull request may close this issue.

1 participant