images ds3.js heatmap - r

I am having trouble determining if you can create a heatmap with DS3 or R that can map onto a list of icons. Specifically wanted to use little people icons like these http://goo.gl/Yt8CG and then show concentrations of activity onto them. I am fairly new to data visualization with DS3.js and R so I might not be doing the right google-fu. Thanks ahead of time if anyone can show me an example or let me know if you CAN do shading on icons not just dynamically generated blocks like http://bl.ocks.org/mbostock/4063318

The basic approach is no different from drawing a normal heatmap (see for example here). The only difference would be that instead of appending rectangles, you append a container for the graphic that you want to use.
Whether you would be able to adjust the shading depends on the graphic itself -- if it's a bitmap you're out of luck. If it's an SVG for example you can simply select the path inside that SVG and set the fill color just like you would for a rectangle in a normal heatmap.

Related

Removing grid lines in a map and smoothing in maps

I am trying to remove the grids on my map. I used several commands for example: plt.grid(), plt.rcParams["axes.grid"] = False but nothing happens, the map produced as is with the grids. Is there any possible way to remove the grids?
Another thing also, how can I make my plot to be smoothed instead of having the data as blocks (see below a sample of the plot).
enter image description here
Please assist in this regard.
Truly appreciate your time.
Thank you.

rectangles on Grace plots

I have been using Grace (xmgrace) plotting for many years. I recently had an important idea for my work, and it involves rectangles on my plots. Grace supports rectangles (called "boxes"), but when I use a filled "box" it blocks my data curves. I want the curves to show over the filled rectangles. This is driving me nuts. Does anyone know how to put the filled rectangles in the background so they don't block data curves? Thanks.
Unfortunately there is no option in the xmgrace graphical interface that allows you to modify the z order of drawing objects such as boxes:
I also saved the graph as an .agr file and viewed it in a text editor. There doesn't seem to be any flag within the file format to modify z position, either.
Same story if you save a parameter file and check it in a text editor.
So it looks like it is really not possible in xmgrace.
One workaround would be to print to a postscript, EPS or SVG file and open it inside a vector graphics program such as Inkscape (results vary, you might need to experiment with filetypes to see which works best). Then you can easily alter the z order of objects.

Plotting an image next to a ruler using r

What I would like to do is make a series of plots that combine an image with a scale that is related to the height of the image, but is multiplied by a factor.
So far I've been able to make a plot using the following code:
library(imager)
im <- load.image("ZAB17_4.png")
plot(im)
Image is attached here
But what I would like to do is to have the y-axis be scaled by a value:
pixel_size <- 0.0596
I would also get rid of the x-axis. (xaxt="n" doesn't seem to do the trick). Ideally, I would like the Y-axis to be directly adjacent to the image. I've been trying to poke around with scales in the plot function, but haven't found what I need to do this, but I'm sure there is a simple solution.
*Edited to add image. I should note that the goal is really just to add a scale to the image. The pixel size represents the size of each pixel in reality in mm. I basically want to add a ruler along the side of the image. Maybe r is not the best tool for this, but I plan to also plot data taken from the imaged object and plot it alongside.
Any help is appreciated.

Color visualization for different parts of a diagram

I have some gene expression data in different parts of plant roots (see the image) and I want to show the gene expression levels in different parts of the roots. For example, if the gene is highly expressed in the apical meristem, I want to mark the apical meristem part of the schematic diagram red. One possibility is to make the diagram a map, does anyone have any suggestion how to make a diagram to a map in R? Or if you know any tool for this purpose, please let me know. Thank you!
The plant root structure
You could draw your own polygons to separate the regions using the raster package. Or, this post may provide a better way to do this.
Then, you can create a heat map and color within the polygons. Say, with ggplot2::geom_polygon()
To make it look even better, you could use the original image as a background, and then overlay your heat map with some transparency (i.e. the alpha argument in ggplot2) so you can see the colored heat map and some of the original image. See this post for more details, or this post if you like funny pictures

visualization - size of circle proportionate to the value of the item

I'm getting familiar with Graphviz and wonder if it's doable to generate a diagram/graph like the one below (not sure what you call it). If not, does anyone know what's a good open source framework that does it? (pref, C++, Java or Python).
According to Many Eyes‌​, this is a bubble chart. They say:
It is especially useful for data sets with dozens to hundreds of values, or with values that differ by several orders of magnitude.
...
To see the exact value of a circle on the chart, move your mouse over it. If you are charting more than one dimension, use the menu to choose which dimension to show. If your data set has multiple numeric columns, you can choose which column to base the circle sizes on by using the menu at the bottom of the chart.
Thus, any presentation with a lot of bubbles in it (especially with many small bubbles) would have to be dynamic to respond to the mouse.
My usual practice with bubble charts is to show three or four variables (x, y and another variable through the size of the bubble, and perhaps another variable with the color or shading of the bubble). With animation, you can show development over time too - see GapMinder. FlowingData provides a good example with a tutorial on how to make static bubble charts in R.
In the example shown in the question, though, the bubbles appear to be located somewhat to have similar companies close together. Even then, the exact design criteria are unclear to me. For example, I'd have expected Volkswagen to be closer to General Motors than Pfizer is (if some measure of company similarity is used to place the bubbles), but that isn't so in this diagram.
You could use Graphviz to produce a static version of a bubble chart, but there would be quite a lot of work involved to do so. You would have to preprocess the data to calculate a similarity matrix, obtain edge weights from that matrix, assign colours and sizes to each bubble and then have the preprocessing script write the Graphviz file with all edges hidden and run the Graphviz file through neato to draw it.

Resources