Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: How to plot a graph, using a distance matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89059] Re: [mg88993] How to plot a graph, using a distance matrix
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 24 May 2008 03:58:28 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

n = 10;

pts = RandomInteger[{0, 100}, {n, 2}];

Show[Graphics[{
   Blue, Line /@ Subsets[pts, {2}],
   Red, AbsolutePointSize[5], Point[pts]}],
 Frame -> True]

dist = Table[Norm[pts[[j]] - pts[[k]]], {j, n}, {k, n}];

Needs["Histograms`"];

Histogram[Flatten[dist]]

ArrayPlot[dist]

MatrixPlot[dist]


Bob Hanlon

---- Eric Heiman <eheiman at mailinator.com> wrote: 
> My dilemna is as such:
> 
> I have a matrix (it happens to be 21x21, but don't worry about that) which contains distances between points.
> So column 1 has distances from point 1 to every other point, with row 1 being 0 (because the distance to itself is zero).
> 
> What I am wondering is how I would be able to get mathematica to plot a graph of these points.
> 
> Thanks in advance!
> 



  • Prev by Date: Re: Is it possible to solve this differential equation?
  • Next by Date: Re: Re: Color space conversion in Mathematica v6.0
  • Previous by thread: Re: How to plot a graph, using a distance matrix
  • Next by thread: Re: How to plot a graph, using a distance matrix