11
$\begingroup$

Bug introduced in 12.1 or earlier and fixed in 13.0.0


Consider the following plot (Mathematica 12.1):

ListLogPlot[Table[{x, x^-10}, {x, 1, 5}], GridLines -> Automatic, 
 Frame -> True]

There is a problem with ticks - the ticks on the left side do not coincide with the ticks on the right side of the plot: enter image description here

Could you please tell me how to fix them to be as on the left side?

$\endgroup$
9
  • $\begingroup$ Hmm. What version? On 11.2, this is not a problem. Could you try - Frame -> {Automatic, Automatic}? $\endgroup$ Jan 19 at 14:44
  • $\begingroup$ @e.doroskevic Thanks, I've updated the question (Mathematica 12.1). The proposed solution does not work. $\endgroup$ Jan 19 at 14:50
  • $\begingroup$ I upvote. Hopefully, somebody comes around to offer help. I am afraid, I cannot test a solution, given the difference in version. Perhaps, you could precompute ticks and impose them in Frame specification. The specification is {{left, right}, {bottom, top}} and you can use Automatic and All as valid input. $\endgroup$ Jan 19 at 14:58
  • $\begingroup$ Works in version 13.0 $\endgroup$ Jan 19 at 15:57
  • $\begingroup$ Works in version 12.0 (Win10-64) $\endgroup$
    – MarcoB
    Jan 19 at 16:17

1 Answer 1

9
$\begingroup$
$Version

(* "12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)" *)

Clear["Global`*"]

Version 12.1.1 also has mismatched FrameTicks on the left and right edges:

llp = ListLogPlot[
  Table[{x, x^-10}, {x, 1, 5}],
  GridLines -> Automatic,
  Frame -> True]

enter image description here

Looking at the FrameTicks option values:

Cases[llp, HoldPattern[FrameTicks -> ft_] :> ft, Infinity]

(* {{{Charting`ScaledTicks[{Log, Exp}], 
   Charting`ScaledFrameTicks[{Identity, Identity}]}, 
    {Automatic, Automatic}}} *)

Setting both left and right to Charting`ScaledTicks[{Log, Exp}] will put them in agreement; however, the tick labels also will show up on the right. Use ImagePadding to hide the labels on the right.

ListLogPlot[
 Table[{x, x^-10}, {x, 1, 5}],
 GridLines -> Automatic,
 Frame -> True,
 FrameTicks -> {{Charting`ScaledTicks[{Log, Exp}],
    Charting`ScaledTicks[{Log, Exp}]}, {Automatic, Automatic}},
 ImagePadding -> {{Automatic, Scaled[0.001]}, 
  {Automatic, Automatic}}]

enter image description here

EDIT: As recommended by Carl Woll, to avoid the need to change the ImagePadding use

Show[
 ListLogPlot[
  Table[{x, x^-10}, {x, 1, 5}],
  GridLines -> Automatic,
  Frame -> True], 
 FrameTicks -> {
  {Charting`ScaledTicks[{Log, Exp}], 
   Charting`ScaledFrameTicks[{Log, Exp}]}, 
  {Automatic, Automatic}}]

enter image description here

$\endgroup$
2
  • 3
    $\begingroup$ You can use Show[graphic, FrameTicks -> {{Charting`ScaledTicks[{Log, Exp}], Charting`ScaledFrameTicks[{Log, Exp}]}, {Automatic, Automatic}}] instead of hiding the labels with ImagePadding. $\endgroup$
    – Carl Woll
    Jan 19 at 22:35
  • 1
    $\begingroup$ @CarlWoll - Thanks, I incorporated your comment. $\endgroup$
    – Bob Hanlon
    Jan 19 at 22:56

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.