{"spec_id":"scatter-map-geographic","library":"muix","language":"javascript","code":"// anyplot.ai\n// scatter-map-geographic: Scatter Map with Geographic Points\n// Library: muix 9.17.0 | JavaScript 22.23.4\n// Quality: 88/100 | Updated: 2026-11-08\nimport { ChartsDataProvider } from \"@mui/x-charts/ChartsDataProvider\";\nimport { ChartsWrapper } from \"@mui/x-charts/ChartsWrapper\";\nimport { ChartsSurface } from \"@mui/x-charts/ChartsSurface\";\nimport { ContinuousColorLegend } from \"@mui/x-charts/ChartsLegend\";\nimport { ChartsXAxis } from \"@mui/x-charts/ChartsXAxis\";\nimport { ChartsYAxis } from \"@mui/x-charts/ChartsYAxis\";\nimport { ChartsGrid } from \"@mui/x-charts/ChartsGrid\";\nimport { ChartsReferenceLine } from \"@mui/x-charts/ChartsReferenceLine\";\nimport { ScatterPlot } from \"@mui/x-charts/ScatterChart\";\nimport { useXScale, useYScale } from \"@mui/x-charts/hooks\";\n\nconst t = window.ANYPLOT_TOKENS;\n\n// Constants\nconst WORLD = { lonMin: -180, lonMax: 180, latMin: -90, latMax: 90 }; // the whole globe, in degrees\nconst PAD_SHARE = 0.025; // map padding on each side as a share of the globe's span, so markers on its edge stay inside\nconst GRATICULE_LON_STEP = 60; // degrees between meridians\nconst GRATICULE_LAT_STEP = 30; // degrees between parallels\nconst MARKER_RADIUS = [4, 16]; // px for the smallest and the largest size value\nconst POINT_OPACITY = 0.82;\n\n// Columns: set these to your data's column names\nconst LATITUDE = \"Latitude\"; // role: latitude\nconst LONGITUDE = \"Longitude\"; // role: longitude\nconst DEPTH = \"Depth (km)\"; // role: value\nconst MAGNITUDE = \"Magnitude (Mw)\"; // role: size\nconst ZONE = \"Seismic zone\"; // role: label\n\n// Data: replace this block with your own records, one object per row\n// Simplified land outlines ([lon, lat] rings) for the basemap, and simulated\n// M5.0+ earthquake epicentres along the plate boundaries of major subduction,\n// transform and collision zones (Ring of Fire, Alpide belt).\nconst LAND_OUTLINES = [\n  // North and Central America\n  [\n    [-168, 65.6], [-166, 68.9], [-156.8, 71.3], [-141, 69.6], [-128, 70], [-117, 68.9],\n    [-108, 68], [-96, 67.5], [-89, 68.5], [-82, 66.5], [-86, 64], [-92, 62.5], [-94.5, 59],\n    [-92.5, 57], [-87, 55.5], [-82, 55], [-82.5, 52.5], [-79, 51.5], [-78.5, 55], [-77, 58],\n    [-78, 60.5], [-74, 62.3], [-70, 61], [-65, 60.3], [-61, 56], [-56, 52.5], [-59.5, 50.4],\n    [-64.5, 49.2], [-64, 48], [-61, 45.5], [-66, 43.8], [-70, 43.7], [-70.5, 41.8], [-74, 40.5],\n    [-75.5, 38], [-76, 35], [-78.5, 33.8], [-81, 31.5], [-80.5, 28], [-80.1, 25.5], [-81.1, 25.1],\n    [-82.7, 27.8], [-84, 30], [-87.5, 30.3], [-89.5, 30], [-90, 29], [-94, 29.6], [-97.2, 27.5],\n    [-97.5, 24], [-97.7, 21.5], [-96.5, 19.3], [-94.5, 18.2], [-91, 18.8], [-90.4, 21], [-87, 21.5],\n    [-87.5, 18.5], [-88.2, 16], [-84, 15.8], [-83.3, 15], [-83.7, 11], [-81.5, 9], [-79.5, 9.5],\n    [-77.4, 8.6], [-78.2, 7.5], [-80, 7.4], [-82.5, 8.2], [-85.7, 10], [-85.8, 11.2], [-87.6, 13],\n    [-91.5, 14], [-94.5, 16], [-96.5, 15.7], [-99.8, 16.8], [-103.5, 18.3], [-105.5, 20.5],\n    [-105.3, 22.5], [-108.5, 25.5], [-111, 27.9], [-112.8, 31.5], [-114.7, 31.7], [-112.5, 27.5],\n    [-110, 24], [-109.5, 23], [-112, 24.8], [-114.3, 27.5], [-115.8, 30.4], [-117.1, 32.5],\n    [-118.5, 34], [-120.6, 34.6], [-122.5, 37.5], [-123.8, 39.5], [-124.3, 42], [-124, 46.3],\n    [-124.7, 48.4], [-123, 49], [-125, 50], [-127.5, 51], [-130, 54.5], [-133, 57.5], [-136.5, 58.5],\n    [-140, 59.8], [-145, 60.3], [-148, 60], [-151, 59.2], [-154, 58], [-158, 56.5], [-162, 55],\n    [-164.5, 54.5], [-161, 56], [-158, 57.5], [-157.5, 58.7], [-162, 59.8], [-165, 61], [-164.5, 63],\n    [-161, 64.5], [-165, 64.5], [-168, 65.6],\n  ],\n  // Aleutian Islands\n  [[-178, 51.5], [-170, 52.5], [-165, 54], [-164.5, 54.6], [-170, 53.1], [-178, 52.1], [-178, 51.5]],\n  // Canadian Arctic Archipelago (Baffin, Victoria, Banks, Ellesmere)\n  [\n    [-80, 73.7], [-73, 71.5], [-67, 69.5], [-62, 66.8], [-64, 63.5], [-66, 62], [-71, 62.8],\n    [-78, 64.4], [-73, 67.8], [-78, 70], [-85, 70], [-90, 71.5], [-86, 73.5], [-80, 73.7],\n  ],\n  [[-118, 69], [-106, 68.8], [-101, 69.6], [-104, 71], [-107, 73.5], [-114, 73], [-119, 71.5], [-118, 69]],\n  [[-125, 71.8], [-120, 71.5], [-117, 74.5], [-124, 74], [-125, 71.8]],\n  [[-90, 76.5], [-80, 76.3], [-75, 79], [-62, 82], [-70, 83], [-85, 82], [-92, 80.5], [-90, 76.5]],\n  // Greenland, Iceland, Newfoundland\n  [\n    [-73, 78.5], [-67, 76], [-58, 75.5], [-55, 72], [-53, 68], [-51, 64], [-48, 61], [-44, 60],\n    [-42, 61.5], [-40, 65], [-35, 66.5], [-26, 68.5], [-22, 70.5], [-22, 73.5], [-19, 76], [-18, 79],\n    [-12, 81.5], [-25, 83], [-40, 83.5], [-55, 82.5], [-62, 81.8], [-68, 80.5], [-73, 78.5],\n  ],\n  [[-24, 65.5], [-22, 66.4], [-17, 66.5], [-14, 65.5], [-15, 64.3], [-18.5, 63.4], [-22, 63.8], [-24, 65.5]],\n  [[-59.3, 47.6], [-56, 47.5], [-53, 46.6], [-52.7, 47.8], [-55.5, 49.8], [-55.5, 51.6], [-57.5, 50.7], [-59.3, 47.6]],\n  // Cuba, Hispaniola\n  [[-85, 21.9], [-82, 23.2], [-77.5, 22], [-74.2, 20.2], [-77.5, 19.9], [-80, 21.7], [-82.5, 21.6], [-85, 21.9]],\n  [[-74.4, 18.4], [-72.8, 19.9], [-69.5, 19.5], [-68.4, 18.6], [-71, 18], [-74.4, 18.4]],\n  // South America, Tierra del Fuego\n  [\n    [-77.4, 8.6], [-76, 9.4], [-75.5, 10.6], [-74, 11.3], [-71.5, 12.4], [-70, 11.5], [-68, 10.5],\n    [-64, 10.6], [-61.5, 10.5], [-60, 8.5], [-57, 6], [-54, 5.7], [-51.5, 4.2], [-50, 1.7], [-49, 0],\n    [-47, -0.8], [-44, -2.5], [-41, -2.9], [-38.5, -3.7], [-35.2, -5.5], [-34.8, -7.5], [-35.5, -9.5],\n    [-37.5, -11.5], [-39, -13.5], [-39.2, -17.5], [-40.5, -20.5], [-42, -23], [-44.5, -23.3],\n    [-48, -25.8], [-48.6, -28.5], [-50.5, -31], [-53.4, -33.7], [-55, -35], [-57.2, -35.5],\n    [-57.5, -38.2], [-62, -39], [-62.3, -40.6], [-65, -41], [-64.5, -42.5], [-65.5, -45],\n    [-67.5, -46.5], [-65.8, -48], [-68.5, -50.5], [-68.4, -52.3], [-70, -52.8], [-71.5, -53.8],\n    [-74, -52], [-75.5, -49], [-74.5, -46], [-73.5, -43], [-73.7, -39.5], [-73.2, -37], [-71.6, -33],\n    [-71.4, -30], [-70.8, -27], [-70.4, -23.5], [-70.2, -20], [-70.4, -18.4], [-72.5, -17],\n    [-76, -14.2], [-77.2, -12], [-79, -8.5], [-81, -6], [-81.2, -4.5], [-80, -2.5], [-80.9, -1],\n    [-80, 1], [-78.8, 1.6], [-77.4, 4], [-77.4, 6.8], [-77.4, 8.6],\n  ],\n  [[-68.6, -52.6], [-65.2, -54.8], [-68.5, -55.5], [-72, -54.5], [-70, -53], [-68.6, -52.6]],\n  // Africa (with Sinai), Madagascar\n  [\n    [32.3, 31.2], [29, 30.9], [25, 31.6], [23, 32.6], [21, 32.8], [20, 32], [19.5, 30.5], [17, 31],\n    [15.3, 32.3], [13, 32.9], [11.2, 33.2], [10.2, 34.5], [11, 35.5], [10.3, 36.8], [11, 37.1],\n    [9.7, 37.3], [8, 36.9], [3, 36.8], [-1, 35.4], [-2, 35.1], [-5.4, 35.9], [-6.2, 35.8],\n    [-9.6, 30.4], [-11.5, 28], [-13.2, 27.6], [-14.5, 26], [-16, 24], [-17.1, 21], [-16.3, 19.5],\n    [-16.5, 16.2], [-17.5, 14.7], [-16.7, 12.5], [-15, 11], [-13.5, 9.5], [-12, 7.5], [-9.5, 5.2],\n    [-7.5, 4.4], [-4, 5.2], [-1, 5], [1.6, 6.2], [4.5, 6.3], [6, 4.3], [7.5, 4.5], [9.5, 3.8],\n    [9.8, 2.5], [9.4, 0], [8.8, -1], [11.1, -3.8], [12.2, -5.8], [13.2, -8.6], [13.6, -12.2],\n    [11.8, -15.8], [12.4, -19], [14.5, -22.9], [15.2, -27], [16.5, -28.6], [18.2, -32], [18.4, -34.1],\n    [20, -34.8], [22.5, -34], [25.6, -34], [27.5, -33.2], [30.1, -31.1], [32.5, -28.5], [32.9, -26],\n    [35.5, -24], [35.4, -22.1], [34.7, -19.9], [36.8, -17.9], [40.5, -15], [40.5, -10.5], [39.3, -7],\n    [39.2, -4.7], [41.6, -1.7], [44, 1.6], [47.5, 4.9], [50.5, 9.5], [51.3, 11.8], [49, 11.2],\n    [45, 10.4], [43.3, 11.5], [41.5, 14], [39.5, 15.5], [38.5, 18], [37.3, 21], [36.9, 22],\n    [35.6, 23.9], [34, 26.5], [32.5, 29.9], [34.2, 27.8], [34.9, 29.5], [34.2, 31.3], [32.3, 31.2],\n  ],\n  [\n    [49.3, -12], [50.5, -15.5], [49.8, -17], [48.5, -20.5], [47.2, -24.8], [45.2, -25.5], [43.6, -23.5],\n    [43.3, -21.8], [44.4, -19.5], [44, -17], [46.3, -15.8], [47.9, -13.6], [49.3, -12],\n  ],\n  // Eurasia\n  [\n    [-5.6, 36], [-6.5, 37], [-8.9, 37], [-8.8, 40], [-8.8, 42], [-9.3, 43], [-8, 43.7], [-4, 43.4],\n    [-1.5, 43.4], [-1.2, 46], [-2.5, 47.3], [-4.6, 48.3], [-1.5, 48.7], [-1.3, 49.7], [1.5, 50.1],\n    [2.5, 51.1], [4.2, 51.9], [5, 53.3], [8.5, 53.6], [8.6, 55], [8.1, 56.6], [10.5, 57.7],\n    [10.5, 56.2], [9.8, 55], [10.9, 54], [12.5, 54.4], [14.3, 53.9], [18, 54.8], [21, 55], [21.1, 57],\n    [24, 57.3], [23.5, 59.2], [28, 59.5], [23, 59.9], [21.3, 60.8], [21.5, 63], [24.5, 64.8],\n    [25.5, 65.5], [22, 65.8], [21, 64.5], [17.5, 62.5], [17.2, 61], [18.8, 59.8], [16.8, 58.5],\n    [16.4, 56.5], [14, 55.4], [12.7, 56], [11.8, 58], [11, 59], [8, 58.1], [5.6, 58.8], [5, 61],\n    [6.5, 62.6], [10, 64], [13, 66.5], [16, 68.5], [19, 69.9], [23.5, 70.8], [28, 71], [31, 70],\n    [33, 69.3], [41, 67.4], [44, 66.3], [44, 68.5], [53, 68.5], [59, 68.8], [66, 69.5], [69, 73],\n    [73, 72.5], [80, 73.5], [87, 74.5], [100, 76.5], [105, 77.6], [113, 73.6], [120, 73], [128, 72.5],\n    [132, 71.8], [140, 72.6], [150, 71.5], [160, 70], [170, 69.9], [178, 69.4], [180, 68.9], [180, 65],\n    [178, 64.5], [177, 62.5], [173, 61.5], [170, 60], [166, 60], [163, 57], [162, 56], [160, 53],\n    [156.7, 51], [156, 57], [160, 61.5], [155, 59.3], [152, 59.2], [148, 59.3], [143, 59.3], [141, 58],\n    [137, 54.5], [141, 53], [140.5, 48.5], [136, 44], [132, 42.8], [129.7, 41], [129.4, 37],\n    [129.2, 35.2], [126.5, 34.4], [126.4, 37], [125, 37.8], [124.5, 39.8], [121.5, 39], [121.6, 40.9],\n    [118, 39], [118, 37.5], [122.5, 37.2], [119.5, 35], [121, 32], [122, 30], [120, 26], [116, 22.8],\n    [113.5, 22.2], [110, 21.5], [108.5, 21.6], [106.5, 20], [105.7, 18.5], [107.5, 16.5], [109.3, 13],\n    [109, 11.5], [106.5, 10.4], [105, 8.7], [104.7, 10.4], [102.5, 12.2], [100.9, 12.6], [100, 13.5],\n    [99.2, 10], [100.4, 7.2], [101.5, 6.8], [103.4, 4.5], [103.5, 1.5], [101.3, 2.5], [100.4, 5],\n    [98.3, 8], [98.5, 13], [97.6, 16.5], [96.5, 16.6], [94.3, 16], [94.2, 19.5], [92.3, 21],\n    [91.8, 22.6], [90, 21.9], [88.2, 21.7], [86.5, 20], [85, 19.3], [82.3, 16.6], [80.2, 15.2],\n    [80.1, 13], [79.8, 10.3], [78.2, 8.9], [77.3, 8.1], [76.3, 9.8], [75, 12.8], [73.5, 16],\n    [72.8, 19.3], [72.7, 21.2], [72.6, 22.3], [70, 21], [69, 22.5], [68.3, 23.6], [66.8, 24.8],\n    [64.5, 25.2], [61.6, 25.2], [57.3, 25.8], [56.4, 27.1], [54.7, 26.5], [51.5, 27.9], [50.2, 29.8],\n    [48, 29.9], [48.4, 28.4], [49.6, 26.8], [51.6, 24.2], [54, 24.1], [56.3, 26.2], [56.4, 24.5],\n    [58.5, 23.6], [59.8, 22.5], [58.5, 20.5], [57.7, 19], [55.4, 17.7], [52.3, 16.3], [48.7, 14],\n    [45, 12.8], [43.4, 12.7], [42.8, 15], [42.7, 16.5], [41.2, 19], [39.1, 21.5], [38, 24], [36.5, 26],\n    [35.2, 28.1], [34.9, 29.5], [34.2, 31.3], [34.9, 32.8], [35.5, 34], [36, 35.8], [35.8, 36.8],\n    [34.5, 36.8], [32.5, 36.1], [30.5, 36.4], [28.2, 36.7], [27.3, 37.8], [26.3, 38.8], [26.6, 40.2],\n    [29, 41.1], [31.5, 41.2], [35, 42], [38.5, 40.9], [41.5, 41.5], [41.7, 42.6], [40, 43.4],\n    [38, 44.6], [36.7, 45.2], [35, 45], [33.5, 44.5], [32.5, 45.3], [33.6, 46], [31, 46.6], [30, 45.5],\n    [29.6, 45], [28.7, 44.2], [28, 42.5], [28.9, 41.3], [27, 40.6], [26.2, 40.6], [24, 40.8],\n    [23, 40.3], [23.5, 39.5], [23, 38], [24, 37.7], [22.8, 36.5], [21.7, 36.8], [21.1, 38.3],\n    [20.7, 39.2], [19.4, 40.4], [19.4, 41.8], [18.5, 42.5], [16, 43.5], [14.5, 45.2], [13.7, 45.7],\n    [12.3, 45.4], [12.4, 44.2], [13.6, 43.5], [14.8, 42.1], [16.2, 41.8], [18.5, 40.2], [17, 39],\n    [16.6, 38], [15.7, 38], [16.1, 39.5], [15.6, 40.1], [14, 41], [12.3, 41.7], [11, 42.6], [10.1, 44],\n    [8.8, 44.4], [7.5, 43.8], [6.2, 43.1], [4.5, 43.4], [3.1, 43], [3.2, 41.9], [0.9, 41], [0, 39.8],\n    [-0.4, 38.4], [-0.8, 37.6], [-2.2, 36.8], [-4.4, 36.7], [-5.6, 36],\n  ],\n  // Chukotka east of the antimeridian\n  [[-180, 68.9], [-175, 67.5], [-171, 66.8], [-169.7, 66], [-171.5, 65], [-173, 64.3], [-176.5, 65.3], [-180, 65], [-180, 68.9]],\n  // Great Britain, Ireland, Sicily, Sardinia, Crete, Svalbard, Novaya Zemlya\n  [\n    [-5.7, 50.1], [-3, 50.6], [1.3, 51.1], [1.7, 52.6], [0.3, 53.5], [-1.3, 54.7], [-2, 55.9],\n    [-2.5, 56.6], [-1.8, 57.6], [-3.4, 58.6], [-5, 58.6], [-6.2, 57.5], [-5.7, 56], [-4.8, 55],\n    [-3.2, 54.9], [-3.3, 54.2], [-3, 53.4], [-4.6, 53.3], [-4.1, 52.5], [-5.1, 51.8], [-3.2, 51.4],\n    [-5.7, 50.1],\n  ],\n  [[-6, 52.1], [-6.2, 53.5], [-5.6, 54.5], [-6.4, 55.2], [-8.3, 55.2], [-10, 54.2], [-9.7, 53], [-10.3, 51.9], [-8.5, 51.6], [-6, 52.1]],\n  [[12.4, 38.1], [15.6, 38.3], [15.1, 36.7], [12.4, 37.6], [12.4, 38.1]],\n  [[8.4, 39], [9.6, 39.1], [9.8, 41], [8.2, 41], [8.4, 39]],\n  [[23.5, 35.3], [26.3, 35.2], [24.8, 34.9], [23.5, 35.3]],\n  [[11, 78.5], [17, 80.2], [27, 80], [22, 78], [16, 76.6], [11, 78.5]],\n  [[52, 71.5], [56, 73.5], [61, 76.3], [68, 76.8], [60, 75], [56, 71], [52, 71.5]],\n  // Sri Lanka, Hainan, Taiwan, Sakhalin\n  [[79.8, 7], [80, 9.8], [81.4, 8.5], [81.8, 7], [80.6, 6], [79.8, 7]],\n  [[108.6, 19.2], [110.5, 20.1], [111, 19.6], [109.6, 18.2], [108.6, 19.2]],\n  [[120.1, 23], [121.5, 25.3], [121.9, 24.8], [120.8, 22], [120.1, 23]],\n  [[142, 46], [143.5, 49.3], [143, 54], [142.7, 54.4], [142, 51], [142, 46]],\n  // Japan (Honshu, Hokkaido, Kyushu, Shikoku)\n  [\n    [130.9, 34], [132.5, 35.4], [135.5, 35.7], [136.8, 37.3], [138.5, 37.4], [140, 39.5], [140, 41.4],\n    [141.5, 41.4], [142, 39.5], [141, 37], [140.9, 35.7], [139.8, 35], [138.8, 34.6], [137, 34.6],\n    [135.2, 33.8], [133, 34.3], [130.9, 34],\n  ],\n  [[140, 41.5], [141, 43.2], [141.6, 45.4], [145.5, 44.3], [145.8, 43.3], [144, 42.9], [141.5, 42.5], [140, 41.5]],\n  [[129.6, 33.3], [130.9, 33.9], [131.9, 33], [131.2, 31.4], [130.2, 31.2], [129.6, 33.3]],\n  [[132.5, 33.5], [134.3, 34.2], [134.7, 33.8], [133, 32.8], [132.5, 33.5]],\n  // Philippines (Luzon, Visayas, Mindanao, Palawan)\n  [[120.6, 18.5], [122.2, 18.5], [122, 16.3], [121.6, 14.2], [124, 13], [123.3, 12.6], [120.9, 13.7], [120.1, 15], [120.4, 16.6], [120.6, 18.5]],\n  [[122, 11.8], [124.3, 12.6], [125.7, 11.2], [125, 10], [123.5, 9.5], [122.4, 10], [122, 11.8]],\n  [[122, 7], [123.5, 7.8], [125.4, 9.8], [126.5, 7.3], [126, 6], [125.3, 5.6], [124, 6.3], [122, 7]],\n  [[117.2, 8.4], [119.5, 11.3], [119.7, 10.5], [118, 8.3], [117.2, 8.4]],\n  // Indonesia (Sumatra, Java, Lesser Sunda, Timor, Borneo, Sulawesi) and New Guinea\n  [\n    [95.3, 5.6], [97.5, 5.2], [100.4, 2.3], [103.5, -0.8], [106, -3.2], [105.8, -5.8], [104.5, -5.9],\n    [102, -4], [100.3, -1], [98.6, 1.7], [96, 4], [95.3, 5.6],\n  ],\n  [[105.2, -6.8], [106.5, -6], [108.5, -6.4], [111, -6.4], [112.7, -6.9], [114.5, -7.8], [114.4, -8.7], [111, -8.2], [108, -7.8], [105.2, -6.8]],\n  [[115, -8.2], [119, -8.3], [123, -8.2], [122.8, -8.8], [119, -8.8], [115, -8.8], [115, -8.2]],\n  [[123.5, -10.2], [125, -8.4], [127.3, -8.4], [124.2, -10.2], [123.5, -10.2]],\n  [\n    [109, 1.5], [110.5, 1.8], [113, 3.2], [115.5, 5.3], [117, 7], [119.2, 5.3], [118, 4.5], [117.9, 1],\n    [117.6, 0.5], [116.5, -1.5], [116.4, -3.8], [114.5, -4], [111.8, -3.5], [110.2, -2.9], [109.1, -0.5],\n    [109, 1.5],\n  ],\n  [\n    [119.4, -5.5], [119.5, -3.4], [118.8, -2.5], [119.8, 0.1], [120.8, 1.3], [124.5, 1.6], [125.2, 1.5],\n    [124.3, 0.4], [121, 0.5], [120.2, 0], [120.6, -1], [123.4, -0.9], [121.5, -1.9], [122.9, -4.5],\n    [121.5, -4.7], [120.5, -2.9], [120.3, -5.5], [119.4, -5.5],\n  ],\n  [\n    [131, -1], [134, -0.9], [135.5, -3.3], [138, -1.6], [141, -2.6], [144.5, -3.8], [147.5, -6],\n    [147.8, -6.7], [146.5, -7.7], [148.2, -8.6], [150, -10.4], [147.2, -10], [144, -7.7], [142.6, -9.3],\n    [141, -9.1], [139, -8.1], [138, -8.4], [137.6, -5.2], [135, -4.4], [133, -4], [132, -2.8], [131, -1],\n  ],\n  // Australia, Tasmania, New Zealand\n  [\n    [113.4, -22], [114, -26], [115, -30], [115, -34], [117.8, -35], [123, -33.8], [126, -32.3],\n    [131, -31.5], [134, -32.8], [135.6, -34.8], [137.5, -33], [137.8, -35.6], [140, -37.8],\n    [143.5, -38.8], [146.3, -39], [150, -37.5], [150.8, -34.5], [152.5, -32], [153.6, -28.5],\n    [153, -25], [150.8, -22.5], [149, -20.5], [146.3, -18.8], [145.4, -15], [143.5, -14],\n    [142.5, -10.7], [141.6, -12.8], [141.5, -16.5], [140.2, -17.7], [138, -16.2], [135.5, -15],\n    [136.8, -12.3], [133, -11.3], [131, -12.2], [129.5, -15], [127, -14], [125, -15], [122.5, -17],\n    [121.5, -19.5], [118, -20.4], [114.5, -21.8], [113.4, -22],\n  ],\n  [[144.6, -40.7], [148.3, -40.9], [148, -43.2], [146, -43.6], [144.6, -40.7]],\n  [\n    [172.7, -34.4], [174.8, -36.8], [176, -37.6], [178.5, -37.7], [177.9, -39.2], [176.9, -39.6],\n    [175.2, -41.6], [174.6, -41.3], [175, -39.9], [173.8, -39.2], [174.6, -38], [172.7, -34.4],\n  ],\n  [\n    [172.7, -40.5], [174.3, -41.7], [173.3, -43.2], [171.2, -44.5], [170.7, -45.9], [169, -46.7],\n    [166.5, -46], [166.7, -45.2], [168.4, -44], [170.8, -42.7], [172.1, -41.2], [172.7, -40.5],\n  ],\n  // Antarctica\n  [\n    [-180, -90], [-180, -78], [-165, -78.5], [-150, -77], [-140, -75], [-125, -73.5], [-110, -74],\n    [-100, -73], [-90, -72.5], [-80, -73], [-75, -71], [-68, -67], [-58, -63.3], [-62, -66],\n    [-61, -70], [-60, -74], [-50, -77.5], [-35, -78], [-30, -76], [-20, -73], [-10, -71], [0, -70],\n    [10, -70], [20, -70], [30, -69.5], [40, -68.5], [50, -67], [60, -67.5], [70, -68], [75, -69.5],\n    [80, -67.5], [90, -66.5], [100, -66], [110, -66], [120, -66.8], [130, -66.2], [140, -66.8],\n    [150, -68.5], [160, -70], [170, -71.5], [167, -77.5], [180, -78], [180, -90], [-180, -90],\n  ],\n];\n\nconst data = (() => {\n  let seed = 8831;\n  const rand = () => {\n    seed = (seed * 1103515245 + 12345) % 2147483648;\n    return seed / 2147483648;\n  };\n  // Each zone follows its plate boundary as a [lon, lat] line through the forearc, traced so that\n  // the overriding plate lies on the left of the direction of travel. Epicentres are spread along\n  // the whole line (one per equal stretch), scattered `width` ground degrees across it, and in a\n  // subduction zone the deeper ones lie up to `slab` degrees landward, above the dipping plate.\n  // Depth and magnitude lean towards their low ends, as real catalogues do.\n  const zones = [\n    {\n      name: \"Japan-Kuril arc\",\n      path: [[141.2, 35], [142.3, 37.5], [142.8, 39.5], [144.5, 41.8], [147.5, 43.2], [151, 45.5], [154.5, 48], [157.5, 51], [160.5, 54]],\n      count: 12, mag: [5.0, 7.2], depth: [10, 300], width: 0.7, slab: 3.5,\n    },\n    {\n      name: \"Aleutian-Alaska arc\",\n      path: [[-178.5, 51], [-173, 51.6], [-168, 52.8], [-163.5, 54], [-158.5, 55.3], [-154.5, 57], [-150.5, 59.3]],\n      count: 8, mag: [5.0, 7.5], depth: [10, 150], width: 0.5, slab: 1.5,\n    },\n    {\n      // Cascadia subduction, the San Andreas transform, the Gulf of California rift and the Middle America trench\n      name: \"Cascadia-Mexico coast\",\n      path: [\n        [-127.5, 49.8], [-125.8, 47.5], [-125.2, 45], [-125, 42.5], [-124.6, 40.4], [-123.3, 38.6], [-122, 37],\n        [-120.5, 35.7], [-118.6, 34.6], [-116.8, 33.9], [-115.6, 32.8], [-114.6, 31.5], [-113, 29], [-111, 26.8],\n        [-109, 24.2], [-106.8, 21.7], [-105.4, 19.6], [-103.2, 18], [-100.5, 16.8], [-98, 15.9], [-95.5, 15.4],\n        [-93, 14.6], [-91, 13.5], [-88.5, 12.5], [-86.5, 11.2],\n      ],\n      count: 12, mag: [5.0, 6.9], depth: [5, 60], width: 0.4, slab: 0.8,\n    },\n    {\n      name: \"Andes subduction\",\n      path: [\n        [-80.6, -1], [-81.2, -5], [-79.8, -8], [-77.8, -11.5], [-76.2, -14], [-73.5, -16.4], [-71.2, -18.5],\n        [-70.6, -21.5], [-70.8, -25], [-71.6, -30], [-72.4, -33.5], [-73.4, -36.8], [-73.9, -40],\n      ],\n      count: 12, mag: [5.0, 7.8], depth: [10, 600], width: 0.6, slab: 7,\n    },\n    {\n      // Sunda trench, Banda arc, Molucca Sea and Philippine trench\n      name: \"Indonesia-Philippines arc\",\n      path: [\n        [95, 5], [96.8, 2], [99.5, -1.8], [102.5, -4.8], [105.8, -7.2], [110, -8.6], [114, -9.3], [118, -9.6],\n        [122, -9.7], [125.5, -8.8], [129, -7.8], [131.2, -6.3], [130.6, -4.2], [128, -3.4], [126.6, -1.6],\n        [126.6, 1.2], [126.9, 4.5], [126.6, 8], [125.9, 11.2], [124.8, 13.8],\n      ],\n      count: 14, mag: [5.0, 7.6], depth: [10, 400], width: 0.6, slab: 3,\n    },\n    {\n      name: \"Tonga-Kermadec trench\",\n      path: [[-178.2, -35], [-177.2, -31], [-176, -27.5], [-174.6, -23.5], [-173.6, -20], [-173.2, -17], [-173.9, -15.6]],\n      count: 8, mag: [5.0, 7.4], depth: [10, 600], width: 0.5, slab: 6,\n    },\n    {\n      // Ionian islands, the Hellenic arc south of Crete, the eastern Aegean and the North Anatolian fault\n      name: \"Anatolia-Aegean\",\n      path: [\n        [20.4, 39.3], [21.2, 37.4], [22.6, 36], [24.6, 35], [26.6, 35.2], [27.9, 36.6], [27, 38.4], [25.6, 39.6],\n        [26.6, 40.5], [29.4, 40.75], [31.5, 40.85], [34, 40.95], [36.5, 40.4], [39.4, 39.75], [41.5, 39.3],\n      ],\n      count: 8, mag: [5.0, 6.8], depth: [5, 40], width: 0.45, slab: 0,\n    },\n    {\n      name: \"Himalayan front\",\n      path: [[73.6, 34.4], [75.6, 32.8], [77.8, 31], [80.2, 29.6], [82.6, 28.6], [85, 27.9], [87.6, 27.5], [90.5, 27.3], [93.2, 27.6], [95.4, 28.3]],\n      count: 8, mag: [5.0, 7.2], depth: [5, 40], width: 0.4, slab: 0.8,\n    },\n  ];\n  return zones.flatMap((zone) => {\n    // Legs in ground degrees: longitude shrinks by the cosine of the leg's mean latitude\n    const legs = zone.path.slice(1).map((b, i) => {\n      const a = zone.path[i];\n      const kx = Math.cos((((a[1] + b[1]) / 2) * Math.PI) / 180);\n      const dx = (b[0] - a[0]) * kx;\n      const dy = b[1] - a[1];\n      return { a, b, kx, dx, dy, len: Math.hypot(dx, dy) };\n    });\n    const total = legs.reduce((sum, leg) => sum + leg.len, 0);\n    return Array.from({ length: zone.count }, (_, k) => {\n      let along = ((k + rand()) / zone.count) * total;\n      let j = 0;\n      while (j < legs.length - 1 && along > legs[j].len) {\n        along -= legs[j].len;\n        j += 1;\n      }\n      const leg = legs[j];\n      const f = Math.min(1, along / leg.len);\n      const depthShare = rand() ** 2;\n      const depth = zone.depth[0] + depthShare * (zone.depth[1] - zone.depth[0]);\n      const magnitude = zone.mag[0] + rand() ** 2 * (zone.mag[1] - zone.mag[0]);\n      const across = zone.slab * depthShare + (rand() - 0.5) * 2 * zone.width;\n      // The left-hand normal of the leg, (-dy, dx), points landward\n      const lat = leg.a[1] + f * (leg.b[1] - leg.a[1]) + (leg.dx / leg.len) * across;\n      const lon = leg.a[0] + f * (leg.b[0] - leg.a[0]) - ((leg.dy / leg.len) * across) / leg.kx;\n      return {\n        [LATITUDE]: Number(lat.toFixed(2)),\n        [LONGITUDE]: Number((((lon + 540) % 360) - 180).toFixed(2)), // wrapped across the antimeridian\n        [DEPTH]: Math.round(depth),\n        [MAGNITUDE]: Number(magnitude.toFixed(1)),\n        [ZONE]: zone.name,\n      };\n    });\n  });\n})();\n\n// Plot: reads only data and the constants above\nconst points = data.map((d, i) => ({\n  id: `p-${i}`,\n  x: d[LONGITUDE],\n  y: d[LATITUDE],\n  z: d[DEPTH],\n  sizeValue: d[MAGNITUDE],\n}));\nconst depths = data.map((d) => d[DEPTH]);\nconst depthMin = Math.min(...depths);\nconst depthMax = Math.max(...depths);\nconst magnitudes = data.map((d) => d[MAGNITUDE]);\nconst magMin = Math.min(...magnitudes);\nconst magMax = Math.max(...magnitudes);\n// Size legend: the smallest, middle and largest magnitude, at the radii the linear size map gives them\nconst sizeLegend = [magMin, (magMin + magMax) / 2, magMax].map((value) => ({\n  value,\n  radius: MARKER_RADIUS[0] + ((MARKER_RADIUS[1] - MARKER_RADIUS[0]) * (value - magMin)) / (magMax - magMin || 1),\n}));\n// The size glyphs take the middle of the depth ramp, so they share the markers' fill, edge and alpha\nconst midRamp = `rgb(${[1, 3, 5]\n  .map((i) => (parseInt(t.seq[0].slice(i, i + 2), 16) + parseInt(t.seq[1].slice(i, i + 2), 16)) / 2)\n  .join(\", \")})`;\n\nconst lonTicks = Array.from(\n  { length: (WORLD.lonMax - WORLD.lonMin) / GRATICULE_LON_STEP + 1 },\n  (_, k) => WORLD.lonMin + k * GRATICULE_LON_STEP,\n);\nconst latTicks = Array.from(\n  { length: (WORLD.latMax - WORLD.latMin) / GRATICULE_LAT_STEP + 1 },\n  (_, k) => WORLD.latMin + k * GRATICULE_LAT_STEP,\n);\n\nconst TITLE = \"scatter-map-geographic · javascript · muix · anyplot.ai\";\nconst SUBTITLE = `${data.length} epicentres · colour: ${DEPTH} · size: ${MAGNITUDE} · equirectangular projection`;\nconst HEADER_HEIGHT = 70;\nconst LEGEND_HEIGHT = 64;\nconst X_AXIS_HEIGHT = 56;\nconst Y_AXIS_WIDTH = 72;\nconst chartWidth = window.ANYPLOT_SIZE.width;\nconst chartHeight = window.ANYPLOT_SIZE.height - HEADER_HEIGHT - LEGEND_HEIGHT;\n\n// The axes run a padded share past the globe, so a marker centred on the antimeridian or a pole stays\n// clear of the axis lines and their tick labels\nconst lonPad = (WORLD.lonMax - WORLD.lonMin) * PAD_SHARE;\nconst latPad = (WORLD.latMax - WORLD.latMin) * PAD_SHARE;\nconst extent = {\n  lonMin: WORLD.lonMin - lonPad,\n  lonMax: WORLD.lonMax + lonPad,\n  latMin: WORLD.latMin - latPad,\n  latMax: WORLD.latMax + latPad,\n};\n\n// Equirectangular: px per degree of latitude = px per degree of longitude / cos(mean latitude)\nconst meanLatitude = ((extent.latMin + extent.latMax) / 2) * (Math.PI / 180);\nconst mapAspect = ((extent.lonMax - extent.lonMin) * Math.cos(meanLatitude)) / (extent.latMax - extent.latMin);\nconst mapHeight = Math.min(chartHeight - X_AXIS_HEIGHT - 28, (chartWidth - Y_AXIS_WIDTH - 48) / mapAspect);\nconst mapWidth = mapHeight * mapAspect;\nconst marginX = (chartWidth - Y_AXIS_WIDTH - mapWidth) / 2;\nconst marginY = (chartHeight - X_AXIS_HEIGHT - mapHeight) / 2;\n\nfunction Basemap() {\n  const xScale = useXScale();\n  const yScale = useYScale();\n  return (\n    <g>\n      {LAND_OUTLINES.map((ring, k) => (\n        <path\n          key={`land-${k}`}\n          d={`M ${ring.map(([lon, lat]) => `${xScale(lon)},${yScale(lat)}`).join(\" L \")} Z`}\n          fill={t.grid}\n          stroke={t.inkSoft}\n          strokeOpacity={0.45}\n          strokeWidth={1}\n        />\n      ))}\n    </g>\n  );\n}\n\nexport default function Chart() {\n  const { width, height } = window.ANYPLOT_SIZE;\n  return (\n    <div style={{ width, height, background: t.pageBg, display: \"flex\", flexDirection: \"column\" }}>\n      <div\n        style={{\n          height: HEADER_HEIGHT,\n          display: \"flex\",\n          flexDirection: \"column\",\n          alignItems: \"center\",\n          justifyContent: \"center\",\n          gap: 6,\n        }}\n      >\n        <div style={{ fontSize: 22, fontWeight: 600, color: t.ink }}>{TITLE}</div>\n        <div style={{ fontSize: 15, color: t.inkSoft }}>{SUBTITLE}</div>\n      </div>\n      <ChartsDataProvider\n        width={chartWidth}\n        height={chartHeight}\n        margin={{ top: marginY, bottom: marginY, left: marginX, right: marginX }}\n        skipAnimation\n        series={[\n          {\n            type: \"scatter\",\n            id: \"epicentres\",\n            label: ZONE,\n            data: points,\n            markerSize: MARKER_RADIUS[0],\n            colorAxisId: \"depth\",\n            sizeAxisId: \"magnitude\",\n            valueFormatter: (v, { dataIndex }) =>\n              `${data[dataIndex][ZONE]} · ${MAGNITUDE} ${data[dataIndex][MAGNITUDE]} · ${DEPTH} ${data[dataIndex][DEPTH]}`,\n          },\n        ]}\n        xAxis={[\n          {\n            id: \"lon\",\n            scaleType: \"linear\",\n            min: extent.lonMin,\n            max: extent.lonMax,\n            label: LONGITUDE,\n            height: X_AXIS_HEIGHT,\n            tickInterval: lonTicks,\n            valueFormatter: (v: number) => (v === 0 ? \"0°\" : `${Math.abs(v)}°${v > 0 ? \"E\" : \"W\"}`),\n            tickLabelStyle: { fontSize: 14, fill: t.inkSoft },\n            labelStyle: { fontSize: 16, fill: t.ink },\n          },\n        ]}\n        yAxis={[\n          {\n            id: \"lat\",\n            scaleType: \"linear\",\n            min: extent.latMin,\n            max: extent.latMax,\n            label: LATITUDE,\n            width: Y_AXIS_WIDTH,\n            tickInterval: latTicks,\n            valueFormatter: (v: number) => (v === 0 ? \"0°\" : `${Math.abs(v)}°${v > 0 ? \"N\" : \"S\"}`),\n            tickLabelStyle: { fontSize: 14, fill: t.inkSoft },\n            labelStyle: { fontSize: 16, fill: t.ink },\n          },\n        ]}\n        zAxis={[\n          {\n            id: \"depth\",\n            min: depthMin,\n            max: depthMax,\n            colorMap: { type: \"continuous\", min: depthMin, max: depthMax, color: [t.seq[0], t.seq[1]] },\n          },\n          {\n            id: \"magnitude\",\n            sizeMap: { type: \"continuous\", min: magMin, max: magMax, size: MARKER_RADIUS, interpolator: \"linear\" },\n          },\n        ]}\n      >\n        <ChartsWrapper legendPosition={{ vertical: \"bottom\", horizontal: \"center\" }} legendDirection=\"horizontal\">\n          <div\n            style={{\n              gridArea: \"legend\",\n              height: LEGEND_HEIGHT,\n              display: \"flex\",\n              alignItems: \"center\",\n              justifyContent: \"center\",\n              gap: 72,\n              color: t.inkSoft,\n              fontSize: 15,\n            }}\n          >\n            <div style={{ display: \"flex\", alignItems: \"center\", gap: 14 }}>\n              <span style={{ color: t.ink, fontSize: 16 }}>{DEPTH}</span>\n              <ContinuousColorLegend\n                axisDirection=\"z\"\n                axisId=\"depth\"\n                direction=\"horizontal\"\n                thickness={14}\n                labelPosition=\"end\"\n                sx={{ width: 300, color: t.inkSoft, fontSize: 14 }}\n              />\n            </div>\n            <div style={{ display: \"flex\", alignItems: \"center\", gap: 14 }}>\n              <span style={{ color: t.ink, fontSize: 16 }}>{MAGNITUDE}</span>\n              {sizeLegend.map(({ value, radius }) => (\n                <span key={`size-${value}`} style={{ display: \"flex\", alignItems: \"center\", gap: 6 }}>\n                  <svg width={2 * MARKER_RADIUS[1] + 2} height={2 * MARKER_RADIUS[1] + 2}>\n                    <circle\n                      cx={MARKER_RADIUS[1] + 1}\n                      cy={MARKER_RADIUS[1] + 1}\n                      r={radius}\n                      fill={midRamp}\n                      fillOpacity={POINT_OPACITY}\n                      stroke={t.pageBg}\n                      strokeWidth={1}\n                    />\n                  </svg>\n                  {value.toFixed(1)}\n                </span>\n              ))}\n            </div>\n          </div>\n          <ChartsSurface\n            sx={{\n              \"& .MuiChartsGrid-line\": { stroke: t.grid, strokeWidth: 1 },\n              \"& .MuiChartsAxis-line\": { stroke: t.inkSoft },\n              \"& .MuiChartsAxis-tick\": { stroke: t.inkSoft },\n              \"& .MuiScatterChart-marker\": { fillOpacity: POINT_OPACITY, stroke: t.pageBg, strokeWidth: 1 },\n            }}\n          >\n            <Basemap />\n            <ChartsGrid horizontal vertical />\n            <ChartsReferenceLine\n              x={0}\n              label=\"Prime meridian\"\n              labelAlign=\"end\"\n              lineStyle={{ stroke: t.inkSoft, strokeOpacity: 0.7, strokeDasharray: \"6 4\", strokeWidth: 1.5 }}\n              labelStyle={{ fontSize: 14, fill: t.inkSoft }}\n            />\n            <ChartsReferenceLine\n              y={0}\n              label=\"Equator\"\n              labelAlign=\"end\"\n              lineStyle={{ stroke: t.inkSoft, strokeOpacity: 0.7, strokeDasharray: \"6 4\", strokeWidth: 1.5 }}\n              labelStyle={{ fontSize: 14, fill: t.inkSoft }}\n            />\n            <ChartsXAxis />\n            <ChartsYAxis />\n            <ScatterPlot />\n          </ChartsSurface>\n        </ChartsWrapper>\n      </ChartsDataProvider>\n    </div>\n  );\n}\n"}