Flag Emojis with adviz

🇦🇩 🇦🇪 🇦🇫 🇦🇬 🇦🇮 🇦🇱 🇦🇲 🇦🇴 🇦🇶 🇦🇷 🇦🇸 🇦🇹 🇦🇺 🇦🇼 🇦🇽 🇦🇿 🇧🇦 🇧🇧 🇧🇩 🇧🇪 🇧🇫 🇧🇬

🇧🇮 🇧🇯 🇧🇱 🇧🇲 🇧🇳 🇧🇴 🇧🇶 🇧🇷 🇧🇸 🇧🇹 🇧🇻 🇧🇼 🇧🇾 🇧🇿 🇨🇦 🇨🇨 🇨🇩 🇨🇫 🇨🇬 🇨🇭 🇨🇮 🇨🇰

🇨🇲 🇨🇳 🇨🇴 🇨🇷 🇨🇺 🇨🇻 🇨🇼 🇨🇽 🇨🇾 🇨🇿 🇩🇪 🇩🇯 🇩🇰 🇩🇲 🇩🇴 🇩🇿 🇪🇨 🇪🇪 🇪🇬 🇪🇭 🇪🇷 🇪🇸

🇫🇮 🇫🇯 🇫🇰 🇫🇲 🇫🇴 🇫🇷 🇬🇦 🇬🇧 🇬🇩 🇬🇪 🇬🇫 🇬🇬 🇬🇭 🇬🇮 🇬🇱 🇬🇲 🇬🇳 🇬🇵 🇬🇶 🇬🇷 🇬🇸 🇬🇹

🇬🇼 🇬🇾 🇭🇰 🇭🇲 🇭🇳 🇭🇷 🇭🇹 🇭🇺 🇮🇩 🇮🇪 🇮🇱 🇮🇲 🇮🇳 🇮🇴 🇮🇶 🇮🇷 🇮🇸 🇮🇹 🇯🇪 🇯🇲 🇯🇴 🇯🇵

🇰🇬 🇰🇭 🇰🇮 🇰🇲 🇰🇳 🇰🇵 🇰🇷 🇰🇼 🇰🇾 🇰🇿 🇱🇦 🇱🇧 🇱🇨 🇱🇮 🇱🇰 🇱🇷 🇱🇸 🇱🇹 🇱🇺 🇱🇻 🇱🇾 🇲🇦

🇲🇩 🇲🇪 🇲🇫 🇲🇬 🇲🇭 🇲🇰 🇲🇱 🇲🇲 🇲🇳 🇲🇴 🇲🇵 🇲🇶 🇲🇷 🇲🇸 🇲🇹 🇲🇺 🇲🇻 🇲🇼 🇲🇽 🇲🇾 🇲🇿 🇳🇦

🇳🇪 🇳🇫 🇳🇬 🇳🇮 🇳🇱 🇳🇴 🇳🇵 🇳🇷 🇳🇺 🇳🇿 🇴🇲 🇵🇦 🇵🇪 🇵🇫 🇵🇬 🇵🇭 🇵🇰 🇵🇱 🇵🇲 🇵🇳 🇵🇷 🇵🇸

🇵🇼 🇵🇾 🇶🇦 🇷🇪 🇷🇴 🇷🇸 🇷🇺 🇷🇼 🇸🇦 🇸🇧 🇸🇨 🇸🇩 🇸🇪 🇸🇬 🇸🇭 🇸🇮 🇸🇯 🇸🇰 🇸🇱 🇸🇲 🇸🇳 🇸🇴

🇸🇸 🇸🇹 🇸🇻 🇸🇽 🇸🇾 🇸🇿 🇹🇨 🇹🇩 🇹🇫 🇹🇬 🇹🇭 🇹🇯 🇹🇰 🇹🇱 🇹🇲 🇹🇳 🇹🇴 🇹🇷 🇹🇹 🇹🇻 🇹🇼 🇹🇿

🇺🇬 🇺🇲 🇺🇸 🇺🇾 🇺🇿 🇻🇦 🇻🇨 🇻🇪 🇻🇬 🇻🇮 🇻🇳 🇻🇺 🇼🇫 🇼🇸 🇾🇪 🇾🇹 🇿🇦 🇿🇲 🇿🇼

Get some country flags

import adviz
adviz.flag('pt'), adviz.flag('prt')
('🇵🇹', '🇵🇹')
adviz.flag('jp'), adviz.flag('jpn'), adviz.flag('JPN'), adviz.flag("JAPAN"), adviz.flag('japan')
('🇯🇵', '🇯🇵', '🇯🇵', '🇯🇵', '🇯🇵')
adviz.flag('za')
'🇿🇦'

Use in an HTML string for more granular control

html(f'<h3 style="font-size: 40pt; color: gold;">This is the flag of Zimbabwe: <span style="font-size: 60pt;">{adviz.flag("zw")}</span></h1>')
html(f'<h3 style="font-size: 40pt; color: steelblue;">This is the flag of Sweden: <span style="font-size: 60pt;">{adviz.flag("se")}</span></h1>')

This is the flag of Zimbabwe: 🇿🇼

This is the flag of Sweden: 🇸🇪

Using flags in Plotly charts

Use flags to make country data more recognizable

country population code
0 China 1439323776 cn
1 India 1380004385 in
2 United States 331002651 us
3 Indonesia 273523615 id
4 Pakistan 220892340 pk

Adding country flags makes them easily recognizable

Code
import plotly.express as px
fig = px.bar(
    population,
    x='country',
    y='population',
    height=500, 
    text=[adviz.flag(cc) for cc in population['code']],
    template='plotly_dark'
)
fig.data[0].textfont.size = 35
fig.data[0].marker.color = 'steelblue'
fig

Horizontal chart

Code
fig = px.bar(
    population.sort_values('population'),
    y='country',
    x='population',
    orientation='h',
    height=500, 
    opacity=0.8,
    text=[adviz.flag(cc) for cc in population.sort_values('population')['code']],
    template='plotly_dark'
)
fig.data[0].textfont.size = 35
fig.data[0].marker.color = 'teal'
fig

Make scatter plots easier to read with flags

Zoom in when some flags are overlapping

country continent year lifeExp pop gdpPercap iso_alpha iso_num flag
11 Afghanistan Asia 2007 43.828 31889923 974.580338 AFG 4 🇦🇫
23 Albania Europe 2007 76.423 3600523 5937.029526 ALB 8 🇦🇱
35 Algeria Africa 2007 72.301 33333216 6223.367465 DZA 12 🇩🇿
47 Angola Africa 2007 42.731 12420476 4797.231267 AGO 24 🇦🇴
59 Argentina Americas 2007 75.320 40301927 12779.379640 ARG 32 🇦🇷
71 Australia Oceania 2007 81.235 20434176 34435.367440 AUS 36 🇦🇺
83 Austria Europe 2007 79.829 8199783 36126.492700 AUT 40 🇦🇹
95 Bahrain Asia 2007 75.635 708573 29796.048340 BHR 48 🇧🇭
107 Bangladesh Asia 2007 64.062 150448339 1391.253792 BGD 50 🇧🇩
119 Belgium Europe 2007 79.441 10392226 33692.605080 BEL 56 🇧🇪

Visualize life expectancy ~ GDP per capita

Europe

Americas

Africa

Asia

Oceania

Get started now:





python3 -m pip install adviz


Explore more advertools data visualizations