Figures for https://mexico.werthmuller.org/kulturgeschichte/sprachenvielfalt.
In [1]:
import numpy as np
import travelmaps2 as tm
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib import cm, colors, rcParams
plt.style.use('ggplot')
# Adjust dpi, so figure on screen and savefig looks the same
dpi = 100
rcParams['figure.dpi'] = dpi
rcParams['savefig.dpi'] = dpi
fpath = '../mexico.werthmuller.org/content/images/'
http://mexico.werthmuller.org/kulturgeschichte/sprachenvielfalt
In [2]:
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
lal = 1300000
ax.barh(10.6, 1544968); ax.text(lal, 11, "1'544'968", va='center', ha='right')
ax.barh( 9.6, 786113); ax.text(lal, 10, " 786'113", va='center', ha='right')
ax.barh( 8.6, 477995); ax.text(lal, 9, " 477'995", va='center', ha='right')
ax.barh( 7.6, 450429); ax.text(lal, 8, " 450'429", va='center', ha='right')
ax.barh( 6.6, 445856); ax.text(lal, 7, " 445'856", va='center', ha='right')
ax.barh( 5.6, 404704); ax.text(lal, 6, " 404'704", va='center', ha='right')
ax.barh( 4.6, 284992); ax.text(lal, 5, " 284'992", va='center', ha='right')
ax.barh( 3.6, 244033); ax.text(lal, 4, " 244'033", va='center', ha='right')
ax.barh( 2.6, 223073); ax.text(lal, 3, " 223'073", va='center', ha='right')
ax.barh( 1.6, 212117); ax.text(lal, 2, " 212'117", va='center', ha='right')
ax.barh( 0.6, 1620948); ax.text(lal, 1, "1'620'948", va='center', ha='right')
ax.xaxis.set_ticks_position('none')
ax.yaxis.set_ticks_position('none')
plt.xticks([500000, 1000000, 1500000], ())
plt.yticks(np.arange(11)+1, ('Alle anderen', 'Chol', 'Mazateco', 'Totonaca', 'Otomi',
'Tzotzil', 'Tzetzal', 'Zapotecas', 'Mixtecas', 'Maya', 'Náhuatl'))
plt.title("Bevölkerung mit indigener Hauptsprache")
#plt.savefig(fpath+'sprachenvielfalt/BevSprache.png', bbox_inches='tight')
plt.show()
In [3]:
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
lal = 5
ax.barh(10.6, 33.8); ax.text(lal, 11, "33.8 %", va='center', ha='right')
ax.barh( 9.6, 29.6); ax.text(lal, 10, "29.6 %", va='center', ha='right')
ax.barh( 8.6, 27.3); ax.text(lal, 9, "27.3 %", va='center', ha='right')
ax.barh( 7.6, 16.2); ax.text(lal, 8, "16.2 %", va='center', ha='right')
ax.barh( 6.6, 15.2); ax.text(lal, 7, "15.2 %", va='center', ha='right')
ax.barh( 5.6, 14.8); ax.text(lal, 6, "14.8 %", va='center', ha='right')
ax.barh( 4.6, 12.0); ax.text(lal, 5, "12.0 %", va='center', ha='right')
ax.barh( 3.6, 11.5); ax.text(lal, 4, "11.5 %", va='center', ha='right')
ax.barh( 2.6, 10.6); ax.text(lal, 3, "10.6 %", va='center', ha='right')
ax.barh( 1.6, 9.3); ax.text(lal, 2, " 9.3 %", va='center', ha='right')
ax.barh( 0.6, 6.6); ax.text(lal, 1, " 6.6 %", va='center', ha='right')
ax.xaxis.set_ticks_position('none')
ax.yaxis.set_ticks_position('none')
plt.xticks([10, 20, 30], ())
plt.yticks(np.arange(11)+1, ('Mexiko Durch.', 'Veracruz', 'San Luis Potosí', 'Puebla', 'Campeche',
'Hidalgo', 'Guerrero', 'Quintana Roo', 'Chiapas', 'Yucatán', 'Oaxaca'))
plt.title("Prozentualer Anteil der Bevölkerung")
#plt.savefig(fpath+'sprachenvielfalt/ProzBev.png', bbox_inches='tight')
plt.show()
In [4]:
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
lal = 3
ax.barh( 7.6, 17.8); ax.text(lal, 8, "17.8 %", va='center', ha='right')
ax.barh( 6.6, 16.7); ax.text(lal, 7, "16.7 %", va='center', ha='right')
ax.barh( 5.6, 16.3); ax.text(lal, 6, "16.3 %", va='center', ha='right')
ax.barh( 4.6, 11.4); ax.text(lal, 5, "11.4 %", va='center', ha='right')
ax.barh( 3.6, 10.4); ax.text(lal, 4, "10.4 %", va='center', ha='right')
ax.barh( 2.6, 10.2); ax.text(lal, 3, "10.2 %", va='center', ha='right')
ax.barh( 1.6, 10.2); ax.text(lal, 2, "10.2 %", va='center', ha='right')
ax.barh( 0.6, 6.9); ax.text(lal, 1, " 6.9 %", va='center', ha='right')
ax.xaxis.set_ticks_position('none')
ax.yaxis.set_ticks_position('none')
plt.xticks([5, 10, 15], ())
plt.yticks(np.arange(8)+1, ('Mexiko Durch.', 'Hidalgo', 'Michoacán', 'Puebla', 'Veracruz',
'Oaxaca', 'Guerrero', 'Chiapas'))
plt.title("Analphabetismus in Prozent")
#plt.savefig(fpath+'sprachenvielfalt/Analfabetismo.png', bbox_inches='tight')
plt.show()
In [5]:
tm.setup_noxkcd(200)
fig_x = plt.figure(figsize=(tm.cm2in([11, 6])))
# Create basemap
m_x = Basemap(width=3500000, height=2300000, resolution='c',
projection='tmerc', lat_0=24, lon_0=-102)
m_x.drawmapboundary(fill_color='#99ccff')
# Fill non-visited countries (fillcontinents does a bad job)
countries = ['USA', 'BLZ', 'GTM', 'HND', 'SLV', 'NIC', 'CUB']
tm.country(countries, m_x, fc='.8', ec='.5', lw=.5)
# Fill states
cols = np.array([3.3, # 0 Aguascalientes
3.2, # 1 Baja California Sur
2.6, # 2 Baja California
8.3, # 3 Campeche
17.8, # 4 Chiapas
3.7, # 5 Chihuahua
2.6, # 6 Coahuila
5.1, # 7 Colima
2.1, # 8 Distrito Federal
3.8, # 9 Durango
8.2, # 10 Guanajuato
16.7, # 11 Guerrero
10.2, # 12 Hidalgo
4.4, # 13 Jalisco
4.4, # 14 México
10.2, # 15 Michoacán
6.4, # 16 Morelos
6.3, # 17 Nayarit
2.2, # 18 Nuevo León
16.3, # 19 Oaxaca
10.4, # 20 Puebla
6.3, # 21 Querétaro
4.8, # 22 Quintana Roo
7.9, # 23 San Luis Potosí
5.0, # 24 Sinaloa
3.0, # 25 Sonora
7.1, # 26 Tabasco
3.6, # 27 Tamaulipas
5.2, # 28 Tlaxcala
11.4, # 29 Veracruz
9.2, # 30 Yucatán
5.5]) # 31 Zacatecas
cols = cm.Greens((cols-2.1)/(17.8-2.1))
fcs = 32*['']
for i in range(32):
fcs[i] = colors.rgb2hex(cols[i,:])
tm.country('MEX', bmap=m_x, fc=fcs, ec='k', lw=.5, adm=1)
# Add visited cities
tm.city([0, 0], '', m_x)
# Save-path
#plt.savefig(fpath+'sprachenvielfalt/KarteAnalphabetismus.png', bbox_inches='tight')
plt.show()
In [6]:
tm.setup_noxkcd(200)
fig_x = plt.figure(figsize=(tm.cm2in([11, 6])))
# Create basemap
m_x = Basemap(width=3500000, height=2300000, resolution='c',
projection='tmerc', lat_0=24, lon_0=-102)
m_x.drawmapboundary(fill_color='#99ccff')
# Fill non-visited countries (fillcontinents does a bad job)
countries = ['USA', 'BLZ', 'GTM', 'HND', 'SLV', 'NIC', 'CUB']
tm.country(countries, m_x, fc='.8', ec='.5', lw=.5)
# Fill states
cols = np.array([0.2, # 0 Aguascalientes
1.8, # 1 Baja California Sur
1.4, # 2 Baja California
12.0, # 3 Campeche
27.3, # 4 Chiapas
3.5, # 5 Chihuahua
0.2, # 6 Coahuila
0.7, # 7 Colima
1.5, # 8 Distrito Federal
2.2, # 9 Durango
0.3, # 10 Guanajuato
15.2, # 11 Guerrero
14.8, # 12 Hidalgo
0.8, # 13 Jalisco
2.7, # 14 México
3.5, # 15 Michoacán
1.9, # 16 Morelos
5.2, # 17 Nayarit
0.9, # 18 Nuevo León
33.8, # 19 Oaxaca
11.5, # 20 Puebla
1.8, # 21 Querétaro
16.2, # 22 Quintana Roo
10.6, # 23 San Luis Potosí
0.9, # 24 Sinaloa
2.5, # 25 Sonora
2.9, # 26 Tabasco
0.8, # 27 Tamaulipas
2.5, # 28 Tlaxcala
9.3, # 29 Veracruz
29.6, # 30 Yucatán
0.4]) # 31 Zacatecas
cols = cm.Greens((cols-0.2)/(33.8-.2))
fcs = 32*['']
for i in range(32):
fcs[i] = colors.rgb2hex(cols[i,:])
tm.country('MEX', bmap=m_x, fc=fcs, ec='k', lw=.5, adm=1)
# Add visited cities
tm.city([0, 0], '', m_x)
# Save-path
#plt.savefig(fpath+'sprachenvielfalt/KarteEinheimischeSprachen.png', bbox_inches='tight')
plt.show()