Sunday, July 10, 2011

More proxy plots with Javascript

This is another in the series of enhanced proxy temperature reconstruction plots with hopefully enhanced clarity. This one catches up with a suggestion earlier from Eli Rabett for using Javascript so users can choose which plot to emphasise by mouse rollover. I thought that would be hard, but TheFordPrefect showed me that it isn't so hard, and did a demonstration case. I've adapted that slightly here.

I've also included a plot of Craig Loehle's reconstruction which uses non-treering proxies, and also the original MBH98, which I got from a CA archive. That was for the MM05 E&E paper. I was hoping to include the centred plot from Fig 1c of  that paper - there are numbers for that in the archive, but I haven't been able to convince myself that they are really from a centred reconstruction. They seem awfully close to what is supposed to be a non-centred modified Gaspe reconstruction.
Update - Craig Loehle's paper had a correction. I've referred to the update paper, but had plotted the original data. I've replaced with the updated data - not a big change. However, the update only goes to 1935, so I've had to change the anomaly base period to 1906-1935. I have updated the zipfile.

I've posted, on the document repository, a zip file called javaproxy.zip. It includes the R files and the data, and a readme.txt file. Despite the name, it also includes the file for the animated gif as well.

I've updated the data notes on the previous post to add the new datasets. Again, all sets have been set to an anomaly base period of 1935-1964 1906-35.


Update.
I've added a facility that enables TheFordPrefect's capability of comparing datasets. You'll see now at the end of the legend a block of four rectangles. Think of these as representing a stack of datasets. You can add new sets at the left end by clicking on their names in the legend. When you add a new one, the others move to the right.

So if you want to compare two sets, just click on them, and then roll the pointer over the two left rectangles. You'll see them show up. You can of course select up to four at a time and cycle through them.

Here is the 2000 year plot. Just roll the mouse pointer over the names in the legend to enhance each individual curve.

Further update:I had an update here warning that Firefox 5 (but not IE) seemed to not free the image memory (about 30Kb) used in this javascript. But I now think it does eventually - the garbage collection is just slow.





11 comments:

  1. The best yet.

    When Eli first suggested this I should have pointed you to Rgraph - an HTML5 javascript plotting library which does this very well for you. I played with it a little. It's very versatile, but does have one very annoying feature: it is focussed on discrete data rather than series, so you have to label the x-axis by yourself. http://www.rgraph.net/

    Kevin C

    ReplyDelete
  2. Thanks for the pointer, Kevin.

    It looks very helpful. I don't think I'll use the library as such - it simplifies life for me if I can write everything out of R. And the canvas element doesn't seem too well supported yet. But it's a great help with Javascript.

    ReplyDelete
  3. I'm now beginning to see common patterns which I couldn't see in the earlier versions. Presented with this version as a data anaysis problem, I'd be tempted to try cluster analysis and see if the results match up to the proxies, methods and/or authors.

    The method of distance scoring (e.g. correlation vs RMS) will probably make a major differebce however.

    Kevin C

    ReplyDelete
  4. Hi

    Just though I'd say I prefer the click-it-to-see-it approach as this allows 2 separated (in index) traces to be toggled and compared. But otherwise it's a big improvement over the gif!! and the dotty lines.

    Thefordprefect

    ReplyDelete
  5. TFP, Thanks for your help on this - that's an aspect I hadn't thought of.

    I think the mouseover has value too, though. I'll experiment with providing other hotspots - say a circle of dots where you can make the mouse swap between pairs. If my Java skill improves, I might even be able to allow it to switch between maps, so the user can choose click or rollover.

    ReplyDelete
  6. A simpler idea is just to provide a second legend, smaller and with little squares rather than text, that respond to clicks.

    More ambitious - clicking on the current legend would select a cycle, which you could click on another button to run through. I'll see if my Java is up to it.

    ReplyDelete
  7. Just a little nitpick: You're using Javascript which has nothing to do with the Java programming language.

    Some other nice javascript plotting libraries (should you decided to go down that route) are raphaeljs.com/ and code.google.com/p/flot/

    D.

    ReplyDelete
  8. D.
    Yes, though Java is more evocative. Anyway, I've changed it.

    Thanks for the tip. It's fairly automated now - the R code generales the png's and the javascript, which I just paste in.

    ReplyDelete
  9. Nick Stokes, are you planning to present proxies making up a given reconstruction in the manner you have done for reconstructions? If not, I think I can handle the GIF animation code for R to do it. I also was contemplatinbg doing some simulated series of proxies modeled on ARIMA and ARFIMA coefficents.

    ReplyDelete
  10. Kenneth,
    I wasn't planning to do proxies as well, so if you want to do it, that would be great. The GIF and javascript codes are fairly similar, and I would think about as easy to use. An advantage of the gif is that you end up with a single file.

    Carrick,
    Thanks, I'll add it.

    ReplyDelete