1

Anyone know how to impose a log scale on both the $x$ and $y$ axes after using ListStepPlot?

There's nothing special about the data set I've used, just a list of 15 ordered pairs that I need to display in a histogram-like manner in a log-log graph. Below is a picture of the graph that I've created, but I can't find any graphics options that will let me show this in a log-log scale.

enter image description here

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
user37840
  • 51
  • 2
  • ListLogLogPlot[{1, 2, 3, 4, 5}, Joined -> True, InterpolationOrder -> 0, Filling -> Axis] – BlacKow Mar 15 '16 at 21:06
  • 1
    Is it a separate question or related to this? – BlacKow Mar 15 '16 at 21:08
  • And regarding InterpolationOrder->0 find very useful discussion here – BlacKow Mar 15 '16 at 21:14
  • 1
    Have you tried ListStepPlot[yourdata, ScalingFunctions -> {"Log", "Log"}]? – MarcoB Mar 15 '16 at 21:24
  • 2
    @MarcoB that's new in v10.4. :) – rcollyer Mar 16 '16 at 02:33
  • @rcol, I believe, scaling functions work in earlier versions, just aren't documented and syntax highlighting sometimes makes them red. – LLlAMnYP Mar 16 '16 at 05:50
  • @LLlAMnYP not for ListStepPlot that was 10.4. – rcollyer Mar 16 '16 at 07:55
  • @rcollyer It is working for me right now in version 10.2 It gives an error message, but works as expected. – LLlAMnYP Mar 16 '16 at 10:58
  • @LLlAMnYP really? Well for some definition of works. Yes, you get logarithmic ticks, but other effects like the correct plot range and placement of the axes is not quite there prior to 10.4. – rcollyer Mar 16 '16 at 12:13
  • @rcollyer Indeed, you are forced to think in terms of the Log of the coordinates, where the axis is placed at {0,0}, which corresponds to what the ticks mark as {1,1}. This is the case for many LogPlot LogLinearPlot and related functions, that internally work with linear coordinates, especially obvious, when one starts to spelunk the ticks functions in the Charting` context. – LLlAMnYP Mar 16 '16 at 12:20

1 Answers1

5

In version 10.4 the use of ScalingFunctions has finally been documented with ListStepPlot (as mentioned by @rcollyer in comments). It seems to work fine to do what you want.

SeedRandom[20160315]

ListStepPlot[
  RandomReal[{0, 0.1}, 15], DataRange -> {0, 19},
  Filling -> Axis, Frame -> True,
  ScalingFunctions -> {"Log", "Log"},
  GridLines -> Automatic
]

Mathematica graphics

I noticed that you posted another similar question regarding the disappearance of ticks on the log vertical axis. Since ListStepPlot was introduced in 10.2, you must have either version 10.2 or 10.3, but possibly not 10.4. Perhaps you would be able to upgrade. In any case, it would be best if you shared the exact code that is giving your trouble.

MarcoB
  • 67,153
  • 18
  • 91
  • 189
  • The same code gives less than pretty, but quite equivalent output here on version 10.2. It's mainly troubled by the Filling option, but a setting of -10 puts it back to normal. – LLlAMnYP Mar 16 '16 at 11:02