# Can't get custom x-axis grid lines for a LogLinearPlot

Needs["ErrorBarPlots"]

Needs["ErrorBarLogPlots"]

errorplot1 =
ErrorListLogLinearPlot[{{{100.15, -5.3},
ErrorBar[0.4]}, {{150.05, -3.0}, ErrorBar[0.4]}, {{200.32, -2.2},
ErrorBar[0.4]}, {{250.15, -1.7},
ErrorBar[0.4]}, {{300.18, -1.3}, ErrorBar[0.4]}}];

LogLinearPlot[
20*Log10[2*Pi*10000*107*10^(-9)*
x/Sqrt[1 + (2*Pi*x*10000*107*10^(-9))^2]], {x, 80, 350}];

Show[%, errorplot1, AxesStyle -> {Opacity[0], AbsoluteThickness[3]},
Frame -> True,
GridLines -> {{100, 150, 200, 250, 300,
350}, {-6, -5, -4, -3, -2, -1}}, GridLinesStyle -> LightGray]


I plotted some measurement data and the theoretical curve of a function. Now I tried making a grid but I can only see the grid of the y-axis. I tried removing the AxesStyle (since I made the x-axis invisible) but that didn't work... Here's what it currently looks like:

## 2 Answers

Your x-axis values are on a log scale, so you need to use Log values for the gridlines.

Show[%, errorplot1, AxesStyle -> {Opacity[0], AbsoluteThickness[3]},
Frame -> True,
GridLines -> {Log@{100, 150, 200, 250, 300,
350}, {-6, -5, -4, -3, -2, -1}}, GridLinesStyle -> LightGray]


Edit This is if you want to add the gridlines afterwards when combining things with Show. But as OP points out here, you can give the gridline command to the log plot and it will make the conversion automatically.

• Thanks a lot, I didn't know that and this was really helpful! – Keno Goertz Feb 5 '16 at 9:23

I solved it by adding the grid lines to the theoretical function. Still curious why it didn't work the way I did it in my question though.

Edit: Here's my code that solved it.

Needs["ErrorBarPlots"]

Needs["ErrorBarLogPlots"]

errorplot1 =
ErrorListLogLinearPlot[{{{100.15, -5.3},
ErrorBar[0.4]}, {{150.05, -3.0}, ErrorBar[0.4]}, {{200.32, -2.2},
ErrorBar[0.4]}, {{250.15, -1.7},
ErrorBar[0.4]}, {{300.18, -1.3}, ErrorBar[0.4]}}];

LogLinearPlot[
20*Log10[2*Pi*10000*107*10^(-9)*
x/Sqrt[1 + (2*Pi*x*10000*107*10^(-9))^2]], {x, 80, 350},
GridLines -> {{100, {150, Orange}, 200, 250, 300,
350}, {-6, -5, -4, {-3, Orange}, -2, -1}}];

Show[%, errorplot1, AxesStyle -> {Opacity[0], AbsoluteThickness[3]},
Frame -> True]