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

Label diffraction spots in plot #172

Merged
merged 4 commits into from Sep 1, 2021
Merged

Label diffraction spots in plot #172

merged 4 commits into from Sep 1, 2021

Conversation

din14970
Copy link
Contributor

@din14970 din14970 commented Jul 6, 2021


name: Option to add labels in simulation diffraction spots

Release Notes

extra parameters in diffraction pattern's plot method for drawing miller index labels next to the diffraction spots

What does this PR do? Please describe and/or link to an open issue.
After discussion in #170 I thought I would open this small PR for adding the option to draw the miller indices of spot patterns. With this change it is now possible to do the following:

fig, ax = plt.subplots()
ax.set_aspect("equal")
ax.set_xlim(-2, 2)
ax.set_ylim(2, -2)
simtest.plot(show_labels=True, label_offset=(0, -0.2), 
             label_formatting={"fontsize": 8},
             size_factor=10, ax = ax)

afbeelding

Does this approach what you had in mind @CSSFrancis ?

Apparently there are also two small additions: the option to mirror pattern masks and the update to the stereo triangle for the hex system. It seems this was not merged before, see #168

Are there any known issues? Do you need help?
I would have liked to create a vectorized implementation but have no idea if this is possible with strings. Probably one could do some smart tricks with string formatting, but I couldn't figure out how to do that with the \bar{} on negative indices. If anyone has a better implementation idea feel free to modify.

Work in progress?
If you know there is more to do, make a checklist here:

  • Needs a test to be added for coverage

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    the unreleased section in CHANGELOG.md.

@hakonanes hakonanes added the enhancement New feature, request, or improvement label Jul 7, 2021
@hakonanes hakonanes added this to the v0.5.0 milestone Jul 7, 2021
@hakonanes
Copy link
Member

This looks like an important "pedagogical" feature!

I would have liked to create a vectorized implementation but have no idea if this is possible with strings. Probably one could do some smart tricks with string formatting

I don't think matplotlib.pyplot.text supports passing more than one set of position and text. Is that what you had in mind? If you find a way to do that, I would be interested, because we have labeling of zone axes in EBSD patterns in kikuchipy (user guide, API, and zone_axes_labels_as_markers() which calls get_text_list()).

@din14970
Copy link
Contributor Author

@pc494 @hakonanes I think with this minor edit it would be fine for review now

Copy link
Member

@pc494 pc494 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pc494 pc494 merged commit aedb7ee into pyxem:master Sep 1, 2021
pc494 added a commit that referenced this pull request Sep 1, 2021
@din14970 din14970 mentioned this pull request Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, request, or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants