简体   繁体   English

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

[英]Python: Plotly: Parallel Coordinates Opacity

Im trying to do a parallel coordinate plot. 我试图做一个平行坐标图。 I want the color of the lines black, but with an opacity so that lines which overlap are darker than the rest. 我希望线条的颜色为黑色,但要具有不透明度,以便重叠的线条比其余线条更暗。 Is it possible to set an opcaity to the color in the example of plotly parallel coordinates ? 在绘图平行坐标的示例中是否可以对颜色设置不透明?

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 needs import plotly as py plotly 2.1.0需要import plotly as py

It looks impossible. 看起来不可能。 The reason is as the follows for there is no any option that is related to "opacity": 原因如下,因为没有与“不透明度”相关的任何选项:

Valid attributes for 'line' at path ['line'] under parents ['parcoords']: 父项['parcoords']下路径['line']处'line'的有效属性:

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

Valid attributes for 'dimension' at path ['dimensions'][3] under parents ['parcoords', 'dimensions']: 父母['parcoords','dimensions']下路径['dimensions'] [3]处“ dimension”的有效属性:

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

However https://plot.ly/python/line-and-scatter/ mentioned "opacity" that might be in another package of plotly 但是, httpsplotly提到了“ opacity”,它可能在另一个plotly包中

You can try R's plot or matplotlib.pyplot 您可以尝试R的绘图或matplotlib.pyplot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM