How to place frame ticks outside of the frame?

Hi,

I am currently altering the outlook of histograms so they are easier to read for my dissertation I would really appreciate if anyone can help me on this.
Say I am plotting a set of data fitted with a normal distribution curve (see algorithm below). By default, the ticks are place inside the frame, is there a way to flip the ticks outside of the frame instead?

data = RandomVariate[NormalDistribution[5, 10], 10^4];
hist = Histogram[data, Automatic, "ProbabilityDensity"]

m1 = Mean[data];
sd1 = StandardDeviation[data];
normdist =
Plot[PDF[NormalDistribution[m1, sd1], k], {k, -40, 40},
  PlotStyle -> Thick, AxesLabel -> {x}]

Show[Histogram[data, {2}, "ProbabilityDensity"], normdist,
Frame -> True, FrameLabel -> {"x", "y"}]

The 3rd element of a tick specification is the pair {plen, mlen}, where plen is the length in the positive direction (i.e., inside for frame ticks), and mlen is the length in the negative direction (i.e., outside for frame ticks). So, create one’s own ticks and use FrameTicks:

xticks = Table[{i, If[Mod[i, 20] == 0, i, ""], {0, 0.01}}, {i, -40, 40, 5}]

Show[Histogram[data, {2}, "ProbabilityDensity"], normdist, Frame -> True,  FrameLabel -> {"x", "y"},  FrameTicks -> {xticks, Automatic, Automatic, Automatic}]

Lengths of major and minor ticks can be set this way also.

Better tick support is needed so that licks on different scales (e.g., log, inverse, etc.) can be easily created by the user. An option to a function that creates the ticks could easily specify whether they were in the inside or outside of the frame.
Bob

I also had a question and decided to research previous questions to see if my problem had been encountered by someone else. The question by Wai was the closest to mine but not quite the same. I am able to display a plot but would like to simply frame it. I use:

ListLinePlot[coords[[n]], ImageSize -> {128, 128}, 
 Frame -> True, Axes -> False, Ticks -> False, AspectRatio -> 1, 
 PlotMarkers -> {{\[FilledCircle], 2}} ]

And I get a frame with ticks and numbers on both the X and Y axes, I would like to know if it is possible to have a simple Frame with no ticks and no axis. Essentially, I just want a Black Frame around my line plot.

For controlling ticks on a frame you should not use the option Ticks but FrameTicks, in your case:

FrameTicks -> None

Hi Henrick,

One way

coords = RandomReal[10, {10, 2}];

ListLinePlot[coords,
  ImageSize -> {128, 128},
  Frame -> False,
  Axes -> False,
  AspectRatio -> 1,
  PlotMarkers -> {{\[FilledCircle], 2}}] // Framed

Check the docs for Framed.

Thank you Rohit and Henrik,
Rohit’s solution does pretty much what I want. When I use Henrik’s solution I get no Frame.
This works:

ListLinePlot[shortCoordinates[[n]], ImageSize -> {128, 128}, 
  Frame -> False, Axes -> False, AspectRatio -> 1, 
  PlotMarkers -> {{\[FilledCircle], 2}} ] // Framed, 

All did was add the // Framed recommended by Rohit and it worked perfectly.

If I use Henrik’s suggestion as in:

ListLinePlot[shortCoordinates[[n]], ImageSize -> {128, 128}, 
 FrameTicks -> None, Axes -> False, AspectRatio -> 1, 
 PlotMarkers -> {{\[FilledCircle], 2}} ] ,

I get my graphs but with no frame.

Finally, if I use Henrik’s solution with the addition of // Framed I get what I want, which is my graphs with a simple black square surrounding them.

Thank you both.

Now, If only I could figure out what most of the graphs use the whole range of [Xmin, Xmax] along the X axis and [Ymin,Ymax} on the Y axis BUT a few graphs (about 4%) use the [Xmin,Xmax] range on the X axis, but only part of the [Ymin,Ymax} on the Y axis where there is space below Ymin and above Ymax on the Y axis. Any clue?

When I use Henrik’s solution I get no Frame.

How can you say that ?!? If you want to get a frame, how about setting Frame -> True ?!

ListLinePlot[RandomReal[{-1, 1}, 25], ImageSize -> {128, 128}, 
 Frame -> True, FrameTicks -> None,
 Axes -> False, AspectRatio -> 1, PlotMarkers -> {{\[FilledCircle], 2}}]