0
$\begingroup$

FrameTicks are plotted all round the frame, but I only want them on the left and bottom.

ListLinePlot[Prime[Range[400]*800], 
  Frame -> True,
  FrameTicks -> 
    {{{49, 4}, {97, 8}, {145, 12}, {193, 16}, {241, 20}, 
      {289, 24}, {337, 28}, {385, 32}, {433, 36}, {481, 40}},
     {{-1000000, "-1m"}, {0, "0"}, {1000000, "1m"}, 
      {2000000, "2m"}, {3000000, "3m"}}}]

enter image description here

Adding None breaks the plot.

ListLinePlot[Prime[Range[400]*800], 
  Frame -> True,
  FrameTicks -> 
    {{{{49, 4}, {97, 8}, {145, 12}, {193, 16}, {241, 20}, 
      {289, 24}, {337, 28}, {385, 32}, {433, 36}, {481, 40}}, 
     None},
     {{{-1000000, "-1m"}, {0, "0"}, {1000000, "1m"},{2000000, "2m"}, {3000000, "3m"}}, 
     None}}]

enter image description here

However, the same syntax works in Plot.

Plot[Sin[x], {x, 0, 10}, 
  Frame -> True, 
  FrameTicks -> 
    {{{{-1, "-1y"}, {0, "0y"}, {1, "1y"}}, None},
     {{{0, 0 °}, {Pi, 180 °}, {2 Pi, 360 °}, {3 Pi, 540 °}}, None}}]

enter image description here

Is there a way to use None in ListPlot?

I am using V10.4.

$\endgroup$
3
  • 1
    $\begingroup$ The pattern is FrameTicks->{{left, right}, {bottom, top}}. Your example seems to be using FrameTicks->{xticks, yticks} which is fine but you can't then use the first form because Mathematica will then assume your xticks belong on the left-y axsis. $\endgroup$
    – Ymareth
    Jun 20, 2016 at 10:37
  • $\begingroup$ @Ymareth - Thanks, I was starting from the deprecated form, {bottom, left, top, right} and didn't notice the switch to {{left, right}, {bottom, top}}. $\endgroup$ Jun 20, 2016 at 11:09
  • $\begingroup$ Welcome, I got similarly burnt in the past :) $\endgroup$
    – Ymareth
    Jun 20, 2016 at 12:15

2 Answers 2

3
$\begingroup$

Try this form...

ListLinePlot[Prime[Range[400]*800], Frame -> True, 
 FrameTicks -> {{{{-1000000, "-1m"}, {0, "0"}, {1000000, 
      "1m"}, {2000000, "2m"}, {3000000, "3m"}}, 
    None}, {{{49, 4}, {97, 8}, {145, 12}, {193, 16}, {241, 20}, {289, 
      24}, {337, 28}, {385, 32}, {433, 36}, {481, 40}}, None}}]

Where I've swapped the order around and nested the two axis' ticks into lists with a None at the end.

$\endgroup$
2
$\begingroup$

Example

ListPlot[data, Frame -> True, FrameTicks -> {{True, False}, {True, False}}]

Note: data is some arbitrary data you want to plot

$\endgroup$

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