MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: LabeledListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96489] Re: [mg96448] Re: LabeledListPlot
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 14 Feb 2009 03:13:17 -0500 (EST)
  • Reply-to: hanlonr at cox.net

data = Sort[RandomReal[{0, 1}, {10, 2}]];

There is nothing special about the PlotMarkers generated with a CharacterRange. Any list can be used. The CharacterRange was just a convenient way of generating an appropriate length list of distinct labels. Any list of the appropriate length will work. For example,

labels = RandomSample[Select[Names[], Length[Characters[#]] < 5 &], 
  Length[data]]

{Bold,Last,Tr,Abs,\[FormalCapitalG],Take,Sign,Norm,FE`i,Erf}

ListPlot[List /@ data, PlotMarkers -> labels, 
 PlotRange -> {{-0.1, 1.1}, {-0.1, 1.1}},
 Frame -> True, Axes -> False]

ListPlot[data, PlotRange -> {{-0.1, 1.1}, {-0.1, 1.1}}, 
 PlotMarkers -> Style[\[EmptyUpTriangle], 24], 
 Epilog -> (Style[Text[#1[[1]], #1[[2]], {-1.5, -1.5}], 10, Red] &) /@ 
   Transpose[{labels, data}],
 Frame -> True, Axes -> False]


Bob Hanlon

---- TerryH <tlharter at verizon.net> wrote: 

=============
Dear Group,
    I've examined the 2 recent posts by Jens-Peer Kuska and Bob Hanlon.
Both approachs work, but it has become clear to me that my question was
somewhat misinterpreted regarding the labels for the individual points
to be plotted (sorry-my fault).  I used the set {"a","b","c",...] to be 
a generic set for arbitrary text strings, for example, "labelTxt1", 
"labelTxt2", etc where for one set of data I want the labels to be 
"1980", "1988", "1997" where these text-year strings can be arbitrary 
with no pre-established sequence or order implied, and then, another 
time, I want these labels to be "East","West","North", etc. This would 
rule out, I think, constructs using FromCharacterCode.
     I'd also like to be able to incorporate an arbitrary plotting 
symbol, that I can pick from one of the standard special Character 
palettes or than can be generated.  Didn't there use to be a MakeSymbol 
built-in command with Ver 5.x?
Any extended ideas?  TIA
.....Terry

TerryH wrote:
> Hi Groupers:
>       Last November 2008, I posted the inquiry below and one of the 
> replies that I got was from Jens (also listed below & it worked great).
> 
>       Now I have a related question, which is:  Instead of labeling the 
> individual plotted points with an integer, how can you label the 
> individual plotted points with textual labels?  For example, I want to 
> label the first plotted point with "a", the second one with "b", the 
> third with "c", and so on.  I've tried using PlotMarkers but that labels 
> the entire data set and not individual points.  The best that I could 
> come up with is to make each x,y pair into its own list, for example
> with 3 points to plot (for the illustration here)
> data = {{x1,y1},{x2,y2},{x3,y3}}  then feed data[[1]], data[[2]], 
> data[[3]] into ListPlot, I want to apply the labels {"a","b","c"}.
> This works for a Point plotting symbol.  However, it feels cumbersome.
> 
>       However, I'd really like to use a filled triangle for the plotting 
> symbol and not the Graphic associated with what 
> Graphic[Point[{num1,num2}]] gives.  The only way I could get this to 
> work is to generate 2 separate graphics with one (grfA) have the labels 
> only, and the other (grfB) without labels but with the correct plotting 
> symbol, and then bring them together using Show[grfA,grfB].  But this 
> method really seems ackword, so surely there has to be a better way. 
> I'm using Ver 6.0.3   Any suggestions?
> TIA
> .......Terry
> 
> 
> 
> 
> Jens-Peer Kuska wrote:
>> Hi,
>>
>> dta = Table[{tmp = Random[], Sin[Pi*tmp]}, {25}] // Sort;
>>
>> ListPlot[dta] /.
>>   Point[lst : {{_, _} ..}] :>
>>    MapIndexed[{Text[#2[[1]], #1, {-1, -1}], Point[#1]} &, lst]
>>
>> Regards
>>    Jens
>>
>> TerryH wrote:
>>> Hi Groupers,
>>>     In Ver 5.2 and earler there was a function called "LabeledListPlot"
>>> In Ver 6.0.1 and 6.0.3 of Mathematica, it seems that this function was
>>> inadvertently omitted (Hopefully, it will be included in the next 
>>> update/Version).  In the meantime does anyone know of a work-around so 
>>> that one can produce a Labeled?List Plot in Ver 6.0?  TIA
>>> .....Terry
>>>



  • Prev by Date: Re: Re: Logarithmic Plot
  • Next by Date: Re: New free introductory book on Mathematica programming, and a few
  • Previous by thread: Re: LabeledListPlot
  • Next by thread: (2/3)[[1]]