proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics
https://proplot.readthedocs.io
MIT License
1.12k stars 102 forks source link

Possible bug when sharing x axis in subplots. #467

Open reemagit opened 1 month ago

reemagit commented 1 month ago

Description

When I plot two subplots aligned as rows, the x is not really shared and there is a weird effect on the grid/xticks. Not sure if I'm doing something wrong, but it seems like a bug to me.

Steps to reproduce

fig,axs = pplt.subplots(nrows=2,ncols=1, sharex=True)
axs[0].scatter([0,10],[0,1])
axs[1].scatter([0,1],[0,1])

Expected behavior:

I would expect 2 plots, one on top of the other, with the x axis aligned so that I see 2 points on the very right on top, and two points on the very left in the bottom (see below for matplotlib output)

Actual behavior:

With proplot I get the following plot:

image

Equivalent steps in matplotlib

I can do something similar with matplotlib

fig = plt.figure()
ax1 = plt.subplot(211)
plt.scatter([0,10],[0,1])
plt.subplot(212, sharex = ax1)
plt.scatter([0,1],[0,1])

obtaining

image

Proplot version

matplotlib: 3.8.4 proplot: 0.9.91

reemagit commented 1 month ago

This is probably the same issue as https://github.com/proplot-dev/proplot/issues/465. Not sure if I should close it and post there?