Using Plotly in Python I ran into the following, rather cryptic, error message, with a minimal reproducible example. The original plot was a lot more complex, as such it took me longer than I like to admit to debug this.
import plotly as px
px.scatter(x=[1,2,3], y=[2,3,4], marginal_x="density")
Traceback (most recent call last):
File "/home/wdecoster/repositories/seetea/scripts/calculate-zscores.py", line 44, in <module>
main()
File "/home/wdecoster/repositories/seetea/scripts/calculate-zscores.py", line 20, in main
fig = px.scatter(
^^^^^^^^^^^
File "/net/winky2/winky2/study252-P200_analysis/results/rr/study/hg38s/study252-P200_analysis/workflow_res>
return make_figure(args=locals(), constructor=go.Scatter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/net/winky2/winky2/study252-P200_analysis/results/rr/study/hg38s/study252-P200_analysis/workflow_res>
trace = trace_spec.constructor(name=trace_name)
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'constructor'
What is going wrong?
It turns out that “density” is not a supported type for a marginal plot, and one should use “violin” instead.