MathGroup Archive 2009

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

Search the Archive

Re: Inconsistency in ListPlot vs. other plotting functions (solution)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102707] Re: [mg102690] Inconsistency in ListPlot vs. other plotting functions (solution)
  • From: "David Park" <djmpark at comcast.net>
  • Date: Thu, 20 Aug 2009 04:56:02 -0400 (EDT)
  • References: <49194.1250681333475.JavaMail.root@n11>

This is another case where the regular Mathematica graphics paradigm, based
on somewhat adaptable set-piece plots, can get you all tangled up. I have no
idea why ListPlot does not display the Tooltips. It appears that it
generates them and then throws them away when rendering the overall plot. It
does work if you Map the Tooltips onto the individual points. Perhaps it is
a bug that WRI will fix.

It is much easier to draw directly what you want and specify the directives
you need for each portion of the graphic. So with Presentations:

Needs["Presentations`Master`"]

Draw2D[
 {AbsolutePointSize[4],
  ListDraw[Tooltip[Range[4], "Data1"]],
  Dashed, Red,
  ListDraw[Tooltip[Range[4]/2, "Data2"], Joined -> True]},
 AspectRatio -> .6,
 Axes -> True]

The tooltips are there, on both the points and the line. For the log plots:

logticks = 
  CustomTicks[Log, {-1, 2, {1, 1.5, 2, 3, 5} // N, {4, 6, 7, 8, 9}}];
Draw2D[
 {Thick,
  ListLogDraw[Tooltip[Range[4], "Data1"], Joined -> True],
  Thin, Dashed, Red,
  ListLogDraw[Tooltip[Range[4]/2, "Data2"], Joined -> True]},
 AspectRatio -> .6,
 PlotRangePadding -> Scaled[.05],
 Frame -> True,
 FrameTicks -> {{logticks, logticks // NoTickLabels}, {Automatic, 
    Automatic}}]


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: dr DanW [mailto:dmaxwarren at gmail.com] 

I have been trying to write a fully functional legend function for the
Plot family of functions.  I have been baffled by some inconsistencies
between the behavior of ListPlot and the other plotting functions,
about which I have posted previously on this forum.  To wit:

ListLogPlot[ Tooltip [ Range[4], "Data" ] ] ]

works as expected, but

ListPlot[ Tooltip [ Range[4], "Data" ] ] ]

looses the tooltip.  Also,

ListLogPlot[ { Range[4], Range[4]/2 } , Joined->True, PlotStyle->
{Thick, Dashed} ]

gives you a solid thick line and a thin dashed line, whereas

ListPlot[ { Range[4], Range[4]/2 } , Joined->True, PlotStyle->{Thick,
Dashed} ]

gives you a solid thick line and a thick dashed line.

These inconsistencies have challenged my faith in Mathematica.
However, through much experimentation I have discovered that
ListLinePlot is a rewritten version of ListPlot (similar to
ListLogPlot being a rewritten version of LogListPlot.)  As far as I
can tell, ListLinePlot has behavior that is consistent with the other
plotting functions.  The only nagging difference is that, by default,
Joined->True, but we know how to deal with that.  I suspect that
ListPlot should have been put on a deprecated function list but was
not.

So, my suggestion is to get into the habit of using ListLinePlot
instead of ListPlot.

Daniel





  • Prev by Date: Re: Slide Show Environment creates discordant font sizes
  • Next by Date: A Question about Combinatorica
  • Previous by thread: Re: Re: Inconsistency in ListPlot vs. other plotting
  • Next by thread: Incongruence? hmm...