I've tried to simplify this down, and I have found that simply plotting 30 data points causes the same problem. For this data (tuples of (x,y)):
[(0.0, 4.424511280376464e-05), (5.859375, 2.409510125289671e-05), (11.71875, 1.2739132216665894e-05), (17.578125, 1.2313
864317547996e-05), (23.4375, 7.784949048073031e-06), (29.296875, 5.878156116523314e-06), (35.15625, 6.562402631971054e-0
6), (41.015625, 3.419693939576973e-06), (46.875, 5.722461992263561e-06), (52.734375, 1.1855792763526551e-05), (58.59375,
1.2042775779264048e-05), (64.453125, 6.911080618010601e-06), (70.3125, 8.628138857602607e-06), (76.171875, 1.1969464139
838237e-05), (82.03125, 5.889412022952456e-06), (87.890625, 2.6964873995893868e-06), (93.75, 5.772120857727714e-06), (99
.609375, 6.0245174609008245e-06), (105.46875, 5.021342076361179e-06), (111.328125, 5.184605470276438e-06), (117.1875, 4.
545432602753863e-06), (123.046875, 5.096236236568075e-06), (128.90625, 5.161716217116918e-06), (134.765625, 3.1326860607
80543e-06), (140.625, 4.866687049798202e-06), (146.484375, 7.188179097283864e-06), (152.34375, 4.7222083594533615e-06),
(158.203125, 3.7413619793369435e-06), (164.0625, 7.523839485656936e-06), (169.921875, 7.544745585619239e-06)]
If I plot it in linear scale it looks fine, but if I try to manually or programmatically transform the x axis to log mode, the axis range blows up to be from 1 to 1e+160. So it looks like the axis is trying to scale its range to 10**(maximum of the actual data values), rather than log10 of the data values.
I have read elsewhere on this list that you need to set the range on the axis programmatically from 0 to log10(max_val), which I have tried doing, but it does not seem to change the behavior at all. I can do this manually in the GUI using the menus, and indeed my scale changes properly and the data looks good. But how can I do this programmatically?
My code looks like this at the moment:
win = pg.GraphicsWindow(title="Frequency Response")
# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)
p1 = win.addPlot(title="Frequency Response")
p1.setLogMode(True, False)
x_axis = p1.getAxis("bottom")
x_axis.setRange(0, 5)
p1.plot(x_data, y_data)
Any help would be appreciated.
Thanks,
Mark.