This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
Boxplot() | |
.add_xaxis( | |
x_axis# | |
) | |
.add_yaxis( | |
"Population 2007", | |
y_axis_pop2007 | |
) | |
.add_yaxis( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x_axis = gapminder.sort_values("continent").continent.unique().tolist() | |
y_axis_pop2007 = [] | |
y_axis_pop1952 = [] | |
for x in x_axis: | |
pop07 = ( | |
gapminder | |
.query("continent == @x") | |
.query("year == 2007") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Awesome-pyecharts</title> | |
<script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script> | |
</head> | |
<body> | |
<div id="0bd2f4c4114a460880b0ab7bd31c5491" class="chart-container" style="width:1024px; height:600px;"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
Bar( | |
opts.InitOpts( | |
#theme = ThemeType.DARK, | |
width = "1024px", | |
height = "600px" | |
) | |
) | |
.add_xaxis(gap_by_continent.continent.tolist()) | |
.add_yaxis( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gap_by_continent = ( | |
gapminder | |
.groupby("continent") | |
.agg( | |
pop_mean = ('pop', 'mean'), | |
pop_sd = ('pop', 'std'), | |
pop_median = ('pop', 'median'), | |
le_mean = ('lifeExp', 'mean'), | |
le_sd = ('lifeExp', 'std') | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyecharts.charts import Bar | |
from pyecharts.charts import Boxplot | |
from pyecharts import options as opts | |
import pandas as pd | |
from gapminder import gapminder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sns.set_palette(sns.color_palette(met_brewer.palettes.met_brew("Navajo", 5), as_cmap = True)) | |
chart = sns.boxplot( | |
data = gapminder.query('year == 2007').assign(popInMio = lambda x: x["pop"] / 1000000), | |
y = "gdpPercap", x = "continent", | |
hue = "continent" | |
) | |
chart.set_ylabel("GDP per Capita") | |
chart.set_xlabel("Continent") | |
chart.get_legend().set_title("Continent") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sns.set_palette(sns.color_palette(met_brewer.palettes.met_brew("Navajo", 5), as_cmap = True)) | |
chart = sns.scatterplot( | |
data = gapminder.query('year == 2007').assign(popInMio = lambda x: x["pop"] / 1000000), | |
x = "gdpPercap", y = "lifeExp", | |
hue = "continent", size = "popInMio", | |
sizes=(50, 750) | |
) | |
chart.set_xlabel("GDP per Capita") | |
chart.set_ylabel("Life Expectancy") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sns.set_palette(sns.color_palette(met_brewer.palettes.met_brew(name = "Cross", n = 100, brew_type = "continuous"), as_cmap = True)) | |
chart = sns.scatterplot( | |
data = gapminder.query('year == 2007').assign(popInMio = lambda x: x["pop"] / 1000000), | |
x = "gdpPercap", y = "lifeExp", | |
hue = "popInMio", size = "popInMio", | |
sizes=(50, 750) | |
) | |
chart.set_xlabel("GDP per Capita") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import seaborn as sns | |
from gapminder import gapminder | |
import met_brewer.palettes | |
sns.set_theme(style="whitegrid") |
NewerOlder