evogytis/baltic

TypeError: unsupported operand type(s) for -: 'function' and 'int'

Closed this issue · 2 comments

Hello,

I'm trying to plot a tree using this line of code loc_tree.plotPoints(ax, x_attr=x_attr, y_attr=y_attr, size=s_func, colour=c_func, zorder=z_func) where everything is defined. The code is one 187 of this script using this input tree. I get this error as a response:

Traceback (most recent call last):
File "C:/Users/28Cha/sarscvo2/scripts/baltic_explodeJSON.py", line 187, in
loc_tree.plotPoints(ax, x_attr=x_attr, y_attr=y_attr, size=s_func, colour=c_func, zorder=z_func)
File "C:\Users\28Cha\Documents\Python\venv\lib\site-packages\baltic\baltic.py", line 780, in plotPoints
ax.scatter(outline_xs,outline_ys,s=outline_sizes,facecolor=outline_colours,edgecolor='none',zorder=zorder-1,**kwargs) ## put a circle at each tip
TypeError: unsupported operand type(s) for -: 'function' and 'int'

If I comment out line 187 and try to use the outline points, I get the same error.

I was wondering if anyone had any suggestions. If it makes a difference, I am using version 0.1.2.

Hello @colejensen, could you run the same line except without the zorder argument or by changing zorder to a number and see if this error persists?

loc_tree.plotPoints(ax, x_attr=x_attr, y_attr=y_attr, size=s_func, colour=c_func)

or

loc_tree.plotPoints(ax, x_attr=x_attr, y_attr=y_attr, size=s_func, colour=c_func, zorder = 100)

My line of thinking is that the error is in zorder-1 where zorder is the lambda function that is passed if it is not None.

Specifying the values in the function instead of having them refer back to present values worked! Thank you!