0

I'm trying to plot points in an x-y plane, and have their size reflect a third dimension, z. This seems perfectly possible using hvplots, as I have found this code on their website showing how to do it:

np.random.seed(10)
data = np.random.rand(100,4)

points = hv.Points(data, vdims=['z', 'size'])
(points + points[0.3:0.7, 0.3:0.7].hist()).opts(
    opts.Points(color='z', s=dim('size')*50))

Unfortunately, when I try it with my data, below:

show = df.hvplot.points('x', 'y', label='Test{}'.format(Y), marker='+', size='z')

I get the error:

"WARNING:param.PointPlot1180947: Cannot declare style mapping for 'size' option and declare a size_index; ignoring the size_index."

Obviously this doesn't use the size index, although the plot still works with equally sized points.

If I try using the syntax used in the example:

show = df.hvplot.points('x', 'y', label='Test{}'.format(Y), marker='+', s=dim('z'))

I get the message that "dim is not defined". They don't seem to define it on the hvplots website though, it seems to be an accepted argument, so I don't know what's happening there.

Tom
  • 109
  • 1
  • 9

1 Answers1

0

Sorry, I found the answer. The error arose because I'm trying to overlay several plots, and apparently you can't set "height" and "width" in the options of the composite plot if you've already established that point size will depend on a third dimension.

Tom
  • 109
  • 1
  • 9