| 201 | |
| 202 | |
| 203 | def test_shared_axis_quantity(quantity_converter): |
| 204 | munits.registry[Quantity] = quantity_converter |
| 205 | x = Quantity(np.linspace(0, 1, 10), "hours") |
| 206 | y1 = Quantity(np.linspace(1, 2, 10), "feet") |
| 207 | y2 = Quantity(np.linspace(3, 4, 10), "feet") |
| 208 | fig, (ax1, ax2) = plt.subplots(2, 1, sharex='all', sharey='all') |
| 209 | ax1.plot(x, y1) |
| 210 | ax2.plot(x, y2) |
| 211 | assert ax1.xaxis.get_units() == ax2.xaxis.get_units() == "hours" |
| 212 | assert ax2.yaxis.get_units() == ax2.yaxis.get_units() == "feet" |
| 213 | ax1.xaxis.set_units("seconds") |
| 214 | ax2.yaxis.set_units("inches") |
| 215 | assert ax1.xaxis.get_units() == ax2.xaxis.get_units() == "seconds" |
| 216 | assert ax1.yaxis.get_units() == ax2.yaxis.get_units() == "inches" |
| 217 | |
| 218 | |
| 219 | def test_shared_axis_datetime(): |