I produced data for a curve, stored in a list. Then I took 1000 random samples out of that data. The y-axis shows my data and the x-axis I the formula output. Up till here everything is fine. The problem starts when I want to plot my data onto an existing image.
As you can see, my x-axis and y-axis are log scale and lower than 1. I have looked for answers and found that I could use FuncFormatter. However, it doesn't work for me, as I need to plot my data with log-scale. When I use simply plt.xscale('log')
the figure looks like this:
Output figure with log-scale
Output figure without log-scale
import matplotlib.pyplot as plt
import numpy as np
#Producing some data and put them in a list named listGercek
xekseni2 = []
data = random.sample(listGercek, 1000)
for teta in data:
olasılık = listGercek.index(teta)/100000
xekseni2.append(olasılık)
im = plt.imread('figure.png')
xmin, xmax, ymin, ymax = (0.001, 1, 0.01, 1)
aspect = im.shape[0] / im.shape[1] * (xmax-xmin)/(ymax-ymin)
plt.imshow(im, zorder=0, extent=[1e-3, 1e0, 1e-2, 1e0], aspect=aspect)
plt.yscale('log')
plt.xscale('log')
plt.xlabel('P')
plt.ylabel(r'$\tau_{c}^{*}$')
plt.plot(xekseni2, data, "ro", marker="o", markersize=1, label="Present Work")
plt.axis([xmin, xmax, ymin, ymax])
plt.legend()
plt.show()
Some data points as asked:
y:0.09141346037829952, 0.06969760102294438, 0.0473781028644485, 0.059295628198887916, 0.0571418702849134, 0.04050307759274645, 0.08088991113201109, 0.03746878506083184, 0.13583224333004337, 0.03269066677698429, 0.06918929672995293, 0.06040315211901601, 0.05772815718352134, 0.07361582566248871, 0.06212973486945907, 0.03283216378016191, 0.14407484921136313, 0.02266323793619761, 0.04439409523587426, 0.055067724315696655,
x:0.81136, 0.67958, 0.43465, 0.58106, 0.55695, 0.33327, 0.75665, 0.2849, 0.93146, 0.20716, 0.6752, 0.59276, 0.56391, 0.70997, 0.6097, 0.20941, 0.94315, 0.06609, 0.39222, 0.53361,