Holoviews 酒吧忽略 .opts()

Holoviews Bars Ignoring .opts()

我正在尝试传递 .opts() 参数来设置 holoviews .Bars 图的样式,但传递时所有参数都被忽略。这会导致以下错误: 警告:param.Bars02978:在下一个主要版本 (1.14.0) 中将弃用使用 call 设置选项。请改用等效的 .opts 方法。 我的版本是 1.14.8。 我怎样才能传递 .opts() 以便我的图形可以适当地设置样式?

# https://www.youtube.com/watch?v=ZWP_h6WV8h0 Connecting multiple plots


from collections import defaultdict

import panel as pn

import holoviews as hv
from holoviews import opts
import pandas as pd
import numpy as np
import pandas_bokeh
import bokeh
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, TableColumn, DataTable, DateEditor, IntEditor\
    , DateFormatter, NumeralTickFormatter, CustomJS, DatePicker, widgets
from bokeh.models import Panel, Tabs, Row
from bokeh.io import show
from bokeh.layouts import Column, layout

import hvplot.pandas

hv.extension('bokeh', 'matplotlib')
renderer = hv.renderer('bokeh')
renderer = renderer.instance(mode='server')

data = {
  "calories": [420],
  "duration": [50],
  "ggg": [60]
}

#load data into a DataFrame object:
df = pd.DataFrame(data)
print(df)
df2 = pd.DataFrame({'Missing Data': df[['calories']].sum(axis=1), 'Delayed Data': df[['duration']].sum(axis=1)
                       , 'Duplicate Data': df[['ggg']].sum(axis=1)})
print(df2)

bar_opts = opts.Bars(height=400, width=600, tools=["hover"], bgcolor="grey", xlabel="Wine Class", ylabel="Malic Acid", ylim=(0.0, 3.5))
bars = hv.Bars(pd.melt(df2.reset_index(), ['index']), ['index', 'variable'], 'value', label='dl_refined_analytics').opts(bar_opts)
bars.opts(height=400, width=600, tools=["hover"], bgcolor="grey", xlabel="Wine Class", ylabel="Malic Acid", ylim=(0.0, 3.5))
dmap = hv.DynamicMap(bars)

app = pn.Row(dmap)

app.show() ```


hv.DynamicMap(bars) 背后的意图是什么?我不确定您为什么要将 bars 对象传递给 DynamicMap 构造函数,如果您只使用 app = pn.Row(bars) 而不是 app = pn.Row(dmap) 它应该可以正常工作。