-
Notifications
You must be signed in to change notification settings - Fork 10
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
Polygonal 2D poloidal plots #280
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #280 +/- ##
==========================================
- Coverage 68.94% 67.71% -1.24%
==========================================
Files 15 15
Lines 3214 3277 +63
Branches 792 808 +16
==========================================
+ Hits 2216 2219 +3
- Misses 734 793 +59
- Partials 264 265 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Also modified plotter to accept style kwargs
Hello @mikekryjak! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-05-28 15:22:58 UTC |
- This becomes a "foolproof" colorbar that won't mess up the aspect ratio of the figure.
This is ready for review & merge |
…into polygon-plots
- Now handles cases when there is no variable name, e.g. when you plot a derived variable like ds["Ne"] * ds["Te"]
xBOUT's default pcolormesh() method creates plotting artifacts around the X-point due to having to plot the grid on a per-region basis and not having corner information.
This new method uses a different approach, and is more like what UEDGE, SOLEDGE2D and SOLPS users do. Using coordinates of cell centres and cell corners, a Matplotlib Polygon is created for each cell independently and put into a PatchCollection . With each cell being independently plotted, there are no issues arising from the poloidal ordering of the cells or from the X-point.
The polygon plotting routine was adapted from this PR which was itself based on a UEDGE routine. The cell corners were obtained using this Hypnotoad PR. It adds a new plot method accessed by
da.bout.polygon()
which creates fast, pretty 2D plots without visual artefacts around the X-point.geometry.py
plot2d_polygon
inplotfuncs.py
Decided to not integrate it with
plot2d_wrapper
aspolygon
doesn't plot on a region basis and does not wrap Xarray plot routines.There is an additional improvement where I fixed the colorbar to be always exactly the height of the plot using a hack from https://joseph-long.com/writing/colorbars/.
I also changed the default style - I disabled the targets and limiter hatching and made the separatrix a continuous thin white line. I personally think this is a cleaner look, but I understand this is personal preference. If anyone has strong feelings about this I'm happy to make the previous look the default.
Example output:
