Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot phase does not use multiple ticker when unwrapping #542

Open
mberz opened this issue Feb 9, 2024 · 0 comments
Open

Plot phase does not use multiple ticker when unwrapping #542

mberz opened this issue Feb 9, 2024 · 0 comments
Labels
enhancement For suggesting enhancements of current functionality plot

Comments

@mberz
Copy link
Member

mberz commented Feb 9, 2024

General

  • pyfar version: all since addition of phase plot

Description

When plotting the unwrapped phase the MultipleFractionTicker and Formatters are not used.
I'd propose to change this and select appropriate multiples of $\pi$ also for unwrapped phase plots, as for example below.

What I Did

import pyfar as pf
import numpy as np
import matplotlib.pyplot as plt
from pyfar.plot.ticker import MultipleFractionLocator, MultipleFractionFormatter

fig, axs = plt.subplots(3, 1)
signal = pf.signals.impulse(1024, delay=4)
pf.plot.phase(signal, ax=axs[0])
pf.plot.phase(signal, ax=axs[1], unwrap=True)
pf.plot.phase(signal, ax=axs[2], unwrap=True)
axs[0].set_title('wrapped phase')
# ax[1].yaxis.set_minor_locator(MultipleFractionLocator(np.pi, 4))
axs[1].set_title('unrapped phase (default')
axs[2].yaxis.set_major_locator(MultipleFractionLocator(2, 1, np.pi))
axs[2].yaxis.set_major_formatter(MultipleFractionFormatter(2, 1, np.pi, r'\pi'))
axs[2].yaxis.set_minor_locator(MultipleFractionLocator(np.pi, 1))
axs[2].set_title('wrapped with ticks at multiples of $\pi$ (proposed)')
[ax.set_ylabel("") for ax in axs]

plt.tight_layout()

dedc962d-7a41-4d2a-801c-e87371637f35

@mberz mberz added enhancement For suggesting enhancements of current functionality plot labels Feb 9, 2024
@github-actions github-actions bot added this to To do in Code Backlog Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For suggesting enhancements of current functionality plot
Projects
Development

No branches or pull requests

1 participant