2

I want to "area-plot" a simple dataframe with hvplot (like here: https://hvplot.pyviz.org/user_guide/Plotting.html ), but the code does not work. Since I am new to hvplot I dont quite get the Error Message

Ploting the dataframe as a "bar-Plot"

df.hvplot.bar(x='col2', y=['col1', 'col3'])

kinda works. But the legend is not on point. The same as an area plot does not work.

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'])

Running my Code gives the following Error Message:

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)
ASDu
  • 89
  • 1
  • 5

1 Answers1

1

Your code is correct.
In conclusion, it thus depended on the library versions you were using.
It works when you upgrade to bokeh 1.4.0, hvplot 0.5.2 and holoviews 1.12.6.

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96