Scatter plot questions

273 views
Skip to first unread message

D Haley

unread,
Jun 5, 2011, 6:40:18 PM6/5/11
to MathGL
Dear Mathgl List,

Is it possible to construct scatter plots? I have been looking through the documentation, but all the examples seem to imply an underlying continuous coordinate system?

If it is possible, does anyone have a sample that can produce, for example, an random scatter of x and y data on a 2D plane (Y vs X)?

I guess I mean a bit like so, but only with the markers, no line:
http://upload.wikimedia.org/wikipedia/commons/0/0f/Oldfaithful3.png

Can the marker sizes be changed too, as in the Mark sample?

Alexey Balakin

unread,
Jun 6, 2011, 1:04:24 AM6/6/11
to MathGL
Just use empty line style ' '. For example:

* Plot(x,y," o"); gives simplest variant of markers (circles) with the
same color and size
* Mark(x,y,r," o"); gives markers (circles) with the same color but
variable size (r array)
* Tens(x,y,c," o"); gives markers (circles) with variable color (c
array) but the same size
* TextMark(x,y,r,"\\kappa"); or TextMark(x,y,"\\kappa"); gives markers
drawn by UTF symbol (or text). In this case the Greek kappa will be
used as marker.

The samples are

mglData a(10), b(10), c(10); a.Modify("rnd"); b.Modify("rnd");
c.Modify("rnd");
gr->Plot(a,b," o");
// or gr->Tens(a,b,c," o");
// or gr->Mark(a,b,c," o");
// or gr->TextMark(a,b,"\\sqrt{\\alpha}");
Reply all
Reply to author
Forward
0 new messages