Re: ListPlot + Colors
- To: mathgroup@smc.vnet.net
- Subject: [mg12138] Re: [mg12068] ListPlot + Colors
- From: Sean Ross <seanross@worldnet.att.net>
- Date: Mon, 27 Apr 1998 01:46:20 -0400
- References: <199804240552.BAA13327@smc.vnet.net.>
Fermat wrote: > > I'm using Mathematica 3.01. > I have ListPlot[{{1,2},{1,3},{2,2}}] and want to display the 3 points in > 2 different colors, depending on the first coordinate. The problem > extends to several thousands upto an infinity of points, so a > ColorFunction seems appropriate. > How to do that? > > marinus.heuvel@pi.net I have been meaning to write a function to do just that, but have not found the time. In the mean time, only 3-D graphics have the ColorFunction option. If you want to plot points with control over the colors you will have to do it with primitives. Start with the FullForm of your graphics expression and you will see its format in terms of graphics primitives: FullForm[ ListPlot[{{1,2},{1,3},{2,2}}]] returns, in part: Graphics[List[Point[List[1,2]],Point[List[1,3]],Point[List[2,2]]], blah, blah,blah] Every expression Point[List[x,y]] needs to be replaced with an expression List[colordirective,Point[List[x,y]]] which can be a RGBColor, Hue, etc. I think this can be most efficiently done with a MapThread construct. -- Remove the _nospam_ in the return address to respond.
- References:
- ListPlot + Colors
- From: "Fermat" <Marinus.van.den.Heuvel@bigfoot.com>
- ListPlot + Colors