MathGroup Archive 2009

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

Search the Archive

Re: How to plot strings s_i at point {x_i,y_i} ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95052] Re: How to plot strings s_i at point {x_i,y_i} ?
  • From: Helen Read <hpr at together.net>
  • Date: Sun, 4 Jan 2009 07:34:32 -0500 (EST)
  • References: <gjng76$2m5$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

John wrote:
> Hello!
> 
> I have a set of triplets {{x1,y1,s1},{x2,y2,s2},...}. I would like to
> make a plot where the third element of each triplet, a string, is
> plotted at the coordinate given by the the first two elements of the
> triplet. How can I acheive this? Of course I don't mind reorganizing
> the format of the data. It seems to me that PlotMarkers is not willing
> to help me, since I want different markes within the same data set.

Well, you *could* do something like the following, treating each set of 
coordinates as a separate list so that each one gets its own PlotMarker.

coords = {{{-5, 5}}, {{8, -3}}, {{6, 8}}};
strings = {"String 1", "String 2", "String 3"};
ListPlot[coords, PlotMarkers -> strings, PlotStyle -> Black,
  PlotRange -> {{-10, 10}, {-10, 10}}]


But why not construct your own Text graphics primitives? For example:

list = {{-5, 5, "String 1"}, {8, -3, "String 2"}, {6, 8, "String 3"}};
f[x_List] := Graphics[Text[x[[3]], {x[[1]], x[[2]]}]];
Show[Map[f, list], Axes -> True]

-- 
Helen Read
University of Vermont


  • Prev by Date: syntax coloring for package function
  • Next by Date: Re: Fourier Transform Graph Coordinates
  • Previous by thread: Re: How to plot strings s_i at point {x_i,y_i} ?
  • Next by thread: syntax coloring for package function