How to add titles, axis label, and legend in sagemath?

myplot = list_plot(
    zip(range(20), range(20)), 
    color='red', 
    legend_label='legend item 1')

myplot2 = list_plot(
    zip(range(20), [i*2 for i in range(20)]), 
    color='blue', 
    legend_label='legend item 2')

combined = myplot + myplot2

combined.axes_labels(['testing x axis', 'testing y axis'])
combined.legend(True)

combined.show(title='Testing title', frame=True, legend_loc="lower right")

I’m not entirely certain why there’s no title method and why the title has to be specified inside show when the axes don’t have to be, but this does appear to work.

Read more here: Source link