I would be grateful if someone could help me with the problem below.
IĀ“m trying to run the code below, but appeared an error only in the ādebug modeā (āCtrl + F10ā) in Spyder IDE.
Running the whole code (F5) and selection (F9) is working correctly.
Spyder version: 5.4.3 (conda)
Python version: 3.8.16 64-bit
Operating System: Windows 10
numpy v1.24.3
plotly v5.14.1
spyder v5.4.3
Code Example:
import numpy as np
import plotly.express as px
x_data = [1,2,3,4]
y_data = [1,4,9,16]
fig = px.scatter(x= x_data, y = y_data)
plot(fig)
Message in IPython Console:
File ~\Doutorado\Python\Feeders\outlier_class.py:85 in grafico_dispersao
fig = px.scatter(x= x_data, y = y_data)
File ~\Anaconda3\lib\site-packages\plotly\express_chart_types.py:66 in scatter
return make_figure(args=locals(), constructor=go.Scatter)
File ~\Anaconda3\lib\site-packages\plotly\express_core.py:1994 in make_figure
apply_default_cascade(args)
File ~\Anaconda3\lib\site-packages\plotly\express_core.py:932 in apply_default_cascade
x[1] for x in args[ātemplateā].layout.colorscale.sequential
AttributeError: āNoneTypeā object has no attribute ālayoutā
Iām confident that @allsyntax and @Skiks will be able to support you in finding an answer.
For any questions you ask in the future, I highly recommend you read over this post. It will help make your posts more readable and even easier to understand and respond to.
Maybe check and make sure you donāt have another variable or a module named px. But the code you posted seems fine on its own and should work. You might need to provide more context or try debugging to pinpoint where the issue is.
Hi, did you find any solution to this? I am experiencing the same error when plotting using px.scatter without any template.
The tracebacks I have are:
File "/usr/local/lib/python3.10/site-packages/plotly/express/_chart_types.py", line 264, in line
return make_figure(args=locals(), constructor=go.Scatter)
File "/usr/local/lib/python3.10/site-packages/plotly/express/_core.py", line 2213, in make_figure
elif args["template"].layout.margin.t is None:
AttributeError: 'NoneType' object has no attribute 'layout'