1
$\begingroup$

I have a list of points, like:

{{0,2.17},{1,1.07},{2,0.53},{3,0.25},{4,0.11},{5,0.03},{6,0.002},{7,-0.015},{8,-0.0227},{9,-0.0250}, {10,-0.024675}, {part tends to zero}}

Ok, I would like to plot this data and, as it is easy to notice, without some manipulations with scale this picture will be not informative. I tried to combine ListLogPlot and take Abs from negative values of my data, but, unfortunately, the attempts failed. How can I do Log scale on the positive part of Y-axis and usual(without scale transformations) scale on the negative part of Y-axis?

Thanks in advance

$\endgroup$
  • $\begingroup$ What's wrong with {#[[1]], Sign@#[[2]] Abs@Log10@Abs@#[[2]]} & /@ data // ListPlot? You can do If[#[[2]] > 0, {#[[1]], Log10@#[[2]]}, #] & /@ data // ListPlot, but I like the first version more. $\endgroup$ – corey979 Apr 3 '18 at 9:56
  • $\begingroup$ Why not to change the origin to move your negative data to positive ones and cheat the marks by renaming the ticks? $\endgroup$ – José Antonio Díaz Navas Apr 3 '18 at 10:12
1
$\begingroup$

not exactly what you asked for , but one way to present such data is a log plot of absolute value, color coding the negatives..

data = Table[{i, Exp[RandomReal[{-5, 3}]] - 0.02}, {i, 30}];
ListLogPlot[If[#[[2]] <= 0, Style[# {1, -1}, Red], #] & /@ data, 
 PlotRange -> All]

enter image description here

another approach, make essentially two plots:

opts = Sequence[PlotRange -> {{0, 30}, Automatic}, 
   ImagePadding -> {{60, Automatic}, {Automatic, Automatic}}, 
   Frame -> True];
GraphicsColumn[{
  ListLogPlot[Select[data, #[[2]] > 0 &], opts],
  ListPlot[Select[data, Abs[#[[2]]] < .2 &], opts]}, Spacings -> -20]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.