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

allow combining histogram with visual(Stairs) #591

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

simeonschaub
Copy link

and other plot types such as Scatter. Possibly an alternative to #572.

The only drawback here is that the visual(...) needs to come before
histogram(), otherwise an error is thrown because width is not
mapped for other plot types. What do you think of this approach?

@jkrumbiegel
Copy link
Member

I've thought about similar things as well, I'm not sure if visual is a good idea here. I think it's a bit convoluted to understand that a transformation might react to a plot type attached to a layer before it is applied, because most transformations come with their own plot types (like histogram does as well). Post-multiplying a visual is ok because you're just changing the output of the transformation as expected. But as your code reflects, you can't of course simply reuse the input data for a histogram for a stairs plot and expect that to work.

I can think of two options. One would be to instead multiply with a visual that does actually look like a stairs version of a barplot. This would have to be added to Makie.

The other option is to add a keyword to the transformation itself in order to choose the desired plot primitive. Then I would have no problem with modifying the data internally, that's entirely expected. I think in general this will have to be done for some transformations because they can create multiple layers with different visuals. If you have that, post-multiplying with visual(some_plottype) will never work. I just haven't come up with a way yet that I would like such an interface to look, because you'd generally want to be able to edit all visual properties of the layers that a transformation creates. I had been thinking of actually just passing a visual as a keyword argument. Like histogram(visual = visual(Stairs, alpha = 0.3)) where there could be multiple different ones for transformations with multiple layers.

and other plot types such as `Scatter`. Possibly an alternative to MakieOrg#572.

The only drawback here is that the `visual(...)` needs to come before
`histogram()`, otherwise an error is thrown because `width` is not
mapped for other plot types. What do you think of this approach?
@simeonschaub
Copy link
Author

You are right, the more I thought about it the less convinced I was that my initial proposal was the right way to go. I now tried implementing your second suggestion with the visual keyword argument, what do you think?

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 this pull request may close these issues.

2 participants