2
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:

enter image description here

corey979
  • 23,947
  • 7
  • 58
  • 101
  • Probably a duplicate of http://mathematica.stackexchange.com/q/4066/9490 , but the answers there are much more complicated than what is needed here. – Jason B. Feb 05 '16 at 09:09

2 Answers2

6

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]

enter image description here

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.

Jason B.
  • 68,381
  • 3
  • 139
  • 286
3

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]