Can you try the script below? You can put the legend at specified x and y values on the graph.
import os
import originpro as op
wks = op.new_sheet()
wks.from_file(os.path.join(op.path('e'), 'Samples', 'Graphing', 'Group.dat'))
graph = op.new_graph(template='scatter')
gl=graph[0]
# plot whole sheet as XY plot
plot = gl.add_plot(f'{wks.lt_range()}!(?,1:end)')
# group the plots and control plots setting in group
gl.group()
plot.colormap = 'Candy'
plot.shapelist = [3, 2, 1]
gl.rescale()
# Customize Legend
lgnd = gl.label('Legend')
lgnd.set_int('showframe',0)
xto = gl.get_float('x.to') // x axis end value
yto = gl.get_float('y.to') // y axis end value
lgnd.set_float('x', xto - lgnd.get_float('dx') / 2) // legend center x position
lgnd.set_float('y', yto - lgnd.get_float('dy') / 2) // legend center y position
James