Re: GridLines
- To: mathgroup at smc.vnet.net
- Subject: [mg55286] Re: GridLines
- From: Peter Pein <petsie at arcor.de>
- Date: Fri, 18 Mar 2005 05:34:08 -0500 (EST)
- References: <d1940s$nom$1@smc.vnet.net> <d1bh4s$ltf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
adamizer wrote: > Give this a try: > <<Graphics`Colors` > > I just load the above package to avoid having to use the > RGBColor[1,0,0] form for the different colors. I took the liberty of > showing how to dash the grids as well as change the colors. > > Plot[Sin[x], {x, 0, 10}, > GridLines -> {{Automatic, {Dashing[{0.05, 0.05}], > Yellow}}, {Automatic, {Dashing[{0.1, 0.1}], Green}}}]; > > I have noted at least one buggy behavior. The color only works with > the Automatic option. Without the color and dashing one can specify > specifically where to put the grids (similar to Ticks) with a list such > at: > > GridLines ->{{0,Pi,2 Pi,3 Pi},{-1,-0.5,0,0.5,1}} > > Which works fine. But I could not get Mathematica to do the > user-defined grid and colors. Maybe someone else out there knows how. > > Adam Smith According to Mathematica's helpfile xstyle = {Dashing[{0.05, 0.05}], Yellow}; ystyle = {Dashing[{0.1, 0.1}], Green}; Plot[Sin[x], {x, 0, 10}, PlotStyle -> Red, GridLines -> {({#1, xstyle} & ) /@ {0, Pi, 2*Pi, 3*Pi}, ({#1, ystyle} & ) /@ {-1, -0.5, 0, 0.5, 1}}, Background -> GrayLevel[0.2]]; works fine. -- Peter Pein Berlin