4
$\begingroup$

Here is Mathematica line code where I am plotting a list log plot

ListLogPlot[{{10, 450}, {14, 460}, {17, 850}, {20, 1450}, {30, 1654}},
PlotRange -> Automatic, Joined -> True, PlotTheme -> "Classic", 
Frame -> True, ImageSize -> Large, BaseStyle -> Large]

enter image description here

I need the following modification.

X axis

I only need 10,20 and 30 as Major ticks of thickness 0.02, 15 and 25 are minor ticks of thickness 0.008. I also need to increase the length.

the solution is that one can either use this or the following

LinTicks[10,30,10,2,MajorTickLength -> 0.02, MinorTickLength -> 0.008]]

using the package here.

Now for Y axis, I need 500,1000,1500 as major ticks of thickness 0.03 and minor ticks of thickness 0.01. How do I perform these operations? I can use log ticks from the package, but that will only show us in some base unit, that is not what I want.

last but not the least

how do I increase the length of the overall ticks for linear x-axis and log y axis in this scenario

$\endgroup$

1 Answer 1

4
$\begingroup$

This is a general way of getting the kinds of ticks you probably want in your plot. You should be able to modify individual entries to get the lengths and thicknesses of major and minor ticks to be anything you want. The documentation for FrameTicks points to the documentation for Ticks where all of the details are given.

xBottomMajorTicks = Table[{x, x, {0.02, 0}, Thickness[0.002]}, {x, 10, 30, 10}];
xBottomMinorTicks = Table[{x, x, {0.01, 0}, Thickness[0.0008]}, {x, 15, 25, 10}];
xBottomTicks = Join[xBottomMajorTicks, xBottomMinorTicks];

xTopMajorTicks = Table[{x, "", {0.02, 0}, Thickness[0.002]}, {x, 10, 30, 10}];
xTopMinorTicks = Table[{x, "", {0.01, 0}, Thickness[0.0008]}, {x, 15, 25, 10}];
xTopTicks = Join[xTopMajorTicks, xTopMinorTicks];

yLeftMajorTicks = Table[{y, y, {0.02, 0}, Thickness[0.002]}, {y, 500, 1500, 500}];
yLeftMinorTicks = Table[{y, "", {0.01, 0}, Thickness[0.0008]}, {y, 400, 1700, 50}];
yLeftTicks = Join[yLeftMajorTicks, yLeftMinorTicks];

yRightMajorTicks = Table[{y, "", {0.02, 0}, Thickness[0.002]}, {y, 500, 1500, 500}];
yRightMinorTicks = Table[{y, "", {0.01, 0}, Thickness[0.0008]}, {y, 400, 1700, 50}];
yRightTicks = Join[yRightMajorTicks, yRightMinorTicks];

ListLogPlot[{{10, 450}, {14, 460}, {17, 850}, {20, 1450}, {30, 1654}},
 PlotRange -> Automatic,
 Joined -> True,
 Mesh -> All,
 PlotTheme -> "Classic",
 Frame -> True,
 FrameTicks -> {{yLeftTicks, yRightTicks}, {xBottomTicks, xTopTicks}},
 ImageSize -> Large, BaseStyle -> Large]

ListLogPlot custom ticks

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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