I put the text next to the points in as a post-processing step by hand in
PhotoShop.
Is there a way to get mathematica to display such information?
Here are some random points with labels:
points = Table[{RandomReal[1, 2], i}, {i, 10}]
If the graphic will be sent to people who have Mathematica 6, use Tooltip:
Graphics[Tooltip[Point[#1], #2] & @@@ points]
Otherwise you could use Text:
Graphics[{Point[#1], Text[#2, #1, {-3, 0}]} & @@@ points]
Graphics[
{AbsolutePointSize[4],
Module[{loc = Part[#, {1, 2}], val = Part[#, 3]}, {Point[loc],
Text[Row[{val, Spacer[2], "%"}], loc, {-1.8, 0}]}] & /@
pointsandvalues},
AspectRatio -> 1,
Axes -> True, AxesOrigin -> {0, 0}, AxesLabel -> {"Time", "Damage"},
ImageSize -> 300]
--
David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/
"AngleWyrm" <angl...@yahoo.com> wrote in message
news:g0h81q$mtp$1...@smc.vnet.net...
Graphics[
{Point[#],
Text[ToString[Round[Random[]*100]] <> " %", #, {1, -1}]} & /@
data, Frame -> True, PlotRange -> {{0, 1}, {0, 1}}]
??
Regards
Jens
You can post-process plot output to add the information you want. For
example, here is a ListPlot:
plot = ListPlot[Table[{x, y}, {x, 1, 4}, {y, 1, x}], AxesOrigin -> {0,
0}]
Christopher Carlson
User Interface Group
Wolfram Research, Inc
To keep the Epilog option from becoming unreadable (and to give you
the change to tweak the appearance of the point/label pairs), here's a
simple function that generates the annotations:
f[lab_, pt_] := {Point[pt], Text[Style[lab, 14], pt, {-1.5, 0}]}
Your plot is then constructed as follows:
Plot[50 x, {x, 0, 2},
PlotRange -> {{0, 2.25}, {0, 200}},
PlotStyle -> Blue,
AspectRatio -> 1,
AxesLabel -> {"Time", "Damage"},
PlotRangeClipping -> False,
Epilog -> {
AbsolutePointSize[6],
Point[{0, 0}],
Point[{0.5, 0}],
Point[{1.5, 0}],
Point[{2.0, 0}],
f["50%", {0.5, 50}],
f["75%", {1, 50}],
f["88%", {1.5, 50}],
f["94%", {2, 50}],
f["25%", {1, 100}],
f["50%", {1.5, 100}],
f["69%", {2, 100}],
f["13%", {1.5, 150}],
f["31%", {2, 150}],
f["6%", {2, 200}]
}
]
Jason
On 15 May 2008, at 12:49, AngleWyrm wrote:
> Here's a graphic I created for a discussion on game theory:
> http://home.comcast.net/~anglewyrm/thread/dps.png
>
> I put the text next to the points in as a post-processing step by
> hand in
> PhotoShop.
>
> Is there a way to get mathematica to display such information?
>
>
>
--
Dr J. McKenzie Alexander
Department of Philosophy, Logic and Scientific Method
London School of Economics and Political Science
Houghton Street, London WC2A 2AE
Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm
Plot[50 x, {x, 0, 2},
Epilog -> {AbsolutePointSize[5],
Point[Take[#, 2] & /@ data],
Text[#[[3]], #[[{1, 2}]], {-1.5, -.5}] & /@ data},
PlotRange -> {{0, 2.15}, {0, 210}},
AxesLabel -> {"Time", "Damage"},
AspectRatio -> 1]
Bob Hanlon
Labeled list plot was available in Mathematica 5. For some reason, it's
not available anymore in version 6, but you can use it by downloading
the package from the previous version from
http://library.wolfram.com/infocenter/MathSource/6808/
Then, after reading the package in by << or Get, try
LabeledListPlot[ {{0.5, 50, " 50%"}, {1, 100, " 25%"}, {1.5, 100,
" 50%"}}, PlotRange -> {{0, 1.7}, {20, 110}}]
Antti
That first reply was truncated somehow. Here's the rest...
To add labels the the ListPlot output, I
(1) replace Point objects in the output with labeled Points,
(2) wrap the result with Show[..., PlotRangeClipping->False], which
prevents labels that fall outside of the plot range from being clipped.
Show[
plot /. Point[pts_] :> ({Point[#], Black, Text[Row[{IntegerPart[100
#[[2]]/5], "%"}], #, {-1.5, -1}]} & /@ pts),
PlotRangeClipping -> False]
(* Custom LabeledListPlot *)
LabeledListPlot[data_] :=
Show[Graphics[{PointSize[Last[#]/50], Point[Take[#, 2]],
Text[ToString[Round[100 Last[#]]] <> "%",
Take[#, 2], {-1.5, 0}]} & /@ data],
Axes -> True, AxesOrigin -> {0, 0}, AspectRatio -> 1,
AxesLabel -> {"Shots", "Damage"}];
(* Data supplied by other routines *)
data = {{1, 1, 0.5`1.9999999999999998}, {2, 1,
0.75`2.0000000000000004}, {2, 2, 0.25`1.9999999999999998}, {3, 1,
0.875`2.0000000000000013}, {3, 2, 0.5`1.9999999999999998}, {3, 3,
0.125`1.9999999999999998}, {4, 1, 0.9375`2.0000000000000004}, {4,
2, 0.6875`2.}, {4, 3, 0.3125`1.9999999999999998}, {4, 4,
0.0625`1.9999999999999998}, {5, 1,
0.96875`1.9999999999999991}, {5, 2, 0.8125`2.000000000000002}, {5,
3, 0.5`1.9999999999999998}, {5, 4,
0.1875`2.0000000000000004}, {5, 5,
0.03125`1.9999999999999998}, {6, 1,
0.984375`2.0000000000000004}, {6, 2,
0.890625`2.0000000000000004}, {6, 3,
0.65625`1.9999999999999998}, {6, 4, 0.34375`2.}, {6, 5,
0.109375`2.0000000000000013}, {6, 6,
0.015625`1.9999999999999998}};
LabeledListPlot[data]