7
$\begingroup$

There is a bug in ListStepPlot, which I reported to Wolfram and they are working on a fix. Until then, I wrote a simple workaround and thought I might share this with people, in case you encounter the same problem.

The bug appears when ListStepPlot is used with both PlotMarkers and ScalingFunctions set to non-default values. For example

ListStepPlot[Table[p Range[6], {p, {3, 7, 11, 13}}], "Center", 
  PlotMarkers -> Automatic, 
  ScalingFunctions -> "Log"
]

gives

a plot with bad markers

I provide a simple temporary bug-fix in my answer.

$\endgroup$

1 Answer 1

8
$\begingroup$

A workaround is to apply the rule

BUGFIXRULEListStepPlotLog =
 GeometricTransformation[Inset[Style[m__], {0., 0.}], tr_] :>
  GeometricTransformation[Inset[Style[m], {0., 0.}], 
   If[#[[1, 2]] == 0, Nothing, {{#[[1, 1]], Log[#[[1, 2]]]}}] & /@ tr]

to the created figure. For example

ListStepPlot[Table[p {1, 2, 3, 0, 4, 5, 6}, {p, {3, 7, 11, 13}}], 
  "Center", PlotMarkers -> Automatic, 
  ScalingFunctions -> "Log"] /. BUGFIXRULEListStepPlotLog

gives

enter image description here

When other scaling functions are used, the bug-fix needs to be adjusted (replace Log by whatever is needed), but the general procedure should work in any case.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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