Repository navigation
Fix source plotting scale bug - #4189
Merged
paulromano merged 1 commit intoOct 13, 2026
Merged
Conversation
Member
Author
|
I have also been testing locally with this script import matplotlib.pyplot as plt
import openmc
sphere = openmc.Sphere(r=10.0, boundary_type="vacuum")
model = openmc.Model(geometry=openmc.Geometry([
openmc.Cell(region=-sphere)
]))
model.settings.source = openmc.IndependentSource(
space=openmc.stats.Point((8.0, 0.0, 0.0))
)
fig, axes = plt.subplots(1, 2, figsize=(10, 4))
for ax, n_samples, title in zip(
axes, [None, 1], ["Without source overlay", "With source overlay"]
):
model.plot(
origin=(0, 0, 0), width=(4, 4), pixels=(100, 100),
n_samples=n_samples, axes=ax,
source_kwargs={"color": "red", "s": 100},
)
ax.set_title(title)
ax.set_xlabel("x [cm]")
ax.set_ylabel("y [cm]")
print(title, "x limits:", ax.get_xlim(), "y limits:", ax.get_ylim())
fig.tight_layout()
plt.show() |
|
Autofix could not be updated. Open Coding to check access and billing. |
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The source points can outside the requested plot width and currently expand the axis limits.
Fixing this by setting the limits after drawing the scatter
AI Assistance
Code changes done by a human but I got GPT-6.1 Sol to review it.
Checklist
Summary by CodeRabbit