hanami icon indicating copy to clipboard operation
hanami copied to clipboard

Template docs (view composition options)

Open mars0i opened this issue 2 years ago • 9 comments

Thanks again for Hanami.

I've been learning Hanami and Vega-Lite at the same time. Other things being equal, I prefer to use Hanami (it's spoiled me--I don't want to have to specify everything in the detail required by V-L :-), but sometimes V-L is necessary, and sometimes it's helpful to study V-L to understand Hanami better.

One thing that would be helpful would be a list of templates with suggested uses, and/or a list of basic uses and suggested templates. (I sometimes go through templates.cljc to try to figure this out, but that involves a bit of guesswork and experimentation, I don't know whether I'm missing useful tools that are in other source files.)

My current case is that I want to produce a lot of small plots at once, and display them in an MxN layout, where the layout might be fixed or might just be whatever fits the plots in. My understanding is that I can do that in Vega-Lite with facet (or maybe concat). I don't know how to use these yet, but I'm trying to figure out whether there's a Hanami way that would make it easier, and then I'll start by learning that. The README illustrates hconcat-chart and vconcat-chart, but I'm wondering whether there is something in Hanami that makes using V-L facet (orconcat easier). Or maybe I just have to think about the existing templates or other tools in Hanami in a different way. [Maybe I'll use vconcat-chart inside hconcat-chart, or vice versa, but that won't let Vega-Lite figure the number of plots per row and column, and I wondered if there is a more direct way.]

Thanks!

mars0i avatar Apr 12 '22 04:04 mars0i

Hi, thanks for the input. I'm a bit under the gun at the moment so, may need to give more detailed answer later.

For the first two paragraphs, you may well be interested in the discussion here https://clojurians.zulipchat.com/#narrow/stream/203279-scicloj-org/topic/workshop-hanami

Your participation would likely be very useful!

For the specific question, yes VGL has facet (if that works for your usecase) but also more generally, hconcat and vconcat. Also, if you were full in on Hanami you could just use its automatic grid layouts. That also applies to Saite (where there are now a couple presentations showing some of this).

jsa-aerial avatar Apr 12 '22 14:04 jsa-aerial

Thanks @jsa-aerial . Sounds good. I didn't know about automatic grid layouts. I'll look into that.

(Thanks for replying quickly. Don't worry about replying to this comment immediately. I understand about being under the gun.)

I wasn't sure where it was best to ask questions or discuss Hanami. Thanks for pointing to that Zulip stream. (The URL you gave didn't go to anything in Zulip--I'm think you probably meant this one: https://clojurians.zulipchat.com/#narrow/stream/305782-nov21-workshops/topic/hanami-2021-11-21 . I thought of that stream as narrowly focused on the November workshops--Kira McLean's workshop in November got me started, in fact--but that seems reasonable. Or should I start a new stream under scicloj-workshops?)

I guess I didn't finish editing the issue title. Sorry about that. (It was late.) I hope you don't mind that I'm changing it to something more accurate.

mars0i avatar Apr 12 '22 14:04 mars0i

this should be the topic: https://clojurians.zulipchat.com/#narrow/stream/203279-scicloj-org/topic/workshop-hanami

jsa-aerial avatar Apr 12 '22 15:04 jsa-aerial

When I click on that it goes to the current discussion topic in the scicloj-org stream

General Hanami/Saite/Aerosaite discussion is in https://clojurians.zulipchat.com/#narrow/stream/210075-saite-dev

jsa-aerial avatar Apr 12 '22 15:04 jsa-aerial

The link you give is the old november workshop - that is not the correct topic

jsa-aerial avatar Apr 12 '22 15:04 jsa-aerial

OK, thanks.

The 203279-scicloj-org, workshop-hanami link goes to "Unknown stream" for me. Ah, I think it's that I haven't been invited into the scicloj-org stream. I just found the posts that mention it, and recall that I didn't ask daslu for an invitation earlier because I knew that I wouldn't have time to contribute in any significant way. (I'm a scicloj supporter but I am not able to do much to help unfortunately.)

I can ask to join scicloj-org in order to access the workshop-hanami stream, if that makes sense, but maybe I should just use the saite-dev stream, since that's already accessible to me. I think I knew about that earlier as a place for Hanami questions, but I'd forgotten.

mars0i avatar Apr 12 '22 16:04 mars0i

There is also a Vega-Lite concat operator, which I believe is like hconcat and vconcat, but not restricted to a row or a column. It's suppose to wrap automatically. I think the output is similar to facet's, but the interface is different, and I think the data has to be prepared differently.

I'm thinking that I might try seeing if I can work up to a PR for a concat-chart using your code for hconcat-chart and vconcat-chart and the associated Hanami keys as a starting point. That would presumably be an easier path for me than trying to add a facet-chart. Maybe adding concat-chart wouldn't require a huge amount of more work for me than using concat directly in Vega-Lite. (If you'd rather I didn't work toward a PR, that's fine, too. I might never get there.) I know I said I can't contribute much on scicloj-related stuff, but I try to help where I can, especially when I can fit it into what I need to get done. Step one: learn how to use hconcat-chart and vconcat-chart with my data.

mars0i avatar Apr 12 '22 16:04 mars0i

I subscribed you to the scicloj-org stream/topic. WRT PR for Hanami with this, we have been discussing that it would be much better if we have another place where specific parameterized chart types can be deposited. The second workshop that we are discussing will focus on 'how to build your own parameterized abstracted visualizations'.

Ethan has said "Keeping a list of such visualizations that are useful and daoble could also be good if we want to encourage workshop participants to work on these on their own"

And I have stated that it would make sense to remove some charts (heatmap, contour) from Hanami and place in a github repo location. At the moment the current 'holding area' is https://github.com/jsa-aerial/aerosaite/tree/main/resources/Code/Templates and specifically the ml-charts.clj

jsa-aerial avatar Apr 12 '22 18:04 jsa-aerial

Thanks @jsa-aerial . All of that sounds good.

mars0i avatar Apr 12 '22 20:04 mars0i