MathGroup Archive 2000

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

Search the Archive

Re: Hatching instead of a colour?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21474] Re: [mg21440] Hatching instead of a colour?
  • From: Hartmut Wolf <hwolf at debis.com>
  • Date: Tue, 11 Jan 2000 04:17:53 -0500 (EST)
  • Organization: debis Systemhaus
  • References: <200001100856.DAA20988@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Harald Giese schrieb:
> 
> There is a matrix of values spanning from negative to positive values
> and a second one indicating, which of the first matrix' elements are
> missing values, i.e. whether the "0" is a value or just meas "nil".
> ListDensityPlot plots a nice gray scale graphic, but I need to indicate
> the missing entries in that plot. I thought about replacing the colour
> of these "empty" elements by a pattern or hatching. Has someone an idea
> how to do that with Mathematica?
> 

Hello Harald,

some proposals: just let's define some data:

data0 = Table[Sin[x] Sin[y], {x, 0, 2Pi, Pi/10}, {y, 0, Pi, Pi/20}];

Where some "points" are missing 

missing = {{5, 3}, {7, 17}, {12, 9}, {12, 12}, {13, 13}, {13, 20}, {18, 
        7}, {20, 14}};

So your (original) data are

data = ReplacePart[data0, 0., Reverse /@ missing];

You can density plot these data and mark the missing spots

ListDensityPlot[data, 
    Epilog -> {PointSize[0.04], Hue[0.1], Point[#] & /@ (missing -
0.5)}];

But perhaps, if you like to play golf, you might like it more fancy

<< Graphics`Arrow`

mark[{x_, y_}, d_] := 
  Graphics[{Hue[0.], 
      Arrow[{x, y}, {x, y} + d {0.2, 1.}, HeadScaling -> Relative, 
        HeadShape -> {Polygon[{{0, 0}, {-.3, 0}, {-.1, -0.4}}]}
        ]}, PlotRange -> All]

Show[ListDensityPlot[data, ColorFunction -> (Hue[0.35, 1., #] &), 
      DisplayFunction -> Identity], mark[#, 2] & /@ (missing - 0.5), 
    DisplayFunction -> $DisplayFunction];

If you like to have a 3D plot, you e.g. could do

data1 = ReplacePart[data, Null, Reverse /@ missing];

g3d = Graphics3D[
      ListPlot3D[data1, BoxRatios -> {1, 1, 0.8}, 
        DisplayFunction -> Identity]];

Show[g3d /. {_, _, Null} -> Sequence[], DisplayFunction ->
$DisplayFunction, 
    ViewPoint -> {1.9, 0.3, 3.}];

Missing points are clearly visible as such. (A point on the grid
corresponds to a rectangle in the density plot, count!).

To my great astonishment, this even seems to work, if you have quite a
lot of adjacent points missing.

Kind regards, Hartmut


  • Prev by Date: Re: 4.0.0.0 Q/bugs?
  • Next by Date: Re: Inner product can be modified?
  • Previous by thread: Re: 4.0.0.0 Q/bugs?
  • Next by thread: Re: Hatching instead of a colour?