Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

An example of what you aim to do would be useful : your question doesn't specify if you want to label the series of a (composite) plot of of multiple set of points,or label each point individually (e. g. by its coordinates).

The latter case is best manager by using point2d (resp. point3d), which has a legend_label option.

The former case isn't handled by Sage directly. You have to manage it yourself. A couple of options :

  • You may overlay (sum) a set of scatter_plots and a a suitably designed legend using point2d and text2d (resp. text3d) objects ;

  • You may also set your (sum of) point2ds and your legend in a multi_graphics object.

If you don't need to further modify the resulting graph, an alternative is to use some R function (either basic plot(..., type="p"), a trellis plot or a ggplot2 object) ; this lazy solution gives you the zillion options used by applied statisticians for their scatter plots, which are a basic need for them. Howver, giving such graphs the same "look and feel" than those created by Sage may require some work...

You may also roll up your own matplotlib function, ou directly use some predefined function of this (rich) library.

HTH,