2

This what I have:

x = df2['bulk_TPM']
y = df2['scRNA_TPM']
plt.scatter(x,y,cmap ='summer',
        edgecolor='black',linewidth=1, alpha = 0.75)
plt.xscale('log')
plt.yscale('log')
plt.title('bulk vs scRNA log10 TPM')
plt.xlabel('bulk_TPM')
plt.ylabel('scRNA_TPM')

I attempted changing the scale by doing this:

plt.xscale('log').xlim(0,10**5) 

and same method for y-axis but get weird scale size.

I would like both x and y axis to have same 0-10^5, how can I resolve thisenter image description here

Caroline
  • 119
  • 8

1 Answers1

1

The documentation describes this solution which I expect to work in your case.

import matplotlib.pyplot as plt
import numpy as np

# Plot circle of radius 3.

an = np.linspace(0, 2 * np.pi, 100)
fig, axs = plt.subplots(2, 2)

axs[0, 0].plot(3 * np.cos(an), 3 * np.sin(an))
axs[0, 0].set_title('not equal, looks like ellipse', fontsize=10)

axs[0, 1].plot(3 * np.cos(an), 3 * np.sin(an))
axs[0, 1].axis('equal')
axs[0, 1].set_title('equal, looks like circle', fontsize=10)

axs[1, 0].plot(3 * np.cos(an), 3 * np.sin(an))
axs[1, 0].axis('equal')
axs[1, 0].set(xlim=(-3, 3), ylim=(-3, 3))
axs[1, 0].set_title('still a circle, even after changing limits', fontsize=10)

axs[1, 1].plot(3 * np.cos(an), 3 * np.sin(an))
axs[1, 1].set_aspect('equal', 'box')
axs[1, 1].set_title('still a circle, auto-adjusted data limits', fontsize=10)

fig.tight_layout()

plt.show()

enter image description here

René
  • 4,594
  • 5
  • 23
  • 52