0
$\begingroup$

Usually on a plot the vertical scale is on the left, and the horizontal scale is on the bottom. How to make the vertical scale appear on both left and right, and similarly the horizontal scale on both top and bottom? This just makes my life easier when after exporting the file I can still see the scale even if I zoom-in the right or top region of the plot.

$\endgroup$
7
  • $\begingroup$ You mean FrameTicks? $\endgroup$
    – Kuba
    Sep 13, 2016 at 13:32
  • $\begingroup$ Try with Frame -> True $\endgroup$ Sep 13, 2016 at 13:35
  • 2
    $\begingroup$ @MichaelE2 I have yet to vote to close, but allow me to disagree. Just above the options table in the Details section of both Plot and ListPlot is the statement "... has the same options as Graphics, with the following additions and changes". $\endgroup$
    – rcollyer
    Sep 13, 2016 at 14:38
  • 1
    $\begingroup$ @rcollyer You're free to disagree. :) In my mind, it is a borderline case, and our comments mean that people will at least think about it before deciding. $\endgroup$
    – Michael E2
    Sep 13, 2016 at 14:56
  • 2
    $\begingroup$ @rcollyer You remind me of a time in 1993 when I told myself to remember that lesson about looking at both Plot and Graphics. I can fix the date because I remember the house we lived in. I wish the close reason read "can be found in the documentation (and easily understood)". Sometimes I vote that way. You may convince me yet in the present case. $\endgroup$
    – Michael E2
    Sep 13, 2016 at 15:14

1 Answer 1

2
$\begingroup$
Plot[Sin[x], {x, -Pi, Pi}, Frame -> True, 
 FrameTicks -> {{All, All}, {All, All}}, ImagePadding -> All]

enter image description here

$\endgroup$
2
  • $\begingroup$ It works for Plot, but I find that if I use ListPlot, even if I include the FrameTicks -> {{All, All}, {All, All}} it is not showing the right and upper frame. why is that? $\endgroup$
    – Physicist
    Sep 20, 2016 at 23:21
  • $\begingroup$ It works; e.g. ListPlot[Table[Sin[x], {x, -Pi, Pi, 0.01}], Frame -> True, FrameTicks -> {{All, All}, {All, All}}, ImagePadding -> All]. $\endgroup$
    – corey979
    Sep 21, 2016 at 6:37

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