MathGroup Archive 2005

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

Search the Archive

Re: Gridlines in MultipleListPlot

  • To: mathgroup at
  • Subject: [mg58869] Re: [mg58848] Gridlines in MultipleListPlot
  • From: "David Park" <djmp at>
  • Date: Thu, 21 Jul 2005 15:46:01 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

I would like to suggest that you consider not doing that at all. The solid
black grid lines and the dashed black grids on the minor ticks will
completely dominate the graphic and hide or seriously distract from your
wonderful data. It is what Edward Tufte calls 'computer junk'. If you are
going to put on grid lines at all, put them only on the major ticks and make
them a very light gray - barely visible. On a graphic, ancillary information
should be put in with what Edward Tufte (again) calls 'the minimum effective

If it is important enough that the viewer should closely read off the values
of the data points, and that is the purpose of the grid lines, then you
could consider adding a table of the data values so the reader can obtain
the actual values without having to interpolate on a plot.

David Park
djmp at

From: ggroup at [mailto:ggroup at]
To: mathgroup at


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[2];
    xticks = ticks[1];

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

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

  • Prev by Date: Re: Symbolic Constrained Maximization
  • Next by Date: Re: How to suppress plot output ?
  • Previous by thread: Re: Gridlines in MultipleListPlot
  • Next by thread: Mathematica 5.2: The 64-bit and multicore release