第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Plotly:如何僅使用一條跡線來(lái)定義一個(gè)開(kāi)放標(biāo)記而不需要一條線穿過(guò)它?

Plotly:如何僅使用一條跡線來(lái)定義一個(gè)開(kāi)放標(biāo)記而不需要一條線穿過(guò)它?

眼眸繁星 2023-08-08 16:30:35
我想用圓開(kāi)放標(biāo)記繪制“線條+標(biāo)記”圖,而不讓線條穿過(guò)它。import plotly.graph_objects as goimport numpy as npx = np.arange(10)fig = go.Figure()fig.add_trace(    go.Scatter(        x=x, y=x**2,        mode='lines+markers',        line=dict(color='green'),        marker_size=16,        marker_symbol='circle-open'    ))fig.update_layout(    plot_bgcolor='white')fig.show()這會(huì)產(chǎn)生一條穿過(guò)開(kāi)放標(biāo)記的線。然后我嘗試在線條頂部添加背景色標(biāo)記 - 但隨后在圖例中我只得到標(biāo)記或線條,而不是兩者組合。有沒(méi)有辦法以這種方式獲得帶有標(biāo)記和線條的圖例?fig = go.Figure()fig.add_trace(    go.Scatter(        x=x, y=x**2,        mode='lines',        line=dict(color='red'),        showlegend=False,        legendgroup='legend'    ))fig.add_trace(    go.Scatter(        x=x, y=x**2,        mode='markers',        marker_color='white',        # line=dict(color='green'),        marker_size=12,        marker_symbol='circle',        marker_line=dict(            width=3,            color='red'        ),    legendgroup='legend'    ))fig.update_layout(    plot_bgcolor='white',)fig.show()
查看完整描述

1 回答

?
郎朗坤

TA貢獻(xiàn)1921條經(jīng)驗(yàn) 獲得超9個(gè)贊

使用幾個(gè)屬性的正確組合應(yīng)該可以幫助您實(shí)現(xiàn)這一目標(biāo):

  1. marker_symbol='circle'

  2. marker_color = 'white'

  3. marker = dict(line = dict(color='green', width = 2))

陰謀

https://img1.sycdn.imooc.com//64d1fd5000013e0112200405.jpg

完整代碼:

import plotly.graph_objects as go

import numpy as np

x = np.arange(10)


fig = go.Figure()

fig.add_trace(

    go.Scatter(

        x=x, y=x**2,

        mode='lines+markers',

        line=dict(color='green'),

        marker_size=16,

        marker_symbol='circle',

        name = 'no line through this',

        showlegend = True,

        

        marker_color = 'white',

        marker = dict(line = dict(color='green', width = 2))

    )

)

fig.update_layout(

    plot_bgcolor='white'

)

fig.show()


查看完整回答
反對(duì) 回復(fù) 2023-08-08
  • 1 回答
  • 0 關(guān)注
  • 121 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)