Scatter Plots

class sage.plot.scatter_plot.ScatterPlot(xdata, ydata, options)

Scatter plot graphics primitive.

__init__(xdata, ydata, options)

Scatter plot graphics primitive.

EXAMPLES:

sage: import numpy
sage: from sage.plot.scatter_plot import ScatterPlot
sage: ScatterPlot(numpy.array([0,1,2]), numpy.array([3.5,2,5.1]), {'facecolor':'white', 'marker':'s'})
Scatter plot graphics primitive on 3 data points
_allowed_options()

Return the dictionary of allowed options for the scatter plot graphics primitive.

EXAMPLES:

sage: from sage.plot.scatter_plot import ScatterPlot
sage: list(sorted(ScatterPlot([-1,2], [17,4], {})._allowed_options().iteritems()))
[('alpha', 'How transparent the marker border is.'),
 ('edgecolor', 'The color of the marker border.'),
 ('facecolor', 'The color of the marker face.'),
 ('hue', 'The color given as a hue.'),
 ('marker', 'What shape to plot the points.'),
 ('markersize', 'the size of the markers.'),
 ('rgbcolor', 'The color as an RGB tuple.'),
 ('zorder', 'The layer level in which to draw.')]
_render_on_subplot(subplot)
Render this scatter plot in a subplot. This is the key function that defines how this scatter plot graphics primitive is rendered in matplotlib’s library.
_repr_()

Text representation of a scatter plot graphics primitive.

EXAMPLES:

sage: import numpy
sage: from sage.plot.scatter_plot import ScatterPlot
sage: ScatterPlot(numpy.array([0,1,2]), numpy.array([3.5,2,5.1]), {})
Scatter plot graphics primitive on 3 data points
get_minmax_data()

Returns a dictionary with the bounding box data.

EXAMPLES:

sage: s = scatter_plot([[0,1],[2,4],[3.2,6]])
sage: d = s.get_minmax_data()
sage: d['xmin']
0.0
sage: d['ymin']
1.0
sage.plot.scatter_plot.scatter_plot(*args, **kwds)

Returns a Graphics object of a scatter plot containing all points in the datalist. Type code{scatter_plot.options} to see all available plotting options.

INPUT:

  • datalist – a list of tuples (x,y)
  • alpha – default: 1
  • markersize – default: 50
  • marker – default: 'o'
  • facecolor – default: '#fec7b8'
  • edgecolor – default: 'black'
  • zorder – default: 5

EXAMPLES:

sage: s = scatter_plot([[0,1],[2,2],[4.3,1.1]], marker='s')
sage: s

Extra options will get passed on to show(), as long as they are valid:

sage: scatter_plot([(0, 0), (1, 1)], markersize=100, facecolor='green', ymax=100)
sage: scatter_plot([(0, 0), (1, 1)], markersize=100, facecolor='green').show(ymax=100) # These are equivalent

Previous topic

Plotting primitives

Next topic

Text in plots

This Page