Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: DiagramPlot and PlanarGraphPlot colors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128050] Re: DiagramPlot and PlanarGraphPlot colors
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Tue, 11 Sep 2012 02:34:49 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20120909213324.167C06765@smc.vnet.net>

Needs["ComputationalGeometry`"]

data2D = {
   {4.4, 14}, {6.7, 15.25}, {6.9, 12.8},
   {2.1, 11.1}, {9.5, 14.9}, {13.2, 11.9},
   {10.3, 12.3}, {6.8, 9.5}, {3.3, 7.7},
   {0.6, 5.1}, {5.3, 2.4}, {8.45, 4.7},
   {11.5, 9.6}, {13.8, 7.3}, {12.9, 3.1},
   {11, 1.1}};

p1 = DiagramPlot[data2D];

p2 = PlanarGraphPlot[data2D];

Graphics[{
  Red,
  AbsoluteThickness[1.5],
  Tooltip[
   Cases[p1, Line[_], Infinity],
   "Diagram Plot"],
  Green,
  Tooltip[
   Cases[p2, Line[_], Infinity],
   "Planar Graph Plot"],
  Black,
  Cases[p1, Text[x__] :>
    Style[Text[x], Bold, 14], Infinity]}]


Bob Hanlon


On Mon, Sep 10, 2012 at 4:04 AM, Dave Snead <dsnead6 at charter.net> wrote:
> Hi,
>
> I'm showing two plots p1 and p2 on top of each other,
> but I'd like to show them in two different colors,
> say red and green.
> Anybody know how to do this?
>
> Here's the code with both plots in black:
>
> Needs["ComputationalGeometry`"]
> data2D = {{4.4, 14}, {6.7, 15.25}, {6.9, 12.8}, {2.1, 11.1}, {9.5,
>     14.9}, {13.2, 11.9}, {10.3, 12.3}, {6.8, 9.5}, {3.3, 7.7}, {0.6,
>     5.1}, {5.3, 2.4}, {8.45, 4.7}, {11.5, 9.6}, {13.8, 7.3}, {12.9,
>     3.1}, {11, 1.1}};
> p1 = DiagramPlot[data2D]
> p2 = PlanarGraphPlot[data2D]
> Show[{p1, p2}]
>
> Thanks in advance,
> Dave
>
>



  • Prev by Date: Re: Begginer's question: Saving a function for later use
  • Next by Date: Re: Landau letter, Re: Mathematica as a New Approach...
  • Previous by thread: Re: How to simplify certain covariance expressions using
  • Next by thread: Begginer's question: Saving a function for later use