我想用 hvplot “区域绘图”一个简单的数据框(比如这里:https://hvplot.pyviz.org/user_guide/Plotting.html),但代码不起作用。由于我是 hvplot 新手,我不太会收到错误消息
将数据框绘制为“条形图”
df.hvplot.bar(x='col2', y=['col1', 'col3'])
有点工作。但传说并不重要。与面积图一样不起作用。
import pandas as pd
import panel as pn
import hvplot.pandas
import matplotlib.pyplot as plt
d = {'col1': [1, 2,3,4,5], 'col2': ['a','b', 'c', 'd', 'e'], 'col3': [11,12,13,14,15]}
df = pd.DataFrame(data=d)
df.hvplot.area(x='col2', y=['col1', 'col3'])
运行我的代码会给出以下错误消息:
AttributeError: unexpected attribute 'plot' to Legend, possible attributes are background_fill_alpha, background_fill_color, border_line_alpha, border_line_cap, border_line_color, border_line_dash, border_line_dash_offset, border_line_join, border_line_width, click_policy, glyph_height, glyph_width, inactive_fill_alpha, inactive_fill_color, items, js_event_callbacks, js_property_callbacks, label_height, label_standoff, label_text_align, label_text_alpha, label_text_baseline, label_text_color, label_text_font, label_text_font_size, label_text_font_style, label_text_line_height, label_width, level, location, margin, name, orientation, padding, spacing, subscribed_events, tags, title, title_standoff, title_text_align, title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, title_text_line_height or visible
:NdOverlay [Variable]
:Area [col2] (value,Baseline)