rectangles on Grace plots - plot

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.

Related

Is there a way to save and quickly reopen surface plots in IDL (Interactive Data Language)?

I was wondering if there is a way to save surface plots in IDL in a way that is convenient to reopen them. As far as I am aware there are only two ways of doing this:
The first way is to save your surface plot as an image e.g. png. The trouble with this is that the viewing angle is fixed and you can no longer drag with the mouse to rotate the surface plot.
The second way is to save the code which generates the plot. Trouble with this is the code often generates loads of plots which are usually just saved as images.
I would like something you can open easily and which opens the surface plot as though you had just run the code to generate it. So that you are free to rotate it by dragging the mouse.
Does this exist?
I only have IDL version 8.3.
If you 'Generate code/save data' (either via the toolbar at the bottom of the window or via the generateCode method with the SAVEDATA keyword), you get a .sav file that contains your plot. Either use the code generated to restore it, or use the generated code as an example to write your own.

How to create a dyraph with multiple x-axis labels?

I'm working with a lot of rank data that would benefit from a way to simultaneously display its respective year on the x-axis. For example, I want to create the following graph adapted from the dygraph gallery:
Note how the rank information (red arrow) for a particular weekend (green arrow) are both displayed on the x axis.
I know this might not be possible with dygraphs now, at least it wasn't available in these demos, so I guess my follow up question would be are there any plans to make this possible (how about in the [r] {dygraph} package)? Apparently a plotter called flot can do this.
UPDATE 1
If indeed this feature does not exist yet, then the following, although potentially obvious to Dygraph developers, is a thought for accomplishing the task easily (perhaps I'm wrong). At first I thought it would be necessary to provide input data of the form shown in Table A
However such input is a major deviation from the existing Dygraph parser model who expects one abscissa. Such suggests that a modification to the parser to accept a "Dual Label" option, requiring that both labels be contained in a single abscissa element as in Table B, would be easier. Thereafter, with the option specified, the parser would manage CSV as it usually would with the exception that it is now "bin cognizant" and detects division between labels 1 and 2 by use of an acceptable delimiter (in this case a single quotation mark - maybe not the best choice) and divisions between label 1 abscissa elements by name change. Behind the scenes each point gets its unique x coordinate and the "Dual Label" option causes the dygraph to visually scoot up a couple pixels to accommodate an extra label. Not sure how to handle full zoomed scrolling put simply leaving a label 1 element centered until an adjacent label 1 element comes on screen is an option.
Dygraphs rule!
There's no simple way to do this with dygraphs now. As you say, there's a fairly deep assumption that there's only a single x-axis.
Your best bet would be to either modify the existing legend plugin to do this, or to create a new plugin which renders just the "Weekend 1", "Weekend 2" line. While the plugins API isn't official yet, it is at least somewhat documented.
If you get this to work, please share your code!

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.

images ds3.js heatmap

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.

Repeat plot command with minor changes in R

I made a plot in R and I want to repeat all the commands (like plot(), legend() or line()) that were carried out for this plot, with some minor changes. For example I want to set the axes to logarithmic scale and change the title of the plot.
In gnuplot I would use the replot command.
plot ...
set title "The same plot with logarithmic axes"
set logscale
replot
Is something like this possible in R. The only thing that comes to my mind of doing this (besides changing the values manually and re-run the lines of codes) would be setting up a function, that asks for all parameters that might be changed by the user.
Thanks for your help,
Sven
R uses a pen and paper graphics model - once the plot has been drawn on the device that is it. If you want to change some aspect of the plot, you need to replay the graphics function calls that produce the plot with the changes made to the code.
Depending on what you are really doing there are two options:
If this is just for you, write code in a text editor / IDE that knows R and can send chunks of code at a time to R. That way the code to produce the figure is recorded in a separate script which you can paste into/send to R making the changes you need each time to the script.
If you are going to be doing this often, then write yourself a wrapper plotting function that encapsulates the plot code you want but allows you to pass in arguments to alter the aspects you want.
Lattice and ggplot2 are a little different as they are based on grid graphics and create objects that when printed produce a plot on the device. One can manipulate that object to alter what is drawn, and with grid one can push and pop things on to / off a viewport.

Resources