Discussion:
Markers in list plot
(too old to reply)
Daniele
2012-10-05 06:40:10 UTC
Permalink
Hi All,
i would like to put personal PlotMarkers in ListPlot in the following way:

ListPlot[{{x1,y1},{x2,y2},...,{xn,yn}}]

in such a way that the first point has as a marker number one, the second number two and so on.. is that possible?

Thanks in advance!
Bob Hanlon
2012-10-06 06:05:50 UTC
Permalink
data = Table[{n, Prime[n]}, {n, 10}];

With PlotMarkers (n data lists with one point each):

ListPlot[List /@ data,
PlotMarkers ->
ToString /@ Range[Length[data]]]

With Text labels (single data list with n points):

ListPlot[data,
PlotStyle -> White,
Epilog -> (n = 1;
Text[n++, #] & /@
data)]


Bob Hanlon
Post by Daniele
Hi All,
ListPlot[{{x1,y1},{x2,y2},...,{xn,yn}}]
in such a way that the first point has as a marker number one, the second number two and so on.. is that possible?
Thanks in advance!
Bill Rowe
2012-10-06 06:07:48 UTC
Permalink
Hi All, i would like to put personal PlotMarkers in ListPlot in the
ListPlot[{{x1,y1},{x2,y2},...,{xn,yn}}]
in such a way that the first point has as a marker number one, the
second number two and so on.. is that possible?
Yes. Here is one way to do that

len = 5;
data = ***@RandomReal[1, {len, 2}];
ListPlot[List /@ data,
PlotMarkers -> (Style[ToString@#, {12, Black}] & /@ Range[len]),
Frame -> True, PlotRange -> All]
Alexei Boulbitch
2012-10-09 04:46:08 UTC
Permalink
Hi All,
i would like to put personal PlotMarkers in ListPlot in the following way:

ListPlot[{{x1,y1},{x2,y2},...,{xn,yn}}]

in such a way that the first point has as a marker number one, the second number two and so on.. is that possible?

Thanks in advance!




Hi, Daniel,

You explained it not quite clearly. Bob Hanlon understood that you need a number in the place of each point (see here http://forums.wolfram.com/mathgroup/archive/2012/Oct/msg00046.html).
However, I see also another way to understand you. Namely, that you need each point to de shown by its own marker.

If this what you want, a very simple way is to add the second parentheses around each pair of numbers. That is, if you have a list like this: {{1,2},{3,4},...} you should have {{{1,2}}, {{3,4}},...}. Then you simply plot it with the option PlotMarkers->Automatic. Otherwise you may specify the markers yourself and use them.

To be specific, assume that this is your list (evaluate it):

points = Transpose[{Range[5], RandomReal[{0, 3}, 5]}];

The following adds the parentheses:

doubleParenthesesList = List /@ points;

and this draws the plot:

ListPlot[doubleParenthesesList, PlotMarkers -> Automatic]

For an idea of making custom markers, have a look here and play with its parameters:

vertexDownOpenTriangle =
Graphics[{EdgeForm[Directive[Thick, Purple]], White,
Polygon[{{1, 0}, {0, -Sqrt[3]}, {-1, 0}}]}, ImageSize -> 7];

hexagonFilled =
Graphics[{Pink,
Polygon[Table[{Cos[2 \[Pi] k/6], Sin[2 \[Pi] k/6]}, {k, 0, 5}]]},
ImageSize -> 7];
hexagonOpen =
Graphics[{EdgeForm[Directive[Thick, Pink]], White,
Polygon[Table[{Cos[2 \[Pi] k/6], Sin[2 \[Pi] k/6]}, {k, 0, 5}]]},
ImageSize -> 7];

diamondFilled =
Graphics[{Red, Polygon[Table[{Cos[Pi k/2], Sin[Pi k/2]}, {k, 4}]]},
ImageSize -> 7];
diamondOpen =
Graphics[{EdgeForm[Directive[Thick, Red]], White,
Polygon[Table[{Cos[Pi k/2], Sin[Pi k/2]}, {k, 4}]]},
ImageSize -> 7];

ListPlot[doubleParanthesesList,
PlotMarkers -> {vertexDownOpenTriangle, hexagonFilled, hexagonOpen,
diamondFilled, diamondOpen}]

Like this you can do whatever you like as the markers.

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44

e-mail: ***@iee.lu

Loading...