├── correlation heatmap.jpg ├── Temp change vs CO2 emission.jpg ├── seasonal variation in CO2 conc.jpg ├── Trends in temp change and CO2 conc.jpg ├── Time series of Temp change and CO2 conc.jpg ├── Cluster of years based on climate patterns.jpg ├── CONTRIBUTING.md ├── LICENSE ├── README.md └── Carbon emission.ipynb /correlation heatmap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavieObi/Carbon-Emissions-Impact-Analysis/HEAD/correlation heatmap.jpg -------------------------------------------------------------------------------- /Temp change vs CO2 emission.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavieObi/Carbon-Emissions-Impact-Analysis/HEAD/Temp change vs CO2 emission.jpg -------------------------------------------------------------------------------- /seasonal variation in CO2 conc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavieObi/Carbon-Emissions-Impact-Analysis/HEAD/seasonal variation in CO2 conc.jpg -------------------------------------------------------------------------------- /Trends in temp change and CO2 conc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavieObi/Carbon-Emissions-Impact-Analysis/HEAD/Trends in temp change and CO2 conc.jpg -------------------------------------------------------------------------------- /Time series of Temp change and CO2 conc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavieObi/Carbon-Emissions-Impact-Analysis/HEAD/Time series of Temp change and CO2 conc.jpg -------------------------------------------------------------------------------- /Cluster of years based on climate patterns.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavieObi/Carbon-Emissions-Impact-Analysis/HEAD/Cluster of years based on climate patterns.jpg -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Carbon Emissions Impact Analysis 2 | 3 | Thank you for your interest in contributing to the **Carbon Emissions Impact Analysis** project! 4 | This project thrives on collaboration, and we welcome contributions from all levels — beginners, data enthusiasts, and experienced developers. 5 | 6 | --- 7 | 8 | ## 🏆 Ways You Can Contribute 9 | 10 | - **Data Analysis:** Explore additional datasets or refine existing analyses. 11 | - **Model Enhancement:** Implement new machine learning models or improve existing ones. 12 | - **Visualization:** Create more insightful visualizations to represent data trends. 13 | - **Documentation:** Improve documentation to make the project more accessible. 14 | - **Bug Fixes:** Identify and resolve issues in code or deployment scripts. 15 | 16 | --- 17 | 18 | ## 🚀 Getting Started 19 | 20 | 1. Fork the repository. 21 | 2. Clone your fork locally: 22 | ```bash 23 | git clone https://github.com/davidobi/Carbon-Emissions-Impact-Analysis.git -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 DavieObi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Carbon Emissions Impact Analysis: A Time-Series and Predictive Study 2 | 3 | ## Project Overview 4 | 5 | This project undertakes a comprehensive data analysis to explore the intricate relationship between global atmospheric carbon dioxide (CO₂) concentrations and global temperature changes over several decades. Utilizing time-series analysis, correlation, causality testing, advanced regression with lagged effects, and machine learning-based clustering, the study aims to quantify the impact of CO₂ on temperature and provide predictive insights into potential future climate scenarios. 6 | 7 | ## Problem Statement 8 | 9 | Global warming and climate change represent one of humanity's most pressing challenges. The scientific consensus points to anthropogenic greenhouse gas emissions, particularly CO₂, as a primary driver. However, understanding the historical patterns, quantifying the statistical relationships, identifying distinct climate epochs, and building predictive models for "what-if" scenarios based on these emissions are crucial for informed decision-making, policy formulation, and climate mitigation strategies. 10 | 11 | ## Project Objectives 12 | 13 | 1. **Exploratory Data Analysis (EDA):** Perform initial statistical analysis to understand the distributions and characteristics of temperature change and CO₂ concentration data. 14 | 2. **Trend and Seasonal Analysis:** Identify long-term trends and examine seasonal variations in both temperature changes and CO₂ concentrations. 15 | 3. **Relationship Quantification:** Quantify the correlation between CO₂ levels and temperature changes using various statistical measures. 16 | 4. **Causality Investigation:** Employ Granger causality tests to explore potential lead-lag predictive relationships between CO₂ and temperature, considering the time-series nature of the data. 17 | 5. **Lagged Effects Modeling:** Build a regression model to assess how current and past CO₂ concentrations collectively influence current temperature changes. 18 | 6. **Climate Pattern Identification:** Utilize clustering techniques to group historical years into distinct climate patterns based on their combined temperature and CO₂ characteristics. 19 | 7. **"What If" Scenario Prediction:** Develop a simple predictive model to simulate temperature changes under hypothetical future CO₂ emission scenarios. 20 | 21 | ## Column Dictionaries 22 | 23 | ### `temperature.csv` 24 | 25 | This dataset contains global temperature change anomalies. 26 | 27 | | Column Name | Description | 28 | | :----------- | :------------------------------------------------------------------------------------------------------ | 29 | | `ObjectId` | Unique identifier for each data entry. | 30 | | `Country` | The geographical entity for which the data is recorded (e.g., 'World'). | 31 | | `ISO2` | Two-letter ISO country code. | 32 | | `ISO3` | Three-letter ISO country code. | 33 | | `FYYYY` | Global average temperature change anomaly for a specific year `YYYY` (e.g., `F1961`, `F2022`). Values are typically in degrees Celsius (°C) relative to a baseline period. | 34 | 35 | ### `carbon_emmission.csv` 36 | 37 | This dataset contains global atmospheric carbon dioxide (CO₂) concentrations. 38 | 39 | | Column Name | Description | 40 | | :----------- | :------------------------------------------------------------------------------------------------------ | 41 | | `ObjectId` | Unique identifier for each data entry. | 42 | | `Country` | The geographical entity for which the data is recorded (e.g., 'World'). | 43 | | `Date` | The date of the measurement in `YYYYMM` format (e.g., `1958M03` for March 1958). | 44 | | `Value` | Atmospheric CO₂ concentration in parts per million (ppm). Note: For some dates, multiple entries exist; this analysis primarily used the aggregated (mean) values as CO₂ concentration. | 45 | 46 | ## Analysis Highlights & Key Findings 47 | 48 | ### 1\. Initial Data Overview & Statistics 49 | 50 | - **CO₂ Data:** Exhibited very high variance, indicating substantial changes over time, and showed a left-skewed distribution, reflecting the increasing trend with more recent higher values. 51 | - **Temperature Data:** Showed a more moderate variance but a clear upward trend in its mean and median, signaling warming. 52 | 53 | ### 2\. Time-Series Analysis: Trends Unveiled 54 | 55 | - Both **global temperature change and CO₂ concentrations display clear, strong, and remarkably parallel upward trends** over the decades. This visual correlation is the first compelling evidence of their linked progression. 56 | 57 | ### 3\. Correlation Quantification: A Strong Link 58 | 59 | - **Correlation Heatmap and Scatter Plot:** Quantified a **very strong positive linear correlation (Pearson: \~0.955; Spearman: \~0.938)** between CO₂ concentration and temperature change. This robust numerical finding unequivocally supports the visual evidence of a direct relationship, where rising CO₂ is associated with increasing temperatures. 60 | 61 | ### 4\. Trends & Seasonal Patterns: Deeper Dive 62 | 63 | - **Quantified Linear Trends:** The analysis determined an average global temperature increase of approximately **0.02°C per year** and an average CO₂ concentration increase of about **1.63 ppm per year**. 64 | - **CO₂ Seasonal Variation:** A distinct annual cycle in CO₂ concentrations was observed, with peaks in late spring/early summer and troughs in autumn. This pattern is consistent with the seasonal biological activity (photosynthesis and respiration) primarily in the Northern Hemisphere's vast landmasses. 65 | 66 | ### 5\. Causality Investigation: Predictive Relationship 67 | 68 | - **Granger Causality Test:** While Pearson and Spearman correlations showed strong association, the Granger causality test (at 1-3 year lags) provided **weak statistical evidence (p-value for Lag 1 was 0.0617, others higher)** for CO₂ concentration "Granger-causing" temperature change within this specific econometric framework. This highlights the complexity of climate systems, where responses might involve longer lags, non-linearities, or other confounding factors not fully captured by this test alone. 69 | 70 | ### 6\. Lagged Effects Analysis: Unpacking the Influence 71 | 72 | - **OLS Regression Model:** A robust model was built, explaining approximately **95% of the variance** in temperature change using current and lagged CO₂ concentrations. 73 | - **Key Predictors:** 74 | - **Current CO₂ Concentration** showed a highly statistically significant positive impact. 75 | - **1-year Lagged CO₂ Concentration** also exhibited a statistically significant effect, though with a negative coefficient (likely influenced by multicollinearity with current CO₂). 76 | - CO₂ concentrations from **2 and 3 years prior did not show statistically significant additional impacts** in this model, suggesting the most dominant effects are relatively immediate or captured within the preceding year. 77 | - **Multicollinearity:** A high condition number in the OLS results indicated strong multicollinearity among the lagged CO₂ variables, which can make individual coefficient interpretations challenging but does not invalidate the overall model's predictive power. 78 | 79 | ### 7\. Climate Pattern Clustering: Identifying Epochs 80 | 81 | - **K-Means Clustering:** Years were successfully clustered into three distinct "climate patterns": 82 | - **'Low Temp & CO₂':** Representing earlier periods with minimal warming. 83 | - **'Moderate Temp & CO₂':** A transitional phase. 84 | - **'High Temp & CO₂':** Encompassing recent decades with significant warming and elevated CO₂ levels. 85 | - This clustering visually confirms a **clear historical progression** through these climate states, driven by increasing CO₂ and leading to higher global temperatures. 86 | 87 | ### 8\. "What If" Analysis: Future Scenario Predictions 88 | 89 | - A simple linear regression model was used to predict temperature changes under hypothetical CO₂ scenarios: 90 | - **+10% CO₂:** Predicted temperature change of \~1.087°C. 91 | - **-10% CO₂:** Predicted temperature change of \~-0.060°C. 92 | - **+20% CO₂:** Predicted temperature change of \~1.660°C. 93 | - **-20% CO₂:** Predicted temperature change of \~-0.633°C. 94 | - These predictions dramatically illustrate the **sensitivity of global temperatures to CO₂ concentrations**, providing tangible insights into the potential warming from increased emissions and the mitigation potential of reduction efforts. 95 | 96 | ## Technologies Used 97 | 98 | * **Python:** Programming Language 99 | * **Pandas:** Data Manipulation and Analysis 100 | * **NumPy:** Numerical Operations 101 | * **Plotly:** Interactive Data Visualization 102 | * **Scikit-learn (sklearn):** Machine Learning (Linear Regression, KMeans, StandardScaler) 103 | * **SciPy:** Scientific Computing (e.g., `linregress`, `pearsonr`, `spearmanr`) 104 | * **Statsmodels:** Statistical Modeling (e.g., OLS Regression, Granger Causality) 105 | 106 | ## How to Run the Code 107 | 108 | 1. **Clone the repository:** 109 | ```bash 110 | git clone 111 | cd 112 | ``` 113 | 2. **Install dependencies:** 114 | ```bash 115 | pip install pandas numpy plotly scikit-learn scipy statsmodels 116 | ``` 117 | 3. **Place Data:** Ensure `carbon_emmission.csv` and `temperature.csv` are in the root directory of the repository. 118 | 4. **Execute:** Run the Python script containing the analysis steps in your preferred environment (e.g., Jupyter Notebook, IDE). 119 | 120 | ----- 121 | -------------------------------------------------------------------------------- /Carbon emission.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "f0d0e29c", 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "name": "stdout", 11 | "output_type": "stream", 12 | "text": [ 13 | "Temperature Data:\n", 14 | " ObjectId Country ISO2 ISO3 F1961 F1962 F1963 \\\n", 15 | "0 1 Afghanistan, Islamic Rep. of AF AFG -0.113 -0.164 0.847 \n", 16 | "1 2 Albania AL ALB 0.627 0.326 0.075 \n", 17 | "2 3 Algeria DZ DZA 0.164 0.114 0.077 \n", 18 | "3 4 American Samoa AS ASM 0.079 -0.042 0.169 \n", 19 | "4 5 Andorra, Principality of AD AND 0.736 0.112 -0.752 \n", 20 | "\n", 21 | " F1964 F1965 F1966 ... F2013 F2014 F2015 F2016 F2017 F2018 F2019 \\\n", 22 | "0 -0.764 -0.244 0.226 ... 1.281 0.456 1.093 1.555 1.540 1.544 0.910 \n", 23 | "1 -0.166 -0.388 0.559 ... 1.333 1.198 1.569 1.464 1.121 2.028 1.675 \n", 24 | "2 0.250 -0.100 0.433 ... 1.192 1.690 1.121 1.757 1.512 1.210 1.115 \n", 25 | "3 -0.140 -0.562 0.181 ... 1.257 1.170 1.009 1.539 1.435 1.189 1.539 \n", 26 | "4 0.308 -0.490 0.415 ... 0.831 1.946 1.690 1.990 1.925 1.919 1.964 \n", 27 | "\n", 28 | " F2020 F2021 F2022 \n", 29 | "0 0.498 1.327 2.012 \n", 30 | "1 1.498 1.536 1.518 \n", 31 | "2 1.926 2.330 1.688 \n", 32 | "3 1.430 1.268 1.256 \n", 33 | "4 2.562 1.533 3.243 \n", 34 | "\n", 35 | "[5 rows x 66 columns]\n", 36 | "\n", 37 | "CO2 Emission Data:\n", 38 | " ObjectId Country Date Value\n", 39 | "0 1 World 1958M03 315.70\n", 40 | "1 2 World 1958M04 317.45\n", 41 | "2 3 World 1958M05 317.51\n", 42 | "3 4 World 1958M06 317.24\n", 43 | "4 5 World 1958M07 315.86\n" 44 | ] 45 | } 46 | ], 47 | "source": [ 48 | "# import libraries\n", 49 | "import pandas as pd \n", 50 | "import numpy as np\n", 51 | "import warnings\n", 52 | "warnings.filterwarnings(\"ignore\")\n", 53 | "\n", 54 | "# load the dataset\n", 55 | "temperature_data = pd.read_csv('temperature.csv')\n", 56 | "co2_data = pd.read_csv('carbon_emmission.csv')\n", 57 | "\n", 58 | "print(\"Temperature Data:\")\n", 59 | "print(temperature_data.head())\n", 60 | "\n", 61 | "print(\"\\nCO2 Emission Data:\")\n", 62 | "print(co2_data.head())" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": 2, 68 | "id": "391bad17", 69 | "metadata": {}, 70 | "outputs": [ 71 | { 72 | "data": { 73 | "text/plain": [ 74 | "({'Mean': 0.5377713483146068, 'Median': 0.47, 'Variance': 0.4294524831504378},\n", 75 | " {'Mean': 180.71615286624203,\n", 76 | " 'Median': 313.835,\n", 77 | " 'Variance': 32600.00200469294})" 78 | ] 79 | }, 80 | "execution_count": 2, 81 | "metadata": {}, 82 | "output_type": "execute_result" 83 | } 84 | ], 85 | "source": [ 86 | "# selecting and computing statistics for temperature changes\n", 87 | "temperature_values = temperature_data.filter(regex='^F').stack() # extracting all year columns\n", 88 | "temperature_stats = {\n", 89 | " \"Mean\": temperature_values.mean(),\n", 90 | " \"Median\": temperature_values.median(),\n", 91 | " \"Variance\": temperature_values.var()\n", 92 | "}\n", 93 | "\n", 94 | "# computing statistics for CO2 concentrations\n", 95 | "co2_values = co2_data[\"Value\"] # extracting the Value column\n", 96 | "co2_stats = {\n", 97 | " \"Mean\": co2_values.mean(),\n", 98 | " \"Median\": co2_values.median(),\n", 99 | " \"Variance\": co2_values.var()\n", 100 | "}\n", 101 | "\n", 102 | "temperature_stats, co2_stats" 103 | ] 104 | }, 105 | { 106 | "cell_type": "code", 107 | "execution_count": 3, 108 | "id": "7c136687", 109 | "metadata": {}, 110 | "outputs": [ 111 | { 112 | "data": { 113 | "application/vnd.plotly.v1+json": { 114 | "config": { 115 | "plotlyServerURL": "https://plot.ly" 116 | }, 117 | "data": [ 118 | { 119 | "mode": "lines+markers", 120 | "name": "Temperature Change (°C)", 121 | "type": "scatter", 122 | "x": [ 123 | 1961, 124 | 1962, 125 | 1963, 126 | 1964, 127 | 1965, 128 | 1966, 129 | 1967, 130 | 1968, 131 | 1969, 132 | 1970, 133 | 1971, 134 | 1972, 135 | 1973, 136 | 1974, 137 | 1975, 138 | 1976, 139 | 1977, 140 | 1978, 141 | 1979, 142 | 1980, 143 | 1981, 144 | 1982, 145 | 1983, 146 | 1984, 147 | 1985, 148 | 1986, 149 | 1987, 150 | 1988, 151 | 1989, 152 | 1990, 153 | 1991, 154 | 1992, 155 | 1993, 156 | 1994, 157 | 1995, 158 | 1996, 159 | 1997, 160 | 1998, 161 | 1999, 162 | 2000, 163 | 2001, 164 | 2002, 165 | 2003, 166 | 2004, 167 | 2005, 168 | 2006, 169 | 2007, 170 | 2008, 171 | 2009, 172 | 2010, 173 | 2011, 174 | 2012, 175 | 2013, 176 | 2014, 177 | 2015, 178 | 2016, 179 | 2017, 180 | 2018, 181 | 2019, 182 | 2020, 183 | 2021, 184 | 2022 185 | ], 186 | "y": [ 187 | 0.1630531914893617, 188 | -0.01347619047619048, 189 | -0.006042553191489363, 190 | -0.07005851063829789, 191 | -0.24702659574468086, 192 | 0.10550520833333336, 193 | -0.11083246073298428, 194 | -0.19910994764397907, 195 | 0.15794210526315788, 196 | 0.09248677248677246, 197 | -0.20051308900523562, 198 | -0.08490625, 199 | 0.2293678756476684, 200 | -0.16303125, 201 | -0.023494680851063827, 202 | -0.24591534391534392, 203 | 0.1658162162162162, 204 | 0.06962962962962962, 205 | 0.2337989417989418, 206 | 0.24728795811518325, 207 | 0.1786439790575916, 208 | 0.17649479166666668, 209 | 0.34459473684210523, 210 | 0.08011702127659574, 211 | 0.07128723404255319, 212 | 0.1511578947368421, 213 | 0.405021052631579, 214 | 0.4900894736842106, 215 | 0.25616842105263155, 216 | 0.5552592592592592, 217 | 0.3681648936170213, 218 | 0.2364903846153846, 219 | 0.2159856459330144, 220 | 0.609514423076923, 221 | 0.6292380952380952, 222 | 0.27922857142857144, 223 | 0.5439951690821256, 224 | 0.971252380952381, 225 | 0.7433014354066987, 226 | 0.6697894736842105, 227 | 0.8501538461538461, 228 | 0.9249999999999998, 229 | 0.8442289719626169, 230 | 0.7778403755868545, 231 | 0.8529905660377357, 232 | 0.8765767441860465, 233 | 1.0225483870967744, 234 | 0.8084103773584905, 235 | 0.9105660377358491, 236 | 1.0990418604651164, 237 | 0.8213917050691244, 238 | 0.9022232558139536, 239 | 0.931199074074074, 240 | 1.114814814814815, 241 | 1.269773148148148, 242 | 1.4395211267605634, 243 | 1.2807850467289719, 244 | 1.3021126760563382, 245 | 1.4430610328638498, 246 | 1.5520377358490567, 247 | 1.343530516431925, 248 | 1.382112676056338 249 | ] 250 | }, 251 | { 252 | "line": { 253 | "dash": "dash" 254 | }, 255 | "mode": "lines+markers", 256 | "name": "CO₂ Concentration (ppm)", 257 | "type": "scatter", 258 | "x": [ 259 | 1958, 260 | 1959, 261 | 1960, 262 | 1961, 263 | 1962, 264 | 1963, 265 | 1964, 266 | 1965, 267 | 1966, 268 | 1967, 269 | 1968, 270 | 1969, 271 | 1970, 272 | 1971, 273 | 1972, 274 | 1973, 275 | 1974, 276 | 1975, 277 | 1976, 278 | 1977, 279 | 1978, 280 | 1979, 281 | 1980, 282 | 1981, 283 | 1982, 284 | 1983, 285 | 1984, 286 | 1985, 287 | 1986, 288 | 1987, 289 | 1988, 290 | 1989, 291 | 1990, 292 | 1991, 293 | 1992, 294 | 1993, 295 | 1994, 296 | 1995, 297 | 1996, 298 | 1997, 299 | 1998, 300 | 1999, 301 | 2000, 302 | 2001, 303 | 2002, 304 | 2003, 305 | 2004, 306 | 2005, 307 | 2006, 308 | 2007, 309 | 2008, 310 | 2009, 311 | 2010, 312 | 2011, 313 | 2012, 314 | 2013, 315 | 2014, 316 | 2015, 317 | 2016, 318 | 2017, 319 | 2018, 320 | 2019, 321 | 2020, 322 | 2021, 323 | 2022, 324 | 2023, 325 | 2024 326 | ], 327 | "y": [ 328 | 315.232, 329 | 172.46045454545455, 330 | 158.60166666666666, 331 | 158.93833333333333, 332 | 159.355, 333 | 159.58041666666668, 334 | 159.90583333333333, 335 | 160.08333333333334, 336 | 160.89208333333332, 337 | 161.21666666666667, 338 | 161.65958333333333, 339 | 162.555, 340 | 163.00375, 341 | 163.25666666666666, 342 | 163.90291666666667, 343 | 165.17791666666668, 344 | 165.17375, 345 | 165.70708333333332, 346 | 166.14875, 347 | 167.19666666666666, 348 | 167.9425, 349 | 168.62958333333333, 350 | 169.66708333333332, 351 | 170.26041666666666, 352 | 170.93916666666667, 353 | 171.8216666666667, 354 | 172.6833333333333, 355 | 173.39125, 356 | 173.98625, 357 | 174.90125, 358 | 176.18541666666667, 359 | 176.8175, 360 | 177.40333333333334, 361 | 178.02833333333334, 362 | 178.39166666666665, 363 | 178.70125, 364 | 179.72375, 365 | 180.76458333333335, 366 | 181.61791666666667, 367 | 182.095, 368 | 183.8275, 369 | 184.50166666666667, 370 | 185.01250000000002, 371 | 185.87708333333333, 372 | 187.01375, 373 | 188.33166666666668, 374 | 189.07625, 375 | 190.29458333333332, 376 | 191.32291666666666, 377 | 192.26541666666665, 378 | 193.15166666666667, 379 | 194.05499999999998, 380 | 195.36833333333334, 381 | 196.15, 382 | 197.30958333333334, 383 | 198.70875, 384 | 199.66750000000002, 385 | 200.78208333333336, 386 | 202.63083333333336, 387 | 203.66916666666668, 388 | 204.59875, 389 | 206.1833333333333, 390 | 207.41666666666666, 391 | 208.47208333333333, 392 | 209.51833333333335, 393 | 210.84416666666667, 394 | 0.68 395 | ] 396 | } 397 | ], 398 | "layout": { 399 | "legend": { 400 | "title": { 401 | "text": "Metrics" 402 | } 403 | }, 404 | "template": { 405 | "data": { 406 | "bar": [ 407 | { 408 | "error_x": { 409 | "color": "#2a3f5f" 410 | }, 411 | "error_y": { 412 | "color": "#2a3f5f" 413 | }, 414 | "marker": { 415 | "line": { 416 | "color": "white", 417 | "width": 0.5 418 | }, 419 | "pattern": { 420 | "fillmode": "overlay", 421 | "size": 10, 422 | "solidity": 0.2 423 | } 424 | }, 425 | "type": "bar" 426 | } 427 | ], 428 | "barpolar": [ 429 | { 430 | "marker": { 431 | "line": { 432 | "color": "white", 433 | "width": 0.5 434 | }, 435 | "pattern": { 436 | "fillmode": "overlay", 437 | "size": 10, 438 | "solidity": 0.2 439 | } 440 | }, 441 | "type": "barpolar" 442 | } 443 | ], 444 | "carpet": [ 445 | { 446 | "aaxis": { 447 | "endlinecolor": "#2a3f5f", 448 | "gridcolor": "#C8D4E3", 449 | "linecolor": "#C8D4E3", 450 | "minorgridcolor": "#C8D4E3", 451 | "startlinecolor": "#2a3f5f" 452 | }, 453 | "baxis": { 454 | "endlinecolor": "#2a3f5f", 455 | "gridcolor": "#C8D4E3", 456 | "linecolor": "#C8D4E3", 457 | "minorgridcolor": "#C8D4E3", 458 | "startlinecolor": "#2a3f5f" 459 | }, 460 | "type": "carpet" 461 | } 462 | ], 463 | "choropleth": [ 464 | { 465 | "colorbar": { 466 | "outlinewidth": 0, 467 | "ticks": "" 468 | }, 469 | "type": "choropleth" 470 | } 471 | ], 472 | "contour": [ 473 | { 474 | "colorbar": { 475 | "outlinewidth": 0, 476 | "ticks": "" 477 | }, 478 | "colorscale": [ 479 | [ 480 | 0, 481 | "#0d0887" 482 | ], 483 | [ 484 | 0.1111111111111111, 485 | "#46039f" 486 | ], 487 | [ 488 | 0.2222222222222222, 489 | "#7201a8" 490 | ], 491 | [ 492 | 0.3333333333333333, 493 | "#9c179e" 494 | ], 495 | [ 496 | 0.4444444444444444, 497 | "#bd3786" 498 | ], 499 | [ 500 | 0.5555555555555556, 501 | "#d8576b" 502 | ], 503 | [ 504 | 0.6666666666666666, 505 | "#ed7953" 506 | ], 507 | [ 508 | 0.7777777777777778, 509 | "#fb9f3a" 510 | ], 511 | [ 512 | 0.8888888888888888, 513 | "#fdca26" 514 | ], 515 | [ 516 | 1, 517 | "#f0f921" 518 | ] 519 | ], 520 | "type": "contour" 521 | } 522 | ], 523 | "contourcarpet": [ 524 | { 525 | "colorbar": { 526 | "outlinewidth": 0, 527 | "ticks": "" 528 | }, 529 | "type": "contourcarpet" 530 | } 531 | ], 532 | "heatmap": [ 533 | { 534 | "colorbar": { 535 | "outlinewidth": 0, 536 | "ticks": "" 537 | }, 538 | "colorscale": [ 539 | [ 540 | 0, 541 | "#0d0887" 542 | ], 543 | [ 544 | 0.1111111111111111, 545 | "#46039f" 546 | ], 547 | [ 548 | 0.2222222222222222, 549 | "#7201a8" 550 | ], 551 | [ 552 | 0.3333333333333333, 553 | "#9c179e" 554 | ], 555 | [ 556 | 0.4444444444444444, 557 | "#bd3786" 558 | ], 559 | [ 560 | 0.5555555555555556, 561 | "#d8576b" 562 | ], 563 | [ 564 | 0.6666666666666666, 565 | "#ed7953" 566 | ], 567 | [ 568 | 0.7777777777777778, 569 | "#fb9f3a" 570 | ], 571 | [ 572 | 0.8888888888888888, 573 | "#fdca26" 574 | ], 575 | [ 576 | 1, 577 | "#f0f921" 578 | ] 579 | ], 580 | "type": "heatmap" 581 | } 582 | ], 583 | "heatmapgl": [ 584 | { 585 | "colorbar": { 586 | "outlinewidth": 0, 587 | "ticks": "" 588 | }, 589 | "colorscale": [ 590 | [ 591 | 0, 592 | "#0d0887" 593 | ], 594 | [ 595 | 0.1111111111111111, 596 | "#46039f" 597 | ], 598 | [ 599 | 0.2222222222222222, 600 | "#7201a8" 601 | ], 602 | [ 603 | 0.3333333333333333, 604 | "#9c179e" 605 | ], 606 | [ 607 | 0.4444444444444444, 608 | "#bd3786" 609 | ], 610 | [ 611 | 0.5555555555555556, 612 | "#d8576b" 613 | ], 614 | [ 615 | 0.6666666666666666, 616 | "#ed7953" 617 | ], 618 | [ 619 | 0.7777777777777778, 620 | "#fb9f3a" 621 | ], 622 | [ 623 | 0.8888888888888888, 624 | "#fdca26" 625 | ], 626 | [ 627 | 1, 628 | "#f0f921" 629 | ] 630 | ], 631 | "type": "heatmapgl" 632 | } 633 | ], 634 | "histogram": [ 635 | { 636 | "marker": { 637 | "pattern": { 638 | "fillmode": "overlay", 639 | "size": 10, 640 | "solidity": 0.2 641 | } 642 | }, 643 | "type": "histogram" 644 | } 645 | ], 646 | "histogram2d": [ 647 | { 648 | "colorbar": { 649 | "outlinewidth": 0, 650 | "ticks": "" 651 | }, 652 | "colorscale": [ 653 | [ 654 | 0, 655 | "#0d0887" 656 | ], 657 | [ 658 | 0.1111111111111111, 659 | "#46039f" 660 | ], 661 | [ 662 | 0.2222222222222222, 663 | "#7201a8" 664 | ], 665 | [ 666 | 0.3333333333333333, 667 | "#9c179e" 668 | ], 669 | [ 670 | 0.4444444444444444, 671 | "#bd3786" 672 | ], 673 | [ 674 | 0.5555555555555556, 675 | "#d8576b" 676 | ], 677 | [ 678 | 0.6666666666666666, 679 | "#ed7953" 680 | ], 681 | [ 682 | 0.7777777777777778, 683 | "#fb9f3a" 684 | ], 685 | [ 686 | 0.8888888888888888, 687 | "#fdca26" 688 | ], 689 | [ 690 | 1, 691 | "#f0f921" 692 | ] 693 | ], 694 | "type": "histogram2d" 695 | } 696 | ], 697 | "histogram2dcontour": [ 698 | { 699 | "colorbar": { 700 | "outlinewidth": 0, 701 | "ticks": "" 702 | }, 703 | "colorscale": [ 704 | [ 705 | 0, 706 | "#0d0887" 707 | ], 708 | [ 709 | 0.1111111111111111, 710 | "#46039f" 711 | ], 712 | [ 713 | 0.2222222222222222, 714 | "#7201a8" 715 | ], 716 | [ 717 | 0.3333333333333333, 718 | "#9c179e" 719 | ], 720 | [ 721 | 0.4444444444444444, 722 | "#bd3786" 723 | ], 724 | [ 725 | 0.5555555555555556, 726 | "#d8576b" 727 | ], 728 | [ 729 | 0.6666666666666666, 730 | "#ed7953" 731 | ], 732 | [ 733 | 0.7777777777777778, 734 | "#fb9f3a" 735 | ], 736 | [ 737 | 0.8888888888888888, 738 | "#fdca26" 739 | ], 740 | [ 741 | 1, 742 | "#f0f921" 743 | ] 744 | ], 745 | "type": "histogram2dcontour" 746 | } 747 | ], 748 | "mesh3d": [ 749 | { 750 | "colorbar": { 751 | "outlinewidth": 0, 752 | "ticks": "" 753 | }, 754 | "type": "mesh3d" 755 | } 756 | ], 757 | "parcoords": [ 758 | { 759 | "line": { 760 | "colorbar": { 761 | "outlinewidth": 0, 762 | "ticks": "" 763 | } 764 | }, 765 | "type": "parcoords" 766 | } 767 | ], 768 | "pie": [ 769 | { 770 | "automargin": true, 771 | "type": "pie" 772 | } 773 | ], 774 | "scatter": [ 775 | { 776 | "fillpattern": { 777 | "fillmode": "overlay", 778 | "size": 10, 779 | "solidity": 0.2 780 | }, 781 | "type": "scatter" 782 | } 783 | ], 784 | "scatter3d": [ 785 | { 786 | "line": { 787 | "colorbar": { 788 | "outlinewidth": 0, 789 | "ticks": "" 790 | } 791 | }, 792 | "marker": { 793 | "colorbar": { 794 | "outlinewidth": 0, 795 | "ticks": "" 796 | } 797 | }, 798 | "type": "scatter3d" 799 | } 800 | ], 801 | "scattercarpet": [ 802 | { 803 | "marker": { 804 | "colorbar": { 805 | "outlinewidth": 0, 806 | "ticks": "" 807 | } 808 | }, 809 | "type": "scattercarpet" 810 | } 811 | ], 812 | "scattergeo": [ 813 | { 814 | "marker": { 815 | "colorbar": { 816 | "outlinewidth": 0, 817 | "ticks": "" 818 | } 819 | }, 820 | "type": "scattergeo" 821 | } 822 | ], 823 | "scattergl": [ 824 | { 825 | "marker": { 826 | "colorbar": { 827 | "outlinewidth": 0, 828 | "ticks": "" 829 | } 830 | }, 831 | "type": "scattergl" 832 | } 833 | ], 834 | "scattermapbox": [ 835 | { 836 | "marker": { 837 | "colorbar": { 838 | "outlinewidth": 0, 839 | "ticks": "" 840 | } 841 | }, 842 | "type": "scattermapbox" 843 | } 844 | ], 845 | "scatterpolar": [ 846 | { 847 | "marker": { 848 | "colorbar": { 849 | "outlinewidth": 0, 850 | "ticks": "" 851 | } 852 | }, 853 | "type": "scatterpolar" 854 | } 855 | ], 856 | "scatterpolargl": [ 857 | { 858 | "marker": { 859 | "colorbar": { 860 | "outlinewidth": 0, 861 | "ticks": "" 862 | } 863 | }, 864 | "type": "scatterpolargl" 865 | } 866 | ], 867 | "scatterternary": [ 868 | { 869 | "marker": { 870 | "colorbar": { 871 | "outlinewidth": 0, 872 | "ticks": "" 873 | } 874 | }, 875 | "type": "scatterternary" 876 | } 877 | ], 878 | "surface": [ 879 | { 880 | "colorbar": { 881 | "outlinewidth": 0, 882 | "ticks": "" 883 | }, 884 | "colorscale": [ 885 | [ 886 | 0, 887 | "#0d0887" 888 | ], 889 | [ 890 | 0.1111111111111111, 891 | "#46039f" 892 | ], 893 | [ 894 | 0.2222222222222222, 895 | "#7201a8" 896 | ], 897 | [ 898 | 0.3333333333333333, 899 | "#9c179e" 900 | ], 901 | [ 902 | 0.4444444444444444, 903 | "#bd3786" 904 | ], 905 | [ 906 | 0.5555555555555556, 907 | "#d8576b" 908 | ], 909 | [ 910 | 0.6666666666666666, 911 | "#ed7953" 912 | ], 913 | [ 914 | 0.7777777777777778, 915 | "#fb9f3a" 916 | ], 917 | [ 918 | 0.8888888888888888, 919 | "#fdca26" 920 | ], 921 | [ 922 | 1, 923 | "#f0f921" 924 | ] 925 | ], 926 | "type": "surface" 927 | } 928 | ], 929 | "table": [ 930 | { 931 | "cells": { 932 | "fill": { 933 | "color": "#EBF0F8" 934 | }, 935 | "line": { 936 | "color": "white" 937 | } 938 | }, 939 | "header": { 940 | "fill": { 941 | "color": "#C8D4E3" 942 | }, 943 | "line": { 944 | "color": "white" 945 | } 946 | }, 947 | "type": "table" 948 | } 949 | ] 950 | }, 951 | "layout": { 952 | "annotationdefaults": { 953 | "arrowcolor": "#2a3f5f", 954 | "arrowhead": 0, 955 | "arrowwidth": 1 956 | }, 957 | "autotypenumbers": "strict", 958 | "coloraxis": { 959 | "colorbar": { 960 | "outlinewidth": 0, 961 | "ticks": "" 962 | } 963 | }, 964 | "colorscale": { 965 | "diverging": [ 966 | [ 967 | 0, 968 | "#8e0152" 969 | ], 970 | [ 971 | 0.1, 972 | "#c51b7d" 973 | ], 974 | [ 975 | 0.2, 976 | "#de77ae" 977 | ], 978 | [ 979 | 0.3, 980 | "#f1b6da" 981 | ], 982 | [ 983 | 0.4, 984 | "#fde0ef" 985 | ], 986 | [ 987 | 0.5, 988 | "#f7f7f7" 989 | ], 990 | [ 991 | 0.6, 992 | "#e6f5d0" 993 | ], 994 | [ 995 | 0.7, 996 | "#b8e186" 997 | ], 998 | [ 999 | 0.8, 1000 | "#7fbc41" 1001 | ], 1002 | [ 1003 | 0.9, 1004 | "#4d9221" 1005 | ], 1006 | [ 1007 | 1, 1008 | "#276419" 1009 | ] 1010 | ], 1011 | "sequential": [ 1012 | [ 1013 | 0, 1014 | "#0d0887" 1015 | ], 1016 | [ 1017 | 0.1111111111111111, 1018 | "#46039f" 1019 | ], 1020 | [ 1021 | 0.2222222222222222, 1022 | "#7201a8" 1023 | ], 1024 | [ 1025 | 0.3333333333333333, 1026 | "#9c179e" 1027 | ], 1028 | [ 1029 | 0.4444444444444444, 1030 | "#bd3786" 1031 | ], 1032 | [ 1033 | 0.5555555555555556, 1034 | "#d8576b" 1035 | ], 1036 | [ 1037 | 0.6666666666666666, 1038 | "#ed7953" 1039 | ], 1040 | [ 1041 | 0.7777777777777778, 1042 | "#fb9f3a" 1043 | ], 1044 | [ 1045 | 0.8888888888888888, 1046 | "#fdca26" 1047 | ], 1048 | [ 1049 | 1, 1050 | "#f0f921" 1051 | ] 1052 | ], 1053 | "sequentialminus": [ 1054 | [ 1055 | 0, 1056 | "#0d0887" 1057 | ], 1058 | [ 1059 | 0.1111111111111111, 1060 | "#46039f" 1061 | ], 1062 | [ 1063 | 0.2222222222222222, 1064 | "#7201a8" 1065 | ], 1066 | [ 1067 | 0.3333333333333333, 1068 | "#9c179e" 1069 | ], 1070 | [ 1071 | 0.4444444444444444, 1072 | "#bd3786" 1073 | ], 1074 | [ 1075 | 0.5555555555555556, 1076 | "#d8576b" 1077 | ], 1078 | [ 1079 | 0.6666666666666666, 1080 | "#ed7953" 1081 | ], 1082 | [ 1083 | 0.7777777777777778, 1084 | "#fb9f3a" 1085 | ], 1086 | [ 1087 | 0.8888888888888888, 1088 | "#fdca26" 1089 | ], 1090 | [ 1091 | 1, 1092 | "#f0f921" 1093 | ] 1094 | ] 1095 | }, 1096 | "colorway": [ 1097 | "#636efa", 1098 | "#EF553B", 1099 | "#00cc96", 1100 | "#ab63fa", 1101 | "#FFA15A", 1102 | "#19d3f3", 1103 | "#FF6692", 1104 | "#B6E880", 1105 | "#FF97FF", 1106 | "#FECB52" 1107 | ], 1108 | "font": { 1109 | "color": "#2a3f5f" 1110 | }, 1111 | "geo": { 1112 | "bgcolor": "white", 1113 | "lakecolor": "white", 1114 | "landcolor": "white", 1115 | "showlakes": true, 1116 | "showland": true, 1117 | "subunitcolor": "#C8D4E3" 1118 | }, 1119 | "hoverlabel": { 1120 | "align": "left" 1121 | }, 1122 | "hovermode": "closest", 1123 | "mapbox": { 1124 | "style": "light" 1125 | }, 1126 | "paper_bgcolor": "white", 1127 | "plot_bgcolor": "white", 1128 | "polar": { 1129 | "angularaxis": { 1130 | "gridcolor": "#EBF0F8", 1131 | "linecolor": "#EBF0F8", 1132 | "ticks": "" 1133 | }, 1134 | "bgcolor": "white", 1135 | "radialaxis": { 1136 | "gridcolor": "#EBF0F8", 1137 | "linecolor": "#EBF0F8", 1138 | "ticks": "" 1139 | } 1140 | }, 1141 | "scene": { 1142 | "xaxis": { 1143 | "backgroundcolor": "white", 1144 | "gridcolor": "#DFE8F3", 1145 | "gridwidth": 2, 1146 | "linecolor": "#EBF0F8", 1147 | "showbackground": true, 1148 | "ticks": "", 1149 | "zerolinecolor": "#EBF0F8" 1150 | }, 1151 | "yaxis": { 1152 | "backgroundcolor": "white", 1153 | "gridcolor": "#DFE8F3", 1154 | "gridwidth": 2, 1155 | "linecolor": "#EBF0F8", 1156 | "showbackground": true, 1157 | "ticks": "", 1158 | "zerolinecolor": "#EBF0F8" 1159 | }, 1160 | "zaxis": { 1161 | "backgroundcolor": "white", 1162 | "gridcolor": "#DFE8F3", 1163 | "gridwidth": 2, 1164 | "linecolor": "#EBF0F8", 1165 | "showbackground": true, 1166 | "ticks": "", 1167 | "zerolinecolor": "#EBF0F8" 1168 | } 1169 | }, 1170 | "shapedefaults": { 1171 | "line": { 1172 | "color": "#2a3f5f" 1173 | } 1174 | }, 1175 | "ternary": { 1176 | "aaxis": { 1177 | "gridcolor": "#DFE8F3", 1178 | "linecolor": "#A2B1C6", 1179 | "ticks": "" 1180 | }, 1181 | "baxis": { 1182 | "gridcolor": "#DFE8F3", 1183 | "linecolor": "#A2B1C6", 1184 | "ticks": "" 1185 | }, 1186 | "bgcolor": "white", 1187 | "caxis": { 1188 | "gridcolor": "#DFE8F3", 1189 | "linecolor": "#A2B1C6", 1190 | "ticks": "" 1191 | } 1192 | }, 1193 | "title": { 1194 | "x": 0.05 1195 | }, 1196 | "xaxis": { 1197 | "automargin": true, 1198 | "gridcolor": "#EBF0F8", 1199 | "linecolor": "#EBF0F8", 1200 | "ticks": "", 1201 | "title": { 1202 | "standoff": 15 1203 | }, 1204 | "zerolinecolor": "#EBF0F8", 1205 | "zerolinewidth": 2 1206 | }, 1207 | "yaxis": { 1208 | "automargin": true, 1209 | "gridcolor": "#EBF0F8", 1210 | "linecolor": "#EBF0F8", 1211 | "ticks": "", 1212 | "title": { 1213 | "standoff": 15 1214 | }, 1215 | "zerolinecolor": "#EBF0F8", 1216 | "zerolinewidth": 2 1217 | } 1218 | } 1219 | }, 1220 | "title": { 1221 | "text": "Time-series of Temperature Change and CO₂ Concentrations" 1222 | }, 1223 | "xaxis": { 1224 | "title": { 1225 | "text": "Year" 1226 | } 1227 | }, 1228 | "yaxis": { 1229 | "title": { 1230 | "text": "Values" 1231 | } 1232 | } 1233 | } 1234 | } 1235 | }, 1236 | "metadata": {}, 1237 | "output_type": "display_data" 1238 | } 1239 | ], 1240 | "source": [ 1241 | "# Time series analysis\n", 1242 | "\n", 1243 | "import plotly.graph_objects as go\n", 1244 | "import plotly.express as px\n", 1245 | "\n", 1246 | "# extracting time-series data for plotting\n", 1247 | "# temperature: averaging across countries for each year\n", 1248 | "temperature_years = temperature_data.filter(regex='^F').mean(axis=0)\n", 1249 | "temperature_years.index = temperature_years.index.str.replace('F', '').astype(int)\n", 1250 | "\n", 1251 | "# CO2: parsing year and averaging monthly data\n", 1252 | "co2_data['Year'] = co2_data['Date'].str[:4].astype(int)\n", 1253 | "co2_yearly = co2_data.groupby('Year')['Value'].mean()\n", 1254 | "\n", 1255 | "# time-series plot for temperature and CO2 levels\n", 1256 | "fig = go.Figure()\n", 1257 | "fig.add_trace(go.Scatter(\n", 1258 | " x=temperature_years.index, y=temperature_years.values,\n", 1259 | " mode='lines+markers', name=\"Temperature Change (°C)\"\n", 1260 | "))\n", 1261 | "fig.add_trace(go.Scatter(\n", 1262 | " x=co2_yearly.index, y=co2_yearly.values,\n", 1263 | " mode='lines+markers', name=\"CO₂ Concentration (ppm)\", line=dict(dash='dash')\n", 1264 | "))\n", 1265 | "fig.update_layout(\n", 1266 | " title=\"Time-series of Temperature Change and CO₂ Concentrations\",\n", 1267 | " xaxis_title=\"Year\",\n", 1268 | " yaxis_title=\"Values\",\n", 1269 | " template=\"plotly_white\",\n", 1270 | " legend_title=\"Metrics\"\n", 1271 | ")\n", 1272 | "fig.show()" 1273 | ] 1274 | }, 1275 | { 1276 | "cell_type": "code", 1277 | "execution_count": 4, 1278 | "id": "bf96326a", 1279 | "metadata": {}, 1280 | "outputs": [ 1281 | { 1282 | "data": { 1283 | "application/vnd.plotly.v1+json": { 1284 | "config": { 1285 | "plotlyServerURL": "https://plot.ly" 1286 | }, 1287 | "data": [ 1288 | { 1289 | "coloraxis": "coloraxis", 1290 | "hovertemplate": "x: %{x}
y: %{y}
color: %{z}", 1291 | "name": "0", 1292 | "texttemplate": "%{z:.2f}", 1293 | "type": "heatmap", 1294 | "x": [ 1295 | "Temperature Change", 1296 | "CO₂ Concentration" 1297 | ], 1298 | "xaxis": "x", 1299 | "y": [ 1300 | "Temperature Change", 1301 | "CO₂ Concentration" 1302 | ], 1303 | "yaxis": "y", 1304 | "z": [ 1305 | [ 1306 | 1, 1307 | 0.9554282559257312 1308 | ], 1309 | [ 1310 | 0.9554282559257312, 1311 | 1 1312 | ] 1313 | ] 1314 | } 1315 | ], 1316 | "layout": { 1317 | "coloraxis": { 1318 | "colorscale": [ 1319 | [ 1320 | 0, 1321 | "rgb(103,0,31)" 1322 | ], 1323 | [ 1324 | 0.1, 1325 | "rgb(178,24,43)" 1326 | ], 1327 | [ 1328 | 0.2, 1329 | "rgb(214,96,77)" 1330 | ], 1331 | [ 1332 | 0.3, 1333 | "rgb(244,165,130)" 1334 | ], 1335 | [ 1336 | 0.4, 1337 | "rgb(253,219,199)" 1338 | ], 1339 | [ 1340 | 0.5, 1341 | "rgb(247,247,247)" 1342 | ], 1343 | [ 1344 | 0.6, 1345 | "rgb(209,229,240)" 1346 | ], 1347 | [ 1348 | 0.7, 1349 | "rgb(146,197,222)" 1350 | ], 1351 | [ 1352 | 0.8, 1353 | "rgb(67,147,195)" 1354 | ], 1355 | [ 1356 | 0.9, 1357 | "rgb(33,102,172)" 1358 | ], 1359 | [ 1360 | 1, 1361 | "rgb(5,48,97)" 1362 | ] 1363 | ] 1364 | }, 1365 | "template": { 1366 | "data": { 1367 | "bar": [ 1368 | { 1369 | "error_x": { 1370 | "color": "#2a3f5f" 1371 | }, 1372 | "error_y": { 1373 | "color": "#2a3f5f" 1374 | }, 1375 | "marker": { 1376 | "line": { 1377 | "color": "white", 1378 | "width": 0.5 1379 | }, 1380 | "pattern": { 1381 | "fillmode": "overlay", 1382 | "size": 10, 1383 | "solidity": 0.2 1384 | } 1385 | }, 1386 | "type": "bar" 1387 | } 1388 | ], 1389 | "barpolar": [ 1390 | { 1391 | "marker": { 1392 | "line": { 1393 | "color": "white", 1394 | "width": 0.5 1395 | }, 1396 | "pattern": { 1397 | "fillmode": "overlay", 1398 | "size": 10, 1399 | "solidity": 0.2 1400 | } 1401 | }, 1402 | "type": "barpolar" 1403 | } 1404 | ], 1405 | "carpet": [ 1406 | { 1407 | "aaxis": { 1408 | "endlinecolor": "#2a3f5f", 1409 | "gridcolor": "#C8D4E3", 1410 | "linecolor": "#C8D4E3", 1411 | "minorgridcolor": "#C8D4E3", 1412 | "startlinecolor": "#2a3f5f" 1413 | }, 1414 | "baxis": { 1415 | "endlinecolor": "#2a3f5f", 1416 | "gridcolor": "#C8D4E3", 1417 | "linecolor": "#C8D4E3", 1418 | "minorgridcolor": "#C8D4E3", 1419 | "startlinecolor": "#2a3f5f" 1420 | }, 1421 | "type": "carpet" 1422 | } 1423 | ], 1424 | "choropleth": [ 1425 | { 1426 | "colorbar": { 1427 | "outlinewidth": 0, 1428 | "ticks": "" 1429 | }, 1430 | "type": "choropleth" 1431 | } 1432 | ], 1433 | "contour": [ 1434 | { 1435 | "colorbar": { 1436 | "outlinewidth": 0, 1437 | "ticks": "" 1438 | }, 1439 | "colorscale": [ 1440 | [ 1441 | 0, 1442 | "#0d0887" 1443 | ], 1444 | [ 1445 | 0.1111111111111111, 1446 | "#46039f" 1447 | ], 1448 | [ 1449 | 0.2222222222222222, 1450 | "#7201a8" 1451 | ], 1452 | [ 1453 | 0.3333333333333333, 1454 | "#9c179e" 1455 | ], 1456 | [ 1457 | 0.4444444444444444, 1458 | "#bd3786" 1459 | ], 1460 | [ 1461 | 0.5555555555555556, 1462 | "#d8576b" 1463 | ], 1464 | [ 1465 | 0.6666666666666666, 1466 | "#ed7953" 1467 | ], 1468 | [ 1469 | 0.7777777777777778, 1470 | "#fb9f3a" 1471 | ], 1472 | [ 1473 | 0.8888888888888888, 1474 | "#fdca26" 1475 | ], 1476 | [ 1477 | 1, 1478 | "#f0f921" 1479 | ] 1480 | ], 1481 | "type": "contour" 1482 | } 1483 | ], 1484 | "contourcarpet": [ 1485 | { 1486 | "colorbar": { 1487 | "outlinewidth": 0, 1488 | "ticks": "" 1489 | }, 1490 | "type": "contourcarpet" 1491 | } 1492 | ], 1493 | "heatmap": [ 1494 | { 1495 | "colorbar": { 1496 | "outlinewidth": 0, 1497 | "ticks": "" 1498 | }, 1499 | "colorscale": [ 1500 | [ 1501 | 0, 1502 | "#0d0887" 1503 | ], 1504 | [ 1505 | 0.1111111111111111, 1506 | "#46039f" 1507 | ], 1508 | [ 1509 | 0.2222222222222222, 1510 | "#7201a8" 1511 | ], 1512 | [ 1513 | 0.3333333333333333, 1514 | "#9c179e" 1515 | ], 1516 | [ 1517 | 0.4444444444444444, 1518 | "#bd3786" 1519 | ], 1520 | [ 1521 | 0.5555555555555556, 1522 | "#d8576b" 1523 | ], 1524 | [ 1525 | 0.6666666666666666, 1526 | "#ed7953" 1527 | ], 1528 | [ 1529 | 0.7777777777777778, 1530 | "#fb9f3a" 1531 | ], 1532 | [ 1533 | 0.8888888888888888, 1534 | "#fdca26" 1535 | ], 1536 | [ 1537 | 1, 1538 | "#f0f921" 1539 | ] 1540 | ], 1541 | "type": "heatmap" 1542 | } 1543 | ], 1544 | "heatmapgl": [ 1545 | { 1546 | "colorbar": { 1547 | "outlinewidth": 0, 1548 | "ticks": "" 1549 | }, 1550 | "colorscale": [ 1551 | [ 1552 | 0, 1553 | "#0d0887" 1554 | ], 1555 | [ 1556 | 0.1111111111111111, 1557 | "#46039f" 1558 | ], 1559 | [ 1560 | 0.2222222222222222, 1561 | "#7201a8" 1562 | ], 1563 | [ 1564 | 0.3333333333333333, 1565 | "#9c179e" 1566 | ], 1567 | [ 1568 | 0.4444444444444444, 1569 | "#bd3786" 1570 | ], 1571 | [ 1572 | 0.5555555555555556, 1573 | "#d8576b" 1574 | ], 1575 | [ 1576 | 0.6666666666666666, 1577 | "#ed7953" 1578 | ], 1579 | [ 1580 | 0.7777777777777778, 1581 | "#fb9f3a" 1582 | ], 1583 | [ 1584 | 0.8888888888888888, 1585 | "#fdca26" 1586 | ], 1587 | [ 1588 | 1, 1589 | "#f0f921" 1590 | ] 1591 | ], 1592 | "type": "heatmapgl" 1593 | } 1594 | ], 1595 | "histogram": [ 1596 | { 1597 | "marker": { 1598 | "pattern": { 1599 | "fillmode": "overlay", 1600 | "size": 10, 1601 | "solidity": 0.2 1602 | } 1603 | }, 1604 | "type": "histogram" 1605 | } 1606 | ], 1607 | "histogram2d": [ 1608 | { 1609 | "colorbar": { 1610 | "outlinewidth": 0, 1611 | "ticks": "" 1612 | }, 1613 | "colorscale": [ 1614 | [ 1615 | 0, 1616 | "#0d0887" 1617 | ], 1618 | [ 1619 | 0.1111111111111111, 1620 | "#46039f" 1621 | ], 1622 | [ 1623 | 0.2222222222222222, 1624 | "#7201a8" 1625 | ], 1626 | [ 1627 | 0.3333333333333333, 1628 | "#9c179e" 1629 | ], 1630 | [ 1631 | 0.4444444444444444, 1632 | "#bd3786" 1633 | ], 1634 | [ 1635 | 0.5555555555555556, 1636 | "#d8576b" 1637 | ], 1638 | [ 1639 | 0.6666666666666666, 1640 | "#ed7953" 1641 | ], 1642 | [ 1643 | 0.7777777777777778, 1644 | "#fb9f3a" 1645 | ], 1646 | [ 1647 | 0.8888888888888888, 1648 | "#fdca26" 1649 | ], 1650 | [ 1651 | 1, 1652 | "#f0f921" 1653 | ] 1654 | ], 1655 | "type": "histogram2d" 1656 | } 1657 | ], 1658 | "histogram2dcontour": [ 1659 | { 1660 | "colorbar": { 1661 | "outlinewidth": 0, 1662 | "ticks": "" 1663 | }, 1664 | "colorscale": [ 1665 | [ 1666 | 0, 1667 | "#0d0887" 1668 | ], 1669 | [ 1670 | 0.1111111111111111, 1671 | "#46039f" 1672 | ], 1673 | [ 1674 | 0.2222222222222222, 1675 | "#7201a8" 1676 | ], 1677 | [ 1678 | 0.3333333333333333, 1679 | "#9c179e" 1680 | ], 1681 | [ 1682 | 0.4444444444444444, 1683 | "#bd3786" 1684 | ], 1685 | [ 1686 | 0.5555555555555556, 1687 | "#d8576b" 1688 | ], 1689 | [ 1690 | 0.6666666666666666, 1691 | "#ed7953" 1692 | ], 1693 | [ 1694 | 0.7777777777777778, 1695 | "#fb9f3a" 1696 | ], 1697 | [ 1698 | 0.8888888888888888, 1699 | "#fdca26" 1700 | ], 1701 | [ 1702 | 1, 1703 | "#f0f921" 1704 | ] 1705 | ], 1706 | "type": "histogram2dcontour" 1707 | } 1708 | ], 1709 | "mesh3d": [ 1710 | { 1711 | "colorbar": { 1712 | "outlinewidth": 0, 1713 | "ticks": "" 1714 | }, 1715 | "type": "mesh3d" 1716 | } 1717 | ], 1718 | "parcoords": [ 1719 | { 1720 | "line": { 1721 | "colorbar": { 1722 | "outlinewidth": 0, 1723 | "ticks": "" 1724 | } 1725 | }, 1726 | "type": "parcoords" 1727 | } 1728 | ], 1729 | "pie": [ 1730 | { 1731 | "automargin": true, 1732 | "type": "pie" 1733 | } 1734 | ], 1735 | "scatter": [ 1736 | { 1737 | "fillpattern": { 1738 | "fillmode": "overlay", 1739 | "size": 10, 1740 | "solidity": 0.2 1741 | }, 1742 | "type": "scatter" 1743 | } 1744 | ], 1745 | "scatter3d": [ 1746 | { 1747 | "line": { 1748 | "colorbar": { 1749 | "outlinewidth": 0, 1750 | "ticks": "" 1751 | } 1752 | }, 1753 | "marker": { 1754 | "colorbar": { 1755 | "outlinewidth": 0, 1756 | "ticks": "" 1757 | } 1758 | }, 1759 | "type": "scatter3d" 1760 | } 1761 | ], 1762 | "scattercarpet": [ 1763 | { 1764 | "marker": { 1765 | "colorbar": { 1766 | "outlinewidth": 0, 1767 | "ticks": "" 1768 | } 1769 | }, 1770 | "type": "scattercarpet" 1771 | } 1772 | ], 1773 | "scattergeo": [ 1774 | { 1775 | "marker": { 1776 | "colorbar": { 1777 | "outlinewidth": 0, 1778 | "ticks": "" 1779 | } 1780 | }, 1781 | "type": "scattergeo" 1782 | } 1783 | ], 1784 | "scattergl": [ 1785 | { 1786 | "marker": { 1787 | "colorbar": { 1788 | "outlinewidth": 0, 1789 | "ticks": "" 1790 | } 1791 | }, 1792 | "type": "scattergl" 1793 | } 1794 | ], 1795 | "scattermapbox": [ 1796 | { 1797 | "marker": { 1798 | "colorbar": { 1799 | "outlinewidth": 0, 1800 | "ticks": "" 1801 | } 1802 | }, 1803 | "type": "scattermapbox" 1804 | } 1805 | ], 1806 | "scatterpolar": [ 1807 | { 1808 | "marker": { 1809 | "colorbar": { 1810 | "outlinewidth": 0, 1811 | "ticks": "" 1812 | } 1813 | }, 1814 | "type": "scatterpolar" 1815 | } 1816 | ], 1817 | "scatterpolargl": [ 1818 | { 1819 | "marker": { 1820 | "colorbar": { 1821 | "outlinewidth": 0, 1822 | "ticks": "" 1823 | } 1824 | }, 1825 | "type": "scatterpolargl" 1826 | } 1827 | ], 1828 | "scatterternary": [ 1829 | { 1830 | "marker": { 1831 | "colorbar": { 1832 | "outlinewidth": 0, 1833 | "ticks": "" 1834 | } 1835 | }, 1836 | "type": "scatterternary" 1837 | } 1838 | ], 1839 | "surface": [ 1840 | { 1841 | "colorbar": { 1842 | "outlinewidth": 0, 1843 | "ticks": "" 1844 | }, 1845 | "colorscale": [ 1846 | [ 1847 | 0, 1848 | "#0d0887" 1849 | ], 1850 | [ 1851 | 0.1111111111111111, 1852 | "#46039f" 1853 | ], 1854 | [ 1855 | 0.2222222222222222, 1856 | "#7201a8" 1857 | ], 1858 | [ 1859 | 0.3333333333333333, 1860 | "#9c179e" 1861 | ], 1862 | [ 1863 | 0.4444444444444444, 1864 | "#bd3786" 1865 | ], 1866 | [ 1867 | 0.5555555555555556, 1868 | "#d8576b" 1869 | ], 1870 | [ 1871 | 0.6666666666666666, 1872 | "#ed7953" 1873 | ], 1874 | [ 1875 | 0.7777777777777778, 1876 | "#fb9f3a" 1877 | ], 1878 | [ 1879 | 0.8888888888888888, 1880 | "#fdca26" 1881 | ], 1882 | [ 1883 | 1, 1884 | "#f0f921" 1885 | ] 1886 | ], 1887 | "type": "surface" 1888 | } 1889 | ], 1890 | "table": [ 1891 | { 1892 | "cells": { 1893 | "fill": { 1894 | "color": "#EBF0F8" 1895 | }, 1896 | "line": { 1897 | "color": "white" 1898 | } 1899 | }, 1900 | "header": { 1901 | "fill": { 1902 | "color": "#C8D4E3" 1903 | }, 1904 | "line": { 1905 | "color": "white" 1906 | } 1907 | }, 1908 | "type": "table" 1909 | } 1910 | ] 1911 | }, 1912 | "layout": { 1913 | "annotationdefaults": { 1914 | "arrowcolor": "#2a3f5f", 1915 | "arrowhead": 0, 1916 | "arrowwidth": 1 1917 | }, 1918 | "autotypenumbers": "strict", 1919 | "coloraxis": { 1920 | "colorbar": { 1921 | "outlinewidth": 0, 1922 | "ticks": "" 1923 | } 1924 | }, 1925 | "colorscale": { 1926 | "diverging": [ 1927 | [ 1928 | 0, 1929 | "#8e0152" 1930 | ], 1931 | [ 1932 | 0.1, 1933 | "#c51b7d" 1934 | ], 1935 | [ 1936 | 0.2, 1937 | "#de77ae" 1938 | ], 1939 | [ 1940 | 0.3, 1941 | "#f1b6da" 1942 | ], 1943 | [ 1944 | 0.4, 1945 | "#fde0ef" 1946 | ], 1947 | [ 1948 | 0.5, 1949 | "#f7f7f7" 1950 | ], 1951 | [ 1952 | 0.6, 1953 | "#e6f5d0" 1954 | ], 1955 | [ 1956 | 0.7, 1957 | "#b8e186" 1958 | ], 1959 | [ 1960 | 0.8, 1961 | "#7fbc41" 1962 | ], 1963 | [ 1964 | 0.9, 1965 | "#4d9221" 1966 | ], 1967 | [ 1968 | 1, 1969 | "#276419" 1970 | ] 1971 | ], 1972 | "sequential": [ 1973 | [ 1974 | 0, 1975 | "#0d0887" 1976 | ], 1977 | [ 1978 | 0.1111111111111111, 1979 | "#46039f" 1980 | ], 1981 | [ 1982 | 0.2222222222222222, 1983 | "#7201a8" 1984 | ], 1985 | [ 1986 | 0.3333333333333333, 1987 | "#9c179e" 1988 | ], 1989 | [ 1990 | 0.4444444444444444, 1991 | "#bd3786" 1992 | ], 1993 | [ 1994 | 0.5555555555555556, 1995 | "#d8576b" 1996 | ], 1997 | [ 1998 | 0.6666666666666666, 1999 | "#ed7953" 2000 | ], 2001 | [ 2002 | 0.7777777777777778, 2003 | "#fb9f3a" 2004 | ], 2005 | [ 2006 | 0.8888888888888888, 2007 | "#fdca26" 2008 | ], 2009 | [ 2010 | 1, 2011 | "#f0f921" 2012 | ] 2013 | ], 2014 | "sequentialminus": [ 2015 | [ 2016 | 0, 2017 | "#0d0887" 2018 | ], 2019 | [ 2020 | 0.1111111111111111, 2021 | "#46039f" 2022 | ], 2023 | [ 2024 | 0.2222222222222222, 2025 | "#7201a8" 2026 | ], 2027 | [ 2028 | 0.3333333333333333, 2029 | "#9c179e" 2030 | ], 2031 | [ 2032 | 0.4444444444444444, 2033 | "#bd3786" 2034 | ], 2035 | [ 2036 | 0.5555555555555556, 2037 | "#d8576b" 2038 | ], 2039 | [ 2040 | 0.6666666666666666, 2041 | "#ed7953" 2042 | ], 2043 | [ 2044 | 0.7777777777777778, 2045 | "#fb9f3a" 2046 | ], 2047 | [ 2048 | 0.8888888888888888, 2049 | "#fdca26" 2050 | ], 2051 | [ 2052 | 1, 2053 | "#f0f921" 2054 | ] 2055 | ] 2056 | }, 2057 | "colorway": [ 2058 | "#636efa", 2059 | "#EF553B", 2060 | "#00cc96", 2061 | "#ab63fa", 2062 | "#FFA15A", 2063 | "#19d3f3", 2064 | "#FF6692", 2065 | "#B6E880", 2066 | "#FF97FF", 2067 | "#FECB52" 2068 | ], 2069 | "font": { 2070 | "color": "#2a3f5f" 2071 | }, 2072 | "geo": { 2073 | "bgcolor": "white", 2074 | "lakecolor": "white", 2075 | "landcolor": "white", 2076 | "showlakes": true, 2077 | "showland": true, 2078 | "subunitcolor": "#C8D4E3" 2079 | }, 2080 | "hoverlabel": { 2081 | "align": "left" 2082 | }, 2083 | "hovermode": "closest", 2084 | "mapbox": { 2085 | "style": "light" 2086 | }, 2087 | "paper_bgcolor": "white", 2088 | "plot_bgcolor": "white", 2089 | "polar": { 2090 | "angularaxis": { 2091 | "gridcolor": "#EBF0F8", 2092 | "linecolor": "#EBF0F8", 2093 | "ticks": "" 2094 | }, 2095 | "bgcolor": "white", 2096 | "radialaxis": { 2097 | "gridcolor": "#EBF0F8", 2098 | "linecolor": "#EBF0F8", 2099 | "ticks": "" 2100 | } 2101 | }, 2102 | "scene": { 2103 | "xaxis": { 2104 | "backgroundcolor": "white", 2105 | "gridcolor": "#DFE8F3", 2106 | "gridwidth": 2, 2107 | "linecolor": "#EBF0F8", 2108 | "showbackground": true, 2109 | "ticks": "", 2110 | "zerolinecolor": "#EBF0F8" 2111 | }, 2112 | "yaxis": { 2113 | "backgroundcolor": "white", 2114 | "gridcolor": "#DFE8F3", 2115 | "gridwidth": 2, 2116 | "linecolor": "#EBF0F8", 2117 | "showbackground": true, 2118 | "ticks": "", 2119 | "zerolinecolor": "#EBF0F8" 2120 | }, 2121 | "zaxis": { 2122 | "backgroundcolor": "white", 2123 | "gridcolor": "#DFE8F3", 2124 | "gridwidth": 2, 2125 | "linecolor": "#EBF0F8", 2126 | "showbackground": true, 2127 | "ticks": "", 2128 | "zerolinecolor": "#EBF0F8" 2129 | } 2130 | }, 2131 | "shapedefaults": { 2132 | "line": { 2133 | "color": "#2a3f5f" 2134 | } 2135 | }, 2136 | "ternary": { 2137 | "aaxis": { 2138 | "gridcolor": "#DFE8F3", 2139 | "linecolor": "#A2B1C6", 2140 | "ticks": "" 2141 | }, 2142 | "baxis": { 2143 | "gridcolor": "#DFE8F3", 2144 | "linecolor": "#A2B1C6", 2145 | "ticks": "" 2146 | }, 2147 | "bgcolor": "white", 2148 | "caxis": { 2149 | "gridcolor": "#DFE8F3", 2150 | "linecolor": "#A2B1C6", 2151 | "ticks": "" 2152 | } 2153 | }, 2154 | "title": { 2155 | "x": 0.05 2156 | }, 2157 | "xaxis": { 2158 | "automargin": true, 2159 | "gridcolor": "#EBF0F8", 2160 | "linecolor": "#EBF0F8", 2161 | "ticks": "", 2162 | "title": { 2163 | "standoff": 15 2164 | }, 2165 | "zerolinecolor": "#EBF0F8", 2166 | "zerolinewidth": 2 2167 | }, 2168 | "yaxis": { 2169 | "automargin": true, 2170 | "gridcolor": "#EBF0F8", 2171 | "linecolor": "#EBF0F8", 2172 | "ticks": "", 2173 | "title": { 2174 | "standoff": 15 2175 | }, 2176 | "zerolinecolor": "#EBF0F8", 2177 | "zerolinewidth": 2 2178 | } 2179 | } 2180 | }, 2181 | "title": { 2182 | "text": "Correlation Heatmap" 2183 | }, 2184 | "xaxis": { 2185 | "anchor": "y", 2186 | "constrain": "domain", 2187 | "domain": [ 2188 | 0, 2189 | 1 2190 | ], 2191 | "scaleanchor": "y" 2192 | }, 2193 | "yaxis": { 2194 | "anchor": "x", 2195 | "autorange": "reversed", 2196 | "constrain": "domain", 2197 | "domain": [ 2198 | 0, 2199 | 1 2200 | ] 2201 | } 2202 | } 2203 | } 2204 | }, 2205 | "metadata": {}, 2206 | "output_type": "display_data" 2207 | } 2208 | ], 2209 | "source": [ 2210 | "# correlation heatmap\n", 2211 | "merged_data = pd.DataFrame({\n", 2212 | " \"Temperature Change\": temperature_years,\n", 2213 | " \"CO₂ Concentration\": co2_yearly\n", 2214 | "}).dropna()\n", 2215 | "\n", 2216 | "heatmap_fig = px.imshow(\n", 2217 | " merged_data.corr(),\n", 2218 | " text_auto=\".2f\",\n", 2219 | " color_continuous_scale=\"RdBu\", # diverging colormap similar to coolwarm\n", 2220 | " title=\"Correlation Heatmap\"\n", 2221 | ")\n", 2222 | "heatmap_fig.update_layout(\n", 2223 | " template=\"plotly_white\"\n", 2224 | ")\n", 2225 | "heatmap_fig.show()" 2226 | ] 2227 | }, 2228 | { 2229 | "cell_type": "code", 2230 | "execution_count": 5, 2231 | "id": "985a66d6", 2232 | "metadata": {}, 2233 | "outputs": [ 2234 | { 2235 | "data": { 2236 | "application/vnd.plotly.v1+json": { 2237 | "config": { 2238 | "plotlyServerURL": "https://plot.ly" 2239 | }, 2240 | "data": [ 2241 | { 2242 | "hovertemplate": "CO₂ Concentration (ppm)=%{x}
Temperature Change (°C)=%{y}", 2243 | "legendgroup": "", 2244 | "marker": { 2245 | "color": "#636efa", 2246 | "opacity": 0.7, 2247 | "size": 10, 2248 | "symbol": "circle" 2249 | }, 2250 | "mode": "markers", 2251 | "name": "", 2252 | "orientation": "v", 2253 | "showlegend": false, 2254 | "type": "scatter", 2255 | "x": [ 2256 | 158.93833333333333, 2257 | 159.355, 2258 | 159.58041666666668, 2259 | 159.90583333333333, 2260 | 160.08333333333334, 2261 | 160.89208333333332, 2262 | 161.21666666666667, 2263 | 161.65958333333333, 2264 | 162.555, 2265 | 163.00375, 2266 | 163.25666666666666, 2267 | 163.90291666666667, 2268 | 165.17791666666668, 2269 | 165.17375, 2270 | 165.70708333333332, 2271 | 166.14875, 2272 | 167.19666666666666, 2273 | 167.9425, 2274 | 168.62958333333333, 2275 | 169.66708333333332, 2276 | 170.26041666666666, 2277 | 170.93916666666667, 2278 | 171.8216666666667, 2279 | 172.6833333333333, 2280 | 173.39125, 2281 | 173.98625, 2282 | 174.90125, 2283 | 176.18541666666667, 2284 | 176.8175, 2285 | 177.40333333333334, 2286 | 178.02833333333334, 2287 | 178.39166666666665, 2288 | 178.70125, 2289 | 179.72375, 2290 | 180.76458333333335, 2291 | 181.61791666666667, 2292 | 182.095, 2293 | 183.8275, 2294 | 184.50166666666667, 2295 | 185.01250000000002, 2296 | 185.87708333333333, 2297 | 187.01375, 2298 | 188.33166666666668, 2299 | 189.07625, 2300 | 190.29458333333332, 2301 | 191.32291666666666, 2302 | 192.26541666666665, 2303 | 193.15166666666667, 2304 | 194.05499999999998, 2305 | 195.36833333333334, 2306 | 196.15, 2307 | 197.30958333333334, 2308 | 198.70875, 2309 | 199.66750000000002, 2310 | 200.78208333333336, 2311 | 202.63083333333336, 2312 | 203.66916666666668, 2313 | 204.59875, 2314 | 206.1833333333333, 2315 | 207.41666666666666, 2316 | 208.47208333333333, 2317 | 209.51833333333335 2318 | ], 2319 | "xaxis": "x", 2320 | "y": [ 2321 | 0.1630531914893617, 2322 | -0.01347619047619048, 2323 | -0.006042553191489363, 2324 | -0.07005851063829789, 2325 | -0.24702659574468086, 2326 | 0.10550520833333336, 2327 | -0.11083246073298428, 2328 | -0.19910994764397907, 2329 | 0.15794210526315788, 2330 | 0.09248677248677246, 2331 | -0.20051308900523562, 2332 | -0.08490625, 2333 | 0.2293678756476684, 2334 | -0.16303125, 2335 | -0.023494680851063827, 2336 | -0.24591534391534392, 2337 | 0.1658162162162162, 2338 | 0.06962962962962962, 2339 | 0.2337989417989418, 2340 | 0.24728795811518325, 2341 | 0.1786439790575916, 2342 | 0.17649479166666668, 2343 | 0.34459473684210523, 2344 | 0.08011702127659574, 2345 | 0.07128723404255319, 2346 | 0.1511578947368421, 2347 | 0.405021052631579, 2348 | 0.4900894736842106, 2349 | 0.25616842105263155, 2350 | 0.5552592592592592, 2351 | 0.3681648936170213, 2352 | 0.2364903846153846, 2353 | 0.2159856459330144, 2354 | 0.609514423076923, 2355 | 0.6292380952380952, 2356 | 0.27922857142857144, 2357 | 0.5439951690821256, 2358 | 0.971252380952381, 2359 | 0.7433014354066987, 2360 | 0.6697894736842105, 2361 | 0.8501538461538461, 2362 | 0.9249999999999998, 2363 | 0.8442289719626169, 2364 | 0.7778403755868545, 2365 | 0.8529905660377357, 2366 | 0.8765767441860465, 2367 | 1.0225483870967744, 2368 | 0.8084103773584905, 2369 | 0.9105660377358491, 2370 | 1.0990418604651164, 2371 | 0.8213917050691244, 2372 | 0.9022232558139536, 2373 | 0.931199074074074, 2374 | 1.114814814814815, 2375 | 1.269773148148148, 2376 | 1.4395211267605634, 2377 | 1.2807850467289719, 2378 | 1.3021126760563382, 2379 | 1.4430610328638498, 2380 | 1.5520377358490567, 2381 | 1.343530516431925, 2382 | 1.382112676056338 2383 | ], 2384 | "yaxis": "y" 2385 | } 2386 | ], 2387 | "layout": { 2388 | "legend": { 2389 | "tracegroupgap": 0 2390 | }, 2391 | "template": { 2392 | "data": { 2393 | "bar": [ 2394 | { 2395 | "error_x": { 2396 | "color": "#2a3f5f" 2397 | }, 2398 | "error_y": { 2399 | "color": "#2a3f5f" 2400 | }, 2401 | "marker": { 2402 | "line": { 2403 | "color": "white", 2404 | "width": 0.5 2405 | }, 2406 | "pattern": { 2407 | "fillmode": "overlay", 2408 | "size": 10, 2409 | "solidity": 0.2 2410 | } 2411 | }, 2412 | "type": "bar" 2413 | } 2414 | ], 2415 | "barpolar": [ 2416 | { 2417 | "marker": { 2418 | "line": { 2419 | "color": "white", 2420 | "width": 0.5 2421 | }, 2422 | "pattern": { 2423 | "fillmode": "overlay", 2424 | "size": 10, 2425 | "solidity": 0.2 2426 | } 2427 | }, 2428 | "type": "barpolar" 2429 | } 2430 | ], 2431 | "carpet": [ 2432 | { 2433 | "aaxis": { 2434 | "endlinecolor": "#2a3f5f", 2435 | "gridcolor": "#C8D4E3", 2436 | "linecolor": "#C8D4E3", 2437 | "minorgridcolor": "#C8D4E3", 2438 | "startlinecolor": "#2a3f5f" 2439 | }, 2440 | "baxis": { 2441 | "endlinecolor": "#2a3f5f", 2442 | "gridcolor": "#C8D4E3", 2443 | "linecolor": "#C8D4E3", 2444 | "minorgridcolor": "#C8D4E3", 2445 | "startlinecolor": "#2a3f5f" 2446 | }, 2447 | "type": "carpet" 2448 | } 2449 | ], 2450 | "choropleth": [ 2451 | { 2452 | "colorbar": { 2453 | "outlinewidth": 0, 2454 | "ticks": "" 2455 | }, 2456 | "type": "choropleth" 2457 | } 2458 | ], 2459 | "contour": [ 2460 | { 2461 | "colorbar": { 2462 | "outlinewidth": 0, 2463 | "ticks": "" 2464 | }, 2465 | "colorscale": [ 2466 | [ 2467 | 0, 2468 | "#0d0887" 2469 | ], 2470 | [ 2471 | 0.1111111111111111, 2472 | "#46039f" 2473 | ], 2474 | [ 2475 | 0.2222222222222222, 2476 | "#7201a8" 2477 | ], 2478 | [ 2479 | 0.3333333333333333, 2480 | "#9c179e" 2481 | ], 2482 | [ 2483 | 0.4444444444444444, 2484 | "#bd3786" 2485 | ], 2486 | [ 2487 | 0.5555555555555556, 2488 | "#d8576b" 2489 | ], 2490 | [ 2491 | 0.6666666666666666, 2492 | "#ed7953" 2493 | ], 2494 | [ 2495 | 0.7777777777777778, 2496 | "#fb9f3a" 2497 | ], 2498 | [ 2499 | 0.8888888888888888, 2500 | "#fdca26" 2501 | ], 2502 | [ 2503 | 1, 2504 | "#f0f921" 2505 | ] 2506 | ], 2507 | "type": "contour" 2508 | } 2509 | ], 2510 | "contourcarpet": [ 2511 | { 2512 | "colorbar": { 2513 | "outlinewidth": 0, 2514 | "ticks": "" 2515 | }, 2516 | "type": "contourcarpet" 2517 | } 2518 | ], 2519 | "heatmap": [ 2520 | { 2521 | "colorbar": { 2522 | "outlinewidth": 0, 2523 | "ticks": "" 2524 | }, 2525 | "colorscale": [ 2526 | [ 2527 | 0, 2528 | "#0d0887" 2529 | ], 2530 | [ 2531 | 0.1111111111111111, 2532 | "#46039f" 2533 | ], 2534 | [ 2535 | 0.2222222222222222, 2536 | "#7201a8" 2537 | ], 2538 | [ 2539 | 0.3333333333333333, 2540 | "#9c179e" 2541 | ], 2542 | [ 2543 | 0.4444444444444444, 2544 | "#bd3786" 2545 | ], 2546 | [ 2547 | 0.5555555555555556, 2548 | "#d8576b" 2549 | ], 2550 | [ 2551 | 0.6666666666666666, 2552 | "#ed7953" 2553 | ], 2554 | [ 2555 | 0.7777777777777778, 2556 | "#fb9f3a" 2557 | ], 2558 | [ 2559 | 0.8888888888888888, 2560 | "#fdca26" 2561 | ], 2562 | [ 2563 | 1, 2564 | "#f0f921" 2565 | ] 2566 | ], 2567 | "type": "heatmap" 2568 | } 2569 | ], 2570 | "heatmapgl": [ 2571 | { 2572 | "colorbar": { 2573 | "outlinewidth": 0, 2574 | "ticks": "" 2575 | }, 2576 | "colorscale": [ 2577 | [ 2578 | 0, 2579 | "#0d0887" 2580 | ], 2581 | [ 2582 | 0.1111111111111111, 2583 | "#46039f" 2584 | ], 2585 | [ 2586 | 0.2222222222222222, 2587 | "#7201a8" 2588 | ], 2589 | [ 2590 | 0.3333333333333333, 2591 | "#9c179e" 2592 | ], 2593 | [ 2594 | 0.4444444444444444, 2595 | "#bd3786" 2596 | ], 2597 | [ 2598 | 0.5555555555555556, 2599 | "#d8576b" 2600 | ], 2601 | [ 2602 | 0.6666666666666666, 2603 | "#ed7953" 2604 | ], 2605 | [ 2606 | 0.7777777777777778, 2607 | "#fb9f3a" 2608 | ], 2609 | [ 2610 | 0.8888888888888888, 2611 | "#fdca26" 2612 | ], 2613 | [ 2614 | 1, 2615 | "#f0f921" 2616 | ] 2617 | ], 2618 | "type": "heatmapgl" 2619 | } 2620 | ], 2621 | "histogram": [ 2622 | { 2623 | "marker": { 2624 | "pattern": { 2625 | "fillmode": "overlay", 2626 | "size": 10, 2627 | "solidity": 0.2 2628 | } 2629 | }, 2630 | "type": "histogram" 2631 | } 2632 | ], 2633 | "histogram2d": [ 2634 | { 2635 | "colorbar": { 2636 | "outlinewidth": 0, 2637 | "ticks": "" 2638 | }, 2639 | "colorscale": [ 2640 | [ 2641 | 0, 2642 | "#0d0887" 2643 | ], 2644 | [ 2645 | 0.1111111111111111, 2646 | "#46039f" 2647 | ], 2648 | [ 2649 | 0.2222222222222222, 2650 | "#7201a8" 2651 | ], 2652 | [ 2653 | 0.3333333333333333, 2654 | "#9c179e" 2655 | ], 2656 | [ 2657 | 0.4444444444444444, 2658 | "#bd3786" 2659 | ], 2660 | [ 2661 | 0.5555555555555556, 2662 | "#d8576b" 2663 | ], 2664 | [ 2665 | 0.6666666666666666, 2666 | "#ed7953" 2667 | ], 2668 | [ 2669 | 0.7777777777777778, 2670 | "#fb9f3a" 2671 | ], 2672 | [ 2673 | 0.8888888888888888, 2674 | "#fdca26" 2675 | ], 2676 | [ 2677 | 1, 2678 | "#f0f921" 2679 | ] 2680 | ], 2681 | "type": "histogram2d" 2682 | } 2683 | ], 2684 | "histogram2dcontour": [ 2685 | { 2686 | "colorbar": { 2687 | "outlinewidth": 0, 2688 | "ticks": "" 2689 | }, 2690 | "colorscale": [ 2691 | [ 2692 | 0, 2693 | "#0d0887" 2694 | ], 2695 | [ 2696 | 0.1111111111111111, 2697 | "#46039f" 2698 | ], 2699 | [ 2700 | 0.2222222222222222, 2701 | "#7201a8" 2702 | ], 2703 | [ 2704 | 0.3333333333333333, 2705 | "#9c179e" 2706 | ], 2707 | [ 2708 | 0.4444444444444444, 2709 | "#bd3786" 2710 | ], 2711 | [ 2712 | 0.5555555555555556, 2713 | "#d8576b" 2714 | ], 2715 | [ 2716 | 0.6666666666666666, 2717 | "#ed7953" 2718 | ], 2719 | [ 2720 | 0.7777777777777778, 2721 | "#fb9f3a" 2722 | ], 2723 | [ 2724 | 0.8888888888888888, 2725 | "#fdca26" 2726 | ], 2727 | [ 2728 | 1, 2729 | "#f0f921" 2730 | ] 2731 | ], 2732 | "type": "histogram2dcontour" 2733 | } 2734 | ], 2735 | "mesh3d": [ 2736 | { 2737 | "colorbar": { 2738 | "outlinewidth": 0, 2739 | "ticks": "" 2740 | }, 2741 | "type": "mesh3d" 2742 | } 2743 | ], 2744 | "parcoords": [ 2745 | { 2746 | "line": { 2747 | "colorbar": { 2748 | "outlinewidth": 0, 2749 | "ticks": "" 2750 | } 2751 | }, 2752 | "type": "parcoords" 2753 | } 2754 | ], 2755 | "pie": [ 2756 | { 2757 | "automargin": true, 2758 | "type": "pie" 2759 | } 2760 | ], 2761 | "scatter": [ 2762 | { 2763 | "fillpattern": { 2764 | "fillmode": "overlay", 2765 | "size": 10, 2766 | "solidity": 0.2 2767 | }, 2768 | "type": "scatter" 2769 | } 2770 | ], 2771 | "scatter3d": [ 2772 | { 2773 | "line": { 2774 | "colorbar": { 2775 | "outlinewidth": 0, 2776 | "ticks": "" 2777 | } 2778 | }, 2779 | "marker": { 2780 | "colorbar": { 2781 | "outlinewidth": 0, 2782 | "ticks": "" 2783 | } 2784 | }, 2785 | "type": "scatter3d" 2786 | } 2787 | ], 2788 | "scattercarpet": [ 2789 | { 2790 | "marker": { 2791 | "colorbar": { 2792 | "outlinewidth": 0, 2793 | "ticks": "" 2794 | } 2795 | }, 2796 | "type": "scattercarpet" 2797 | } 2798 | ], 2799 | "scattergeo": [ 2800 | { 2801 | "marker": { 2802 | "colorbar": { 2803 | "outlinewidth": 0, 2804 | "ticks": "" 2805 | } 2806 | }, 2807 | "type": "scattergeo" 2808 | } 2809 | ], 2810 | "scattergl": [ 2811 | { 2812 | "marker": { 2813 | "colorbar": { 2814 | "outlinewidth": 0, 2815 | "ticks": "" 2816 | } 2817 | }, 2818 | "type": "scattergl" 2819 | } 2820 | ], 2821 | "scattermapbox": [ 2822 | { 2823 | "marker": { 2824 | "colorbar": { 2825 | "outlinewidth": 0, 2826 | "ticks": "" 2827 | } 2828 | }, 2829 | "type": "scattermapbox" 2830 | } 2831 | ], 2832 | "scatterpolar": [ 2833 | { 2834 | "marker": { 2835 | "colorbar": { 2836 | "outlinewidth": 0, 2837 | "ticks": "" 2838 | } 2839 | }, 2840 | "type": "scatterpolar" 2841 | } 2842 | ], 2843 | "scatterpolargl": [ 2844 | { 2845 | "marker": { 2846 | "colorbar": { 2847 | "outlinewidth": 0, 2848 | "ticks": "" 2849 | } 2850 | }, 2851 | "type": "scatterpolargl" 2852 | } 2853 | ], 2854 | "scatterternary": [ 2855 | { 2856 | "marker": { 2857 | "colorbar": { 2858 | "outlinewidth": 0, 2859 | "ticks": "" 2860 | } 2861 | }, 2862 | "type": "scatterternary" 2863 | } 2864 | ], 2865 | "surface": [ 2866 | { 2867 | "colorbar": { 2868 | "outlinewidth": 0, 2869 | "ticks": "" 2870 | }, 2871 | "colorscale": [ 2872 | [ 2873 | 0, 2874 | "#0d0887" 2875 | ], 2876 | [ 2877 | 0.1111111111111111, 2878 | "#46039f" 2879 | ], 2880 | [ 2881 | 0.2222222222222222, 2882 | "#7201a8" 2883 | ], 2884 | [ 2885 | 0.3333333333333333, 2886 | "#9c179e" 2887 | ], 2888 | [ 2889 | 0.4444444444444444, 2890 | "#bd3786" 2891 | ], 2892 | [ 2893 | 0.5555555555555556, 2894 | "#d8576b" 2895 | ], 2896 | [ 2897 | 0.6666666666666666, 2898 | "#ed7953" 2899 | ], 2900 | [ 2901 | 0.7777777777777778, 2902 | "#fb9f3a" 2903 | ], 2904 | [ 2905 | 0.8888888888888888, 2906 | "#fdca26" 2907 | ], 2908 | [ 2909 | 1, 2910 | "#f0f921" 2911 | ] 2912 | ], 2913 | "type": "surface" 2914 | } 2915 | ], 2916 | "table": [ 2917 | { 2918 | "cells": { 2919 | "fill": { 2920 | "color": "#EBF0F8" 2921 | }, 2922 | "line": { 2923 | "color": "white" 2924 | } 2925 | }, 2926 | "header": { 2927 | "fill": { 2928 | "color": "#C8D4E3" 2929 | }, 2930 | "line": { 2931 | "color": "white" 2932 | } 2933 | }, 2934 | "type": "table" 2935 | } 2936 | ] 2937 | }, 2938 | "layout": { 2939 | "annotationdefaults": { 2940 | "arrowcolor": "#2a3f5f", 2941 | "arrowhead": 0, 2942 | "arrowwidth": 1 2943 | }, 2944 | "autotypenumbers": "strict", 2945 | "coloraxis": { 2946 | "colorbar": { 2947 | "outlinewidth": 0, 2948 | "ticks": "" 2949 | } 2950 | }, 2951 | "colorscale": { 2952 | "diverging": [ 2953 | [ 2954 | 0, 2955 | "#8e0152" 2956 | ], 2957 | [ 2958 | 0.1, 2959 | "#c51b7d" 2960 | ], 2961 | [ 2962 | 0.2, 2963 | "#de77ae" 2964 | ], 2965 | [ 2966 | 0.3, 2967 | "#f1b6da" 2968 | ], 2969 | [ 2970 | 0.4, 2971 | "#fde0ef" 2972 | ], 2973 | [ 2974 | 0.5, 2975 | "#f7f7f7" 2976 | ], 2977 | [ 2978 | 0.6, 2979 | "#e6f5d0" 2980 | ], 2981 | [ 2982 | 0.7, 2983 | "#b8e186" 2984 | ], 2985 | [ 2986 | 0.8, 2987 | "#7fbc41" 2988 | ], 2989 | [ 2990 | 0.9, 2991 | "#4d9221" 2992 | ], 2993 | [ 2994 | 1, 2995 | "#276419" 2996 | ] 2997 | ], 2998 | "sequential": [ 2999 | [ 3000 | 0, 3001 | "#0d0887" 3002 | ], 3003 | [ 3004 | 0.1111111111111111, 3005 | "#46039f" 3006 | ], 3007 | [ 3008 | 0.2222222222222222, 3009 | "#7201a8" 3010 | ], 3011 | [ 3012 | 0.3333333333333333, 3013 | "#9c179e" 3014 | ], 3015 | [ 3016 | 0.4444444444444444, 3017 | "#bd3786" 3018 | ], 3019 | [ 3020 | 0.5555555555555556, 3021 | "#d8576b" 3022 | ], 3023 | [ 3024 | 0.6666666666666666, 3025 | "#ed7953" 3026 | ], 3027 | [ 3028 | 0.7777777777777778, 3029 | "#fb9f3a" 3030 | ], 3031 | [ 3032 | 0.8888888888888888, 3033 | "#fdca26" 3034 | ], 3035 | [ 3036 | 1, 3037 | "#f0f921" 3038 | ] 3039 | ], 3040 | "sequentialminus": [ 3041 | [ 3042 | 0, 3043 | "#0d0887" 3044 | ], 3045 | [ 3046 | 0.1111111111111111, 3047 | "#46039f" 3048 | ], 3049 | [ 3050 | 0.2222222222222222, 3051 | "#7201a8" 3052 | ], 3053 | [ 3054 | 0.3333333333333333, 3055 | "#9c179e" 3056 | ], 3057 | [ 3058 | 0.4444444444444444, 3059 | "#bd3786" 3060 | ], 3061 | [ 3062 | 0.5555555555555556, 3063 | "#d8576b" 3064 | ], 3065 | [ 3066 | 0.6666666666666666, 3067 | "#ed7953" 3068 | ], 3069 | [ 3070 | 0.7777777777777778, 3071 | "#fb9f3a" 3072 | ], 3073 | [ 3074 | 0.8888888888888888, 3075 | "#fdca26" 3076 | ], 3077 | [ 3078 | 1, 3079 | "#f0f921" 3080 | ] 3081 | ] 3082 | }, 3083 | "colorway": [ 3084 | "#636efa", 3085 | "#EF553B", 3086 | "#00cc96", 3087 | "#ab63fa", 3088 | "#FFA15A", 3089 | "#19d3f3", 3090 | "#FF6692", 3091 | "#B6E880", 3092 | "#FF97FF", 3093 | "#FECB52" 3094 | ], 3095 | "font": { 3096 | "color": "#2a3f5f" 3097 | }, 3098 | "geo": { 3099 | "bgcolor": "white", 3100 | "lakecolor": "white", 3101 | "landcolor": "white", 3102 | "showlakes": true, 3103 | "showland": true, 3104 | "subunitcolor": "#C8D4E3" 3105 | }, 3106 | "hoverlabel": { 3107 | "align": "left" 3108 | }, 3109 | "hovermode": "closest", 3110 | "mapbox": { 3111 | "style": "light" 3112 | }, 3113 | "paper_bgcolor": "white", 3114 | "plot_bgcolor": "white", 3115 | "polar": { 3116 | "angularaxis": { 3117 | "gridcolor": "#EBF0F8", 3118 | "linecolor": "#EBF0F8", 3119 | "ticks": "" 3120 | }, 3121 | "bgcolor": "white", 3122 | "radialaxis": { 3123 | "gridcolor": "#EBF0F8", 3124 | "linecolor": "#EBF0F8", 3125 | "ticks": "" 3126 | } 3127 | }, 3128 | "scene": { 3129 | "xaxis": { 3130 | "backgroundcolor": "white", 3131 | "gridcolor": "#DFE8F3", 3132 | "gridwidth": 2, 3133 | "linecolor": "#EBF0F8", 3134 | "showbackground": true, 3135 | "ticks": "", 3136 | "zerolinecolor": "#EBF0F8" 3137 | }, 3138 | "yaxis": { 3139 | "backgroundcolor": "white", 3140 | "gridcolor": "#DFE8F3", 3141 | "gridwidth": 2, 3142 | "linecolor": "#EBF0F8", 3143 | "showbackground": true, 3144 | "ticks": "", 3145 | "zerolinecolor": "#EBF0F8" 3146 | }, 3147 | "zaxis": { 3148 | "backgroundcolor": "white", 3149 | "gridcolor": "#DFE8F3", 3150 | "gridwidth": 2, 3151 | "linecolor": "#EBF0F8", 3152 | "showbackground": true, 3153 | "ticks": "", 3154 | "zerolinecolor": "#EBF0F8" 3155 | } 3156 | }, 3157 | "shapedefaults": { 3158 | "line": { 3159 | "color": "#2a3f5f" 3160 | } 3161 | }, 3162 | "ternary": { 3163 | "aaxis": { 3164 | "gridcolor": "#DFE8F3", 3165 | "linecolor": "#A2B1C6", 3166 | "ticks": "" 3167 | }, 3168 | "baxis": { 3169 | "gridcolor": "#DFE8F3", 3170 | "linecolor": "#A2B1C6", 3171 | "ticks": "" 3172 | }, 3173 | "bgcolor": "white", 3174 | "caxis": { 3175 | "gridcolor": "#DFE8F3", 3176 | "linecolor": "#A2B1C6", 3177 | "ticks": "" 3178 | } 3179 | }, 3180 | "title": { 3181 | "x": 0.05 3182 | }, 3183 | "xaxis": { 3184 | "automargin": true, 3185 | "gridcolor": "#EBF0F8", 3186 | "linecolor": "#EBF0F8", 3187 | "ticks": "", 3188 | "title": { 3189 | "standoff": 15 3190 | }, 3191 | "zerolinecolor": "#EBF0F8", 3192 | "zerolinewidth": 2 3193 | }, 3194 | "yaxis": { 3195 | "automargin": true, 3196 | "gridcolor": "#EBF0F8", 3197 | "linecolor": "#EBF0F8", 3198 | "ticks": "", 3199 | "title": { 3200 | "standoff": 15 3201 | }, 3202 | "zerolinecolor": "#EBF0F8", 3203 | "zerolinewidth": 2 3204 | } 3205 | } 3206 | }, 3207 | "title": { 3208 | "text": "Temperature Change vs CO₂ Concentration" 3209 | }, 3210 | "xaxis": { 3211 | "anchor": "y", 3212 | "domain": [ 3213 | 0, 3214 | 1 3215 | ], 3216 | "title": { 3217 | "text": "CO₂ Concentration (ppm)" 3218 | } 3219 | }, 3220 | "yaxis": { 3221 | "anchor": "x", 3222 | "domain": [ 3223 | 0, 3224 | 1 3225 | ], 3226 | "title": { 3227 | "text": "Temperature Change (°C)" 3228 | } 3229 | } 3230 | } 3231 | } 3232 | }, 3233 | "metadata": {}, 3234 | "output_type": "display_data" 3235 | } 3236 | ], 3237 | "source": [ 3238 | "# scatter plot: temperature vs CO2 concentrations\n", 3239 | "scatter_fig = px.scatter(\n", 3240 | " merged_data,\n", 3241 | " x=\"CO₂ Concentration\", y=\"Temperature Change\",\n", 3242 | " labels={\"CO₂ Concentration\": \"CO₂ Concentration (ppm)\", \"Temperature Change\": \"Temperature Change (°C)\"},\n", 3243 | " title=\"Temperature Change vs CO₂ Concentration\",\n", 3244 | " template=\"plotly_white\"\n", 3245 | ")\n", 3246 | "scatter_fig.update_traces(marker=dict(size=10, opacity=0.7))\n", 3247 | "scatter_fig.show()" 3248 | ] 3249 | }, 3250 | { 3251 | "cell_type": "code", 3252 | "execution_count": 6, 3253 | "id": "25ae344a", 3254 | "metadata": {}, 3255 | "outputs": [ 3256 | { 3257 | "data": { 3258 | "application/vnd.plotly.v1+json": { 3259 | "config": { 3260 | "plotlyServerURL": "https://plot.ly" 3261 | }, 3262 | "data": [ 3263 | { 3264 | "mode": "lines+markers", 3265 | "name": "Temperature Change (°C)", 3266 | "type": "scatter", 3267 | "x": [ 3268 | 1961, 3269 | 1962, 3270 | 1963, 3271 | 1964, 3272 | 1965, 3273 | 1966, 3274 | 1967, 3275 | 1968, 3276 | 1969, 3277 | 1970, 3278 | 1971, 3279 | 1972, 3280 | 1973, 3281 | 1974, 3282 | 1975, 3283 | 1976, 3284 | 1977, 3285 | 1978, 3286 | 1979, 3287 | 1980, 3288 | 1981, 3289 | 1982, 3290 | 1983, 3291 | 1984, 3292 | 1985, 3293 | 1986, 3294 | 1987, 3295 | 1988, 3296 | 1989, 3297 | 1990, 3298 | 1991, 3299 | 1992, 3300 | 1993, 3301 | 1994, 3302 | 1995, 3303 | 1996, 3304 | 1997, 3305 | 1998, 3306 | 1999, 3307 | 2000, 3308 | 2001, 3309 | 2002, 3310 | 2003, 3311 | 2004, 3312 | 2005, 3313 | 2006, 3314 | 2007, 3315 | 2008, 3316 | 2009, 3317 | 2010, 3318 | 2011, 3319 | 2012, 3320 | 2013, 3321 | 2014, 3322 | 2015, 3323 | 2016, 3324 | 2017, 3325 | 2018, 3326 | 2019, 3327 | 2020, 3328 | 2021, 3329 | 2022 3330 | ], 3331 | "y": [ 3332 | 0.1630531914893617, 3333 | -0.01347619047619048, 3334 | -0.006042553191489363, 3335 | -0.07005851063829789, 3336 | -0.24702659574468086, 3337 | 0.10550520833333336, 3338 | -0.11083246073298428, 3339 | -0.19910994764397907, 3340 | 0.15794210526315788, 3341 | 0.09248677248677246, 3342 | -0.20051308900523562, 3343 | -0.08490625, 3344 | 0.2293678756476684, 3345 | -0.16303125, 3346 | -0.023494680851063827, 3347 | -0.24591534391534392, 3348 | 0.1658162162162162, 3349 | 0.06962962962962962, 3350 | 0.2337989417989418, 3351 | 0.24728795811518325, 3352 | 0.1786439790575916, 3353 | 0.17649479166666668, 3354 | 0.34459473684210523, 3355 | 0.08011702127659574, 3356 | 0.07128723404255319, 3357 | 0.1511578947368421, 3358 | 0.405021052631579, 3359 | 0.4900894736842106, 3360 | 0.25616842105263155, 3361 | 0.5552592592592592, 3362 | 0.3681648936170213, 3363 | 0.2364903846153846, 3364 | 0.2159856459330144, 3365 | 0.609514423076923, 3366 | 0.6292380952380952, 3367 | 0.27922857142857144, 3368 | 0.5439951690821256, 3369 | 0.971252380952381, 3370 | 0.7433014354066987, 3371 | 0.6697894736842105, 3372 | 0.8501538461538461, 3373 | 0.9249999999999998, 3374 | 0.8442289719626169, 3375 | 0.7778403755868545, 3376 | 0.8529905660377357, 3377 | 0.8765767441860465, 3378 | 1.0225483870967744, 3379 | 0.8084103773584905, 3380 | 0.9105660377358491, 3381 | 1.0990418604651164, 3382 | 0.8213917050691244, 3383 | 0.9022232558139536, 3384 | 0.931199074074074, 3385 | 1.114814814814815, 3386 | 1.269773148148148, 3387 | 1.4395211267605634, 3388 | 1.2807850467289719, 3389 | 1.3021126760563382, 3390 | 1.4430610328638498, 3391 | 1.5520377358490567, 3392 | 1.343530516431925, 3393 | 1.382112676056338 3394 | ] 3395 | }, 3396 | { 3397 | "line": { 3398 | "dash": "dash" 3399 | }, 3400 | "mode": "lines", 3401 | "name": "Temperature Trend (Slope: 0.03)", 3402 | "type": "scatter", 3403 | "x": [ 3404 | 1961, 3405 | 1962, 3406 | 1963, 3407 | 1964, 3408 | 1965, 3409 | 1966, 3410 | 1967, 3411 | 1968, 3412 | 1969, 3413 | 1970, 3414 | 1971, 3415 | 1972, 3416 | 1973, 3417 | 1974, 3418 | 1975, 3419 | 1976, 3420 | 1977, 3421 | 1978, 3422 | 1979, 3423 | 1980, 3424 | 1981, 3425 | 1982, 3426 | 1983, 3427 | 1984, 3428 | 1985, 3429 | 1986, 3430 | 1987, 3431 | 1988, 3432 | 1989, 3433 | 1990, 3434 | 1991, 3435 | 1992, 3436 | 1993, 3437 | 1994, 3438 | 1995, 3439 | 1996, 3440 | 1997, 3441 | 1998, 3442 | 1999, 3443 | 2000, 3444 | 2001, 3445 | 2002, 3446 | 2003, 3447 | 2004, 3448 | 2005, 3449 | 2006, 3450 | 2007, 3451 | 2008, 3452 | 2009, 3453 | 2010, 3454 | 2011, 3455 | 2012, 3456 | 2013, 3457 | 2014, 3458 | 2015, 3459 | 2016, 3460 | 2017, 3461 | 2018, 3462 | 2019, 3463 | 2020, 3464 | 2021, 3465 | 2022 3466 | ], 3467 | "y": [ 3468 | -0.2848616043898815, 3469 | -0.25869152781056215, 3470 | -0.2325214512312428, 3471 | -0.20635137465193054, 3472 | -0.18018129807261118, 3473 | -0.15401122149329183, 3474 | -0.12784114491397958, 3475 | -0.10167106833466022, 3476 | -0.07550099175534086, 3477 | -0.04933091517602861, 3478 | -0.023160838596709254, 3479 | 0.0030092379826101023, 3480 | 0.029179314561922354, 3481 | 0.05534939114124171, 3482 | 0.08151946772056107, 3483 | 0.10768954429987332, 3484 | 0.13385962087919268, 3485 | 0.16002969745851203, 3486 | 0.18619977403782428, 3487 | 0.21236985061714364, 3488 | 0.238539927196463, 3489 | 0.26471000377577525, 3490 | 0.2908800803550946, 3491 | 0.31705015693441396, 3492 | 0.3432202335137262, 3493 | 0.36939031009304557, 3494 | 0.3955603866723649, 3495 | 0.4217304632516772, 3496 | 0.44790053983099654, 3497 | 0.4740706164103159, 3498 | 0.5002406929896281, 3499 | 0.5264107695689475, 3500 | 0.5525808461482669, 3501 | 0.5787509227275791, 3502 | 0.6049209993068985, 3503 | 0.6310910758862178, 3504 | 0.6572611524655301, 3505 | 0.6834312290448494, 3506 | 0.7096013056241688, 3507 | 0.735771382203481, 3508 | 0.7619414587828004, 3509 | 0.7881115353621198, 3510 | 0.814281611941432, 3511 | 0.8404516885207514, 3512 | 0.8666217651000707, 3513 | 0.892791841679383, 3514 | 0.9189619182587023, 3515 | 0.9451319948380217, 3516 | 0.9713020714173339, 3517 | 0.9974721479966533, 3518 | 1.0236422245759726, 3519 | 1.049812301155285, 3520 | 1.0759823777346043, 3521 | 1.1021524543139165, 3522 | 1.1283225308932359, 3523 | 1.1544926074725552, 3524 | 1.1806626840518675, 3525 | 1.2068327606311868, 3526 | 1.2330028372105062, 3527 | 1.2591729137898184, 3528 | 1.2853429903691378, 3529 | 1.3115130669484572 3530 | ] 3531 | }, 3532 | { 3533 | "mode": "lines+markers", 3534 | "name": "CO₂ Concentration (ppm)", 3535 | "type": "scatter", 3536 | "x": [ 3537 | 1958, 3538 | 1959, 3539 | 1960, 3540 | 1961, 3541 | 1962, 3542 | 1963, 3543 | 1964, 3544 | 1965, 3545 | 1966, 3546 | 1967, 3547 | 1968, 3548 | 1969, 3549 | 1970, 3550 | 1971, 3551 | 1972, 3552 | 1973, 3553 | 1974, 3554 | 1975, 3555 | 1976, 3556 | 1977, 3557 | 1978, 3558 | 1979, 3559 | 1980, 3560 | 1981, 3561 | 1982, 3562 | 1983, 3563 | 1984, 3564 | 1985, 3565 | 1986, 3566 | 1987, 3567 | 1988, 3568 | 1989, 3569 | 1990, 3570 | 1991, 3571 | 1992, 3572 | 1993, 3573 | 1994, 3574 | 1995, 3575 | 1996, 3576 | 1997, 3577 | 1998, 3578 | 1999, 3579 | 2000, 3580 | 2001, 3581 | 2002, 3582 | 2003, 3583 | 2004, 3584 | 2005, 3585 | 2006, 3586 | 2007, 3587 | 2008, 3588 | 2009, 3589 | 2010, 3590 | 2011, 3591 | 2012, 3592 | 2013, 3593 | 2014, 3594 | 2015, 3595 | 2016, 3596 | 2017, 3597 | 2018, 3598 | 2019, 3599 | 2020, 3600 | 2021, 3601 | 2022, 3602 | 2023, 3603 | 2024 3604 | ], 3605 | "y": [ 3606 | 315.232, 3607 | 172.46045454545455, 3608 | 158.60166666666666, 3609 | 158.93833333333333, 3610 | 159.355, 3611 | 159.58041666666668, 3612 | 159.90583333333333, 3613 | 160.08333333333334, 3614 | 160.89208333333332, 3615 | 161.21666666666667, 3616 | 161.65958333333333, 3617 | 162.555, 3618 | 163.00375, 3619 | 163.25666666666666, 3620 | 163.90291666666667, 3621 | 165.17791666666668, 3622 | 165.17375, 3623 | 165.70708333333332, 3624 | 166.14875, 3625 | 167.19666666666666, 3626 | 167.9425, 3627 | 168.62958333333333, 3628 | 169.66708333333332, 3629 | 170.26041666666666, 3630 | 170.93916666666667, 3631 | 171.8216666666667, 3632 | 172.6833333333333, 3633 | 173.39125, 3634 | 173.98625, 3635 | 174.90125, 3636 | 176.18541666666667, 3637 | 176.8175, 3638 | 177.40333333333334, 3639 | 178.02833333333334, 3640 | 178.39166666666665, 3641 | 178.70125, 3642 | 179.72375, 3643 | 180.76458333333335, 3644 | 181.61791666666667, 3645 | 182.095, 3646 | 183.8275, 3647 | 184.50166666666667, 3648 | 185.01250000000002, 3649 | 185.87708333333333, 3650 | 187.01375, 3651 | 188.33166666666668, 3652 | 189.07625, 3653 | 190.29458333333332, 3654 | 191.32291666666666, 3655 | 192.26541666666665, 3656 | 193.15166666666667, 3657 | 194.05499999999998, 3658 | 195.36833333333334, 3659 | 196.15, 3660 | 197.30958333333334, 3661 | 198.70875, 3662 | 199.66750000000002, 3663 | 200.78208333333336, 3664 | 202.63083333333336, 3665 | 203.66916666666668, 3666 | 204.59875, 3667 | 206.1833333333333, 3668 | 207.41666666666666, 3669 | 208.47208333333333, 3670 | 209.51833333333335, 3671 | 210.84416666666667, 3672 | 0.68 3673 | ] 3674 | }, 3675 | { 3676 | "line": { 3677 | "dash": "dash" 3678 | }, 3679 | "mode": "lines", 3680 | "name": "CO₂ Trend (Slope: 0.32)", 3681 | "type": "scatter", 3682 | "x": [ 3683 | 1958, 3684 | 1959, 3685 | 1960, 3686 | 1961, 3687 | 1962, 3688 | 1963, 3689 | 1964, 3690 | 1965, 3691 | 1966, 3692 | 1967, 3693 | 1968, 3694 | 1969, 3695 | 1970, 3696 | 1971, 3697 | 1972, 3698 | 1973, 3699 | 1974, 3700 | 1975, 3701 | 1976, 3702 | 1977, 3703 | 1978, 3704 | 1979, 3705 | 1980, 3706 | 1981, 3707 | 1982, 3708 | 1983, 3709 | 1984, 3710 | 1985, 3711 | 1986, 3712 | 1987, 3713 | 1988, 3714 | 1989, 3715 | 1990, 3716 | 1991, 3717 | 1992, 3718 | 1993, 3719 | 1994, 3720 | 1995, 3721 | 1996, 3722 | 1997, 3723 | 1998, 3724 | 1999, 3725 | 2000, 3726 | 2001, 3727 | 2002, 3728 | 2003, 3729 | 2004, 3730 | 2005, 3731 | 2006, 3732 | 2007, 3733 | 2008, 3734 | 2009, 3735 | 2010, 3736 | 2011, 3737 | 2012, 3738 | 2013, 3739 | 2014, 3740 | 2015, 3741 | 2016, 3742 | 2017, 3743 | 2018, 3744 | 2019, 3745 | 2020, 3746 | 2021, 3747 | 2022, 3748 | 2023, 3749 | 2024 3750 | ], 3751 | "y": [ 3752 | 168.87221360443777, 3753 | 169.1916574728449, 3754 | 169.51110134125202, 3755 | 169.83054520965914, 3756 | 170.14998907806626, 3757 | 170.46943294647338, 3758 | 170.7888768148805, 3759 | 171.10832068328762, 3760 | 171.42776455169474, 3761 | 171.74720842010186, 3762 | 172.06665228850898, 3763 | 172.3860961569161, 3764 | 172.7055400253231, 3765 | 173.02498389373022, 3766 | 173.34442776213734, 3767 | 173.66387163054446, 3768 | 173.98331549895158, 3769 | 174.3027593673587, 3770 | 174.62220323576582, 3771 | 174.94164710417294, 3772 | 175.26109097258006, 3773 | 175.58053484098718, 3774 | 175.8999787093943, 3775 | 176.21942257780142, 3776 | 176.53886644620854, 3777 | 176.85831031461566, 3778 | 177.17775418302278, 3779 | 177.4971980514299, 3780 | 177.81664191983702, 3781 | 178.13608578824403, 3782 | 178.45552965665115, 3783 | 178.77497352505827, 3784 | 179.0944173934654, 3785 | 179.4138612618725, 3786 | 179.73330513027963, 3787 | 180.05274899868675, 3788 | 180.37219286709387, 3789 | 180.691636735501, 3790 | 181.0110806039081, 3791 | 181.33052447231523, 3792 | 181.64996834072235, 3793 | 181.96941220912947, 3794 | 182.2888560775366, 3795 | 182.6082999459437, 3796 | 182.92774381435083, 3797 | 183.24718768275795, 3798 | 183.56663155116507, 3799 | 183.88607541957208, 3800 | 184.2055192879792, 3801 | 184.52496315638632, 3802 | 184.84440702479344, 3803 | 185.16385089320056, 3804 | 185.48329476160768, 3805 | 185.8027386300148, 3806 | 186.12218249842192, 3807 | 186.44162636682904, 3808 | 186.76107023523616, 3809 | 187.08051410364328, 3810 | 187.3999579720504, 3811 | 187.71940184045752, 3812 | 188.03884570886464, 3813 | 188.35828957727176, 3814 | 188.67773344567888, 3815 | 188.997177314086, 3816 | 189.316621182493, 3817 | 189.63606505090013, 3818 | 189.95550891930725 3819 | ] 3820 | } 3821 | ], 3822 | "layout": { 3823 | "legend": { 3824 | "title": { 3825 | "text": "Metrics" 3826 | } 3827 | }, 3828 | "template": { 3829 | "data": { 3830 | "bar": [ 3831 | { 3832 | "error_x": { 3833 | "color": "#2a3f5f" 3834 | }, 3835 | "error_y": { 3836 | "color": "#2a3f5f" 3837 | }, 3838 | "marker": { 3839 | "line": { 3840 | "color": "white", 3841 | "width": 0.5 3842 | }, 3843 | "pattern": { 3844 | "fillmode": "overlay", 3845 | "size": 10, 3846 | "solidity": 0.2 3847 | } 3848 | }, 3849 | "type": "bar" 3850 | } 3851 | ], 3852 | "barpolar": [ 3853 | { 3854 | "marker": { 3855 | "line": { 3856 | "color": "white", 3857 | "width": 0.5 3858 | }, 3859 | "pattern": { 3860 | "fillmode": "overlay", 3861 | "size": 10, 3862 | "solidity": 0.2 3863 | } 3864 | }, 3865 | "type": "barpolar" 3866 | } 3867 | ], 3868 | "carpet": [ 3869 | { 3870 | "aaxis": { 3871 | "endlinecolor": "#2a3f5f", 3872 | "gridcolor": "#C8D4E3", 3873 | "linecolor": "#C8D4E3", 3874 | "minorgridcolor": "#C8D4E3", 3875 | "startlinecolor": "#2a3f5f" 3876 | }, 3877 | "baxis": { 3878 | "endlinecolor": "#2a3f5f", 3879 | "gridcolor": "#C8D4E3", 3880 | "linecolor": "#C8D4E3", 3881 | "minorgridcolor": "#C8D4E3", 3882 | "startlinecolor": "#2a3f5f" 3883 | }, 3884 | "type": "carpet" 3885 | } 3886 | ], 3887 | "choropleth": [ 3888 | { 3889 | "colorbar": { 3890 | "outlinewidth": 0, 3891 | "ticks": "" 3892 | }, 3893 | "type": "choropleth" 3894 | } 3895 | ], 3896 | "contour": [ 3897 | { 3898 | "colorbar": { 3899 | "outlinewidth": 0, 3900 | "ticks": "" 3901 | }, 3902 | "colorscale": [ 3903 | [ 3904 | 0, 3905 | "#0d0887" 3906 | ], 3907 | [ 3908 | 0.1111111111111111, 3909 | "#46039f" 3910 | ], 3911 | [ 3912 | 0.2222222222222222, 3913 | "#7201a8" 3914 | ], 3915 | [ 3916 | 0.3333333333333333, 3917 | "#9c179e" 3918 | ], 3919 | [ 3920 | 0.4444444444444444, 3921 | "#bd3786" 3922 | ], 3923 | [ 3924 | 0.5555555555555556, 3925 | "#d8576b" 3926 | ], 3927 | [ 3928 | 0.6666666666666666, 3929 | "#ed7953" 3930 | ], 3931 | [ 3932 | 0.7777777777777778, 3933 | "#fb9f3a" 3934 | ], 3935 | [ 3936 | 0.8888888888888888, 3937 | "#fdca26" 3938 | ], 3939 | [ 3940 | 1, 3941 | "#f0f921" 3942 | ] 3943 | ], 3944 | "type": "contour" 3945 | } 3946 | ], 3947 | "contourcarpet": [ 3948 | { 3949 | "colorbar": { 3950 | "outlinewidth": 0, 3951 | "ticks": "" 3952 | }, 3953 | "type": "contourcarpet" 3954 | } 3955 | ], 3956 | "heatmap": [ 3957 | { 3958 | "colorbar": { 3959 | "outlinewidth": 0, 3960 | "ticks": "" 3961 | }, 3962 | "colorscale": [ 3963 | [ 3964 | 0, 3965 | "#0d0887" 3966 | ], 3967 | [ 3968 | 0.1111111111111111, 3969 | "#46039f" 3970 | ], 3971 | [ 3972 | 0.2222222222222222, 3973 | "#7201a8" 3974 | ], 3975 | [ 3976 | 0.3333333333333333, 3977 | "#9c179e" 3978 | ], 3979 | [ 3980 | 0.4444444444444444, 3981 | "#bd3786" 3982 | ], 3983 | [ 3984 | 0.5555555555555556, 3985 | "#d8576b" 3986 | ], 3987 | [ 3988 | 0.6666666666666666, 3989 | "#ed7953" 3990 | ], 3991 | [ 3992 | 0.7777777777777778, 3993 | "#fb9f3a" 3994 | ], 3995 | [ 3996 | 0.8888888888888888, 3997 | "#fdca26" 3998 | ], 3999 | [ 4000 | 1, 4001 | "#f0f921" 4002 | ] 4003 | ], 4004 | "type": "heatmap" 4005 | } 4006 | ], 4007 | "heatmapgl": [ 4008 | { 4009 | "colorbar": { 4010 | "outlinewidth": 0, 4011 | "ticks": "" 4012 | }, 4013 | "colorscale": [ 4014 | [ 4015 | 0, 4016 | "#0d0887" 4017 | ], 4018 | [ 4019 | 0.1111111111111111, 4020 | "#46039f" 4021 | ], 4022 | [ 4023 | 0.2222222222222222, 4024 | "#7201a8" 4025 | ], 4026 | [ 4027 | 0.3333333333333333, 4028 | "#9c179e" 4029 | ], 4030 | [ 4031 | 0.4444444444444444, 4032 | "#bd3786" 4033 | ], 4034 | [ 4035 | 0.5555555555555556, 4036 | "#d8576b" 4037 | ], 4038 | [ 4039 | 0.6666666666666666, 4040 | "#ed7953" 4041 | ], 4042 | [ 4043 | 0.7777777777777778, 4044 | "#fb9f3a" 4045 | ], 4046 | [ 4047 | 0.8888888888888888, 4048 | "#fdca26" 4049 | ], 4050 | [ 4051 | 1, 4052 | "#f0f921" 4053 | ] 4054 | ], 4055 | "type": "heatmapgl" 4056 | } 4057 | ], 4058 | "histogram": [ 4059 | { 4060 | "marker": { 4061 | "pattern": { 4062 | "fillmode": "overlay", 4063 | "size": 10, 4064 | "solidity": 0.2 4065 | } 4066 | }, 4067 | "type": "histogram" 4068 | } 4069 | ], 4070 | "histogram2d": [ 4071 | { 4072 | "colorbar": { 4073 | "outlinewidth": 0, 4074 | "ticks": "" 4075 | }, 4076 | "colorscale": [ 4077 | [ 4078 | 0, 4079 | "#0d0887" 4080 | ], 4081 | [ 4082 | 0.1111111111111111, 4083 | "#46039f" 4084 | ], 4085 | [ 4086 | 0.2222222222222222, 4087 | "#7201a8" 4088 | ], 4089 | [ 4090 | 0.3333333333333333, 4091 | "#9c179e" 4092 | ], 4093 | [ 4094 | 0.4444444444444444, 4095 | "#bd3786" 4096 | ], 4097 | [ 4098 | 0.5555555555555556, 4099 | "#d8576b" 4100 | ], 4101 | [ 4102 | 0.6666666666666666, 4103 | "#ed7953" 4104 | ], 4105 | [ 4106 | 0.7777777777777778, 4107 | "#fb9f3a" 4108 | ], 4109 | [ 4110 | 0.8888888888888888, 4111 | "#fdca26" 4112 | ], 4113 | [ 4114 | 1, 4115 | "#f0f921" 4116 | ] 4117 | ], 4118 | "type": "histogram2d" 4119 | } 4120 | ], 4121 | "histogram2dcontour": [ 4122 | { 4123 | "colorbar": { 4124 | "outlinewidth": 0, 4125 | "ticks": "" 4126 | }, 4127 | "colorscale": [ 4128 | [ 4129 | 0, 4130 | "#0d0887" 4131 | ], 4132 | [ 4133 | 0.1111111111111111, 4134 | "#46039f" 4135 | ], 4136 | [ 4137 | 0.2222222222222222, 4138 | "#7201a8" 4139 | ], 4140 | [ 4141 | 0.3333333333333333, 4142 | "#9c179e" 4143 | ], 4144 | [ 4145 | 0.4444444444444444, 4146 | "#bd3786" 4147 | ], 4148 | [ 4149 | 0.5555555555555556, 4150 | "#d8576b" 4151 | ], 4152 | [ 4153 | 0.6666666666666666, 4154 | "#ed7953" 4155 | ], 4156 | [ 4157 | 0.7777777777777778, 4158 | "#fb9f3a" 4159 | ], 4160 | [ 4161 | 0.8888888888888888, 4162 | "#fdca26" 4163 | ], 4164 | [ 4165 | 1, 4166 | "#f0f921" 4167 | ] 4168 | ], 4169 | "type": "histogram2dcontour" 4170 | } 4171 | ], 4172 | "mesh3d": [ 4173 | { 4174 | "colorbar": { 4175 | "outlinewidth": 0, 4176 | "ticks": "" 4177 | }, 4178 | "type": "mesh3d" 4179 | } 4180 | ], 4181 | "parcoords": [ 4182 | { 4183 | "line": { 4184 | "colorbar": { 4185 | "outlinewidth": 0, 4186 | "ticks": "" 4187 | } 4188 | }, 4189 | "type": "parcoords" 4190 | } 4191 | ], 4192 | "pie": [ 4193 | { 4194 | "automargin": true, 4195 | "type": "pie" 4196 | } 4197 | ], 4198 | "scatter": [ 4199 | { 4200 | "fillpattern": { 4201 | "fillmode": "overlay", 4202 | "size": 10, 4203 | "solidity": 0.2 4204 | }, 4205 | "type": "scatter" 4206 | } 4207 | ], 4208 | "scatter3d": [ 4209 | { 4210 | "line": { 4211 | "colorbar": { 4212 | "outlinewidth": 0, 4213 | "ticks": "" 4214 | } 4215 | }, 4216 | "marker": { 4217 | "colorbar": { 4218 | "outlinewidth": 0, 4219 | "ticks": "" 4220 | } 4221 | }, 4222 | "type": "scatter3d" 4223 | } 4224 | ], 4225 | "scattercarpet": [ 4226 | { 4227 | "marker": { 4228 | "colorbar": { 4229 | "outlinewidth": 0, 4230 | "ticks": "" 4231 | } 4232 | }, 4233 | "type": "scattercarpet" 4234 | } 4235 | ], 4236 | "scattergeo": [ 4237 | { 4238 | "marker": { 4239 | "colorbar": { 4240 | "outlinewidth": 0, 4241 | "ticks": "" 4242 | } 4243 | }, 4244 | "type": "scattergeo" 4245 | } 4246 | ], 4247 | "scattergl": [ 4248 | { 4249 | "marker": { 4250 | "colorbar": { 4251 | "outlinewidth": 0, 4252 | "ticks": "" 4253 | } 4254 | }, 4255 | "type": "scattergl" 4256 | } 4257 | ], 4258 | "scattermapbox": [ 4259 | { 4260 | "marker": { 4261 | "colorbar": { 4262 | "outlinewidth": 0, 4263 | "ticks": "" 4264 | } 4265 | }, 4266 | "type": "scattermapbox" 4267 | } 4268 | ], 4269 | "scatterpolar": [ 4270 | { 4271 | "marker": { 4272 | "colorbar": { 4273 | "outlinewidth": 0, 4274 | "ticks": "" 4275 | } 4276 | }, 4277 | "type": "scatterpolar" 4278 | } 4279 | ], 4280 | "scatterpolargl": [ 4281 | { 4282 | "marker": { 4283 | "colorbar": { 4284 | "outlinewidth": 0, 4285 | "ticks": "" 4286 | } 4287 | }, 4288 | "type": "scatterpolargl" 4289 | } 4290 | ], 4291 | "scatterternary": [ 4292 | { 4293 | "marker": { 4294 | "colorbar": { 4295 | "outlinewidth": 0, 4296 | "ticks": "" 4297 | } 4298 | }, 4299 | "type": "scatterternary" 4300 | } 4301 | ], 4302 | "surface": [ 4303 | { 4304 | "colorbar": { 4305 | "outlinewidth": 0, 4306 | "ticks": "" 4307 | }, 4308 | "colorscale": [ 4309 | [ 4310 | 0, 4311 | "#0d0887" 4312 | ], 4313 | [ 4314 | 0.1111111111111111, 4315 | "#46039f" 4316 | ], 4317 | [ 4318 | 0.2222222222222222, 4319 | "#7201a8" 4320 | ], 4321 | [ 4322 | 0.3333333333333333, 4323 | "#9c179e" 4324 | ], 4325 | [ 4326 | 0.4444444444444444, 4327 | "#bd3786" 4328 | ], 4329 | [ 4330 | 0.5555555555555556, 4331 | "#d8576b" 4332 | ], 4333 | [ 4334 | 0.6666666666666666, 4335 | "#ed7953" 4336 | ], 4337 | [ 4338 | 0.7777777777777778, 4339 | "#fb9f3a" 4340 | ], 4341 | [ 4342 | 0.8888888888888888, 4343 | "#fdca26" 4344 | ], 4345 | [ 4346 | 1, 4347 | "#f0f921" 4348 | ] 4349 | ], 4350 | "type": "surface" 4351 | } 4352 | ], 4353 | "table": [ 4354 | { 4355 | "cells": { 4356 | "fill": { 4357 | "color": "#EBF0F8" 4358 | }, 4359 | "line": { 4360 | "color": "white" 4361 | } 4362 | }, 4363 | "header": { 4364 | "fill": { 4365 | "color": "#C8D4E3" 4366 | }, 4367 | "line": { 4368 | "color": "white" 4369 | } 4370 | }, 4371 | "type": "table" 4372 | } 4373 | ] 4374 | }, 4375 | "layout": { 4376 | "annotationdefaults": { 4377 | "arrowcolor": "#2a3f5f", 4378 | "arrowhead": 0, 4379 | "arrowwidth": 1 4380 | }, 4381 | "autotypenumbers": "strict", 4382 | "coloraxis": { 4383 | "colorbar": { 4384 | "outlinewidth": 0, 4385 | "ticks": "" 4386 | } 4387 | }, 4388 | "colorscale": { 4389 | "diverging": [ 4390 | [ 4391 | 0, 4392 | "#8e0152" 4393 | ], 4394 | [ 4395 | 0.1, 4396 | "#c51b7d" 4397 | ], 4398 | [ 4399 | 0.2, 4400 | "#de77ae" 4401 | ], 4402 | [ 4403 | 0.3, 4404 | "#f1b6da" 4405 | ], 4406 | [ 4407 | 0.4, 4408 | "#fde0ef" 4409 | ], 4410 | [ 4411 | 0.5, 4412 | "#f7f7f7" 4413 | ], 4414 | [ 4415 | 0.6, 4416 | "#e6f5d0" 4417 | ], 4418 | [ 4419 | 0.7, 4420 | "#b8e186" 4421 | ], 4422 | [ 4423 | 0.8, 4424 | "#7fbc41" 4425 | ], 4426 | [ 4427 | 0.9, 4428 | "#4d9221" 4429 | ], 4430 | [ 4431 | 1, 4432 | "#276419" 4433 | ] 4434 | ], 4435 | "sequential": [ 4436 | [ 4437 | 0, 4438 | "#0d0887" 4439 | ], 4440 | [ 4441 | 0.1111111111111111, 4442 | "#46039f" 4443 | ], 4444 | [ 4445 | 0.2222222222222222, 4446 | "#7201a8" 4447 | ], 4448 | [ 4449 | 0.3333333333333333, 4450 | "#9c179e" 4451 | ], 4452 | [ 4453 | 0.4444444444444444, 4454 | "#bd3786" 4455 | ], 4456 | [ 4457 | 0.5555555555555556, 4458 | "#d8576b" 4459 | ], 4460 | [ 4461 | 0.6666666666666666, 4462 | "#ed7953" 4463 | ], 4464 | [ 4465 | 0.7777777777777778, 4466 | "#fb9f3a" 4467 | ], 4468 | [ 4469 | 0.8888888888888888, 4470 | "#fdca26" 4471 | ], 4472 | [ 4473 | 1, 4474 | "#f0f921" 4475 | ] 4476 | ], 4477 | "sequentialminus": [ 4478 | [ 4479 | 0, 4480 | "#0d0887" 4481 | ], 4482 | [ 4483 | 0.1111111111111111, 4484 | "#46039f" 4485 | ], 4486 | [ 4487 | 0.2222222222222222, 4488 | "#7201a8" 4489 | ], 4490 | [ 4491 | 0.3333333333333333, 4492 | "#9c179e" 4493 | ], 4494 | [ 4495 | 0.4444444444444444, 4496 | "#bd3786" 4497 | ], 4498 | [ 4499 | 0.5555555555555556, 4500 | "#d8576b" 4501 | ], 4502 | [ 4503 | 0.6666666666666666, 4504 | "#ed7953" 4505 | ], 4506 | [ 4507 | 0.7777777777777778, 4508 | "#fb9f3a" 4509 | ], 4510 | [ 4511 | 0.8888888888888888, 4512 | "#fdca26" 4513 | ], 4514 | [ 4515 | 1, 4516 | "#f0f921" 4517 | ] 4518 | ] 4519 | }, 4520 | "colorway": [ 4521 | "#636efa", 4522 | "#EF553B", 4523 | "#00cc96", 4524 | "#ab63fa", 4525 | "#FFA15A", 4526 | "#19d3f3", 4527 | "#FF6692", 4528 | "#B6E880", 4529 | "#FF97FF", 4530 | "#FECB52" 4531 | ], 4532 | "font": { 4533 | "color": "#2a3f5f" 4534 | }, 4535 | "geo": { 4536 | "bgcolor": "white", 4537 | "lakecolor": "white", 4538 | "landcolor": "white", 4539 | "showlakes": true, 4540 | "showland": true, 4541 | "subunitcolor": "#C8D4E3" 4542 | }, 4543 | "hoverlabel": { 4544 | "align": "left" 4545 | }, 4546 | "hovermode": "closest", 4547 | "mapbox": { 4548 | "style": "light" 4549 | }, 4550 | "paper_bgcolor": "white", 4551 | "plot_bgcolor": "white", 4552 | "polar": { 4553 | "angularaxis": { 4554 | "gridcolor": "#EBF0F8", 4555 | "linecolor": "#EBF0F8", 4556 | "ticks": "" 4557 | }, 4558 | "bgcolor": "white", 4559 | "radialaxis": { 4560 | "gridcolor": "#EBF0F8", 4561 | "linecolor": "#EBF0F8", 4562 | "ticks": "" 4563 | } 4564 | }, 4565 | "scene": { 4566 | "xaxis": { 4567 | "backgroundcolor": "white", 4568 | "gridcolor": "#DFE8F3", 4569 | "gridwidth": 2, 4570 | "linecolor": "#EBF0F8", 4571 | "showbackground": true, 4572 | "ticks": "", 4573 | "zerolinecolor": "#EBF0F8" 4574 | }, 4575 | "yaxis": { 4576 | "backgroundcolor": "white", 4577 | "gridcolor": "#DFE8F3", 4578 | "gridwidth": 2, 4579 | "linecolor": "#EBF0F8", 4580 | "showbackground": true, 4581 | "ticks": "", 4582 | "zerolinecolor": "#EBF0F8" 4583 | }, 4584 | "zaxis": { 4585 | "backgroundcolor": "white", 4586 | "gridcolor": "#DFE8F3", 4587 | "gridwidth": 2, 4588 | "linecolor": "#EBF0F8", 4589 | "showbackground": true, 4590 | "ticks": "", 4591 | "zerolinecolor": "#EBF0F8" 4592 | } 4593 | }, 4594 | "shapedefaults": { 4595 | "line": { 4596 | "color": "#2a3f5f" 4597 | } 4598 | }, 4599 | "ternary": { 4600 | "aaxis": { 4601 | "gridcolor": "#DFE8F3", 4602 | "linecolor": "#A2B1C6", 4603 | "ticks": "" 4604 | }, 4605 | "baxis": { 4606 | "gridcolor": "#DFE8F3", 4607 | "linecolor": "#A2B1C6", 4608 | "ticks": "" 4609 | }, 4610 | "bgcolor": "white", 4611 | "caxis": { 4612 | "gridcolor": "#DFE8F3", 4613 | "linecolor": "#A2B1C6", 4614 | "ticks": "" 4615 | } 4616 | }, 4617 | "title": { 4618 | "x": 0.05 4619 | }, 4620 | "xaxis": { 4621 | "automargin": true, 4622 | "gridcolor": "#EBF0F8", 4623 | "linecolor": "#EBF0F8", 4624 | "ticks": "", 4625 | "title": { 4626 | "standoff": 15 4627 | }, 4628 | "zerolinecolor": "#EBF0F8", 4629 | "zerolinewidth": 2 4630 | }, 4631 | "yaxis": { 4632 | "automargin": true, 4633 | "gridcolor": "#EBF0F8", 4634 | "linecolor": "#EBF0F8", 4635 | "ticks": "", 4636 | "title": { 4637 | "standoff": 15 4638 | }, 4639 | "zerolinecolor": "#EBF0F8", 4640 | "zerolinewidth": 2 4641 | } 4642 | } 4643 | }, 4644 | "title": { 4645 | "text": "Trends in Temperature Change and CO₂ Concentrations" 4646 | }, 4647 | "xaxis": { 4648 | "title": { 4649 | "text": "Year" 4650 | } 4651 | }, 4652 | "yaxis": { 4653 | "title": { 4654 | "text": "Values" 4655 | } 4656 | } 4657 | } 4658 | } 4659 | }, 4660 | "metadata": {}, 4661 | "output_type": "display_data" 4662 | } 4663 | ], 4664 | "source": [ 4665 | "# Trends and Seasonal Variations Analysis\n", 4666 | "\n", 4667 | "from scipy.stats import linregress\n", 4668 | "\n", 4669 | "# temperature trend\n", 4670 | "temp_trend = linregress(temperature_years.index, temperature_years.values)\n", 4671 | "temp_trend_line = temp_trend.slope * temperature_years.index + temp_trend.intercept\n", 4672 | "\n", 4673 | "# CO2 trend\n", 4674 | "co2_trend = linregress(co2_yearly.index, co2_yearly.values)\n", 4675 | "co2_trend_line = co2_trend.slope * co2_yearly.index + co2_trend.intercept\n", 4676 | "\n", 4677 | "fig_trends = go.Figure()\n", 4678 | "\n", 4679 | "fig_trends.add_trace(go.Scatter(\n", 4680 | " x=temperature_years.index, y=temperature_years.values,\n", 4681 | " mode='lines+markers', name=\"Temperature Change (°C)\"\n", 4682 | "))\n", 4683 | "fig_trends.add_trace(go.Scatter(\n", 4684 | " x=temperature_years.index, y=temp_trend_line,\n", 4685 | " mode='lines', name=f\"Temperature Trend (Slope: {temp_trend.slope:.2f})\", line=dict(dash='dash')\n", 4686 | "))\n", 4687 | "fig_trends.add_trace(go.Scatter(\n", 4688 | " x=co2_yearly.index, y=co2_yearly.values,\n", 4689 | " mode='lines+markers', name=\"CO₂ Concentration (ppm)\"\n", 4690 | "))\n", 4691 | "fig_trends.add_trace(go.Scatter(\n", 4692 | " x=co2_yearly.index, y=co2_trend_line,\n", 4693 | " mode='lines', name=f\"CO₂ Trend (Slope: {co2_trend.slope:.2f})\", line=dict(dash='dash')\n", 4694 | "))\n", 4695 | "\n", 4696 | "fig_trends.update_layout(\n", 4697 | " title=\"Trends in Temperature Change and CO₂ Concentrations\",\n", 4698 | " xaxis_title=\"Year\",\n", 4699 | " yaxis_title=\"Values\",\n", 4700 | " template=\"plotly_white\",\n", 4701 | " legend_title=\"Metrics\"\n", 4702 | ")\n", 4703 | "fig_trends.show()" 4704 | ] 4705 | }, 4706 | { 4707 | "cell_type": "code", 4708 | "execution_count": 7, 4709 | "id": "00cc95a8", 4710 | "metadata": {}, 4711 | "outputs": [ 4712 | { 4713 | "data": { 4714 | "application/vnd.plotly.v1+json": { 4715 | "config": { 4716 | "plotlyServerURL": "https://plot.ly" 4717 | }, 4718 | "data": [ 4719 | { 4720 | "hovertemplate": "Month=%{x}
CO₂ Concentration (ppm)=%{y}", 4721 | "legendgroup": "", 4722 | "line": { 4723 | "color": "#636efa", 4724 | "dash": "solid" 4725 | }, 4726 | "marker": { 4727 | "symbol": "circle" 4728 | }, 4729 | "mode": "markers+lines", 4730 | "name": "", 4731 | "orientation": "v", 4732 | "showlegend": false, 4733 | "type": "scatter", 4734 | "x": [ 4735 | 1, 4736 | 2, 4737 | 3, 4738 | 4, 4739 | 5, 4740 | 6, 4741 | 7, 4742 | 8, 4743 | 9, 4744 | 10, 4745 | 11, 4746 | 12 4747 | ], 4748 | "xaxis": "x", 4749 | "y": [ 4750 | 178.15503816793895, 4751 | 181.2962015503876, 4752 | 181.35931297709922, 4753 | 182.0142748091603, 4754 | 182.30740458015268, 4755 | 182.02519083969466, 4756 | 181.2520610687023, 4757 | 180.23725190839696, 4758 | 179.4613740458015, 4759 | 179.49076335877862, 4760 | 180.16847328244273, 4761 | 180.8353435114504 4762 | ], 4763 | "yaxis": "y" 4764 | } 4765 | ], 4766 | "layout": { 4767 | "legend": { 4768 | "tracegroupgap": 0 4769 | }, 4770 | "template": { 4771 | "data": { 4772 | "bar": [ 4773 | { 4774 | "error_x": { 4775 | "color": "#2a3f5f" 4776 | }, 4777 | "error_y": { 4778 | "color": "#2a3f5f" 4779 | }, 4780 | "marker": { 4781 | "line": { 4782 | "color": "white", 4783 | "width": 0.5 4784 | }, 4785 | "pattern": { 4786 | "fillmode": "overlay", 4787 | "size": 10, 4788 | "solidity": 0.2 4789 | } 4790 | }, 4791 | "type": "bar" 4792 | } 4793 | ], 4794 | "barpolar": [ 4795 | { 4796 | "marker": { 4797 | "line": { 4798 | "color": "white", 4799 | "width": 0.5 4800 | }, 4801 | "pattern": { 4802 | "fillmode": "overlay", 4803 | "size": 10, 4804 | "solidity": 0.2 4805 | } 4806 | }, 4807 | "type": "barpolar" 4808 | } 4809 | ], 4810 | "carpet": [ 4811 | { 4812 | "aaxis": { 4813 | "endlinecolor": "#2a3f5f", 4814 | "gridcolor": "#C8D4E3", 4815 | "linecolor": "#C8D4E3", 4816 | "minorgridcolor": "#C8D4E3", 4817 | "startlinecolor": "#2a3f5f" 4818 | }, 4819 | "baxis": { 4820 | "endlinecolor": "#2a3f5f", 4821 | "gridcolor": "#C8D4E3", 4822 | "linecolor": "#C8D4E3", 4823 | "minorgridcolor": "#C8D4E3", 4824 | "startlinecolor": "#2a3f5f" 4825 | }, 4826 | "type": "carpet" 4827 | } 4828 | ], 4829 | "choropleth": [ 4830 | { 4831 | "colorbar": { 4832 | "outlinewidth": 0, 4833 | "ticks": "" 4834 | }, 4835 | "type": "choropleth" 4836 | } 4837 | ], 4838 | "contour": [ 4839 | { 4840 | "colorbar": { 4841 | "outlinewidth": 0, 4842 | "ticks": "" 4843 | }, 4844 | "colorscale": [ 4845 | [ 4846 | 0, 4847 | "#0d0887" 4848 | ], 4849 | [ 4850 | 0.1111111111111111, 4851 | "#46039f" 4852 | ], 4853 | [ 4854 | 0.2222222222222222, 4855 | "#7201a8" 4856 | ], 4857 | [ 4858 | 0.3333333333333333, 4859 | "#9c179e" 4860 | ], 4861 | [ 4862 | 0.4444444444444444, 4863 | "#bd3786" 4864 | ], 4865 | [ 4866 | 0.5555555555555556, 4867 | "#d8576b" 4868 | ], 4869 | [ 4870 | 0.6666666666666666, 4871 | "#ed7953" 4872 | ], 4873 | [ 4874 | 0.7777777777777778, 4875 | "#fb9f3a" 4876 | ], 4877 | [ 4878 | 0.8888888888888888, 4879 | "#fdca26" 4880 | ], 4881 | [ 4882 | 1, 4883 | "#f0f921" 4884 | ] 4885 | ], 4886 | "type": "contour" 4887 | } 4888 | ], 4889 | "contourcarpet": [ 4890 | { 4891 | "colorbar": { 4892 | "outlinewidth": 0, 4893 | "ticks": "" 4894 | }, 4895 | "type": "contourcarpet" 4896 | } 4897 | ], 4898 | "heatmap": [ 4899 | { 4900 | "colorbar": { 4901 | "outlinewidth": 0, 4902 | "ticks": "" 4903 | }, 4904 | "colorscale": [ 4905 | [ 4906 | 0, 4907 | "#0d0887" 4908 | ], 4909 | [ 4910 | 0.1111111111111111, 4911 | "#46039f" 4912 | ], 4913 | [ 4914 | 0.2222222222222222, 4915 | "#7201a8" 4916 | ], 4917 | [ 4918 | 0.3333333333333333, 4919 | "#9c179e" 4920 | ], 4921 | [ 4922 | 0.4444444444444444, 4923 | "#bd3786" 4924 | ], 4925 | [ 4926 | 0.5555555555555556, 4927 | "#d8576b" 4928 | ], 4929 | [ 4930 | 0.6666666666666666, 4931 | "#ed7953" 4932 | ], 4933 | [ 4934 | 0.7777777777777778, 4935 | "#fb9f3a" 4936 | ], 4937 | [ 4938 | 0.8888888888888888, 4939 | "#fdca26" 4940 | ], 4941 | [ 4942 | 1, 4943 | "#f0f921" 4944 | ] 4945 | ], 4946 | "type": "heatmap" 4947 | } 4948 | ], 4949 | "heatmapgl": [ 4950 | { 4951 | "colorbar": { 4952 | "outlinewidth": 0, 4953 | "ticks": "" 4954 | }, 4955 | "colorscale": [ 4956 | [ 4957 | 0, 4958 | "#0d0887" 4959 | ], 4960 | [ 4961 | 0.1111111111111111, 4962 | "#46039f" 4963 | ], 4964 | [ 4965 | 0.2222222222222222, 4966 | "#7201a8" 4967 | ], 4968 | [ 4969 | 0.3333333333333333, 4970 | "#9c179e" 4971 | ], 4972 | [ 4973 | 0.4444444444444444, 4974 | "#bd3786" 4975 | ], 4976 | [ 4977 | 0.5555555555555556, 4978 | "#d8576b" 4979 | ], 4980 | [ 4981 | 0.6666666666666666, 4982 | "#ed7953" 4983 | ], 4984 | [ 4985 | 0.7777777777777778, 4986 | "#fb9f3a" 4987 | ], 4988 | [ 4989 | 0.8888888888888888, 4990 | "#fdca26" 4991 | ], 4992 | [ 4993 | 1, 4994 | "#f0f921" 4995 | ] 4996 | ], 4997 | "type": "heatmapgl" 4998 | } 4999 | ], 5000 | "histogram": [ 5001 | { 5002 | "marker": { 5003 | "pattern": { 5004 | "fillmode": "overlay", 5005 | "size": 10, 5006 | "solidity": 0.2 5007 | } 5008 | }, 5009 | "type": "histogram" 5010 | } 5011 | ], 5012 | "histogram2d": [ 5013 | { 5014 | "colorbar": { 5015 | "outlinewidth": 0, 5016 | "ticks": "" 5017 | }, 5018 | "colorscale": [ 5019 | [ 5020 | 0, 5021 | "#0d0887" 5022 | ], 5023 | [ 5024 | 0.1111111111111111, 5025 | "#46039f" 5026 | ], 5027 | [ 5028 | 0.2222222222222222, 5029 | "#7201a8" 5030 | ], 5031 | [ 5032 | 0.3333333333333333, 5033 | "#9c179e" 5034 | ], 5035 | [ 5036 | 0.4444444444444444, 5037 | "#bd3786" 5038 | ], 5039 | [ 5040 | 0.5555555555555556, 5041 | "#d8576b" 5042 | ], 5043 | [ 5044 | 0.6666666666666666, 5045 | "#ed7953" 5046 | ], 5047 | [ 5048 | 0.7777777777777778, 5049 | "#fb9f3a" 5050 | ], 5051 | [ 5052 | 0.8888888888888888, 5053 | "#fdca26" 5054 | ], 5055 | [ 5056 | 1, 5057 | "#f0f921" 5058 | ] 5059 | ], 5060 | "type": "histogram2d" 5061 | } 5062 | ], 5063 | "histogram2dcontour": [ 5064 | { 5065 | "colorbar": { 5066 | "outlinewidth": 0, 5067 | "ticks": "" 5068 | }, 5069 | "colorscale": [ 5070 | [ 5071 | 0, 5072 | "#0d0887" 5073 | ], 5074 | [ 5075 | 0.1111111111111111, 5076 | "#46039f" 5077 | ], 5078 | [ 5079 | 0.2222222222222222, 5080 | "#7201a8" 5081 | ], 5082 | [ 5083 | 0.3333333333333333, 5084 | "#9c179e" 5085 | ], 5086 | [ 5087 | 0.4444444444444444, 5088 | "#bd3786" 5089 | ], 5090 | [ 5091 | 0.5555555555555556, 5092 | "#d8576b" 5093 | ], 5094 | [ 5095 | 0.6666666666666666, 5096 | "#ed7953" 5097 | ], 5098 | [ 5099 | 0.7777777777777778, 5100 | "#fb9f3a" 5101 | ], 5102 | [ 5103 | 0.8888888888888888, 5104 | "#fdca26" 5105 | ], 5106 | [ 5107 | 1, 5108 | "#f0f921" 5109 | ] 5110 | ], 5111 | "type": "histogram2dcontour" 5112 | } 5113 | ], 5114 | "mesh3d": [ 5115 | { 5116 | "colorbar": { 5117 | "outlinewidth": 0, 5118 | "ticks": "" 5119 | }, 5120 | "type": "mesh3d" 5121 | } 5122 | ], 5123 | "parcoords": [ 5124 | { 5125 | "line": { 5126 | "colorbar": { 5127 | "outlinewidth": 0, 5128 | "ticks": "" 5129 | } 5130 | }, 5131 | "type": "parcoords" 5132 | } 5133 | ], 5134 | "pie": [ 5135 | { 5136 | "automargin": true, 5137 | "type": "pie" 5138 | } 5139 | ], 5140 | "scatter": [ 5141 | { 5142 | "fillpattern": { 5143 | "fillmode": "overlay", 5144 | "size": 10, 5145 | "solidity": 0.2 5146 | }, 5147 | "type": "scatter" 5148 | } 5149 | ], 5150 | "scatter3d": [ 5151 | { 5152 | "line": { 5153 | "colorbar": { 5154 | "outlinewidth": 0, 5155 | "ticks": "" 5156 | } 5157 | }, 5158 | "marker": { 5159 | "colorbar": { 5160 | "outlinewidth": 0, 5161 | "ticks": "" 5162 | } 5163 | }, 5164 | "type": "scatter3d" 5165 | } 5166 | ], 5167 | "scattercarpet": [ 5168 | { 5169 | "marker": { 5170 | "colorbar": { 5171 | "outlinewidth": 0, 5172 | "ticks": "" 5173 | } 5174 | }, 5175 | "type": "scattercarpet" 5176 | } 5177 | ], 5178 | "scattergeo": [ 5179 | { 5180 | "marker": { 5181 | "colorbar": { 5182 | "outlinewidth": 0, 5183 | "ticks": "" 5184 | } 5185 | }, 5186 | "type": "scattergeo" 5187 | } 5188 | ], 5189 | "scattergl": [ 5190 | { 5191 | "marker": { 5192 | "colorbar": { 5193 | "outlinewidth": 0, 5194 | "ticks": "" 5195 | } 5196 | }, 5197 | "type": "scattergl" 5198 | } 5199 | ], 5200 | "scattermapbox": [ 5201 | { 5202 | "marker": { 5203 | "colorbar": { 5204 | "outlinewidth": 0, 5205 | "ticks": "" 5206 | } 5207 | }, 5208 | "type": "scattermapbox" 5209 | } 5210 | ], 5211 | "scatterpolar": [ 5212 | { 5213 | "marker": { 5214 | "colorbar": { 5215 | "outlinewidth": 0, 5216 | "ticks": "" 5217 | } 5218 | }, 5219 | "type": "scatterpolar" 5220 | } 5221 | ], 5222 | "scatterpolargl": [ 5223 | { 5224 | "marker": { 5225 | "colorbar": { 5226 | "outlinewidth": 0, 5227 | "ticks": "" 5228 | } 5229 | }, 5230 | "type": "scatterpolargl" 5231 | } 5232 | ], 5233 | "scatterternary": [ 5234 | { 5235 | "marker": { 5236 | "colorbar": { 5237 | "outlinewidth": 0, 5238 | "ticks": "" 5239 | } 5240 | }, 5241 | "type": "scatterternary" 5242 | } 5243 | ], 5244 | "surface": [ 5245 | { 5246 | "colorbar": { 5247 | "outlinewidth": 0, 5248 | "ticks": "" 5249 | }, 5250 | "colorscale": [ 5251 | [ 5252 | 0, 5253 | "#0d0887" 5254 | ], 5255 | [ 5256 | 0.1111111111111111, 5257 | "#46039f" 5258 | ], 5259 | [ 5260 | 0.2222222222222222, 5261 | "#7201a8" 5262 | ], 5263 | [ 5264 | 0.3333333333333333, 5265 | "#9c179e" 5266 | ], 5267 | [ 5268 | 0.4444444444444444, 5269 | "#bd3786" 5270 | ], 5271 | [ 5272 | 0.5555555555555556, 5273 | "#d8576b" 5274 | ], 5275 | [ 5276 | 0.6666666666666666, 5277 | "#ed7953" 5278 | ], 5279 | [ 5280 | 0.7777777777777778, 5281 | "#fb9f3a" 5282 | ], 5283 | [ 5284 | 0.8888888888888888, 5285 | "#fdca26" 5286 | ], 5287 | [ 5288 | 1, 5289 | "#f0f921" 5290 | ] 5291 | ], 5292 | "type": "surface" 5293 | } 5294 | ], 5295 | "table": [ 5296 | { 5297 | "cells": { 5298 | "fill": { 5299 | "color": "#EBF0F8" 5300 | }, 5301 | "line": { 5302 | "color": "white" 5303 | } 5304 | }, 5305 | "header": { 5306 | "fill": { 5307 | "color": "#C8D4E3" 5308 | }, 5309 | "line": { 5310 | "color": "white" 5311 | } 5312 | }, 5313 | "type": "table" 5314 | } 5315 | ] 5316 | }, 5317 | "layout": { 5318 | "annotationdefaults": { 5319 | "arrowcolor": "#2a3f5f", 5320 | "arrowhead": 0, 5321 | "arrowwidth": 1 5322 | }, 5323 | "autotypenumbers": "strict", 5324 | "coloraxis": { 5325 | "colorbar": { 5326 | "outlinewidth": 0, 5327 | "ticks": "" 5328 | } 5329 | }, 5330 | "colorscale": { 5331 | "diverging": [ 5332 | [ 5333 | 0, 5334 | "#8e0152" 5335 | ], 5336 | [ 5337 | 0.1, 5338 | "#c51b7d" 5339 | ], 5340 | [ 5341 | 0.2, 5342 | "#de77ae" 5343 | ], 5344 | [ 5345 | 0.3, 5346 | "#f1b6da" 5347 | ], 5348 | [ 5349 | 0.4, 5350 | "#fde0ef" 5351 | ], 5352 | [ 5353 | 0.5, 5354 | "#f7f7f7" 5355 | ], 5356 | [ 5357 | 0.6, 5358 | "#e6f5d0" 5359 | ], 5360 | [ 5361 | 0.7, 5362 | "#b8e186" 5363 | ], 5364 | [ 5365 | 0.8, 5366 | "#7fbc41" 5367 | ], 5368 | [ 5369 | 0.9, 5370 | "#4d9221" 5371 | ], 5372 | [ 5373 | 1, 5374 | "#276419" 5375 | ] 5376 | ], 5377 | "sequential": [ 5378 | [ 5379 | 0, 5380 | "#0d0887" 5381 | ], 5382 | [ 5383 | 0.1111111111111111, 5384 | "#46039f" 5385 | ], 5386 | [ 5387 | 0.2222222222222222, 5388 | "#7201a8" 5389 | ], 5390 | [ 5391 | 0.3333333333333333, 5392 | "#9c179e" 5393 | ], 5394 | [ 5395 | 0.4444444444444444, 5396 | "#bd3786" 5397 | ], 5398 | [ 5399 | 0.5555555555555556, 5400 | "#d8576b" 5401 | ], 5402 | [ 5403 | 0.6666666666666666, 5404 | "#ed7953" 5405 | ], 5406 | [ 5407 | 0.7777777777777778, 5408 | "#fb9f3a" 5409 | ], 5410 | [ 5411 | 0.8888888888888888, 5412 | "#fdca26" 5413 | ], 5414 | [ 5415 | 1, 5416 | "#f0f921" 5417 | ] 5418 | ], 5419 | "sequentialminus": [ 5420 | [ 5421 | 0, 5422 | "#0d0887" 5423 | ], 5424 | [ 5425 | 0.1111111111111111, 5426 | "#46039f" 5427 | ], 5428 | [ 5429 | 0.2222222222222222, 5430 | "#7201a8" 5431 | ], 5432 | [ 5433 | 0.3333333333333333, 5434 | "#9c179e" 5435 | ], 5436 | [ 5437 | 0.4444444444444444, 5438 | "#bd3786" 5439 | ], 5440 | [ 5441 | 0.5555555555555556, 5442 | "#d8576b" 5443 | ], 5444 | [ 5445 | 0.6666666666666666, 5446 | "#ed7953" 5447 | ], 5448 | [ 5449 | 0.7777777777777778, 5450 | "#fb9f3a" 5451 | ], 5452 | [ 5453 | 0.8888888888888888, 5454 | "#fdca26" 5455 | ], 5456 | [ 5457 | 1, 5458 | "#f0f921" 5459 | ] 5460 | ] 5461 | }, 5462 | "colorway": [ 5463 | "#636efa", 5464 | "#EF553B", 5465 | "#00cc96", 5466 | "#ab63fa", 5467 | "#FFA15A", 5468 | "#19d3f3", 5469 | "#FF6692", 5470 | "#B6E880", 5471 | "#FF97FF", 5472 | "#FECB52" 5473 | ], 5474 | "font": { 5475 | "color": "#2a3f5f" 5476 | }, 5477 | "geo": { 5478 | "bgcolor": "white", 5479 | "lakecolor": "white", 5480 | "landcolor": "white", 5481 | "showlakes": true, 5482 | "showland": true, 5483 | "subunitcolor": "#C8D4E3" 5484 | }, 5485 | "hoverlabel": { 5486 | "align": "left" 5487 | }, 5488 | "hovermode": "closest", 5489 | "mapbox": { 5490 | "style": "light" 5491 | }, 5492 | "paper_bgcolor": "white", 5493 | "plot_bgcolor": "white", 5494 | "polar": { 5495 | "angularaxis": { 5496 | "gridcolor": "#EBF0F8", 5497 | "linecolor": "#EBF0F8", 5498 | "ticks": "" 5499 | }, 5500 | "bgcolor": "white", 5501 | "radialaxis": { 5502 | "gridcolor": "#EBF0F8", 5503 | "linecolor": "#EBF0F8", 5504 | "ticks": "" 5505 | } 5506 | }, 5507 | "scene": { 5508 | "xaxis": { 5509 | "backgroundcolor": "white", 5510 | "gridcolor": "#DFE8F3", 5511 | "gridwidth": 2, 5512 | "linecolor": "#EBF0F8", 5513 | "showbackground": true, 5514 | "ticks": "", 5515 | "zerolinecolor": "#EBF0F8" 5516 | }, 5517 | "yaxis": { 5518 | "backgroundcolor": "white", 5519 | "gridcolor": "#DFE8F3", 5520 | "gridwidth": 2, 5521 | "linecolor": "#EBF0F8", 5522 | "showbackground": true, 5523 | "ticks": "", 5524 | "zerolinecolor": "#EBF0F8" 5525 | }, 5526 | "zaxis": { 5527 | "backgroundcolor": "white", 5528 | "gridcolor": "#DFE8F3", 5529 | "gridwidth": 2, 5530 | "linecolor": "#EBF0F8", 5531 | "showbackground": true, 5532 | "ticks": "", 5533 | "zerolinecolor": "#EBF0F8" 5534 | } 5535 | }, 5536 | "shapedefaults": { 5537 | "line": { 5538 | "color": "#2a3f5f" 5539 | } 5540 | }, 5541 | "ternary": { 5542 | "aaxis": { 5543 | "gridcolor": "#DFE8F3", 5544 | "linecolor": "#A2B1C6", 5545 | "ticks": "" 5546 | }, 5547 | "baxis": { 5548 | "gridcolor": "#DFE8F3", 5549 | "linecolor": "#A2B1C6", 5550 | "ticks": "" 5551 | }, 5552 | "bgcolor": "white", 5553 | "caxis": { 5554 | "gridcolor": "#DFE8F3", 5555 | "linecolor": "#A2B1C6", 5556 | "ticks": "" 5557 | } 5558 | }, 5559 | "title": { 5560 | "x": 0.05 5561 | }, 5562 | "xaxis": { 5563 | "automargin": true, 5564 | "gridcolor": "#EBF0F8", 5565 | "linecolor": "#EBF0F8", 5566 | "ticks": "", 5567 | "title": { 5568 | "standoff": 15 5569 | }, 5570 | "zerolinecolor": "#EBF0F8", 5571 | "zerolinewidth": 2 5572 | }, 5573 | "yaxis": { 5574 | "automargin": true, 5575 | "gridcolor": "#EBF0F8", 5576 | "linecolor": "#EBF0F8", 5577 | "ticks": "", 5578 | "title": { 5579 | "standoff": 15 5580 | }, 5581 | "zerolinecolor": "#EBF0F8", 5582 | "zerolinewidth": 2 5583 | } 5584 | } 5585 | }, 5586 | "title": { 5587 | "text": "Seasonal Variations in CO₂ Concentrations" 5588 | }, 5589 | "xaxis": { 5590 | "anchor": "y", 5591 | "domain": [ 5592 | 0, 5593 | 1 5594 | ], 5595 | "tickmode": "array", 5596 | "tickvals": [ 5597 | 1, 5598 | 2, 5599 | 3, 5600 | 4, 5601 | 5, 5602 | 6, 5603 | 7, 5604 | 8, 5605 | 9, 5606 | 10, 5607 | 11, 5608 | 12 5609 | ], 5610 | "title": { 5611 | "text": "Month" 5612 | } 5613 | }, 5614 | "yaxis": { 5615 | "anchor": "x", 5616 | "domain": [ 5617 | 0, 5618 | 1 5619 | ], 5620 | "title": { 5621 | "text": "CO₂ Concentration (ppm)" 5622 | } 5623 | } 5624 | } 5625 | } 5626 | }, 5627 | "metadata": {}, 5628 | "output_type": "display_data" 5629 | } 5630 | ], 5631 | "source": [ 5632 | "# seasonal variations in CO2 concentrations\n", 5633 | "co2_data['Month'] = co2_data['Date'].str[-2:].astype(int)\n", 5634 | "co2_monthly = co2_data.groupby('Month')['Value'].mean()\n", 5635 | "\n", 5636 | "fig_seasonal = px.line(\n", 5637 | " co2_monthly,\n", 5638 | " x=co2_monthly.index,\n", 5639 | " y=co2_monthly.values,\n", 5640 | " labels={\"x\": \"Month\", \"y\": \"CO₂ Concentration (ppm)\"},\n", 5641 | " title=\"Seasonal Variations in CO₂ Concentrations\",\n", 5642 | " markers=True\n", 5643 | ")\n", 5644 | "fig_seasonal.update_layout(\n", 5645 | " xaxis=dict(tickmode=\"array\", tickvals=list(range(1, 13))),\n", 5646 | " template=\"plotly_white\"\n", 5647 | ")\n", 5648 | "fig_seasonal.show()" 5649 | ] 5650 | }, 5651 | { 5652 | "cell_type": "code", 5653 | "execution_count": 8, 5654 | "id": "6e514434", 5655 | "metadata": {}, 5656 | "outputs": [ 5657 | { 5658 | "data": { 5659 | "text/plain": [ 5660 | "(0.9554282559257312,\n", 5661 | " 0.9379013371609882,\n", 5662 | " {'Lag 1': 0.0617, 'Lag 2': 0.6754, 'Lag 3': 0.2994})" 5663 | ] 5664 | }, 5665 | "execution_count": 8, 5666 | "metadata": {}, 5667 | "output_type": "execute_result" 5668 | } 5669 | ], 5670 | "source": [ 5671 | "# Correlation and Causality Analysis\n", 5672 | "\n", 5673 | "from scipy.stats import pearsonr, spearmanr\n", 5674 | "from statsmodels.tsa.stattools import grangercausalitytests\n", 5675 | "\n", 5676 | "# pearson and spearman correlation coefficients\n", 5677 | "pearson_corr, _ = pearsonr(merged_data[\"CO₂ Concentration\"], merged_data[\"Temperature Change\"])\n", 5678 | "spearman_corr, _ = spearmanr(merged_data[\"CO₂ Concentration\"], merged_data[\"Temperature Change\"])\n", 5679 | "\n", 5680 | "# granger causality test\n", 5681 | "granger_data = merged_data.diff().dropna() # first differencing to make data stationary\n", 5682 | "granger_results = grangercausalitytests(granger_data, maxlag=3, verbose=False)\n", 5683 | "\n", 5684 | "# extracting p-values for causality\n", 5685 | "granger_p_values = {f\"Lag {lag}\": round(results[0]['ssr_chi2test'][1], 4)\n", 5686 | " for lag, results in granger_results.items()}\n", 5687 | "\n", 5688 | "pearson_corr, spearman_corr, granger_p_values" 5689 | ] 5690 | }, 5691 | { 5692 | "cell_type": "code", 5693 | "execution_count": 9, 5694 | "id": "4ac53874", 5695 | "metadata": {}, 5696 | "outputs": [ 5697 | { 5698 | "data": { 5699 | "text/html": [ 5700 | "\n", 5701 | "\n", 5702 | "\n", 5703 | " \n", 5704 | "\n", 5705 | "\n", 5706 | " \n", 5707 | "\n", 5708 | "\n", 5709 | " \n", 5710 | "\n", 5711 | "\n", 5712 | " \n", 5713 | "\n", 5714 | "\n", 5715 | " \n", 5716 | "\n", 5717 | "\n", 5718 | " \n", 5719 | "\n", 5720 | "\n", 5721 | " \n", 5722 | "\n", 5723 | "\n", 5724 | " \n", 5725 | "\n", 5726 | "\n", 5727 | " \n", 5728 | "\n", 5729 | "
OLS Regression Results
Dep. Variable: Temperature Change R-squared: 0.949
Model: OLS Adj. R-squared: 0.945
Method: Least Squares F-statistic: 252.5
Date: Tue, 29 Jul 2025 Prob (F-statistic): 2.97e-34
Time: 18:48:26 Log-Likelihood: 45.098
No. Observations: 59 AIC: -80.20
Df Residuals: 54 BIC: -69.81
Df Model: 4
Covariance Type: nonrobust
\n", 5730 | "\n", 5731 | "\n", 5732 | " \n", 5733 | "\n", 5734 | "\n", 5735 | " \n", 5736 | "\n", 5737 | "\n", 5738 | " \n", 5739 | "\n", 5740 | "\n", 5741 | " \n", 5742 | "\n", 5743 | "\n", 5744 | " \n", 5745 | "\n", 5746 | "\n", 5747 | " \n", 5748 | "\n", 5749 | "
coef std err t P>|t| [0.025 0.975]
const -4.7980 0.317 -15.137 0.000 -5.434 -4.163
CO₂ Concentration 0.3245 0.055 5.942 0.000 0.215 0.434
CO₂ Lag 1 -0.2962 0.068 -4.361 0.000 -0.432 -0.160
CO₂ Lag 2 0.0104 0.068 0.153 0.879 -0.126 0.146
CO₂ Lag 3 -0.0107 0.056 -0.191 0.849 -0.123 0.101
\n", 5750 | "\n", 5751 | "\n", 5752 | " \n", 5753 | "\n", 5754 | "\n", 5755 | " \n", 5756 | "\n", 5757 | "\n", 5758 | " \n", 5759 | "\n", 5760 | "\n", 5761 | " \n", 5762 | "\n", 5763 | "
Omnibus: 2.369 Durbin-Watson: 1.554
Prob(Omnibus): 0.306 Jarque-Bera (JB): 2.077
Skew: -0.457 Prob(JB): 0.354
Kurtosis: 2.902 Cond. No. 7.54e+03


Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[2] The condition number is large, 7.54e+03. This might indicate that there are
strong multicollinearity or other numerical problems." 5764 | ], 5765 | "text/latex": [ 5766 | "\\begin{center}\n", 5767 | "\\begin{tabular}{lclc}\n", 5768 | "\\toprule\n", 5769 | "\\textbf{Dep. Variable:} & Temperature Change & \\textbf{ R-squared: } & 0.949 \\\\\n", 5770 | "\\textbf{Model:} & OLS & \\textbf{ Adj. R-squared: } & 0.945 \\\\\n", 5771 | "\\textbf{Method:} & Least Squares & \\textbf{ F-statistic: } & 252.5 \\\\\n", 5772 | "\\textbf{Date:} & Tue, 29 Jul 2025 & \\textbf{ Prob (F-statistic):} & 2.97e-34 \\\\\n", 5773 | "\\textbf{Time:} & 18:48:26 & \\textbf{ Log-Likelihood: } & 45.098 \\\\\n", 5774 | "\\textbf{No. Observations:} & 59 & \\textbf{ AIC: } & -80.20 \\\\\n", 5775 | "\\textbf{Df Residuals:} & 54 & \\textbf{ BIC: } & -69.81 \\\\\n", 5776 | "\\textbf{Df Model:} & 4 & \\textbf{ } & \\\\\n", 5777 | "\\textbf{Covariance Type:} & nonrobust & \\textbf{ } & \\\\\n", 5778 | "\\bottomrule\n", 5779 | "\\end{tabular}\n", 5780 | "\\begin{tabular}{lcccccc}\n", 5781 | " & \\textbf{coef} & \\textbf{std err} & \\textbf{t} & \\textbf{P$> |$t$|$} & \\textbf{[0.025} & \\textbf{0.975]} \\\\\n", 5782 | "\\midrule\n", 5783 | "\\textbf{const} & -4.7980 & 0.317 & -15.137 & 0.000 & -5.434 & -4.163 \\\\\n", 5784 | "\\textbf{CO₂ Concentration} & 0.3245 & 0.055 & 5.942 & 0.000 & 0.215 & 0.434 \\\\\n", 5785 | "\\textbf{CO₂ Lag 1} & -0.2962 & 0.068 & -4.361 & 0.000 & -0.432 & -0.160 \\\\\n", 5786 | "\\textbf{CO₂ Lag 2} & 0.0104 & 0.068 & 0.153 & 0.879 & -0.126 & 0.146 \\\\\n", 5787 | "\\textbf{CO₂ Lag 3} & -0.0107 & 0.056 & -0.191 & 0.849 & -0.123 & 0.101 \\\\\n", 5788 | "\\bottomrule\n", 5789 | "\\end{tabular}\n", 5790 | "\\begin{tabular}{lclc}\n", 5791 | "\\textbf{Omnibus:} & 2.369 & \\textbf{ Durbin-Watson: } & 1.554 \\\\\n", 5792 | "\\textbf{Prob(Omnibus):} & 0.306 & \\textbf{ Jarque-Bera (JB): } & 2.077 \\\\\n", 5793 | "\\textbf{Skew:} & -0.457 & \\textbf{ Prob(JB): } & 0.354 \\\\\n", 5794 | "\\textbf{Kurtosis:} & 2.902 & \\textbf{ Cond. No. } & 7.54e+03 \\\\\n", 5795 | "\\bottomrule\n", 5796 | "\\end{tabular}\n", 5797 | "%\\caption{OLS Regression Results}\n", 5798 | "\\end{center}\n", 5799 | "\n", 5800 | "Notes: \\newline\n", 5801 | " [1] Standard Errors assume that the covariance matrix of the errors is correctly specified. \\newline\n", 5802 | " [2] The condition number is large, 7.54e+03. This might indicate that there are \\newline\n", 5803 | " strong multicollinearity or other numerical problems." 5804 | ], 5805 | "text/plain": [ 5806 | "\n", 5807 | "\"\"\"\n", 5808 | " OLS Regression Results \n", 5809 | "==============================================================================\n", 5810 | "Dep. Variable: Temperature Change R-squared: 0.949\n", 5811 | "Model: OLS Adj. R-squared: 0.945\n", 5812 | "Method: Least Squares F-statistic: 252.5\n", 5813 | "Date: Tue, 29 Jul 2025 Prob (F-statistic): 2.97e-34\n", 5814 | "Time: 18:48:26 Log-Likelihood: 45.098\n", 5815 | "No. Observations: 59 AIC: -80.20\n", 5816 | "Df Residuals: 54 BIC: -69.81\n", 5817 | "Df Model: 4 \n", 5818 | "Covariance Type: nonrobust \n", 5819 | "=====================================================================================\n", 5820 | " coef std err t P>|t| [0.025 0.975]\n", 5821 | "-------------------------------------------------------------------------------------\n", 5822 | "const -4.7980 0.317 -15.137 0.000 -5.434 -4.163\n", 5823 | "CO₂ Concentration 0.3245 0.055 5.942 0.000 0.215 0.434\n", 5824 | "CO₂ Lag 1 -0.2962 0.068 -4.361 0.000 -0.432 -0.160\n", 5825 | "CO₂ Lag 2 0.0104 0.068 0.153 0.879 -0.126 0.146\n", 5826 | "CO₂ Lag 3 -0.0107 0.056 -0.191 0.849 -0.123 0.101\n", 5827 | "==============================================================================\n", 5828 | "Omnibus: 2.369 Durbin-Watson: 1.554\n", 5829 | "Prob(Omnibus): 0.306 Jarque-Bera (JB): 2.077\n", 5830 | "Skew: -0.457 Prob(JB): 0.354\n", 5831 | "Kurtosis: 2.902 Cond. No. 7.54e+03\n", 5832 | "==============================================================================\n", 5833 | "\n", 5834 | "Notes:\n", 5835 | "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n", 5836 | "[2] The condition number is large, 7.54e+03. This might indicate that there are\n", 5837 | "strong multicollinearity or other numerical problems.\n", 5838 | "\"\"\"" 5839 | ] 5840 | }, 5841 | "execution_count": 9, 5842 | "metadata": {}, 5843 | "output_type": "execute_result" 5844 | } 5845 | ], 5846 | "source": [ 5847 | "# Lagged Effects Analysis\n", 5848 | "\n", 5849 | "import statsmodels.api as sm\n", 5850 | "\n", 5851 | "# creating lagged CO2 data to investigate lagged effects\n", 5852 | "merged_data['CO₂ Lag 1'] = merged_data[\"CO₂ Concentration\"].shift(1)\n", 5853 | "merged_data['CO₂ Lag 2'] = merged_data[\"CO₂ Concentration\"].shift(2)\n", 5854 | "merged_data['CO₂ Lag 3'] = merged_data[\"CO₂ Concentration\"].shift(3)\n", 5855 | "\n", 5856 | "# dropping rows with NaN due to lags\n", 5857 | "lagged_data = merged_data.dropna()\n", 5858 | "\n", 5859 | "X = lagged_data[['CO₂ Concentration', 'CO₂ Lag 1', 'CO₂ Lag 2', 'CO₂ Lag 3']]\n", 5860 | "y = lagged_data['Temperature Change']\n", 5861 | "X = sm.add_constant(X) # adding a constant for intercept\n", 5862 | "\n", 5863 | "model = sm.OLS(y, X).fit()\n", 5864 | "\n", 5865 | "model_summary = model.summary()\n", 5866 | "model_summary" 5867 | ] 5868 | }, 5869 | { 5870 | "cell_type": "code", 5871 | "execution_count": 10, 5872 | "id": "680fb850", 5873 | "metadata": {}, 5874 | "outputs": [ 5875 | { 5876 | "data": { 5877 | "application/vnd.plotly.v1+json": { 5878 | "config": { 5879 | "plotlyServerURL": "https://plot.ly" 5880 | }, 5881 | "data": [ 5882 | { 5883 | "hovertemplate": "Climate Pattern=High Temp & CO₂
CO₂ Concentration (ppm)=%{x}
Temperature Change (°C)=%{y}", 5884 | "legendgroup": "High Temp & CO₂", 5885 | "marker": { 5886 | "color": "rgb(102,194,165)", 5887 | "symbol": "circle" 5888 | }, 5889 | "mode": "markers", 5890 | "name": "High Temp & CO₂", 5891 | "orientation": "v", 5892 | "showlegend": true, 5893 | "type": "scatter", 5894 | "x": [ 5895 | 158.93833333333333, 5896 | 159.355, 5897 | 159.58041666666668, 5898 | 159.90583333333333, 5899 | 160.08333333333334, 5900 | 160.89208333333332, 5901 | 161.21666666666667, 5902 | 161.65958333333333, 5903 | 162.555, 5904 | 163.00375, 5905 | 163.25666666666666, 5906 | 163.90291666666667, 5907 | 165.17791666666668, 5908 | 165.17375, 5909 | 165.70708333333332, 5910 | 166.14875, 5911 | 167.19666666666666, 5912 | 167.9425, 5913 | 168.62958333333333, 5914 | 169.66708333333332, 5915 | 170.26041666666666, 5916 | 170.93916666666667, 5917 | 171.8216666666667, 5918 | 172.6833333333333, 5919 | 173.39125, 5920 | 173.98625, 5921 | 174.90125, 5922 | 176.18541666666667, 5923 | 176.8175, 5924 | 178.02833333333334, 5925 | 178.39166666666665, 5926 | 178.70125, 5927 | 181.61791666666667 5928 | ], 5929 | "xaxis": "x", 5930 | "y": [ 5931 | 0.1630531914893617, 5932 | -0.01347619047619048, 5933 | -0.006042553191489363, 5934 | -0.07005851063829789, 5935 | -0.24702659574468086, 5936 | 0.10550520833333336, 5937 | -0.11083246073298428, 5938 | -0.19910994764397907, 5939 | 0.15794210526315788, 5940 | 0.09248677248677246, 5941 | -0.20051308900523562, 5942 | -0.08490625, 5943 | 0.2293678756476684, 5944 | -0.16303125, 5945 | -0.023494680851063827, 5946 | -0.24591534391534392, 5947 | 0.1658162162162162, 5948 | 0.06962962962962962, 5949 | 0.2337989417989418, 5950 | 0.24728795811518325, 5951 | 0.1786439790575916, 5952 | 0.17649479166666668, 5953 | 0.34459473684210523, 5954 | 0.08011702127659574, 5955 | 0.07128723404255319, 5956 | 0.1511578947368421, 5957 | 0.405021052631579, 5958 | 0.4900894736842106, 5959 | 0.25616842105263155, 5960 | 0.3681648936170213, 5961 | 0.2364903846153846, 5962 | 0.2159856459330144, 5963 | 0.27922857142857144 5964 | ], 5965 | "yaxis": "y" 5966 | }, 5967 | { 5968 | "hovertemplate": "Climate Pattern=Moderate Temp & CO₂
CO₂ Concentration (ppm)=%{x}
Temperature Change (°C)=%{y}", 5969 | "legendgroup": "Moderate Temp & CO₂", 5970 | "marker": { 5971 | "color": "rgb(252,141,98)", 5972 | "symbol": "circle" 5973 | }, 5974 | "mode": "markers", 5975 | "name": "Moderate Temp & CO₂", 5976 | "orientation": "v", 5977 | "showlegend": true, 5978 | "type": "scatter", 5979 | "x": [ 5980 | 177.40333333333334, 5981 | 179.72375, 5982 | 180.76458333333335, 5983 | 182.095, 5984 | 183.8275, 5985 | 184.50166666666667, 5986 | 185.01250000000002, 5987 | 185.87708333333333, 5988 | 187.01375, 5989 | 188.33166666666668, 5990 | 189.07625, 5991 | 190.29458333333332, 5992 | 191.32291666666666, 5993 | 192.26541666666665, 5994 | 193.15166666666667, 5995 | 194.05499999999998, 5996 | 195.36833333333334, 5997 | 196.15, 5998 | 197.30958333333334, 5999 | 198.70875 6000 | ], 6001 | "xaxis": "x", 6002 | "y": [ 6003 | 0.5552592592592592, 6004 | 0.609514423076923, 6005 | 0.6292380952380952, 6006 | 0.5439951690821256, 6007 | 0.971252380952381, 6008 | 0.7433014354066987, 6009 | 0.6697894736842105, 6010 | 0.8501538461538461, 6011 | 0.9249999999999998, 6012 | 0.8442289719626169, 6013 | 0.7778403755868545, 6014 | 0.8529905660377357, 6015 | 0.8765767441860465, 6016 | 1.0225483870967744, 6017 | 0.8084103773584905, 6018 | 0.9105660377358491, 6019 | 1.0990418604651164, 6020 | 0.8213917050691244, 6021 | 0.9022232558139536, 6022 | 0.931199074074074 6023 | ], 6024 | "yaxis": "y" 6025 | }, 6026 | { 6027 | "hovertemplate": "Climate Pattern=Low Temp & CO₂
CO₂ Concentration (ppm)=%{x}
Temperature Change (°C)=%{y}", 6028 | "legendgroup": "Low Temp & CO₂", 6029 | "marker": { 6030 | "color": "rgb(141,160,203)", 6031 | "symbol": "circle" 6032 | }, 6033 | "mode": "markers", 6034 | "name": "Low Temp & CO₂", 6035 | "orientation": "v", 6036 | "showlegend": true, 6037 | "type": "scatter", 6038 | "x": [ 6039 | 199.66750000000002, 6040 | 200.78208333333336, 6041 | 202.63083333333336, 6042 | 203.66916666666668, 6043 | 204.59875, 6044 | 206.1833333333333, 6045 | 207.41666666666666, 6046 | 208.47208333333333, 6047 | 209.51833333333335 6048 | ], 6049 | "xaxis": "x", 6050 | "y": [ 6051 | 1.114814814814815, 6052 | 1.269773148148148, 6053 | 1.4395211267605634, 6054 | 1.2807850467289719, 6055 | 1.3021126760563382, 6056 | 1.4430610328638498, 6057 | 1.5520377358490567, 6058 | 1.343530516431925, 6059 | 1.382112676056338 6060 | ], 6061 | "yaxis": "y" 6062 | } 6063 | ], 6064 | "layout": { 6065 | "legend": { 6066 | "title": { 6067 | "text": "Climate Pattern" 6068 | }, 6069 | "tracegroupgap": 0 6070 | }, 6071 | "template": { 6072 | "data": { 6073 | "bar": [ 6074 | { 6075 | "error_x": { 6076 | "color": "#2a3f5f" 6077 | }, 6078 | "error_y": { 6079 | "color": "#2a3f5f" 6080 | }, 6081 | "marker": { 6082 | "line": { 6083 | "color": "white", 6084 | "width": 0.5 6085 | }, 6086 | "pattern": { 6087 | "fillmode": "overlay", 6088 | "size": 10, 6089 | "solidity": 0.2 6090 | } 6091 | }, 6092 | "type": "bar" 6093 | } 6094 | ], 6095 | "barpolar": [ 6096 | { 6097 | "marker": { 6098 | "line": { 6099 | "color": "white", 6100 | "width": 0.5 6101 | }, 6102 | "pattern": { 6103 | "fillmode": "overlay", 6104 | "size": 10, 6105 | "solidity": 0.2 6106 | } 6107 | }, 6108 | "type": "barpolar" 6109 | } 6110 | ], 6111 | "carpet": [ 6112 | { 6113 | "aaxis": { 6114 | "endlinecolor": "#2a3f5f", 6115 | "gridcolor": "#C8D4E3", 6116 | "linecolor": "#C8D4E3", 6117 | "minorgridcolor": "#C8D4E3", 6118 | "startlinecolor": "#2a3f5f" 6119 | }, 6120 | "baxis": { 6121 | "endlinecolor": "#2a3f5f", 6122 | "gridcolor": "#C8D4E3", 6123 | "linecolor": "#C8D4E3", 6124 | "minorgridcolor": "#C8D4E3", 6125 | "startlinecolor": "#2a3f5f" 6126 | }, 6127 | "type": "carpet" 6128 | } 6129 | ], 6130 | "choropleth": [ 6131 | { 6132 | "colorbar": { 6133 | "outlinewidth": 0, 6134 | "ticks": "" 6135 | }, 6136 | "type": "choropleth" 6137 | } 6138 | ], 6139 | "contour": [ 6140 | { 6141 | "colorbar": { 6142 | "outlinewidth": 0, 6143 | "ticks": "" 6144 | }, 6145 | "colorscale": [ 6146 | [ 6147 | 0, 6148 | "#0d0887" 6149 | ], 6150 | [ 6151 | 0.1111111111111111, 6152 | "#46039f" 6153 | ], 6154 | [ 6155 | 0.2222222222222222, 6156 | "#7201a8" 6157 | ], 6158 | [ 6159 | 0.3333333333333333, 6160 | "#9c179e" 6161 | ], 6162 | [ 6163 | 0.4444444444444444, 6164 | "#bd3786" 6165 | ], 6166 | [ 6167 | 0.5555555555555556, 6168 | "#d8576b" 6169 | ], 6170 | [ 6171 | 0.6666666666666666, 6172 | "#ed7953" 6173 | ], 6174 | [ 6175 | 0.7777777777777778, 6176 | "#fb9f3a" 6177 | ], 6178 | [ 6179 | 0.8888888888888888, 6180 | "#fdca26" 6181 | ], 6182 | [ 6183 | 1, 6184 | "#f0f921" 6185 | ] 6186 | ], 6187 | "type": "contour" 6188 | } 6189 | ], 6190 | "contourcarpet": [ 6191 | { 6192 | "colorbar": { 6193 | "outlinewidth": 0, 6194 | "ticks": "" 6195 | }, 6196 | "type": "contourcarpet" 6197 | } 6198 | ], 6199 | "heatmap": [ 6200 | { 6201 | "colorbar": { 6202 | "outlinewidth": 0, 6203 | "ticks": "" 6204 | }, 6205 | "colorscale": [ 6206 | [ 6207 | 0, 6208 | "#0d0887" 6209 | ], 6210 | [ 6211 | 0.1111111111111111, 6212 | "#46039f" 6213 | ], 6214 | [ 6215 | 0.2222222222222222, 6216 | "#7201a8" 6217 | ], 6218 | [ 6219 | 0.3333333333333333, 6220 | "#9c179e" 6221 | ], 6222 | [ 6223 | 0.4444444444444444, 6224 | "#bd3786" 6225 | ], 6226 | [ 6227 | 0.5555555555555556, 6228 | "#d8576b" 6229 | ], 6230 | [ 6231 | 0.6666666666666666, 6232 | "#ed7953" 6233 | ], 6234 | [ 6235 | 0.7777777777777778, 6236 | "#fb9f3a" 6237 | ], 6238 | [ 6239 | 0.8888888888888888, 6240 | "#fdca26" 6241 | ], 6242 | [ 6243 | 1, 6244 | "#f0f921" 6245 | ] 6246 | ], 6247 | "type": "heatmap" 6248 | } 6249 | ], 6250 | "heatmapgl": [ 6251 | { 6252 | "colorbar": { 6253 | "outlinewidth": 0, 6254 | "ticks": "" 6255 | }, 6256 | "colorscale": [ 6257 | [ 6258 | 0, 6259 | "#0d0887" 6260 | ], 6261 | [ 6262 | 0.1111111111111111, 6263 | "#46039f" 6264 | ], 6265 | [ 6266 | 0.2222222222222222, 6267 | "#7201a8" 6268 | ], 6269 | [ 6270 | 0.3333333333333333, 6271 | "#9c179e" 6272 | ], 6273 | [ 6274 | 0.4444444444444444, 6275 | "#bd3786" 6276 | ], 6277 | [ 6278 | 0.5555555555555556, 6279 | "#d8576b" 6280 | ], 6281 | [ 6282 | 0.6666666666666666, 6283 | "#ed7953" 6284 | ], 6285 | [ 6286 | 0.7777777777777778, 6287 | "#fb9f3a" 6288 | ], 6289 | [ 6290 | 0.8888888888888888, 6291 | "#fdca26" 6292 | ], 6293 | [ 6294 | 1, 6295 | "#f0f921" 6296 | ] 6297 | ], 6298 | "type": "heatmapgl" 6299 | } 6300 | ], 6301 | "histogram": [ 6302 | { 6303 | "marker": { 6304 | "pattern": { 6305 | "fillmode": "overlay", 6306 | "size": 10, 6307 | "solidity": 0.2 6308 | } 6309 | }, 6310 | "type": "histogram" 6311 | } 6312 | ], 6313 | "histogram2d": [ 6314 | { 6315 | "colorbar": { 6316 | "outlinewidth": 0, 6317 | "ticks": "" 6318 | }, 6319 | "colorscale": [ 6320 | [ 6321 | 0, 6322 | "#0d0887" 6323 | ], 6324 | [ 6325 | 0.1111111111111111, 6326 | "#46039f" 6327 | ], 6328 | [ 6329 | 0.2222222222222222, 6330 | "#7201a8" 6331 | ], 6332 | [ 6333 | 0.3333333333333333, 6334 | "#9c179e" 6335 | ], 6336 | [ 6337 | 0.4444444444444444, 6338 | "#bd3786" 6339 | ], 6340 | [ 6341 | 0.5555555555555556, 6342 | "#d8576b" 6343 | ], 6344 | [ 6345 | 0.6666666666666666, 6346 | "#ed7953" 6347 | ], 6348 | [ 6349 | 0.7777777777777778, 6350 | "#fb9f3a" 6351 | ], 6352 | [ 6353 | 0.8888888888888888, 6354 | "#fdca26" 6355 | ], 6356 | [ 6357 | 1, 6358 | "#f0f921" 6359 | ] 6360 | ], 6361 | "type": "histogram2d" 6362 | } 6363 | ], 6364 | "histogram2dcontour": [ 6365 | { 6366 | "colorbar": { 6367 | "outlinewidth": 0, 6368 | "ticks": "" 6369 | }, 6370 | "colorscale": [ 6371 | [ 6372 | 0, 6373 | "#0d0887" 6374 | ], 6375 | [ 6376 | 0.1111111111111111, 6377 | "#46039f" 6378 | ], 6379 | [ 6380 | 0.2222222222222222, 6381 | "#7201a8" 6382 | ], 6383 | [ 6384 | 0.3333333333333333, 6385 | "#9c179e" 6386 | ], 6387 | [ 6388 | 0.4444444444444444, 6389 | "#bd3786" 6390 | ], 6391 | [ 6392 | 0.5555555555555556, 6393 | "#d8576b" 6394 | ], 6395 | [ 6396 | 0.6666666666666666, 6397 | "#ed7953" 6398 | ], 6399 | [ 6400 | 0.7777777777777778, 6401 | "#fb9f3a" 6402 | ], 6403 | [ 6404 | 0.8888888888888888, 6405 | "#fdca26" 6406 | ], 6407 | [ 6408 | 1, 6409 | "#f0f921" 6410 | ] 6411 | ], 6412 | "type": "histogram2dcontour" 6413 | } 6414 | ], 6415 | "mesh3d": [ 6416 | { 6417 | "colorbar": { 6418 | "outlinewidth": 0, 6419 | "ticks": "" 6420 | }, 6421 | "type": "mesh3d" 6422 | } 6423 | ], 6424 | "parcoords": [ 6425 | { 6426 | "line": { 6427 | "colorbar": { 6428 | "outlinewidth": 0, 6429 | "ticks": "" 6430 | } 6431 | }, 6432 | "type": "parcoords" 6433 | } 6434 | ], 6435 | "pie": [ 6436 | { 6437 | "automargin": true, 6438 | "type": "pie" 6439 | } 6440 | ], 6441 | "scatter": [ 6442 | { 6443 | "fillpattern": { 6444 | "fillmode": "overlay", 6445 | "size": 10, 6446 | "solidity": 0.2 6447 | }, 6448 | "type": "scatter" 6449 | } 6450 | ], 6451 | "scatter3d": [ 6452 | { 6453 | "line": { 6454 | "colorbar": { 6455 | "outlinewidth": 0, 6456 | "ticks": "" 6457 | } 6458 | }, 6459 | "marker": { 6460 | "colorbar": { 6461 | "outlinewidth": 0, 6462 | "ticks": "" 6463 | } 6464 | }, 6465 | "type": "scatter3d" 6466 | } 6467 | ], 6468 | "scattercarpet": [ 6469 | { 6470 | "marker": { 6471 | "colorbar": { 6472 | "outlinewidth": 0, 6473 | "ticks": "" 6474 | } 6475 | }, 6476 | "type": "scattercarpet" 6477 | } 6478 | ], 6479 | "scattergeo": [ 6480 | { 6481 | "marker": { 6482 | "colorbar": { 6483 | "outlinewidth": 0, 6484 | "ticks": "" 6485 | } 6486 | }, 6487 | "type": "scattergeo" 6488 | } 6489 | ], 6490 | "scattergl": [ 6491 | { 6492 | "marker": { 6493 | "colorbar": { 6494 | "outlinewidth": 0, 6495 | "ticks": "" 6496 | } 6497 | }, 6498 | "type": "scattergl" 6499 | } 6500 | ], 6501 | "scattermapbox": [ 6502 | { 6503 | "marker": { 6504 | "colorbar": { 6505 | "outlinewidth": 0, 6506 | "ticks": "" 6507 | } 6508 | }, 6509 | "type": "scattermapbox" 6510 | } 6511 | ], 6512 | "scatterpolar": [ 6513 | { 6514 | "marker": { 6515 | "colorbar": { 6516 | "outlinewidth": 0, 6517 | "ticks": "" 6518 | } 6519 | }, 6520 | "type": "scatterpolar" 6521 | } 6522 | ], 6523 | "scatterpolargl": [ 6524 | { 6525 | "marker": { 6526 | "colorbar": { 6527 | "outlinewidth": 0, 6528 | "ticks": "" 6529 | } 6530 | }, 6531 | "type": "scatterpolargl" 6532 | } 6533 | ], 6534 | "scatterternary": [ 6535 | { 6536 | "marker": { 6537 | "colorbar": { 6538 | "outlinewidth": 0, 6539 | "ticks": "" 6540 | } 6541 | }, 6542 | "type": "scatterternary" 6543 | } 6544 | ], 6545 | "surface": [ 6546 | { 6547 | "colorbar": { 6548 | "outlinewidth": 0, 6549 | "ticks": "" 6550 | }, 6551 | "colorscale": [ 6552 | [ 6553 | 0, 6554 | "#0d0887" 6555 | ], 6556 | [ 6557 | 0.1111111111111111, 6558 | "#46039f" 6559 | ], 6560 | [ 6561 | 0.2222222222222222, 6562 | "#7201a8" 6563 | ], 6564 | [ 6565 | 0.3333333333333333, 6566 | "#9c179e" 6567 | ], 6568 | [ 6569 | 0.4444444444444444, 6570 | "#bd3786" 6571 | ], 6572 | [ 6573 | 0.5555555555555556, 6574 | "#d8576b" 6575 | ], 6576 | [ 6577 | 0.6666666666666666, 6578 | "#ed7953" 6579 | ], 6580 | [ 6581 | 0.7777777777777778, 6582 | "#fb9f3a" 6583 | ], 6584 | [ 6585 | 0.8888888888888888, 6586 | "#fdca26" 6587 | ], 6588 | [ 6589 | 1, 6590 | "#f0f921" 6591 | ] 6592 | ], 6593 | "type": "surface" 6594 | } 6595 | ], 6596 | "table": [ 6597 | { 6598 | "cells": { 6599 | "fill": { 6600 | "color": "#EBF0F8" 6601 | }, 6602 | "line": { 6603 | "color": "white" 6604 | } 6605 | }, 6606 | "header": { 6607 | "fill": { 6608 | "color": "#C8D4E3" 6609 | }, 6610 | "line": { 6611 | "color": "white" 6612 | } 6613 | }, 6614 | "type": "table" 6615 | } 6616 | ] 6617 | }, 6618 | "layout": { 6619 | "annotationdefaults": { 6620 | "arrowcolor": "#2a3f5f", 6621 | "arrowhead": 0, 6622 | "arrowwidth": 1 6623 | }, 6624 | "autotypenumbers": "strict", 6625 | "coloraxis": { 6626 | "colorbar": { 6627 | "outlinewidth": 0, 6628 | "ticks": "" 6629 | } 6630 | }, 6631 | "colorscale": { 6632 | "diverging": [ 6633 | [ 6634 | 0, 6635 | "#8e0152" 6636 | ], 6637 | [ 6638 | 0.1, 6639 | "#c51b7d" 6640 | ], 6641 | [ 6642 | 0.2, 6643 | "#de77ae" 6644 | ], 6645 | [ 6646 | 0.3, 6647 | "#f1b6da" 6648 | ], 6649 | [ 6650 | 0.4, 6651 | "#fde0ef" 6652 | ], 6653 | [ 6654 | 0.5, 6655 | "#f7f7f7" 6656 | ], 6657 | [ 6658 | 0.6, 6659 | "#e6f5d0" 6660 | ], 6661 | [ 6662 | 0.7, 6663 | "#b8e186" 6664 | ], 6665 | [ 6666 | 0.8, 6667 | "#7fbc41" 6668 | ], 6669 | [ 6670 | 0.9, 6671 | "#4d9221" 6672 | ], 6673 | [ 6674 | 1, 6675 | "#276419" 6676 | ] 6677 | ], 6678 | "sequential": [ 6679 | [ 6680 | 0, 6681 | "#0d0887" 6682 | ], 6683 | [ 6684 | 0.1111111111111111, 6685 | "#46039f" 6686 | ], 6687 | [ 6688 | 0.2222222222222222, 6689 | "#7201a8" 6690 | ], 6691 | [ 6692 | 0.3333333333333333, 6693 | "#9c179e" 6694 | ], 6695 | [ 6696 | 0.4444444444444444, 6697 | "#bd3786" 6698 | ], 6699 | [ 6700 | 0.5555555555555556, 6701 | "#d8576b" 6702 | ], 6703 | [ 6704 | 0.6666666666666666, 6705 | "#ed7953" 6706 | ], 6707 | [ 6708 | 0.7777777777777778, 6709 | "#fb9f3a" 6710 | ], 6711 | [ 6712 | 0.8888888888888888, 6713 | "#fdca26" 6714 | ], 6715 | [ 6716 | 1, 6717 | "#f0f921" 6718 | ] 6719 | ], 6720 | "sequentialminus": [ 6721 | [ 6722 | 0, 6723 | "#0d0887" 6724 | ], 6725 | [ 6726 | 0.1111111111111111, 6727 | "#46039f" 6728 | ], 6729 | [ 6730 | 0.2222222222222222, 6731 | "#7201a8" 6732 | ], 6733 | [ 6734 | 0.3333333333333333, 6735 | "#9c179e" 6736 | ], 6737 | [ 6738 | 0.4444444444444444, 6739 | "#bd3786" 6740 | ], 6741 | [ 6742 | 0.5555555555555556, 6743 | "#d8576b" 6744 | ], 6745 | [ 6746 | 0.6666666666666666, 6747 | "#ed7953" 6748 | ], 6749 | [ 6750 | 0.7777777777777778, 6751 | "#fb9f3a" 6752 | ], 6753 | [ 6754 | 0.8888888888888888, 6755 | "#fdca26" 6756 | ], 6757 | [ 6758 | 1, 6759 | "#f0f921" 6760 | ] 6761 | ] 6762 | }, 6763 | "colorway": [ 6764 | "#636efa", 6765 | "#EF553B", 6766 | "#00cc96", 6767 | "#ab63fa", 6768 | "#FFA15A", 6769 | "#19d3f3", 6770 | "#FF6692", 6771 | "#B6E880", 6772 | "#FF97FF", 6773 | "#FECB52" 6774 | ], 6775 | "font": { 6776 | "color": "#2a3f5f" 6777 | }, 6778 | "geo": { 6779 | "bgcolor": "white", 6780 | "lakecolor": "white", 6781 | "landcolor": "white", 6782 | "showlakes": true, 6783 | "showland": true, 6784 | "subunitcolor": "#C8D4E3" 6785 | }, 6786 | "hoverlabel": { 6787 | "align": "left" 6788 | }, 6789 | "hovermode": "closest", 6790 | "mapbox": { 6791 | "style": "light" 6792 | }, 6793 | "paper_bgcolor": "white", 6794 | "plot_bgcolor": "white", 6795 | "polar": { 6796 | "angularaxis": { 6797 | "gridcolor": "#EBF0F8", 6798 | "linecolor": "#EBF0F8", 6799 | "ticks": "" 6800 | }, 6801 | "bgcolor": "white", 6802 | "radialaxis": { 6803 | "gridcolor": "#EBF0F8", 6804 | "linecolor": "#EBF0F8", 6805 | "ticks": "" 6806 | } 6807 | }, 6808 | "scene": { 6809 | "xaxis": { 6810 | "backgroundcolor": "white", 6811 | "gridcolor": "#DFE8F3", 6812 | "gridwidth": 2, 6813 | "linecolor": "#EBF0F8", 6814 | "showbackground": true, 6815 | "ticks": "", 6816 | "zerolinecolor": "#EBF0F8" 6817 | }, 6818 | "yaxis": { 6819 | "backgroundcolor": "white", 6820 | "gridcolor": "#DFE8F3", 6821 | "gridwidth": 2, 6822 | "linecolor": "#EBF0F8", 6823 | "showbackground": true, 6824 | "ticks": "", 6825 | "zerolinecolor": "#EBF0F8" 6826 | }, 6827 | "zaxis": { 6828 | "backgroundcolor": "white", 6829 | "gridcolor": "#DFE8F3", 6830 | "gridwidth": 2, 6831 | "linecolor": "#EBF0F8", 6832 | "showbackground": true, 6833 | "ticks": "", 6834 | "zerolinecolor": "#EBF0F8" 6835 | } 6836 | }, 6837 | "shapedefaults": { 6838 | "line": { 6839 | "color": "#2a3f5f" 6840 | } 6841 | }, 6842 | "ternary": { 6843 | "aaxis": { 6844 | "gridcolor": "#DFE8F3", 6845 | "linecolor": "#A2B1C6", 6846 | "ticks": "" 6847 | }, 6848 | "baxis": { 6849 | "gridcolor": "#DFE8F3", 6850 | "linecolor": "#A2B1C6", 6851 | "ticks": "" 6852 | }, 6853 | "bgcolor": "white", 6854 | "caxis": { 6855 | "gridcolor": "#DFE8F3", 6856 | "linecolor": "#A2B1C6", 6857 | "ticks": "" 6858 | } 6859 | }, 6860 | "title": { 6861 | "x": 0.05 6862 | }, 6863 | "xaxis": { 6864 | "automargin": true, 6865 | "gridcolor": "#EBF0F8", 6866 | "linecolor": "#EBF0F8", 6867 | "ticks": "", 6868 | "title": { 6869 | "standoff": 15 6870 | }, 6871 | "zerolinecolor": "#EBF0F8", 6872 | "zerolinewidth": 2 6873 | }, 6874 | "yaxis": { 6875 | "automargin": true, 6876 | "gridcolor": "#EBF0F8", 6877 | "linecolor": "#EBF0F8", 6878 | "ticks": "", 6879 | "title": { 6880 | "standoff": 15 6881 | }, 6882 | "zerolinecolor": "#EBF0F8", 6883 | "zerolinewidth": 2 6884 | } 6885 | } 6886 | }, 6887 | "title": { 6888 | "text": "Clustering of Years Based on Climate Patterns" 6889 | }, 6890 | "xaxis": { 6891 | "anchor": "y", 6892 | "domain": [ 6893 | 0, 6894 | 1 6895 | ], 6896 | "title": { 6897 | "text": "CO₂ Concentration (ppm)" 6898 | } 6899 | }, 6900 | "yaxis": { 6901 | "anchor": "x", 6902 | "domain": [ 6903 | 0, 6904 | 1 6905 | ], 6906 | "title": { 6907 | "text": "Temperature Change (°C)" 6908 | } 6909 | } 6910 | } 6911 | } 6912 | }, 6913 | "metadata": {}, 6914 | "output_type": "display_data" 6915 | } 6916 | ], 6917 | "source": [ 6918 | "# Clustering Climate Patterns\n", 6919 | "\n", 6920 | "from sklearn.cluster import KMeans\n", 6921 | "from sklearn.preprocessing import StandardScaler\n", 6922 | "import numpy as np\n", 6923 | "\n", 6924 | "# preparing the data for clustering\n", 6925 | "clustering_data = merged_data[[\"Temperature Change\", \"CO₂ Concentration\"]].dropna()\n", 6926 | "\n", 6927 | "scaler = StandardScaler()\n", 6928 | "scaled_data = scaler.fit_transform(clustering_data)\n", 6929 | "\n", 6930 | "# applying K-Means clustering\n", 6931 | "kmeans = KMeans(n_clusters=3, random_state=42) # assuming 3 clusters for simplicity\n", 6932 | "clustering_data['Cluster'] = kmeans.fit_predict(scaled_data)\n", 6933 | "\n", 6934 | "# adding labels for periods with similar climate patterns\n", 6935 | "clustering_data['Label'] = clustering_data['Cluster'].map({\n", 6936 | " 0: 'Moderate Temp & CO₂',\n", 6937 | " 1: 'High Temp & CO₂',\n", 6938 | " 2: 'Low Temp & CO₂'\n", 6939 | "})\n", 6940 | "\n", 6941 | "import plotly.express as px\n", 6942 | "\n", 6943 | "fig_clusters = px.scatter(\n", 6944 | " clustering_data,\n", 6945 | " x=\"CO₂ Concentration\",\n", 6946 | " y=\"Temperature Change\",\n", 6947 | " color=\"Label\",\n", 6948 | " color_discrete_sequence=px.colors.qualitative.Set2,\n", 6949 | " labels={\n", 6950 | " \"CO₂ Concentration\": \"CO₂ Concentration (ppm)\",\n", 6951 | " \"Temperature Change\": \"Temperature Change (°C)\",\n", 6952 | " \"Label\": \"Climate Pattern\"\n", 6953 | " },\n", 6954 | " title=\"Clustering of Years Based on Climate Patterns\"\n", 6955 | ")\n", 6956 | "\n", 6957 | "fig_clusters.update_layout(\n", 6958 | " template=\"plotly_white\",\n", 6959 | " legend_title=\"Climate Pattern\"\n", 6960 | ")\n", 6961 | "\n", 6962 | "fig_clusters.show()" 6963 | ] 6964 | }, 6965 | { 6966 | "cell_type": "code", 6967 | "execution_count": 11, 6968 | "id": "b8156eba", 6969 | "metadata": {}, 6970 | "outputs": [ 6971 | { 6972 | "data": { 6973 | "text/plain": [ 6974 | "{'Increase CO₂ by 10%': 1.0866445037958163,\n", 6975 | " 'Decrease CO₂ by 10%': -0.059993041237237144,\n", 6976 | " 'Increase CO₂ by 20%': 1.6599632763123422,\n", 6977 | " 'Decrease CO₂ by 20%': -0.6333118137537621}" 6978 | ] 6979 | }, 6980 | "execution_count": 11, 6981 | "metadata": {}, 6982 | "output_type": "execute_result" 6983 | } 6984 | ], 6985 | "source": [ 6986 | "# Predicting Temperature Changes Under What If Analysis\n", 6987 | "\n", 6988 | "# setting up a simple predictive model using linear regression\n", 6989 | "from sklearn.linear_model import LinearRegression\n", 6990 | "\n", 6991 | "# Preparing data\n", 6992 | "X = merged_data[[\"CO₂ Concentration\"]].values # CO₂ concentration as input\n", 6993 | "y = merged_data[\"Temperature Change\"].values # temperature change as target\n", 6994 | "\n", 6995 | "model = LinearRegression()\n", 6996 | "model.fit(X, y)\n", 6997 | "\n", 6998 | "# function to simulate \"what-if\" scenarios\n", 6999 | "def simulate_temperature_change(co2_percentage_change):\n", 7000 | " # Calculate new CO2 concentrations\n", 7001 | " current_mean_co2 = merged_data[\"CO₂ Concentration\"].mean()\n", 7002 | " new_co2 = current_mean_co2 * (1 + co2_percentage_change / 100)\n", 7003 | "\n", 7004 | " # predict temperature change\n", 7005 | " predicted_temp = model.predict([[new_co2]])\n", 7006 | " return predicted_temp[0]\n", 7007 | "\n", 7008 | "# simulating scenarios\n", 7009 | "scenarios = {\n", 7010 | " \"Increase CO₂ by 10%\": simulate_temperature_change(10),\n", 7011 | " \"Decrease CO₂ by 10%\": simulate_temperature_change(-10),\n", 7012 | " \"Increase CO₂ by 20%\": simulate_temperature_change(20),\n", 7013 | " \"Decrease CO₂ by 20%\": simulate_temperature_change(-20),\n", 7014 | "}\n", 7015 | "\n", 7016 | "scenarios" 7017 | ] 7018 | }, 7019 | { 7020 | "cell_type": "code", 7021 | "execution_count": null, 7022 | "id": "38ba2f08", 7023 | "metadata": {}, 7024 | "outputs": [], 7025 | "source": [] 7026 | } 7027 | ], 7028 | "metadata": { 7029 | "kernelspec": { 7030 | "display_name": "base", 7031 | "language": "python", 7032 | "name": "python3" 7033 | }, 7034 | "language_info": { 7035 | "codemirror_mode": { 7036 | "name": "ipython", 7037 | "version": 3 7038 | }, 7039 | "file_extension": ".py", 7040 | "mimetype": "text/x-python", 7041 | "name": "python", 7042 | "nbconvert_exporter": "python", 7043 | "pygments_lexer": "ipython3", 7044 | "version": "3.11.7" 7045 | } 7046 | }, 7047 | "nbformat": 4, 7048 | "nbformat_minor": 5 7049 | } 7050 | --------------------------------------------------------------------------------