I am trying to plot a scatter plot with a logarithmic y-axis (Like this but with the y-axis being logarithmic). I am able to get the plot to work properly before I change the y tick values, but as soon as I change the values to the ones I desire the plot ends up with the wrong scale. I am displaying the plot on a GUI made using tkinter. What am I missing? Any help would be greatly appreciated.
The code I am using:
x=np.array (x_values)
y= np.array (y_values)
fig = Figure(figsize=(6,6))
a = fig.add_subplot(111)
a.scatter(x,y,color='red')
a.set_title ("Estimation Grid", fontsize=16)
a.set_ylabel("Y", fontsize=14)
a.set_xlabel("X", fontsize=14)
a.set_yscale("log")
#a.set_yticks([100, 50, 10, 1.5, 1, 0.5, 0.1, 0.01, 0])
a.set_yticks([0, 0.01, 0.1, 0.5, 1, 1.5, 10, 50, 100])
a.get_yaxis().set_major_formatter(matplotlib.ticker.LogFormatter())
a.grid()
The values used for this plot are:
x_values =[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]
y_values = [99.99, 75, 60, 50, 45, 40, 35, 30]
Questions I've looked at: Overlapping axis tick labels in logarithmic plots set ticks with logarithmic scale