When making a plot, sometimes I would like to alter the ticks and labeling of the ticks, in particular when doing a LogPlot
or LogLogPlot
.
Here an Example:
ticks = Automatic;
LogPlot[2/(3 Exp[3 x/2]), {x, 0, 40}, AxesOrigin -> {0, 1}, Ticks -> ticks]
There are a number of things I would like to change here.
(1) The x-Axis is now on top of the plot, so it would make more sense, and in many situation look better, to have the ticks below the axis, and the labeling {10,20,30,40}
above. How can I do that?
(2) On the logarythmic y-Axis, I would like the main ticks to go in steps of 10^-3
, rather than 10^-5
. So from top to bottom I would like the labels to be {1,10^-3,10^-6,10^-9}
, and between I would like to have small ticks without a label in steps of 10
.
Now for two I actually know a way to do it, namely brute force specify the ticks manually like this:
ticks = {Automatic,
{
{10^-27, , {.008, 0}},
{10^-26, , {.003, 0}}, {10^-25, , {.003, 0}},
{10^-24, "10^-24", {.008, 0}},
{10^-23, , {.003, 0}}, {10^-22, , {.003, 0}},
{10^-21, , {.008, 0}},
{10^-20, , {.003, 0}}, {10^-19, , {.003, 0}},
{10^-18, "10^-18", {.008, 0}},
{10^-17, , {.003, 0}}, {10^-16, , {.003, 0}},
{10^-15, , {.008, 0}},
{10^-14, , {.003, 0}}, {10^-13, , {.003, 0}},
{10^-12, "10^-12", {.008, 0}},
{10^-11, , {.003, 0}}, {10^-10, , {.003, 0}},
{10^-9, , {.008, 0}},
{10^-8, , {.003, 0}}, {10^-7, , {.003, 0}},
{10^-6,"10^-6", {.008, 0}},
{10^-5, , {.003, 0}}, {10^-4, , {.003, 0}},
{10^-3, , {.008, 0}},
{10^-2, , {.003, 0}}, {10^-1, , {.003, 0}},
{1, 1, {.008, 0}
}
};
However this is extremely cumbersome, and I am wondering if there isn't an easier way to do it. Is there not a simple command that lets me specify the major ticks in steps of A, and the minor ticks in steps of B?
(3) Suppose I was satisfied with the default ticks that Mathematica makes for my plot. Then is there a way to manually add a tick and label at a special value, or I then have to manually specify all the ticks?
In the above example, for instance, could I add a single tick at x = 10.2
, and specify a length of the tickmark, and position of its label? I know I could possibly do this by manually drawing a Graphics[Line[…]]
, however it would be a fiddling around to make it look good, adjusting the grayscale and thickness of the line. In the case of logarithmic plots, adjusting the position could also be cumbersome.
CustomTicks
package (scidraw.nd.edu/levelscheme/CustomTicksGuide.pdf) $\endgroup$