diff --git a/07.Project 2 - Data Visualization/Interactive Visualization with Pandas.ipynb b/07.Project 2 - Data Visualization/Interactive Visualization with Pandas.ipynb index a0816aa..784f28f 100644 --- a/07.Project 2 - Data Visualization/Interactive Visualization with Pandas.ipynb +++ b/07.Project 2 - Data Visualization/Interactive Visualization with Pandas.ipynb @@ -2,26 +2,236 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "db3ee280", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", - "import cufflinks as cf\n", - "from IPython.display import display, HTML\n", - "\n", - "cf.set_config_file(sharing='public', theme='ggplot', offline=True)" + "import plotly.express as px" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "5210cda7", "metadata": { "scrolled": false }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
countryUnited StatesIndiaChinaIndonesiaBrazil
year
1955.0171685336.04.098806e+086.122416e+0877273425.062533919.0
1960.0186720571.04.505477e+086.604081e+0887751068.072179226.0
1965.0199733676.04.991233e+087.242190e+08100267062.083373530.0
1970.0209513341.05.551898e+088.276014e+08114793178.095113265.0
1975.0219081251.06.231029e+089.262409e+08130680727.0107216205.0
1980.0229476354.06.989528e+081.000089e+09147447836.0120694009.0
1985.0240499825.07.843600e+081.075589e+09164982451.0135274080.0
1990.0252120309.08.732778e+081.176884e+09181413402.0149003223.0
1995.0265163745.09.639226e+081.240921e+09196934260.0162019896.0
2000.0281710909.01.056576e+091.290551e+09211513823.0174790340.0
2005.0294993511.01.147610e+091.330776e+09226289470.0186127103.0
2010.0309011475.01.234281e+091.368811e+09241834215.0195713635.0
2015.0320878310.01.310152e+091.406848e+09258383256.0204471769.0
2016.0323015995.01.324517e+091.414049e+09261556381.0206163053.0
2017.0325084756.01.338677e+091.421022e+09264650963.0207833823.0
2018.0327096265.01.352642e+091.427648e+09267670543.0209469323.0
2019.0329064917.01.366418e+091.433784e+09270625568.0211049527.0
2020.0331002651.01.380004e+091.439324e+09273523615.0212559417.0
\n", + "
" + ], + "text/plain": [ + "country United States India China Indonesia Brazil\n", + "year \n", + "1955.0 171685336.0 4.098806e+08 6.122416e+08 77273425.0 62533919.0\n", + "1960.0 186720571.0 4.505477e+08 6.604081e+08 87751068.0 72179226.0\n", + "1965.0 199733676.0 4.991233e+08 7.242190e+08 100267062.0 83373530.0\n", + "1970.0 209513341.0 5.551898e+08 8.276014e+08 114793178.0 95113265.0\n", + "1975.0 219081251.0 6.231029e+08 9.262409e+08 130680727.0 107216205.0\n", + "1980.0 229476354.0 6.989528e+08 1.000089e+09 147447836.0 120694009.0\n", + "1985.0 240499825.0 7.843600e+08 1.075589e+09 164982451.0 135274080.0\n", + "1990.0 252120309.0 8.732778e+08 1.176884e+09 181413402.0 149003223.0\n", + "1995.0 265163745.0 9.639226e+08 1.240921e+09 196934260.0 162019896.0\n", + "2000.0 281710909.0 1.056576e+09 1.290551e+09 211513823.0 174790340.0\n", + "2005.0 294993511.0 1.147610e+09 1.330776e+09 226289470.0 186127103.0\n", + "2010.0 309011475.0 1.234281e+09 1.368811e+09 241834215.0 195713635.0\n", + "2015.0 320878310.0 1.310152e+09 1.406848e+09 258383256.0 204471769.0\n", + "2016.0 323015995.0 1.324517e+09 1.414049e+09 261556381.0 206163053.0\n", + "2017.0 325084756.0 1.338677e+09 1.421022e+09 264650963.0 207833823.0\n", + "2018.0 327096265.0 1.352642e+09 1.427648e+09 267670543.0 209469323.0\n", + "2019.0 329064917.0 1.366418e+09 1.433784e+09 270625568.0 211049527.0\n", + "2020.0 331002651.0 1.380004e+09 1.439324e+09 273523615.0 212559417.0" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# reading the csv file\n", "df_population_raw = pd.read_csv('population_total.csv')\n", @@ -47,13 +257,748 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "3f0c1e49", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "country=United States
Years=%{x}
Population=%{y}", + "legendgroup": "United States", + "line": { + "color": "#636efa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "United States", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAAsGt3pEEAAAB2QkKmQQAAAFhjz6dBAAAA+tb5qEEAAABG1B2qQQAAAAQQW6tBAAAA4nirrEEAAADqGQ6uQQAAAMInnK9BAAAAPZHKsEEAAABnPpWxQQAAABMka7JBAAAA5jYgs0EAAAA71UCzQQAAAFRmYLNBAAAAyRd/s0EAAADVIZ2zQQAAABuzurNB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=India
Years=%{x}
Population=%{y}", + "legendgroup": "India", + "line": { + "color": "#EF553B", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "India", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAAE0huuEEAAADfz9q6QQAAAHwEwL1BAAAAEMOLwEEAAIDY5ZHCQQAAAEaW1MRBAAAAJDFgx0EAAACzlAbKQQAAAE4lusxBAACAHgh9z0EAAMDRyBnRQQAAgLRoZNJBAADAtNWF00EAAEDgobzTQQAAQIyl8tNBAAAAuusn1EEAAIBWeFzUQQAAQIhMkNRB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=China
Years=%{x}
Population=%{y}", + "legendgroup": "China", + "line": { + "color": "#00cc96", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "China", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAASQg/wkEAAAB8g67DQQAAACxalcVBAAAA+RiqyEEAAIA6qJrLQQAAgEkTzs1BAABAPAwH0EEAAIB2dInRQQAAwHW8fdJBAABAew8700EAAABPgtTTQQAAwB2ZZdRBAACA37L21EEAAMCRKxLVQQAAwJfELNVBAACASgtG1UEAAIBhc13VQQAAAKCVctVB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=Indonesia
Years=%{x}
Population=%{y}", + "legendgroup": "Indonesia", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "Indonesia", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAARGVskkEAAABw5uuUQQAAANjQ55dBAAAAaGtem0EAAABcHiifQQAAADjAk6FBAAAAZt2qo0EAAAA0TKClQQAAAOj0eadBAAAAvuM2qUEAAAB8zvmqQQAAAM4x1KxBAAAAMDvNrkEAAAA6ES6vQQAAAKaBjK9BAAAAHqjor0EAAAAgayGwQQAAAJ+jTbBB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=Brazil
Years=%{x}
Population=%{y}", + "legendgroup": "Brazil", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "Brazil", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAA+IjRjUEAAABoeDWRQQAAAGi34JNBAAAAxECtlkEAAAA09Y+ZQQAAAOSTxpxBAAAAwDwgoEEAAACuN8OhQQAAAHB0UKNBAAAAiC3WpEEAAAD+JTCmQQAAAMa0VKdBAAAAsvtfqEEAAADamJOoQQAAAL6VxqhBAAAAFn/4qEEAAABuuCipQQAAAHLMVqlB", + "dtype": "f8" + }, + "yaxis": "y" + } + ], + "layout": { + "legend": { + "title": { + "text": "country" + }, + "tracegroupgap": 0 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "rgb(51,51,51)" + }, + "error_y": { + "color": "rgb(51,51,51)" + }, + "marker": { + "line": { + "color": "rgb(237,237,237)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(237,237,237)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "rgb(51,51,51)", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "rgb(51,51,51)" + }, + "baxis": { + "endlinecolor": "rgb(51,51,51)", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "rgb(51,51,51)" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "colorscale": [ + [ + 0, + "rgb(20,44,66)" + ], + [ + 1, + "rgb(90,179,244)" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "colorscale": [ + [ + 0, + "rgb(20,44,66)" + ], + [ + 1, + "rgb(90,179,244)" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "colorscale": [ + [ + 0, + "rgb(20,44,66)" + ], + [ + 1, + "rgb(90,179,244)" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "colorscale": [ + [ + 0, + "rgb(20,44,66)" + ], + [ + 1, + "rgb(90,179,244)" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + }, + "colorscale": [ + [ + 0, + "rgb(20,44,66)" + ], + [ + 1, + "rgb(90,179,244)" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "rgb(237,237,237)" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "rgb(217,217,217)" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "tickcolor": "rgb(237,237,237)", + "ticklen": 6, + "ticks": "inside" + } + }, + "colorscale": { + "sequential": [ + [ + 0, + "rgb(20,44,66)" + ], + [ + 1, + "rgb(90,179,244)" + ] + ], + "sequentialminus": [ + [ + 0, + "rgb(20,44,66)" + ], + [ + 1, + "rgb(90,179,244)" + ] + ] + }, + "colorway": [ + "#F8766D", + "#A3A500", + "#00BF7D", + "#00B0F6", + "#E76BF3" + ], + "font": { + "color": "rgb(51,51,51)" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "rgb(237,237,237)", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "paper_bgcolor": "white", + "plot_bgcolor": "rgb(237,237,237)", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside" + }, + "bgcolor": "rgb(237,237,237)", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(237,237,237)", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "rgb(237,237,237)", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "rgb(237,237,237)", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "fillcolor": "black", + "line": { + "width": 0 + }, + "opacity": 0.3 + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside" + }, + "bgcolor": "rgb(237,237,237)", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside" + } + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white" + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "showgrid": true, + "tickcolor": "rgb(51,51,51)", + "ticks": "outside", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white" + } + } + }, + "title": { + "text": "Population (1955-2020)" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Years" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Population" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot.iplot(kind='line', xTitle='Years', yTitle='Population', \n", - " title='Population (1955-2020)')" + "fig = px.line(df_pivot, title='Population (1955-2020)',\n", + " labels={'value':'Population','year':'Years','variable':'Country'})\n", + "\n", + "#Updating the theme\n", + "fig.update_layout(template='ggplot2')\n", + "\n", + "#Displaying the lineplot\n", + "fig.show()" ] }, { @@ -66,7 +1011,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "48a6e884", "metadata": {}, "outputs": [], @@ -82,10 +1027,865 @@ "execution_count": null, "id": "847ec9e4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "hovertemplate": "year=2020.0
Countries=%{x}
value=%{y}", + "legendgroup": "2020.0", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "2020.0", + "offsetgroup": "2020.0", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "type": "bar", + "x": [ + "United States", + "India", + "China", + "Indonesia", + "Brazil" + ], + "xaxis": "x", + "y": { + "bdata": "AAAAG7O6s0EAAECITJDUQQAAAKCVctVBAAAAn6NNsEEAAAByzFapQQ==", + "dtype": "f8" + }, + "yaxis": "y" + } + ], + "layout": { + "barmode": "group", + "legend": { + "title": { + "text": "year" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Countries" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "value" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot_2020.iplot(kind='bar', color='lightgreen',\n", - " xTitle='Years', yTitle='Population')" + "fig = px.bar(df_pivot_2020,barmode='group',\n", + " labels={'values':'Population','country':'Countries'})\n", + "\n", + "#Display the single Bargraph\n", + "fig.show()\n" ] }, { @@ -98,7 +1898,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "b4e043a6", "metadata": {}, "outputs": [], @@ -109,12 +1909,971 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "673c5ad4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "hovertemplate": "country=United States
year=%{x}
value=%{y}", + "legendgroup": "United States", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "United States", + "offsetgroup": "United States", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "type": "bar", + "x": { + "bdata": "AAAAAADwnkAAAAAAABifQAAAAAAAQJ9AAAAAAABon0AAAAAAAJCfQA==", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAABBBbq0EAAADqGQ6uQQAAAD2RyrBBAAAAEyRrskEAAAAbs7qzQQ==", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "country=India
year=%{x}
value=%{y}", + "legendgroup": "India", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "India", + "offsetgroup": "India", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "type": "bar", + "x": { + "bdata": "AAAAAADwnkAAAAAAABifQAAAAAAAQJ9AAAAAAABon0AAAAAAAJCfQA==", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAARpbUxEEAAACzlAbKQQAAgB4Ifc9BAACAtGhk0kEAAECITJDUQQ==", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "country=China
year=%{x}
value=%{y}", + "legendgroup": "China", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "China", + "offsetgroup": "China", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "type": "bar", + "x": { + "bdata": "AAAAAADwnkAAAAAAABifQAAAAAAAQJ9AAAAAAABon0AAAAAAAJCfQA==", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AACASRPOzUEAAIB2dInRQQAAQHsPO9NBAADAHZll1EEAAACglXLVQQ==", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "country=Indonesia
year=%{x}
value=%{y}", + "legendgroup": "Indonesia", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "Indonesia", + "offsetgroup": "Indonesia", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "type": "bar", + "x": { + "bdata": "AAAAAADwnkAAAAAAABifQAAAAAAAQJ9AAAAAAABon0AAAAAAAJCfQA==", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAAOMCToUEAAAA0TKClQQAAAL7jNqlBAAAAzjHUrEEAAACfo02wQQ==", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "country=Brazil
year=%{x}
value=%{y}", + "legendgroup": "Brazil", + "marker": { + "color": "#FFA15A", + "pattern": { + "shape": "" + } + }, + "name": "Brazil", + "offsetgroup": "Brazil", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "type": "bar", + "x": { + "bdata": "AAAAAADwnkAAAAAAABifQAAAAAAAQJ9AAAAAAABon0AAAAAAAJCfQA==", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAA5JPGnEEAAACuN8OhQQAAAIgt1qRBAAAAxrRUp0EAAAByzFapQQ==", + "dtype": "f8" + }, + "yaxis": "y" + } + ], + "layout": { + "barmode": "group", + "legend": { + "title": { + "text": "country" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "year" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "value" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot_sample.iplot(kind='bar')" + "fig = px.bar(df_pivot_sample,barmode='group')\n", + "\n", + "fig.show()" ] }, { @@ -127,7 +2886,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "7bebdb83", "metadata": {}, "outputs": [], @@ -138,22 +2897,924 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "68c949a0", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
yearindexcountry2020
00United States3.310027e+08
11India1.380004e+09
22China1.439324e+09
33Indonesia2.735236e+08
44Brazil2.125594e+08
\n", + "
" + ], + "text/plain": [ + "year index country 2020\n", + "0 0 United States 3.310027e+08\n", + "1 1 India 1.380004e+09\n", + "2 2 China 1.439324e+09\n", + "3 3 Indonesia 2.735236e+08\n", + "4 4 Brazil 2.125594e+08" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "df_pivot_2020 = df_pivot_2020.reset_index()" + "df_pivot_2020 = df_pivot_2020.reset_index()\n", + "df_pivot_2020" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "bf71522f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "domain": { + "x": [ + 0, + 1 + ], + "y": [ + 0, + 1 + ] + }, + "hovertemplate": "country=%{label}
2020=%{value}", + "labels": [ + "United States", + "India", + "China", + "Indonesia", + "Brazil" + ], + "legendgroup": "", + "name": "", + "showlegend": true, + "type": "pie", + "values": { + "bdata": "AAAAG7O6s0EAAECITJDUQQAAAKCVctVBAAAAn6NNsEEAAAByzFapQQ==", + "dtype": "f8" + } + } + ], + "layout": { + "legend": { + "tracegroupgap": 0 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Population distribution in 2020" + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot_2020.iplot(kind='pie', values='2020', labels='country')" + "px.pie(df_pivot_2020,values='2020',names='country',title='Population distribution in 2020')" ] }, { @@ -166,25 +3827,1823 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "1d0b781b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "hovertemplate": "Country=%{x}
Population=%{y}", + "legendgroup": "", + "marker": { + "color": "#636efa" + }, + "name": "", + "notched": false, + "offsetgroup": "", + "orientation": "v", + "showlegend": false, + "type": "box", + "x": [ + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India" + ], + "x0": " ", + "xaxis": "x", + "y": { + "bdata": "AAAAE0huuEEAAADfz9q6QQAAAHwEwL1BAAAAEMOLwEEAAIDY5ZHCQQAAAEaW1MRBAAAAJDFgx0EAAACzlAbKQQAAAE4lusxBAACAHgh9z0EAAMDRyBnRQQAAgLRoZNJBAADAtNWF00EAAEDgobzTQQAAQIyl8tNBAAAAuusn1EEAAIBWeFzUQQAAQIhMkNRB", + "dtype": "f8" + }, + "y0": " ", + "yaxis": "y" + } + ], + "layout": { + "boxmode": "group", + "legend": { + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Country" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Population" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot['United States'].iplot(kind='box', color='green',\n", - " yTitle='Population')" + "#Single Box plot\n", + "\n", + "df_pivot_single_country = df_pivot[['India']]\n", + "fig = px.box(df_pivot_single_country,labels={'value':'Population','country':'Country'})\n", + "fig.show()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "id": "828a47a5", "metadata": { "scrolled": false }, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "hovertemplate": "Country=%{x}
Population=%{y}", + "legendgroup": "", + "marker": { + "color": "#636efa" + }, + "name": "", + "notched": false, + "offsetgroup": "", + "orientation": "v", + "showlegend": false, + "type": "box", + "x": [ + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "United States", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "India", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "China", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Indonesia", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil", + "Brazil" + ], + "x0": " ", + "xaxis": "x", + "y": { + "bdata": "AAAAsGt3pEEAAAB2QkKmQQAAAFhjz6dBAAAA+tb5qEEAAABG1B2qQQAAAAQQW6tBAAAA4nirrEEAAADqGQ6uQQAAAMInnK9BAAAAPZHKsEEAAABnPpWxQQAAABMka7JBAAAA5jYgs0EAAAA71UCzQQAAAFRmYLNBAAAAyRd/s0EAAADVIZ2zQQAAABuzurNBAAAAE0huuEEAAADfz9q6QQAAAHwEwL1BAAAAEMOLwEEAAIDY5ZHCQQAAAEaW1MRBAAAAJDFgx0EAAACzlAbKQQAAAE4lusxBAACAHgh9z0EAAMDRyBnRQQAAgLRoZNJBAADAtNWF00EAAEDgobzTQQAAQIyl8tNBAAAAuusn1EEAAIBWeFzUQQAAQIhMkNRBAAAASQg/wkEAAAB8g67DQQAAACxalcVBAAAA+RiqyEEAAIA6qJrLQQAAgEkTzs1BAABAPAwH0EEAAIB2dInRQQAAwHW8fdJBAABAew8700EAAABPgtTTQQAAwB2ZZdRBAACA37L21EEAAMCRKxLVQQAAwJfELNVBAACASgtG1UEAAIBhc13VQQAAAKCVctVBAAAARGVskkEAAABw5uuUQQAAANjQ55dBAAAAaGtem0EAAABcHiifQQAAADjAk6FBAAAAZt2qo0EAAAA0TKClQQAAAOj0eadBAAAAvuM2qUEAAAB8zvmqQQAAAM4x1KxBAAAAMDvNrkEAAAA6ES6vQQAAAKaBjK9BAAAAHqjor0EAAAAgayGwQQAAAJ+jTbBBAAAA+IjRjUEAAABoeDWRQQAAAGi34JNBAAAAxECtlkEAAAA09Y+ZQQAAAOSTxpxBAAAAwDwgoEEAAACuN8OhQQAAAHB0UKNBAAAAiC3WpEEAAAD+JTCmQQAAAMa0VKdBAAAAsvtfqEEAAADamJOoQQAAAL6VxqhBAAAAFn/4qEEAAABuuCipQQAAAHLMVqlB", + "dtype": "f8" + }, + "y0": " ", + "yaxis": "y" + } + ], + "layout": { + "boxmode": "group", + "legend": { + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Country" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Population" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot.iplot(kind='box', yTitle='Population')" + "# Box plot(multiple columns)\n", + "px.box(df_pivot,labels={'value':'Population','country':'Country'})" ] }, { @@ -197,13 +5656,951 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "id": "d993a996", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "bingroup": "x", + "hovertemplate": "country=United States
value=%{x}
count=%{y}", + "legendgroup": "United States", + "marker": { + "color": "#636efa", + "opacity": 0.5, + "pattern": { + "shape": "" + } + }, + "name": "United States", + "nbinsx": 3, + "orientation": "v", + "showlegend": true, + "type": "histogram", + "x": { + "bdata": "AAAAsGt3pEEAAAB2QkKmQQAAAFhjz6dBAAAA+tb5qEEAAABG1B2qQQAAAAQQW6tBAAAA4nirrEEAAADqGQ6uQQAAAMInnK9BAAAAPZHKsEEAAABnPpWxQQAAABMka7JBAAAA5jYgs0EAAAA71UCzQQAAAFRmYLNBAAAAyRd/s0EAAADVIZ2zQQAAABuzurNB", + "dtype": "f8" + }, + "xaxis": "x", + "yaxis": "y" + }, + { + "bingroup": "x", + "hovertemplate": "country=India
value=%{x}
count=%{y}", + "legendgroup": "India", + "marker": { + "color": "#EF553B", + "opacity": 0.5, + "pattern": { + "shape": "" + } + }, + "name": "India", + "nbinsx": 3, + "orientation": "v", + "showlegend": true, + "type": "histogram", + "x": { + "bdata": "AAAAE0huuEEAAADfz9q6QQAAAHwEwL1BAAAAEMOLwEEAAIDY5ZHCQQAAAEaW1MRBAAAAJDFgx0EAAACzlAbKQQAAAE4lusxBAACAHgh9z0EAAMDRyBnRQQAAgLRoZNJBAADAtNWF00EAAEDgobzTQQAAQIyl8tNBAAAAuusn1EEAAIBWeFzUQQAAQIhMkNRB", + "dtype": "f8" + }, + "xaxis": "x", + "yaxis": "y" + }, + { + "bingroup": "x", + "hovertemplate": "country=China
value=%{x}
count=%{y}", + "legendgroup": "China", + "marker": { + "color": "#00cc96", + "opacity": 0.5, + "pattern": { + "shape": "" + } + }, + "name": "China", + "nbinsx": 3, + "orientation": "v", + "showlegend": true, + "type": "histogram", + "x": { + "bdata": "AAAASQg/wkEAAAB8g67DQQAAACxalcVBAAAA+RiqyEEAAIA6qJrLQQAAgEkTzs1BAABAPAwH0EEAAIB2dInRQQAAwHW8fdJBAABAew8700EAAABPgtTTQQAAwB2ZZdRBAACA37L21EEAAMCRKxLVQQAAwJfELNVBAACASgtG1UEAAIBhc13VQQAAAKCVctVB", + "dtype": "f8" + }, + "xaxis": "x", + "yaxis": "y" + }, + { + "bingroup": "x", + "hovertemplate": "country=Indonesia
value=%{x}
count=%{y}", + "legendgroup": "Indonesia", + "marker": { + "color": "#ab63fa", + "opacity": 0.5, + "pattern": { + "shape": "" + } + }, + "name": "Indonesia", + "nbinsx": 3, + "orientation": "v", + "showlegend": true, + "type": "histogram", + "x": { + "bdata": "AAAARGVskkEAAABw5uuUQQAAANjQ55dBAAAAaGtem0EAAABcHiifQQAAADjAk6FBAAAAZt2qo0EAAAA0TKClQQAAAOj0eadBAAAAvuM2qUEAAAB8zvmqQQAAAM4x1KxBAAAAMDvNrkEAAAA6ES6vQQAAAKaBjK9BAAAAHqjor0EAAAAgayGwQQAAAJ+jTbBB", + "dtype": "f8" + }, + "xaxis": "x", + "yaxis": "y" + }, + { + "bingroup": "x", + "hovertemplate": "country=Brazil
value=%{x}
count=%{y}", + "legendgroup": "Brazil", + "marker": { + "color": "#FFA15A", + "opacity": 0.5, + "pattern": { + "shape": "" + } + }, + "name": "Brazil", + "nbinsx": 3, + "orientation": "v", + "showlegend": true, + "type": "histogram", + "x": { + "bdata": "AAAA+IjRjUEAAABoeDWRQQAAAGi34JNBAAAAxECtlkEAAAA09Y+ZQQAAAOSTxpxBAAAAwDwgoEEAAACuN8OhQQAAAHB0UKNBAAAAiC3WpEEAAAD+JTCmQQAAAMa0VKdBAAAAsvtfqEEAAADamJOoQQAAAL6VxqhBAAAAFn/4qEEAAABuuCipQQAAAHLMVqlB", + "dtype": "f8" + }, + "xaxis": "x", + "yaxis": "y" + } + ], + "layout": { + "barmode": "overlay", + "legend": { + "title": { + "text": "country" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "value" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "count" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot[['United States', 'Indonesia']].iplot(kind='hist', xTitle='Population',\n", - " bins=3)" + "fig = px.histogram(df_pivot,nbins=3,barmode='overlay')\n", + "\n", + "fig.show()" ] }, { @@ -216,18 +6613,962 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "id": "6efa5f6e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "country=United States
Years=%{x}
Population=%{y}", + "legendgroup": "United States", + "marker": { + "color": "#636efa", + "symbol": "circle" + }, + "mode": "markers", + "name": "United States", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAAsGt3pEEAAAB2QkKmQQAAAFhjz6dBAAAA+tb5qEEAAABG1B2qQQAAAAQQW6tBAAAA4nirrEEAAADqGQ6uQQAAAMInnK9BAAAAPZHKsEEAAABnPpWxQQAAABMka7JBAAAA5jYgs0EAAAA71UCzQQAAAFRmYLNBAAAAyRd/s0EAAADVIZ2zQQAAABuzurNB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=India
Years=%{x}
Population=%{y}", + "legendgroup": "India", + "marker": { + "color": "#EF553B", + "symbol": "circle" + }, + "mode": "markers", + "name": "India", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAAE0huuEEAAADfz9q6QQAAAHwEwL1BAAAAEMOLwEEAAIDY5ZHCQQAAAEaW1MRBAAAAJDFgx0EAAACzlAbKQQAAAE4lusxBAACAHgh9z0EAAMDRyBnRQQAAgLRoZNJBAADAtNWF00EAAEDgobzTQQAAQIyl8tNBAAAAuusn1EEAAIBWeFzUQQAAQIhMkNRB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=China
Years=%{x}
Population=%{y}", + "legendgroup": "China", + "marker": { + "color": "#00cc96", + "symbol": "circle" + }, + "mode": "markers", + "name": "China", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAASQg/wkEAAAB8g67DQQAAACxalcVBAAAA+RiqyEEAAIA6qJrLQQAAgEkTzs1BAABAPAwH0EEAAIB2dInRQQAAwHW8fdJBAABAew8700EAAABPgtTTQQAAwB2ZZdRBAACA37L21EEAAMCRKxLVQQAAwJfELNVBAACASgtG1UEAAIBhc13VQQAAAKCVctVB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=Indonesia
Years=%{x}
Population=%{y}", + "legendgroup": "Indonesia", + "marker": { + "color": "#ab63fa", + "symbol": "circle" + }, + "mode": "markers", + "name": "Indonesia", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAARGVskkEAAABw5uuUQQAAANjQ55dBAAAAaGtem0EAAABcHiifQQAAADjAk6FBAAAAZt2qo0EAAAA0TKClQQAAAOj0eadBAAAAvuM2qUEAAAB8zvmqQQAAAM4x1KxBAAAAMDvNrkEAAAA6ES6vQQAAAKaBjK9BAAAAHqjor0EAAAAgayGwQQAAAJ+jTbBB", + "dtype": "f8" + }, + "yaxis": "y" + }, + { + "hovertemplate": "country=Brazil
Years=%{x}
Population=%{y}", + "legendgroup": "Brazil", + "marker": { + "color": "#FFA15A", + "symbol": "circle" + }, + "mode": "markers", + "name": "Brazil", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": { + "bdata": "AAAAAACMnkAAAAAAAKCeQAAAAAAAtJ5AAAAAAADInkAAAAAAANyeQAAAAAAA8J5AAAAAAAAEn0AAAAAAABifQAAAAAAALJ9AAAAAAABAn0AAAAAAAFSfQAAAAAAAaJ9AAAAAAAB8n0AAAAAAAICfQAAAAAAAhJ9AAAAAAACIn0AAAAAAAIyfQAAAAAAAkJ9A", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "AAAA+IjRjUEAAABoeDWRQQAAAGi34JNBAAAAxECtlkEAAAA09Y+ZQQAAAOSTxpxBAAAAwDwgoEEAAACuN8OhQQAAAHB0UKNBAAAAiC3WpEEAAAD+JTCmQQAAAMa0VKdBAAAAsvtfqEEAAADamJOoQQAAAL6VxqhBAAAAFn/4qEEAAABuuCipQQAAAHLMVqlB", + "dtype": "f8" + }, + "yaxis": "y" + } + ], + "layout": { + "legend": { + "title": { + "text": "country" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Years" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Population" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "df_pivot.iplot(kind='scatter', mode='markers')" + "px.scatter(df_pivot,labels={'value':'Population','year':'Years'})" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "df04b60b", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "base", "language": "python", "name": "python3" }, @@ -241,7 +7582,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.13.5" }, "toc": { "base_numbering": 1,