moodymudskipper / flow

View and Browse Code Using Flow Diagrams
https://moodymudskipper.github.io/flow/
Other
395 stars 26 forks source link

Is there a way to increase the resolution? #38

Closed AdrianAntico closed 3 years ago

AdrianAntico commented 3 years ago

@moodymudskipper I'd like to start off by saying this is a really cool package!

Now to the request: I ran flow::flow_view() over a highly involved function and even after sending to a png and zooming in, there isn't enough resolution to see what's happening. Is this something that can be looked into? To me, having the ability to visualize a process becomes more important as the complexity of the function or script increases.

I ran was the below and it's a function with a ton of parameters and calls to other functions that are themselves highly involved.

flow::flow_view(RemixAutoML::AutoCatBoostChainLadder)
moodymudskipper commented 3 years ago

Hi @AdrianAntico and thanks for the kind words.

How did you save it to png ? Have you tried out = "png" ? When I try it on my side on the function I found on your repo I can zoom more than enough, see below :

ML

If you don't see the same thing then it must by system dependent and I only have windows to test it unfortunately, but you might want to try to play with the width and height , they are forwarded to htmlwidgets::createWidget(), I've never needed them so not sure exactly what it'll change.

Try also flow::flow_view(AutoCatBoostChainLadder, out = "html", svg = TRUE) , it should render it as vector graphics in a webpage so you might be able to zoom better there.

Now there are other ways to alter the view. You could use code = FALSE not to display the code in blocks, as sometimes you can infer it from the logical path.

Because your code is very cleanly commented I think you'd enjoy the prefix feature but I'm embarassed to see it seems broken unfortunately, I hope you'll remember to check it later when I fix it. with prefix = "#" and code = FALSE you'll see your comments instead of the code below, which is nice to inspect the logic.

Finally there's a way to zoom quite literally, it's the range argument. It might require a bit of manual adjustments to choose a range that looks good but it works quite well still:

flow::flow_view(AutoCatBoostChainLadder, range = 47:52)

image

Please tell me how it works for you, your feedback is extremely valuable to me

AdrianAntico commented 3 years ago

@moodymudskipper Ah ha! I did not use the out = "png" argument. I ran it without and then used Rstudio to show the image which I then saved to png, which obviously is not the right way to do it. I was able to reproduce the image like you showed! Super thanks!

moodymudskipper commented 3 years ago

Good to know! FYI if instead of "png" you provite a legit path to a png file it will save it there, and not open it automatically.

AdrianAntico commented 3 years ago

@moodymudskipper Even better!

moodymudskipper commented 3 years ago

Hi @AdrianAntico ,

I don't know if it's of interest for you but I've fixed the use the prefix argument, for your function you can use your comments as headers by setting prefix = "#" (all comments are headers in that case) . The code can be shortened by applying also code = FALSE, in that case it's all described by headers :

flow_view(AutoCatBoostChainLadder, prefix = "#", code = FALSE, out = "png")

Capture1

Or you can display the code only when headers are not available, using code = NA :

flow_view(AutoCatBoostChainLadder, prefix = "#", code = NA, out = "png")

Capture2

AdrianAntico commented 3 years ago

@moodymudskipper Thanks for the update! I think the comment only version is very useful, maybe more so, since it's usually non-technical folks who make request for these types of documents.

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.