Discussion:
Labeling individual plot points using PlotMarkers
(too old to reply)
Nazdrovje
2007-07-04 09:54:42 UTC
Permalink
I need to plot data measured by several subjects (using Mathematica 6). For
each subject (on the x-axis) I want to plot the maximum of a list of
observations and I want to label it with the position in the list
where this maximum value is reached. Getting these values is no
problem, but the labelling part is. I know I could program the labels
using Text or so with Epilog, but it looks so clumsy that I really
hate to do it in this way. ListPlot should be able to do its own
labeling, but it doesn't work for me. Since every dataset is just one
point (one subject, one maximum), ListPlot should be called as:

ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}].

The outer braces to indicate that various datasets follow, the next
deeper {} to indicate the data set and the deepest {} to indicate a
coordinate pair as opposed to single y-values. I get three points with
different colors as expected. Leave out the second level of braces and
they are considered the same data set and are colored the same. If I
now add a PlotMarker option like this:

ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}, PlotMarkers -> {"\[Alpha]",
"\[Beta]", "\[Gamma]"}]

the results are unexpected. The first plotmarker is fine, but the
second and third contain both the intended symbols and the first one
combined. The following workaround yields the result I want, but it's
really an ugly kludge:

ListPlot[{{{1, 2}, {1, 2}}, {{6, 9}, {6, 9}}, {{7, 10}, {7, 10}}},
PlotMarkers -> {"\[Alpha]", "\[Beta]", "\[Gamma]"}]

Anyone have a better idea to handle this? And is the overlapping
behaviour a bug?
Brett Champion
2007-07-05 08:24:02 UTC
Permalink
Post by Nazdrovje
I need to plot data measured by several subjects (using Mathematica
6). For
each subject (on the x-axis) I want to plot the maximum of a list of
observations and I want to label it with the position in the list
where this maximum value is reached. Getting these values is no
problem, but the labelling part is. I know I could program the labels
using Text or so with Epilog, but it looks so clumsy that I really
hate to do it in this way. ListPlot should be able to do its own
labeling, but it doesn't work for me. Since every dataset is just one
ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}].
The outer braces to indicate that various datasets follow, the next
deeper {} to indicate the data set and the deepest {} to indicate a
coordinate pair as opposed to single y-values. I get three points with
different colors as expected. Leave out the second level of braces and
they are considered the same data set and are colored the same. If I
ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}, PlotMarkers -> {"\[Alpha]",
"\[Beta]", "\[Gamma]"}]
the results are unexpected. The first plotmarker is fine, but the
second and third contain both the intended symbols and the first one
combined. The following workaround yields the result I want, but it's
ListPlot[{{{1, 2}, {1, 2}}, {{6, 9}, {6, 9}}, {{7, 10}, {7, 10}}},
PlotMarkers -> {"\[Alpha]", "\[Beta]", "\[Gamma]"}]
Anyone have a better idea to handle this? And is the overlapping
behaviour a bug?
It's a bug that occurs when you have data sets that only contain a
single point.

Brett Champion
Wolfram Research
Jens-Peer Kuska
2007-07-05 08:37:21 UTC
Permalink
Hi,

Graphics[MapThread[
Tooltip[Point[#1], #2] &, {{{{1, 2}, {1, 2}}, {{6, 9}, {6, 9}}, {{7,
10}, {7, 10}}}, {"\[Alpha]", "\[Beta]", "\[Gamma]"}}],
Frame -> True]

make tool tips on the points.

Regards
Jens
Post by Nazdrovje
I need to plot data measured by several subjects (using Mathematica 6). For
each subject (on the x-axis) I want to plot the maximum of a list of
observations and I want to label it with the position in the list
where this maximum value is reached. Getting these values is no
problem, but the labelling part is. I know I could program the labels
using Text or so with Epilog, but it looks so clumsy that I really
hate to do it in this way. ListPlot should be able to do its own
labeling, but it doesn't work for me. Since every dataset is just one
ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}].
The outer braces to indicate that various datasets follow, the next
deeper {} to indicate the data set and the deepest {} to indicate a
coordinate pair as opposed to single y-values. I get three points with
different colors as expected. Leave out the second level of braces and
they are considered the same data set and are colored the same. If I
ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}, PlotMarkers -> {"\[Alpha]",
"\[Beta]", "\[Gamma]"}]
the results are unexpected. The first plotmarker is fine, but the
second and third contain both the intended symbols and the first one
combined. The following workaround yields the result I want, but it's
ListPlot[{{{1, 2}, {1, 2}}, {{6, 9}, {6, 9}}, {{7, 10}, {7, 10}}},
PlotMarkers -> {"\[Alpha]", "\[Beta]", "\[Gamma]"}]
Anyone have a better idea to handle this? And is the overlapping
behaviour a bug?
Nazdrovje
2007-07-13 10:21:26 UTC
Permalink
I am aware of that, but I really need something that is visible when
printed...
Post by Jens-Peer Kuska
Hi,
Graphics[MapThread[
Tooltip[Point[#1], #2] &, {{{{1, 2}, {1, 2}}, {{6, 9}, {6, 9}}, {{7,
10}, {7, 10}}}, {"\[Alpha]", "\[Beta]", "\[Gamma]"}}],
Frame -> True]
make tool tips on the points.
Regards
Jens
Post by Nazdrovje
I need to plot data measured by several subjects (using Mathematica 6). For
each subject (on the x-axis) I want to plot the maximum of a list of
observations and I want to label it with the position in the list
where this maximum value is reached. Getting these values is no
problem, but the labelling part is. I know I could program the labels
using Text or so with Epilog, but it looks so clumsy that I really
hate to do it in this way. ListPlot should be able to do its own
labeling, but it doesn't work for me. Since every dataset is just one
ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}].
The outer braces to indicate that various datasets follow, the next
deeper {} to indicate the data set and the deepest {} to indicate a
coordinate pair as opposed to single y-values. I get three points with
different colors as expected. Leave out the second level of braces and
they are considered the same data set and are colored the same. If I
ListPlot[{{{1, 2}}, {{6, 9}}, {{7, 10}}}, PlotMarkers -> {"\[Alpha]",
"\[Beta]", "\[Gamma]"}]
the results are unexpected. The first plotmarker is fine, but the
second and third contain both the intended symbols and the first one
combined. The following workaround yields the result I want, but it's
ListPlot[{{{1, 2}, {1, 2}}, {{6, 9}, {6, 9}}, {{7, 10}, {7, 10}}},
PlotMarkers -> {"\[Alpha]", "\[Beta]", "\[Gamma]"}]
Anyone have a better idea to handle this? And is the overlapping
behaviour a bug?
Loading...