I'm working on a R Shiny app that plots (with ggplot2) information about different chromosomes, and there is also an option to show all the chromosomes together.
I have a really bad performance problem, especially with the 'all' view, I looked for some caching solutions, but didn't really find anything helpful.
I thought to put 2 tabs in my app, the first is for the single chromosomes, and the second for all together, so it would run in the background, and load while the user is still in the first tab, but when I read about Tabsets I found out this-
Notice that outputs that are not visible are not re-evaluated until they become visible.
So my question is, is there a way to bypass this? or is there a way to cache a plot so when I want to plot it the only thing left to do is to draw it, and skip the construct, build, and render stages. (there is a good chance that I don't really understand the plotting process, and it's not possible)
One last thing, I am aware of (the much faster) ggvis and ggobi, but these are for now not an option.
Related
I would like to offend the elder gods and use parallel::mcfork (or something like it) with minimal starting knowledge understanding that there are hidden dangers that may fall on top of my head. Maybe the behavior I'm hoping for is foolish or impossible; but I didn't think it could hurt too much to ask.
What I want to do is load some data into the workspace and then work with it from two separate interactive sessions with no intent for those sessions to communicate with each other. I can parallel::mcfork(estranged=TRUE) and see that there is another R session with a distinct pid. What I haven't been able to do is figure out how to connect to it in an interactive session. I tried using reptyr, but only got a message saying that both pids have a sub-process and I can't attach to them.
Is it possible to accomplish this aim? If so, how?
For what purpose? I have a largish dataset that takes a while to load. Now that I'm using Ubuntu, I've noticed that I can do parallel processing on this large dataset incurring a much lower cost in RAM and time than when I was using a Windows machine (i.e. mclapply vs parLapply). Now I have this large dataset... but I don't know quite what all I might want to do with it in terms of analysis. What I do know is that a measurable amount of time is going to pass between my issuing a command and the result. I'd like to, having loaded the data, analyze the data in two separate interactive sessions so that I can pursue the lines of reasoning that seem most fruitful without having layed out a plan in advance or being stuck waiting and manually monitoring the results of mcparallel. Incidentally, mcparallel provides some hopeful looking options, e.g. mc.interactive, but yields similar errors as before with reptyr.
i'm working on a simple game project with libgdx and i need some help to make a random infinite world. After googling for hours i knew that many games use the "chunk theory" to generate an infinite map and also implement tiles. There are many things i don't understand... for example:
What is a tile? and a chunk?
How can i implement this "chunk theory" in a game?
Is this the best way to generate an infinite random map?
can someone answer my questions to make some clarifications in my mind?
Thanks in advance
Tile-based maps are maps, which are organized as a grid. A Tile is then a cell of this grid and objects are placed inside this Tile/cell and can't be placed between to cells. Think about Minecraft, every Block there is one Tile.
A chunk is a part of the map, containing many Tiles. It has a fixed size and is used to be able to load only part of an infinite map.
Imagine a map with a size of 1600*1600 Tiles. You won't be able to see all Tiles at once. Also you don't need to update the logic for the whole map, as it won't affect you anyway. So you split your map into little parts, so called chunks, which have a fixed size (for example 16*16).
Depending on your position, adjacent chunks are loaded and far chunks are unloaded. So if you move from south to nord, chunks in the nord are loaded, chunks in the south are unloaded.
I never implemented a chunk-system myself, so i can't tell you how to implement it, but i guess there are many tutorials out there.
This is not the way to generate infinite maps, but the way to store, load and work with huge maps. The generation is usualy done with some noise functions, but thats a different story.
Anyways i suggest you to start with something smaller and simpler. Rushing into to complex things will just discourage you.
Recently I explored some libraries where I can visualize graphs from Neo4j, but didn't get a clear view wich one to choose, so I have a couple thought I'd like to share.
My requirements and wishes - after search throught REST API with cypher query visualize graphs with all relationships, nodes. And result make interactive - able to drag/drop... opportunity to reveal other nodes/rels on click. Import nodes throught json data and be able to show quickly up to at least 400 elements.
So I more or less explored further libraries:
Three.js - mostly for 3D. (If I don't need 3D then better not to choose this one)
Arbor.js - drawing leaves up to you, mostly layout library
VivaGraphJS - easy to use, but almost no documentation :(
D3.js - Looks fine, but uses SVG
Cytoscape.js - looks fine, but I read that I can't use it with Neo4j. Is D3.js the right choice for real-time visualization of Neo4j Graph DB data why?
Processing.js - have it's own language similar to Java. I'm not so much in Java-like language (yet).
And I have a couple questions:
1) Whats your experience - benefits, weakneses of libraries?
2) I suppose I want to use canvas insted of SVG? (a lot of small elements on the screen).
3) Arbor is special library for layout, but others don't have layout algorithms or what?
I'll appreciate any opinion! :-)
I pondered a similar situation. I chose sigma.js.
1) Whats your experience - benefits, weakneses of libraries?
sigma.js is specific to graph rendering. d3 is a full on toolbox for visualization. Since I only want to draw graphs, the concise sigma.js interface was easier to work with. I think this is the video where the creator talks about how sigma.js is able to do incremental rendering and thus perform better and handle more vertices/edges smoothly.
2) I suppose I want to use canvas insted of SVG? (a lot of small
elements on the screen).
sigma.js renders to the canvas.
Here are the sigma.js examples. The "hide nodes" example shows mouse interactions. Additionaly, here is a blog post showing how one can easily integrate neo4j w/ sigma using a very minimal amount of data massaging code written in node.js. It would be easy to port this to any server language.
I don't see sigma.js in that list which you might want to take a look at as it is very useful (example)
You will have to somehow handle the rendering of the received data (i.e. go from a data structure to its visual representation) and this depends on what are you trying to show / say with that visualisation, how you want to do it and how you want it to look like.
As a starting point, i would go with D3 and Sigma.
I note that Gephi is not on your list. As a standalone visualiser/editor, its the best that I have used (you just get the neo4j plugin, and it will import the source files of the database and let you view it). Its also Open Source, so you can include it as part of a project.
Also missing from your list is the yFiles family of graph visualization libraries.
The JavaScript variant of if uses both Canvas, WebGL, and SVG. This can give very good performance and high-quality visualizations at the same time. For hair-ball-like graphs (thousands of dots and lines, but probably no text) you can use WebGL and Canvas and when you zoom in to actually make sense of the data, you can use SVG to get detailed high-quality visualizations with labels, icons, data-bound visualizations, etc. You can use both techniques in the same visualization, even at the same time, benefiting from the best of both worlds (demo).
Connecting yFiles to Neo4j is easy using the JavaScript Bolt driver.
Aiming at 400 elements in the view is a good idea. While larger graphs tend to look really nice, most of the time you won't gain a lot of insights by looking at "hair-balls". These almost artistic visualizations all look very similar and as such carry little to no information. Often you could just as well display a static image showing the first google image search hit for a "hairball graph" query :-)
In order to better support the user during exploration, filtering, grouping, nesting, and dynamic interaction should be added to the viewer application. How this can be implemented, very much depends on the business domain in the visualization, though and there are only very few generic approaches that work for generic graphs.
Disclaimer: I work for the company that creates the above mentioned visualization library. I do not represent it on SO, though.
Standard R graphics are not particularly convenient for interactive zooming into large data sets. There's been some work with Qt for a new device, but I haven't seen a fully working example yet (pointers appreciated if I missed something).
That's how I came across Acinonyx; it is already at a usable stage, at least on OSX, and promises fast and interactive display.
Sadly, I cannot find examples to perform the following tasks:
zoom in and out with mouse interaction
display the coordinates of a selected point
I'm pretty sure both are possible / implemented, but the documentation is quite weak at the moment.
Edit: after playing around and going through iplot's documentation, it seems that the command and ctrl keys do what I wanted.
More generally, though, is there a possibility to extend the interactivity of Acinonyx with custom buttons? When hovering the top-left of the plot window, buttons appear, that depend on the plot type. I would like to create a new one for scatterplots, that would let the user select a curve and shift it vertically with the mouse.
In working on a shortest path algorithm across a network I would like to generate a picture of the network. I'd like to represent nodes (circles), links (lines), cost to traverse the link (number in the middle of the link line), and capacity of the link (number on the link line next to the node it represents) in the picture. Is there any library/software out there that would help to automate creating this picture?
I can do this manually in Visio or with some drawing application but I'd like to generate them from code as I change/tweak the network.
Sounds like a job for GraphViz , it generates graphs from a short text description file. I've used it to produce connected node graphs and I believe it should be possible to add link labels, as you require.
If you're using python, Nodebox draws pretty graphs.
One of the big problems in displaying networks like this is figuring out where to put the nodes on the display screen. If arranging nodes is logically simple given your network, then an off-the-shelf product is likely to suit your needs.
If the arrangements are much more complicated, you may have to accept a certain amount of manual intervention to get this to work with off-the-shelf stuff, or byte the bullet and program the whole thing yourself.
.NET is one choice, and once you've mastered the Graphics class it's easy to use and plenty fast for something like this. However, there are probably better languages/platforms than .NET for something graphics-oriented like this.
Update: .NET is much better for 2D graphics than I knew. The key is finding a fast workaround to the pitifully slow GetPixel() and SetPixel() methods in the Bitmap class. Once you can read and write individual pixels easily and quickly, you can do whatever you want as a programmer.
Did you by chance check out the R programming language? I'm not positive but I believe that you can make images and such out of graphs. r-project.org
There are a bunch of visualizations of various algorithms here: Algorithmics Animation Workshop