简体   繁体   English

如何搜索绘图图形的特定属性的选项?

[英]How can I search for the options for a particular property of a plotly figure?

The question问题

In the figure below, the jagged shape of the line is set using 'hvh' as an argument for the shape property of the line.在下图中,线条的锯齿形状是使用'hvh'作为线条的shape属性的参数设置的。 As a specific example for a more general case, let's say that I've forgotten which porperty (or properites) that take 'hvh' as an argument.作为更一般情况的具体示例,假设我忘记了将'hvh'作为参数的属性(或属性)。 How can I search through the entire plotly figure to find it?如何搜索整个情节图以找到它?

Plot:阴谋:

在此处输入图片说明

Code:代码:

#imports
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

import numpy as np
import pandas as pd
# Notebook settings
init_notebook_mode(connected=True)

# Some sample data
x = np.random.normal(50, 5, 500)
binned = np.histogram(x, bins=25, density=True)
plot_y = np.cumsum(binned[0])

# Line
trace1 = go.Scatter(
    x=binned[1],
    y=plot_y,
    mode='lines',
    name="X",
    hoverinfo='all',
    line=dict(color = 'rgb(1255, 0, 0)', shape='hvh'
    )
)

data = [trace1]

# Layout
layout = dict(title = 'Where is hvh?',
    legend=dict(
        y=0.5,
        traceorder='reversed',
        font=dict(
            size=16
        )
    )
)

# Make figure
fig = dict(data=data, layout=layout)

# Plot
iplot(fig, filename='line-shapes')

The details:细节:

The shape is obtained using line=dict(color = 'rgb(1255, 0, 0)', shape='hvh' . And if you simply run fig , it will return a dict where you can see where the argument is applied to the figure:形状是使用line=dict(color = 'rgb(1255, 0, 0)', shape='hvh' 。如果您只运行fig ,它将返回一个 dict ,您可以在其中查看参数应用于的位置图:

{'data': [Scatter({
      'hoverinfo': 'all',
      'line': {'color': 'rgb(1255, 0, 0)', 'shape': 'hvh'},
      'mode': 'lines',
      'name': 'X',
      'x': array([35.36954648,
[...]

Let's say that I'd like to know what other propoerties of a an iplot figure that can take 'hvh' or any other string as an argument, how can I search for that?假设我想知道 iplot 图形的哪些其他属性可以将'hvh'或任何其他字符串作为参数,我该如何搜索? I happen to know that 'hvh' shows up in the output from help(trace1['line'])我碰巧知道'hvh'出现在help(trace1['line'])

shape
 |      Determines the line shape. With "spline" the lines are drawn
 |      using spline interpolation. The other available values
 |      correspond to step-wise line shapes.
 |      
 |      The 'shape' property is an enumeration that may be specified as:
 |        - One of the following enumeration values:
 |              ['linear', 'spline', 'hv', 'vh', 'hvh', 'vhv']

But if 'hvh' were to occure for several shapes, It would be extremely hard to look through the output from help() for every possible property.但是,如果'hvh'出现在几个形状中,那么查看help()的输出中每个可能的属性将是非常困难的。 If I was looking for 'shape' itself, I could just run a search on plot.ly/python/reference/ and get:如果我正在寻找'shape'本身,我可以在plot.ly/python/reference/上进行搜索并得到:

在此处输入图片说明

But that is not the case for 'hvh' or hvh :'hvh'hvh

在此处输入图片说明

Thank you for any suggestions!感谢您的任何建议!

You can always use your in-browser ctl-F to search within the page at https://plot.ly/python/reference/ if the search box isn't giving you what you need.如果搜索框没有提供您需要的内容,您始终可以使用浏览器内的 ctl-F 在https://plot.ly/python/reference/的页面内进行搜索。

That said, I've just updated our search index to include the list of accepted values in enumerated attributes, so as of 2 minutes ago, searching for "hvh" gives:也就是说,我刚刚更新了我们的搜索索引以包含枚举属性中接受值的列表,因此截至 2 分钟前,搜索“hvh”给出:

在此处输入图片说明

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

相关问题 如何更改 python plotly 图形 id? - How can I change the python plotly figure id? 如何在不覆盖图形的情况下将 plotly 图形的图例向左移动? - How can I move the legend of a plotly figure to the left without covering my graph? 我不知道如何让我的 Plotly 图表只显示整数 - I can't figure out how to make my Plotly charts show whole numbers only 如何在不重新加载图中虚线的情况下更新地图框内的信息 - How can I update the info inside a mapbox without reloading the figure in plotly dash 我使用 Colab 和 Plotly,我想保存一个 Plotly 图 - 如何在 Colab 中安装 plotly-orca? - I use Colab and Plotly and I want save a Plotly figure - how to install plotly-orca in Colab? 情节:如何检查和更改情节图? - Plotly: How to inspect and make changes to a plotly figure? Plotly:如何在 Plotly 图形上绘制多个图像? - Plotly: How to plot multiple images on a Plotly figure? 如何从 python 中的 dataframe 中搜索和提取特定值? - How can I search for and extract a particular value from a dataframe in python? Plotly:如何更改图形大小? - Plotly: How to change figure size? 有人可以帮我弄清楚如何打印此下拉列表中的选项吗? - Can someone help me figure out how to print the options in this dropdown?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM