Log In  


Cart #climate-0 | 2026-09-27 | Embed ▽ | License: CC4-BY-NC-SA
7

ABOUT

A rendition of the Climate/Warming Stripes​ for Picotron, using exactly 1024 bytes of compressed code, for #Pico1k Jam 2026​​.

The climate stripes were created by Professor Ed Hawkins at the University of Reading in 2018. They show clearly and vividly how global average temperatures have risen over nearly two centuries.

FEATURES

🌍 Visualises global climate data from 1850 to 2025
​​📊 Displays both Stripes and Graph visual representation
👆 Hover to view temperature at any point in time

CONTROLS

🖱️ Move = Hover to see climate temp for each year
🖱️ Click = Switch between "stripes" and "graph" display

REFERENCES/LINKS

📖 Climate stripes created by Professor Ed Hawkins
📖 #ShowYourStripes display of stripes/graphs for different regions
📖 Met Office download for global climate observation datasets
📖 Climate Change Visualised blog post on the stripes history and usage
📖 The Climate Book featuring the stripes visualisation on the cover
🔨 Shrinko8 by thisismypassword to minimise compressed size

SOURCE CODE (1024 Compressed Bytes)*

*(before "safe" minification to Tiny .ROM with Shrinko8)

----------------------------- ClimateStripes -----------------------------
-- climate stripes + line graph viewer for picotron
function _init()
    num_stripes = 176
    start_year = 1850

    -- 1. Define climate data (Global, from Met Office)
    anomalies = {
       -0.600, -0.438, -0.389, -0.421, -0.432, -0.427, -0.472, -0.618, -0.547, -0.434, -0.558, -0.634, -0.724, -0.578, -0.681, -0.592, -0.596, -0.601, -0.547, -0.480, -0.475, -0.524, -0.446, -0.451, -0.497, -0.503, -0.550, -0.210, -0.113, -0.421, -0.426, -0.338, -0.397, -0.439, -0.584, -0.567, -0.513, -0.603, -0.490, -0.374, -0.625, -0.534, -0.645, -0.630, -0.622, -0.581, -0.410, -0.393, -0.609, -0.475, -0.364, -0.420, -0.569, -0.658, -0.724, -0.525, -0.437, -0.618, -0.625, -0.644, -0.636, -0.650, -0.578, -0.573, -0.367, -0.308, -0.541, -0.673, -0.565, -0.469, -0.434, -0.359, -0.446, -0.420, -0.414, -0.387, -0.231, -0.329, -0.318, -0.498, -0.277, -0.211, -0.249, -0.424, -0.273, -0.305, -0.266, -0.110, -0.107, -0.136, -0.044, -0.172, -0.209, -0.197, -0.060, -0.158, -0.265, -0.231, -0.254, -0.268, -0.341, -0.164, -0.089, -0.022, -0.207, -0.289, -0.341, -0.102, -0.081, -0.112, -0.169, -0.065, -0.113, -0.084, -0.349, -0.254, -0.195, -0.160, -0.210, -0.068, -0.122, -0.242, -0.127, 0.014, -0.207, -0.143, -0.252, 0.063, -0.034, 0.059, 0.159, 0.216, -0.010, 0.185, 0.012, 0.013, 0.060, 0.207, 0.243, 0.140, 0.320, 0.298, 0.086, 0.123, 0.191, 0.338, 0.239, 0.383, 0.539, 0.285, 0.293, 0.450, 0.507, 0.505, 0.432, 0.571, 0.535, 0.554, 0.427, 0.559, 0.643, 0.502, 0.540, 0.583, 0.635, 0.784, 0.894, 0.804, 0.722, 0.854, 0.882, 0.732, 0.765, 1.073, 1.130, 1.009, 0.959
    }

	 -- 1.5. Set custom palette
	 local palette = {
	 	0x00000000,0x0008306b,0x0008519c,0x002171b5,0x004292c6,0x006baed6,0x009ecae1,0x00c6dbef,0x00deebf7,0x00fee0d2,0x00fcbba1,0x00fc9272,0x00fb6a4a,0x00ef3b2c,0x00cb181d,0x00a50f15,0x0067000d,0x00440007
	 }

	 for i = 1, #palette do
		poke4(0x5000 + 4 * (i-1),palette[i])		
	 end

    -- Interaction & View Toggle States
    mx, my, mb = 0, 0, 0
    was_clicked = false

    view_mode = 0     -- 0 = Stripes, 1 = Line Graph
    transition = 0.0   -- 0.0 (Stripes) to 1.0 (Line Graph)
end

function _update()
    mx, my, mb = mouse()

    -- Click detector toggle logic (avoids multi-firing)
    if mb == 1 then
        if not was_clicked then
            view_mode = 1 - view_mode -- Flip between 0 and 1
            was_clicked = true
        end
    else
        was_clicked = false
    end

    -- Interpolate smooth sliding transition
    transition += view_mode == 1 and 0.08 or -0.08
    transition = mid(0, transition, 1.0)
end

function _draw()
    cls()

    local w = 480
    local h = 270
    local stripe_w = w / num_stripes

    -- Graph plotting settings
    local graph_baseline = h / 2 - 10
    local graph_scale = 100

    -- Track highlighted index based on cursor x coordinate
    local selected_idx = flr(mx / stripe_w) + 1
    selected_idx = mid(1, selected_idx, num_stripes)

    -- Draw Data Structures
    for i=1, num_stripes do
        local norm = (anomalies[i] + 0.76) / 1.6
        local col_idx = flr(norm * 14) + 1

        local x1 = flr((i-1) * stripe_w)
        local x2 = flr(i * stripe_w)

        -- Interpolate structural shape layout changes
        -- Interpolates from full vertical height to thin line graph bars
        local target_y1 = flr(graph_baseline - (anomalies[i] * graph_scale))
        local target_y2 = graph_baseline
        if target_y1 > target_y2 then 
            target_y1, target_y2 = target_y2, target_y1 
        end

        local render_y1 = flr(0 * (1 - transition) + target_y1 * transition)
        local render_y2 = flr(240 * (1 - transition) + target_y2 * transition)

        rectfill(x1, render_y1, x2, render_y2, i==selected_idx and 13 or col_idx)
    end

    -- Draw Interactive Highlight Overlay UI

    -- Format values for layout display
    local sign = anomalies[selected_idx] >= 0 and "+" or ""
    local info_str = "YEAR:" .. start_year + (selected_idx - 1) 
     					.. "\tANOMALY: " .. sign .. anomalies[selected_idx]
     					.. "\31C\*d\t"

    -- Print data string in solid white text (Palette Entry 7)
    -- Mode hint text string info
    print(info_str .. (view_mode == 0 and "CLICK TO SHOW GRAPH" or "CLICK TO SHOW STRIPES"), 12, h - 18, 7)

end

7


1

This looks very cool!
However, nothing happens when I hit the "Fire Banana" button. I assume that's a typo?


@NotAHat: OMG, that's hilarious! 🤣
Yeah, can you tell that I stole the layout for this post from my "Gorillas-1K" entry from a couple years ago?! 🍌
Well spotted (have edited the post) - thx! 👍


1

Gorillas + Climate Stripes
= "Primate Stripes"🍌



[Please log in to post a comment]