MathGroup Archive 2001

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

Search the Archive

Re: 1. Input of screen coordinates; 2. Fast graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27003] Re: 1. Input of screen coordinates; 2. Fast graphics
  • From: Erich Mueller <emuelle1 at uiuc.edu>
  • Date: Tue, 30 Jan 2001 23:22:22 -0500 (EST)
  • Organization: University of Illinois at Urbana-Champaign
  • References: <94vs7q$oa9@smc.vnet.net> <95603s$3v@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

An alternative to Raster is ListDensityPlot or DensityGraphics, as in

ListDensityPlot[Table[Random[],{i,10},{j,10}],ColorFunction->Hue,Mesh->False]

Note that if you don't turn off the mesh you will really slow down the
rendering.  This is really the same as using Raster, look at the above
expression with FullForm[Graphics[%]].

As for using Raster, if you don't need a custom palette, the following
construction is simpler

Show[Graphics[Raster[Table[Random[],{i,10},{j,10}],ColorFunction->Hue]]]

Erich


On 30 Jan 2001, Jens-Peer Kuska wrote:

> Hi,
> 
> I can't answer your first question, 
> 
> Look into the Raster[] outpur if you read a palette
> image (GIF's) The color function is a huge switch statment
> with the palette. in you case it may help
> but
> 
> yourPalette={3,5,67,255,196,...};
> Show[
> Graphics[
>   Raster[your600x600Array,ColorFunction->(Hue[yourPalette[[#]]/MaxColor]
> &)]
>  ]
> ]
> 
> Hope that helps
>   Jens
> 
> > 2nd question - Suppose you have an array 600x600 of numbers (of colors) in
> > Mathematica and you want to get an image of a square (600x600 pixels),
> > each pixel having a color depending on the number in the corresponding
> > position of the array. (If Color is the array and MaxColor the maximum
> > element of the array, the color of pixel {x,y} could be given by
> > Graphics[Hue[Color[[x,y]]/MaxColor]]).
> >         Of course it is very easy to do that by appending instructions
> > Graphics[Hue[color[[x,y]]/MaxColor]], Graphics[Point[[x,y]]], ... and for
> > economy, if the color did not change, you may even suppress the color
> > instruction. This works for small arrays, but it takes a lot of computing
> > time if the array is big, e.g. 600x600.
> >         Is there a fast way of getting the picture?
> >         If not, I would consider saving the corresponding array to a
> > file and using another program to view the image. Any suggestion?
> > 
> >         Thanks in advance.
> > 
> >         Manuel Chaves
> 
> 


  • Prev by Date: Re: Any better way for finding frequencies of list entries?
  • Next by Date: Re: Queries: notebook, matrices
  • Previous by thread: RE: RE: 1. Input of screen coordinates; 2. Fast graphics
  • Next by thread: RE: RE: 1. Input of screen coordinates; 2. Fast graphics