       Gridlines in MultipleListPlot

• To: mathgroup at smc.vnet.net
• Subject: [mg58848] Gridlines in MultipleListPlot
• From: ggroup at sarj.ca
• Date: Thu, 21 Jul 2005 03:07:55 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

I'm trying to come up with a solution that will allow me to generate a
MultipleListPlot that has solid gridlines for every major tick mark and
dashed gridlines for every minor tick mark.

So far, I've been able to come up with a module (see code below) which
generates a table of gridlines and styles.  I can then use this table
with the GridLines option.  My solution so far is to plot the data
using ListPlot and extract the tick mark positions using the
AbsoluteOptions command.  I handle multiple lists by merely joining the
lists together for the ListPlot.

One problem I've noticed with this technique is that it fails when the
lists have different dimension (ie one list could be 2D, the other 1D).
I'm also slightly concerned that I might run into a case where the
tick marks automatically generated by ListPlot and those generated by
MultipleListPlot may not be the same.  So far it seems to be working as
intended, but my code does seem somewhat heavy-handed.

Any suggestions would be very much appreciated.  Thanks!

MyListPlot[f___List, opts___?OptionQ] :=
Module[{ticks, yticks, xticks, grid, i},
ticks = Ticks /. AbsoluteOptions[
ListPlot[Join[f], DisplayFunction ->
Identity, PlotRange -> {All, All}]];
yticks = ticks;
xticks = ticks;

grid = {
Table[
If[xticks[i, 2] =!= "",
{xticks[i, 1], {GreyLevel[0.], Thickness[0.002]}},
{xticks[i, 1], {Dashing[{0.005, 0.005}],
Thickness[0.001]}}],
{i, Length[xticks]}]
,
Table[
If[yticks[i, 2] =!= "",
{yticks[i, 1], {GreyLevel[0.], Thickness[0.002]}},
{yticks[i, 1], {Dashing[{0.005, 0.005}],
Thickness[0.001]}}],
{i, Length[yticks]}]};

MultipleListPlot[f, GridLines -> grid, opts];]

```

• Prev by Date: Re: Getting crude approximation to a function
• Next by Date: Re: Getting crude approximation to a function
• Previous by thread: Re: LegendreP in Mathematica 5.2 --system dump error
• Next by thread: Re: Gridlines in MultipleListPlot