[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plotting matrices on a Raster
From: |
Paul Johnson |
Subject: |
Re: Plotting matrices on a Raster |
Date: |
Thu, 18 Nov 1999 12:56:34 -0600 |
Fabio Mascelloni wrote:
>
> I'd like to plot on a raster a n*n matrix (currently 10*10) of float values
> in the range [0.0 1.0], each value corrisponding to a color, from black of
> 0.0 to red of 1.0, through all the possibles values.This was already made
> using Matlab
> (look at the attached pic) and I'd like to obtain a similar effect with
> SWARM.
> I've tried using Diffuse2D, for example, but without good results. I'm
> wondering if it's possible.
> Fabio.
>
> ------------------------------------------------------------------------
> Name: output.jpg
> output.jpg Type: JPEG Image (image/jpeg)
> Encoding: base64
Use Value2dDisplay, that's a matrix in which you can put an integer in
each square to represent the colors. You can't put floats in there, but
you can scale your floating point numbers from 1 to 100000 or so to
approximate a scale.
The key is in getting the colors right in the Colormap in the
ObserverSwarm. Know what I mean? fix up the ColorMap.
The alternative is to redesign your simulation so that you have little
"wrapper objects" holding your floating point values. The wrapper can
sit on an Object2dDisplay and you can have the drawSelfOn method set the
color (which has to be an integer).
I've got a copy of heatbugs that I adjusted to have the bugs draw
themselves with the color to reflect their desired heat. I put a copy
here
http://lark.cc.ukans.edu/~pauljohn/Swarm/MySwarmCode/coloredheatbugs-1.3.1.tar.gz
It might give you a hint. I don't know of any reason this won't run
under Swarm 2.
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.