moodymudskipper / flow

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

zooming/vector graphics? #6

Closed MichaelChirico closed 4 years ago

MichaelChirico commented 4 years ago

Have some issues seeing details on our more complicated functions (e.g. data.table::foverlaps & data.table:::dcast.data.table)

Screenshot 2019-10-21 at 9 35 07 AM Screenshot 2019-10-21 at 9 35 59 AM

Would be great to zoom!

moodymudskipper commented 4 years ago

You might want to try different browsers. There's a button in Rstudio to open in your default browser and you can copy the url to a different browser. In my case Internet explorer worked than chrome. Can you please test on the browsers you have and report ?

There is actually a zoom argument that you can play with (pass through the ...) but I think its effect depends on browser too.

I think it would really make sense to be able to chunk big charts, especially those that take a lot of horizontal space, but I need to figure out the heuristics, parameters, and how to display it.

MichaelChirico commented 4 years ago

Hmm I was looking for a button to open in browser but I didn't get anywhere:

Screenshot 2019-10-21 at 2 55 54 PM

Export allows me to save as a webpage but (in Chrome/Safari at least) that page didn't offer any zoom either :\

Screenshot 2019-10-21 at 2 56 32 PM

moodymudskipper commented 4 years ago

Open in browser is the last icon on the right in your last image. Though I guess it won't help you much here.

moodymudskipper commented 4 years ago

Maybe I can also save it through code to a big svg image

MichaelChirico commented 4 years ago

Oh, I see, thanks. The hover-over said "Open in new window" which threw me off. For Shiny e.g. it explicitly says "Open in browser".

Again, not sure the implementation complexity, but I've found PDF more satisfying for this type of thing in terms of output.

moodymudskipper commented 4 years ago

Can you update the package and try this ?

tf_foverlaps <- tempfile(fileext = ".png")
tf_dcast <- tempfile(fileext = ".png")
view_flow(data.table::foverlaps, png = tf_foverlaps)
view_flow(data.table:::dcast.data.table, png = tf_foverlaps)
browseURL(tf_foverlaps)
browseURL(tf_dcast)

Still no luck with [.data.table, it doesn't error but doesn't write the file either, not sure if the issue comes from nomnoml, htmlwidgets or webshot, or me :), possibly a combination.

MichaelChirico commented 4 years ago

Nice! looking great

PS heads up that this one makes a suggested system dependency binding:

PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.

moodymudskipper commented 4 years ago

Do you suggest I should do something to deal with this better ? If so, what should I do ?

moodymudskipper commented 4 years ago

splitting the chart has its own issue : https://github.com/moodymudskipper/funflow/issues/10

MichaelChirico commented 4 years ago

Do you suggest I should do something to deal with this better

No, it's just an FYI. The error message is quite helpful already.

moodymudskipper commented 4 years ago

foverlaps doesn't display right anymore because of https://github.com/moodymudskipper/funflow/issues/11

i.e. some if calls, and the function itself, never reach their end because there are return() or stop() calls at the end of both yes and no branches.

I think it shows the truth however, only polluted by some additional "end" blocks.

moodymudskipper commented 4 years ago

I don't think I can do much better than this about zooming but keeping this open until :

moodymudskipper commented 4 years ago

We have the options zoom, height and width that are forwarded to nomnoml, and nomnoml can also in principle prints to svg but I can't get any of those to work, at least they don't change things for the better.

A range argument to the function flow_view (a rework of view_flow, which will disappear) has a range argument allowing to choose a starting and finishing block.

for instance flow_view(data.table::foverlaps, range = 17:36)

or flow_html(data.table::foverlaps, range = 17:36) to create an html page

opening several of them makes it convenient to examine the logic of the function.

But still it's some work to determine the cutpoints.

We can do better by :

This way even a huge function could be split without much manual tweaking, and be readable right away

moodymudskipper commented 4 years ago

@MichaelChirico I believe that now we have good ways to zoom. A range argument allows you to focus on some part, one can easily export in different formats (including html containing svg, to adress the vector graphics query, by setting svg=TRUE).

Using flow_run with trim = TRUE can also help.

It might be improved further later but closing for now.

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.