Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Erro: 'AxesSubplot' object has no attribute 'figure_set_size_inches'

Ao rodar o comando abaixo, aparece um alerta na linha 2 :'AxesSubplot' object has no attribute 'figure_set_size_inches'

ax = notas_fulano['Fulano'].plot(style = 'o')
ax.figure_set_size_inches(14, 6)
ax.hlines(y = nota_media_fulano, xmin = 0, xmax = notas_fulano.shape[0] - 1, colors = 'red')
for i in range(notas_fulano.shape[0]):
    ax.vlines(x = i, ymin = nota_media_fulano, ymax = notas_fulano['Fulano'][i], linestyle='dashed')
ax

o Alerta:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-122-b7a067b471a9> in <module>()
      1 ax = notas_fulano['Fulano'].plot(style = 'o')
----> 2 ax.figure_set_size_inches(14, 6)
      3 ax.hlines(y = nota_media_fulano, xmin = 0, xmax = notas_fulano.shape[0] - 1, colors = 'red')
      4 for i in range(notas_fulano.shape[0]):
      5     ax.vlines(x = i, ymin = nota_media_fulano, ymax = notas_fulano['Fulano'][i], linestyle='dashed')

AttributeError: 'AxesSubplot' object has no attribute 'figure_set_size_inches'

Este erro seria por causa da diferença de versão do programa?

2 respostas
solução!

Bom dia Keigo, tudo bem? Espero que sim!

O correto seria como mostrado no vídeo:

ax.figure.set_size_inches(14, 6)

Precisa-se colocar ponto (.) e não underscore (_) entre figure e set_size_inches.

Eu vi que na transcrição do vídeo está escrito errado o código, peço desculpas, já corrigimos a transcrição.

Estou à disposição. Bons estudos!

Nossa, foi falta de atençao mesmo.... Obrigado !!

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