1
resposta

AttributeError: 'tuple' object has no attribute 'figure'

ax = sns.distplot(dados.Idade, hist_kws = {'cumulative': True}, kde_kws = {'cumulative': True}), ax.figure.set_size_inches(14, 6) ax.set_title('Distribuição de Frequências Acumulada', fontsize=18) ax.set_ylabel('Acumulado', fontsize=14) ax.set_xlabel('Anos', fontsize=14) ax

Erro: /usr/local/lib/python3.6/dist-packages/seaborn/distributions.py:2551: FutureWarning: distplot is a deprecated function and will be removed in a future version. Please adapt your code to use either displot (a figure-level function with similar flexibility) or histplot (an axes-level function for histograms).

warnings.warn(msg, FutureWarning)

AttributeError Traceback (most recent call last) in () 10 hist_kws = {'cumulative': True}, 11 kde_kws = {'cumulative': True}), ---> 12 ax.figure.set_size_inches(14, 6) 13 ax.set_title('Distribuição de Frequências Acumulada', fontsize=18) 14 ax.set_ylabel('Acumulado', fontsize=14)

AttributeError: 'tuple' object has no attribute 'figure'

como resolver este erro.

1 resposta

O erro é referente a você tentar mexer num atributo que não existe, nesse caso o figure.

Então ao invés de ax.figure.set_size_inches(14, 6), você precisa digitar ax.set_size_inches(14, 6).

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software