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

FIX: Plot Axis Name Change #1087

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Conversation

zdomke
Copy link
Contributor

@zdomke zdomke commented Jun 26, 2024

This fixes a bug in the BasePlotAxisItem class where the name property will be set internally, but the axis' associated MultiAxisPlot will contain a dictionary with the wrong key-value pairing for the axis object.

AxisItem name bug example scenario:

  1. Create a BasePlotAxisItem with name "A"
    my_axis = BasePlotAxisItem(name="A")
  2. Change the name of the previous BasePlotAxisItem to "B"
    my_axis.name = "B"
  3. Create a BasePlotCurveItem and attach it to the BasePlotAxisItem using its new name
    my_curve = BasePlotCurveItem(yAxisName = "B")

This scenario produces a KeyError as the MultiAxisPlot.axes dictionary still uses "A" as the key to reference my_axis, but it should use "B".

Solution:
Include a method in MultiAxisPlot for changing the name/key of an axis. Then, update the MultiAxisPlot.axes key in the BasePlotAxisItem.name property setter.

Another small change made in this PR is to fix the BasePlotAxisItem.label setter. Now it will call self.setLabel(self._label) to update its label on any associated plots.

@zdomke zdomke marked this pull request as ready for review June 26, 2024 22:21
@nstelter-slac nstelter-slac merged commit c352bc0 into slaclab:master Jul 10, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants