I have a set of linear data and I need to plot it in python. Because there is so much data I need to plot it on a logarithmic scale but when I do using matplotlib.pyplot.xscale('log') and the same for yscale I get a curved graph not a straight line which I should get.
I'm not exactly sure what else to try other than xscale and yscale.
import matplotlib.pyplot as mpl
import sys
import numpy as np
time, rate = [], []
x = sys.argv[1]
for line in open(x, 'r'):
column = [float(s) for s in line.split()]
time.append(column[0])
rate.append(column[1])
mpl.xscale('log')
mpl.yscale('log')
mpl.plot(time, rate)
mpl.show()
The expected result should be a linear decreasing graph on a logarithmic scale. Is there a way to have a logarithmic scale on a graph without changing the values to logarithmic? Or is that what mpl.yscale('log') does?