簡體   English   中英

Python:Plotly:平行坐標不透明度

[英]Python: Plotly: Parallel Coordinates Opacity

我試圖做一個平行坐標圖。 我希望線條的顏色為黑色,但要具有不透明度,以便重疊的線條比其余線條更暗。 在繪圖平行坐標的示例中是否可以對顏色設置不透明?

import plotly.plotly as py
import plotly.graph_objs as go

import pandas as pd 

df = pd.read_csv("https://raw.githubusercontent.com/bcdunbar/datasets/master/parcoords_data.csv")

data = [
    go.Parcoords(
        line = dict(color = df['colorVal'],
                   colorscale = 'Jet',
                   showscale = True,
                   reversescale = True,
                   cmin = -4000,
                   cmax = -100),
        dimensions = list([
            dict(range = [32000,227900],
                 constraintrange = [100000,150000],
                 label = 'Block Height', values = df['blockHeight']),
            dict(range = [0,700000],
                 label = 'Block Width', values = df['blockWidth']),
            dict(tickvals = [0,0.5,1,2,3],
                 ticktext = ['A','AB','B','Y','Z'],
                 label = 'Cyclinder Material', values = df['cycMaterial']),
            dict(range = [-1,4],
                 tickvals = [0,1,2,3],
                 label = 'Block Material', values = df['blockMaterial']),
            dict(range = [134,3154],
                 visible = True,
                 label = 'Total Weight', values = df['totalWeight']),
            dict(range = [9,19984],
                 label = 'Assembly Penalty Weight', values = df['assemblyPW']),
            dict(range = [49000,568000],
                 label = 'Height st Width', values = df['HstW']),
            dict(range = [-28000,196430],
                 label = 'Min Height Width', values = df['minHW']),
            dict(range = [98453,501789],
                 label = 'Min Width Diameter', values = df['minWD']),
            dict(range = [1417,107154],
                 label = 'RF Block', values = df['rfBlock'])
        ])
    )
]

py.offline.plot(data, filename = 'parcoords-advanced')

plotly 2.1.0需要import plotly as py

看起來不可能。 原因如下,因為沒有與“不透明度”相關的任何選項:

父項['parcoords']下路徑['line']處'line'的有效屬性:

['autocolorscale', 'cauto', 'cmax', 'cmin', 'color', 'colorbar',
'colorscale', 'colorsrc', 'reversescale', 'showscale']

父母['parcoords','dimensions']下路徑['dimensions'] [3]處“ dimension”的有效屬性:

['constraintrange', 'label', 'range', 'tickformat', 'ticktext',
'ticktextsrc', 'tickvals', 'tickvalssrc', 'values', 'valuessrc',
'visible']

但是, httpsplotly提到了“ opacity”,它可能在另一個plotly包中

您可以嘗試R的繪圖或matplotlib.pyplot

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM