我想使用hvplot对区域进行简单的数据框绘制(例如:https://hvplot.pyviz.org/user_guide/Plotting.html),但是代码无法正常工作。由于我是hvplot的新手,所以我不太了解错误消息
将数据框绘制为“条形图”
df.hvplot.bar(x='col2',y=['col1','col3'])
kinda有用。但是传说并没有到位。与区域图相同无法正常工作。
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','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)