如何解决情节不显示?
我第一次使用 plotly,当我运行我的代码片段时,图形将我的变量显示为变量,但没有显示图形的位置????我知道这可能是我的一个愚蠢的用户错误,但我在这里。由于它不适用于我的 df,我决定恢复到与 plotly 相关的文档给出的示例。请告诉我我做错了什么。
我的输入(就像在文档中一样):
[IN]:
# don't know in a I need this?
import dash
import plotly.express as px
long_df = px.data.medals_long()
long_df
import plotly.express as px
long_df = px.data.medals_long()
fig = px.bar(long_df,x="nation",y="count",color="medal",title="Long-Form Input")
fig.show()
[OUT]: nothing in console,nothing in plots,but this show's up in variables:
然后我尝试了:
[IN]:
print(fig)
[OUT]:
Figure({
'data': [{'alignmentgroup': 'True','hovertemplate': 'medal=gold<br>nation=%{x}<br>count=%{y}<extra></extra>','legendgroup': 'gold','marker': {'color': '#636efa'},'name': 'gold','offsetgroup': 'gold','orientation': 'v','showlegend': True,'textposition': 'auto','type': 'bar','x': array(['South Korea','China','Canada'],dtype=object),'xaxis': 'x','y': array([24,10,9],dtype=int64),'yaxis': 'y'},{'alignmentgroup': 'True','hovertemplate': 'medal=silver<br>nation=%{x}<br>count=%{y}<extra></extra>','legendgroup': 'silver','marker': {'color': '#EF553B'},'name': 'silver','offsetgroup': 'silver','y': array([13,15,12],'hovertemplate': 'medal=bronze<br>nation=%{x}<br>count=%{y}<extra></extra>','legendgroup': 'bronze','marker': {'color': '#00cc96'},'name': 'bronze','offsetgroup': 'bronze','y': array([11,8,'yaxis': 'y'}],'layout': {'barmode': 'relative','legend': {'title': {'text': 'medal'},'tracegroupgap': 0},'template': '...','title': {'text': 'Long-Form Input'},'xaxis': {'anchor': 'y','domain': [0.0,1.0],'title': {'text': 'nation'}},'yaxis': {'anchor': 'x','title': {'text': 'count'}}}
})
Exception in comms call get_value:
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py",line 344,in _handle_remote_call
self._set_call_return_value(msg_dict,return_value)
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py",line 381,in _set_call_return_value
self._send_message('remote_call_reply',content=content,data=data,File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py",line 244,in _send_message
buffers = [cloudpickle.dumps(
File "C:\Users\cyrra\anaconda3\lib\site-packages\cloudpickle\cloudpickle_fast.py",line 73,in dumps
cp.dump(obj)
File "C:\Users\cyrra\anaconda3\lib\site-packages\cloudpickle\cloudpickle_fast.py",line 563,in dump
return Pickler.dump(self,obj)
TypeError: cannot pickle '_thread.lock' object
谁能告诉我发生了什么或者我犯了什么愚蠢的错误。我相信我已经通过 conda 正确安装了 dash 和 plotly。
谢谢,
瑞秋
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。