How to do a group transform bar graph? #889
-
I'm just getting started with Mosaic, and it's a fantastic framework - Thanks for all your work and help so far... I'd like to create a bar graph in mosaic, and following the link at https://idl.uw.edu/mosaic/api/vgplot/marks.html#bar I find that this one in Observable is the example I want (with a group transform): That is specified with:
but I can't work out how to do the equivalent in Mosaic with Many thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Not sure I get the question so let me know if that's not the answer you are looking for. Mosaic automatically groups. See https://idl.uw.edu/mosaic/examples/sorted-bars.html for an example. |
Beta Was this translation helpful? Give feedback.
-
I find it tricky to understand the sorted-bars example because I don't know what the table looks like that it's loading the data from. I'm assuming the table looks like this, with
My data isn't numerical (as in the group transform Observable example above) where the data looks like this (I think):
OK, so I I figured it out...
Creates this plot on the left... ![]() There's a couple of issues.
![]() The ![]() I wonder if there's a way to label that bar as "others", at least to avoid confusion?
Many thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
Oh, and thanks for the |
Beta Was this translation helpful? Give feedback.
You can not apply an interval interactor over a discrete domain (such as the ordinal domain used by a bar chart). That is why you are seeing this invert error. Non-continuous scales have no invert function defined.
Intervals are only defined over continuous numerical or temporal data. So you need to use a different interactor, such as toggleY (to click bars) or region (to select individual bars using a brush and select their underlying discrete values rather than a [min, max] interval). Hope that helps!