Monday, December 1, 2014

Maintained monthly active temperature plotter

This post follows on from a thought by commenter JCH. On the latest data page, I maintain an active graph of six recent temperature indices, set to a common anomaly base 1981-2010. But I actually maintain a file of about fifteen. JCH mentioned a difficulty of now getting recent data for HADCRUT, for example. So I thought I should add some user facilities to that active graph to make use of this data.

I tried dynamic plotting once previously with annual data - it is the climate plotter page. It hasn't been much used, and I think I may have tried to cram too much into a small space. So I've been experimenting with different systems. I've learnt more about Javascript since then.

So the first addition is a panel for choosing which datasets to show. It has a floating legend, with buttons for changing color, asking for regression (OLS), or smoothing (12-month boxcar). If you ask for regression, a similar panel pops up with again color, and start and end time text boxes. Initially it sets these to the visible screen, but you can type in other times. If you press on any color button, another panel pops up with color choices. The OLS trend in °C/Century for the stated interval, is in the red-lined box.

The original plot worked by mouse dragging. If you drag in the main space, the plot follows. But if you drag below or left of the axes, it stretches/shrinks along that axis. I've kept that, but added an alternative.

There is a faint line at about 45° from the origin. If you move the mouse in that region, you'll see faint numbers at each end of the x-axis. These are tentative years. If you click with Shift pressed, the plot adapts so that those become the endpoints. The scheme is similar to the triangle of the trend viewer, but backwards. Near the origin, you get short intervals in recent time; the scale of mouse move gives better resolution here. Move along the x-axis makes the start recede; along the diagonal, both recede keeping the interval short. In the upper triangle, it's similar with the y-limits. It's easier to try than to read.

The Redraw button is hardly needed, because there is much automatic redraw. The Regress button forces a recalc when you've manually edited the text boxes for intervals. Each pop-up window has an exit button; the Legend button is the way to bring it back (it toggles). Each pop-up is draggable (gently).

More on regression - you can at any stage amend the textboxes with dates, and then click either the regress button (main table) or the red-bordered cell containing the regression trend in C/Cen to get a new plot with the specified period. By default the period will be set to the visible screen, which may include months in the future (but trend will be calculated over actual data). Trend lines will be shown.

So here it is below the fold. It's still experimental, and feedback welcomed. When stable, I'll embed it in the page.


  1. I use mostly Firefox, but tried also IE (Version 11.0.14), which seems to work identically, also plot dragging.

    What's confusing at first is that the data extends to the left of the y-axis. This is also identical in Firefox and IE.

    1. Thanks, Pekka. I have the same IE version, which is a puzzle. The data extending is part of the concept that you see a window on the data which you can move.

    2. I checked IE on two more computers, two run Windows 8.1 and one Windows 7. The IE version is the same on all. Dragging the data works on all three.

    3. Thanks, Pekka
      I have changed to fix what seemed to be the problem, which was a strange one. It works for me now too, and in Chrome.

  2. I think this is the data plotted (RSS in example):

    This is looking really good. Comprehensive.