0

I have a pandas dataframe with columns labeled...

x
y
true_x
true_y

I would like to plot a curve of true_x vs true_y overlaid with points y vs x.

The tutorials leave me baffled since they only describe simple 2D and 3D examples.

toonice
  • 2,211
  • 1
  • 13
  • 20
user
  • 1
  • 2

1 Answers1

1

We're about to start working extensively on additional documentation so that's good feedback. To create a simple plot like that simply declare a Curve and a Scatter object each with the appropriate kdims and vdims and overlay them using the mul operator:

curve = hv.Curve(df, kdims=['true_x'], vdims=['true_y'])
scatter = hv.Scatter(df, kdims=['x'], vdims=['y'])
curve * scatter
philippjfr
  • 3,997
  • 14
  • 15
  • so there is no holoviews Table or other element to import the dataframe into? – user Apr 08 '17 at 01:11
  • So here is what I ended up with for a Kalman filter example where data contains the measurements, truth and Kalman estimates: %%opts Scatter [width=600,height=300] data['Time']=np.linspace(start=0, stop=len(data)-1,num=len(data)) print(data.info()) hv.Curve (data, kdims=['x.true'], vdims=['y.true']) *\ hv.Scatter(data, kdims=['x.meas'], vdims=['y.meas'])(style=dict(color='r')) *\ hv.Scatter(data, kdims=['x.est'], vdims=['y.est'])(style=dict(color='darkgreen')) *\ hv.Curve (data, kdims=['x.est'], vdims=['y.est'])(style=dict(color='lightgreen')) – user Apr 08 '17 at 01:42
  • and I need to figure out how to remove a badly formated comment. Sorry! – user Apr 08 '17 at 01:49