Re: LogLinearPlot strange "features"

*To*: mathgroup at smc.vnet.net*Subject*: [mg101398] Re: [mg101315] LogLinearPlot strange "features"*From*: "David Park" <djmpark at comcast.net>*Date*: Sun, 5 Jul 2009 04:46:32 -0400 (EDT)*References*: <16474964.1246447235743.JavaMail.root@n11>

You essentially found the answer. The separately plotted Points have to be converted to the underlying log plot coordinates. (And these are not the same as the labeled values.) "It'd be nice to have all the graphics primitives in the same coordinate, wouldn't it?" Yes. Here is one way to work from the same basic data, in fact the same basic plot primitives, for all four plot types. I'm using the Presentations package DrawingTransform to transform a set of pre-computed graphics primitives to the various log plot types. The one down side of this method is that we have to use CustomTicks and CustomGridLines to specify the proper ticks and grids. However, especially with the Grids, the Mathematica choice is quite poor anyway. Besides a poor choice of values, they make the Grid lines way too dark. Grid lines should be barely visible so they don't stomp all over the data. (The following plots don't generate any "out of domain" messages, but you could just use Quiet on your plots anyway. If Mathematica can normally ignore non-real plot points, why can't they also ignore points outside an InterpolatingFunction domain?) Needs["Presentations`Master`"] list = {{0.528, 3.3}, {0.75, 6}, {1.0607, 10}, {1.5, 15.3}, {2.121, 21.9}, {3, 29.1}, {4.243, 36.5}, {6.008, 44.1}}; f[x_] = Interpolation[list][x] Pre-compute the curve and points. basicgraphics = {Draw[f[x], {x, 0.53, 6}], AbsolutePointSize[4], Point[list]}; Regular Plot xgrids = CustomGridLines[Identity, {0, 6, 1}, {GrayLevel[.8]}]; ygrids = CustomGridLines[Identity, {0, 40, 10}, {GrayLevel[.8]}]; Draw2D[ {basicgraphics}, AspectRatio -> .5, Frame -> True, GridLines -> {xgrids, ygrids}, PlotLabel -> "Linear - Linear Plot", ImageSize -> 350] LogLinearPlot xgrids = CustomGridLines[ Log[10, #] &, {-1, 1, {1, 1.5, 2, 3, 4, 5, 7}}, {GrayLevel[.8]}]; ygrids = CustomGridLines[Identity, {0, 40, 10}, {GrayLevel[.8]}]; xticks = CustomTicks[ Log[10, #] &, {-1, 1, {1, 1.5, 2, 3, 4, 5, 7} // N, {}}]; yticks = Automatic; Draw2D[ {basicgraphics /. DrawingTransform[Log[10, #1] &, #2 &] }, AspectRatio -> .5, Frame -> True, FrameTicks -> {{yticks, yticks}, {xticks, xticks // NoTickLabels}}, GridLines -> {xgrids, ygrids}, PlotLabel -> "Log - Linear Plot", ImageSize -> 350] LogPlot xgrids = CustomGridLines[Identity, {0, 6, 1}, {GrayLevel[.8]}]; ygrids = CustomGridLines[ Log[10, #] &, {0, 2, Range[9]}, {GrayLevel[.8]}]; xticks = CustomTicks[Identity, {0, 6, 1, 5}]; yticks = CustomTicks[ Log[10, #] &, {0, 2, {1, 2, 3, 4, 5, 8}, {6, 7, 9}}]; Draw2D[ {basicgraphics /. DrawingTransform[#1 &, Log[10, #2] &] }, AspectRatio -> .5, Frame -> True, FrameTicks -> {{yticks, yticks // NoTickLabels}, {xticks, xticks // NoTickLabels}}, GridLines -> {xgrids, ygrids}, PlotLabel -> "Linear - Log Plot", ImageSize -> 350] LogLogPlot xgrids = CustomGridLines[ Log[10, #] &, {-1, 1, {1, 1.5, 2, 3, 4, 5, 7}}, {GrayLevel[.8]}]; ygrids = CustomGridLines[ Log[10, #] &, {0, 2, Range[9]}, {GrayLevel[.8]}]; xticks = CustomTicks[ Log[10, #] &, {-1, 1, {1, 1.5, 2, 3, 4, 5, 7} // N, {}}]; yticks = CustomTicks[ Log[10, #] &, {0, 2, {1, 2, 3, 4, 5, 8}, {6, 7, 9}}]; Draw2D[ {basicgraphics /. DrawingTransform[Log[10, #1] &, Log[10, #2] &] }, AspectRatio -> .5, Frame -> True, FrameTicks -> {{yticks, yticks // NoTickLabels}, {xticks, xticks // NoTickLabels}}, GridLines -> {xgrids, ygrids}, PlotLabel -> "Log - Log Plot", ImageSize -> 350] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ I spend a lot of time working on graphics questions, but I don't spend any time working on email addresses. From: Fred Bartoli [mailto:""@news.free.fr] Hi, Is it me or Epilog doesn't work as expect with Log plots: (*a list of points*) list = {{0.528, 3.3}, {0.75, 6}, {1.0607, 10}, {1.5, 15.3}, {2.121, 21.9}, {3, 29.1}, {4.243, 36.5}, {6.008, 44.1}}; (* This works OK but *) Plot[{Interpolation[list][x]}, {x, 0.53, 6}, GridLines -> Automatic, Epilog -> {PointSize[Medium], Point[list]}] (*Those don't *) LogLinearPlot[{Interpolation[list][x]}, {x, 0.53, 6}, GridLines -> Automatic, Epilog -> {PointSize[Medium], Point[list]}] LogPlot[{Interpolation[list][x]}, {x, 0.53, 6}, GridLines -> Automatic, Epilog -> {PointSize[Medium], Point[list]}] LogLogPlot[{Interpolation[list][x]}, {x, 0.53, 6}, GridLines -> Automatic, Epilog -> {PointSize[Medium], Point[list]}] (* This does the job *) LogLin = {Log[#[[1]]], #[[2]]} & LogLinearPlot[{Interpolation[list][x]}, {x, 0.53, 6}, GridLines -> Automatic, Epilog -> {PointSize[Medium], Point[LogLin/@list]}] It'd be nice to have all the graphics primitives in the same coordinate, wouldn't it? I also keep getting that message: InterpolatingFunction::dmval: Input value {-0.634829} lies outside the range of data in the interpolating function. Extrapolation will be used. which I guess is plain wrong since Exp[-0.6348286996935327`] = 0.5300262742047284` Mathematica 7.01 / XP 32b -- Thanks, Fred.

**Re: Re: Separating real part and imaginary part from**

**Re: Manipulate subtleties?**

**LogLinearPlot strange "features"**

**Re: LogLinearPlot strange "features"**