"" " De: https://www.gov.uk/government/statistics/abortion-statistics-for-england-and-wales-2019 https://assets.publishing.service.gov.uk/government/uploads/ system / uploads / attach_data / file / 915150 / abortion-statistics-2019-data-tables.ods Tabla 5: Abortos legales: gestación (semanas) por comprador y método de aborto, residentes de Inglaterra y Gales, 2019 "" " import numpy como np import matplotlib.pyplot como plttabla = np . matriz ([[ 3 , 4 , 2207 ], [ 5 , 5 , 28556 ], [ 6 , 6 , 56246 ], [ 7 , 7 , 39409 ], [ 8 , 8 , 28618 ], [ 9 , 9 , 16025 ] , [ 10 , 10 , 7448 ], [ 11 , 11, 6456 ], [ 12 , 12 , 5161 ], [ 13 , 13 , 4442 ], [ 14 , 14 , 2290 ], [ 15 , 15 , 2247 ], [ 16 , 16 , 1578 ], [ 17 , 17 , 1526 ], [ 18 , 18 , 993 ], [ 19 , 19 , 859 ], [ 20 , 20 , 772 ], [ 21 , 21 , 834 ], [ 22 , 22 , 754 ], [ 23 , 23 , 684 ], [ 24 , 24 , 68 ], [ 25 , 25 , 42 ] , [ 26 , 27 , 52 ], [ 28 , 31 , 72 ], [ 32 , 40 , 45 ]])freqs = table [:, 2 ] freqs = freqs / 1000 bins = np . concatenar (( tabla [ 0 : 1 , 0 ], tabla [:, 1 ])) afirmar len ( bins ) == len ( freqs ) + 1anchos = contenedores [ 1 :] - contenedores [: - 1 ]alturas = frec / anchos alturas = frec . astype ( np . float ) / anchurashigo , ax = plt . subtramas ( tamaño de la figura = ( 4.5 , 3.8 ))hacha . bar ( bins [: - 1 ], heights , width = widths , align = 'edge' , facecolor = '# B2BFD9' , edgecolor = '# 778BB2' , zorder = 2 )"" " Dibuje para que coincida con https://en.wikipedia.org/wiki/File:Abortionmethods.png " "" kwargs = { 'xycoords' : ( 'datos' , 'fracción de ejes' ), ' alineación horizontal' : 'centro ' , ' alineación vertical ' : ' centro ' } eje . axvspan ( 0 , 12 , color = '# ACE07B' ) ax . anotar ( '1er trimestre \ n (0-12 semanas)' , ( 6 , 0,93), ** kwargs ) hacha . axvspan ( 12 , 28 , color = '# D8E370' ) ax . anotar ( '2do trimestre \ n (13-28 semanas)' , ( 20 , 0.93 ), ** kwargs ) ax . axvspan ( 28 , 40 , color = '# E1BA72' ) ax . anotar ( '3er trimestre \ n (29-40 semanas)' , ( 34 , 0,93 ), ** kwargs ) hacha . axvline ( 12 , c = 'gris' , lw = 0.2 , zorder = 1 ) ax . axvline ( 28 , c = 'gris' , lw = 0.2 , zorder = 1 )hacha . set_xlim ( 0 , 40 ) ax . set_ylim ( 0 , 65 ) hacha . set_xlabel ( 'Edad gestacional [semanas]' ) ax . set_ylabel ( 'Abortos (× 1000)' ) ax . minorticks_on ()plt . tight_layout () plt . mostrar ()