Comments (5)
Ah I missed what you said "ahead of MPL API". Now I got it how it works, thanks! @neutrinoceros
from yt.
I think what you described is an unfortunate but known limitation of yt's callback system: in general, using yt API to modify a plot has, by design, no immediate effect, and most computations and IO operations are delayed until the figure is rendered (in a REPL, or when render
or save
are called). This system helps a lot with performance, however it works by redrawing the entire figure each time a render is needed, which means that any modification done directly with MPL (bypassing yt) will be erased on the next render.
I never could find a nice way to better support this usage, but if we could better integrate with MPL API, it'd make part of yt's completely redundant and lead to great simplifications.
from yt.
hi @xshaokun , thanks for noticing !
I think what's happening is that the image (and most of the plot) is lazy-generated at some point ™️ between calls to MPL API and .save()
, which invalidates everything done by the script.
It's trivially fixed by forcing rendering at a controlled point ahead of MPL API calls with slc.render()
, though I wonder why this wasn't necessary when this example was written.
from yt.
Thank @neutrinoceros for your reply!
It's trivially fixed by forcing rendering at a controlled point ahead of MPL API calls with
slc.render()
, though I wonder why this wasn't necessary when this example was written.
It can produce an expected output in docs. However, if some plot window methods are called, it will break again. For example, methods like slc.set_origin("lower-center-window")
or slc.annotate_timestamp()
will make slc.save()
and fig.savefig("sloshing.png")
giving different results. Output from the former only applied the modifications by plot_window methods, while output from the latter only applied the modifications by matplotlib engine, even if slc.render()
is used (actually it will overwrite the modifications from matplotlib engine).
It seems like I was modifying different objects with different approaches. Does it make sense?
from yt.
I'm okay with the current design as soon as I know what's happening inside the box. I have to dive into the source code to figure out that render
will erase old axes, which should be told explicitly in docs so that users can use MPL API properly. Many thanks for your help!
from yt.
Related Issues (20)
- bug/not implemented problem: annotate_contour does not work with GIZMO MFM output HOT 1
- Volume Rendering Multiple Fields with MPI HOT 1
- [4.3.1] Test failure on i386 in test_grid_arrays_view HOT 1
- BUG: some RAMSES fields return different values depending on order of operations HOT 5
- Question/Bug: matplotlib Qt backend specification HOT 4
- ENH: Only open auxilliary files for Tipsy as needed
- unexpected output when using ParticlePhasePlot HOT 2
- OSX wheels aren't compiled with OpenMP support HOT 5
- BUG: ResourceWarnings for unclosed files in boxlib frontend HOT 2
- BUG: convert_to_cartesian from _sanitize_center fails for Geographic geometry when bbox is subset of globe
- BLD: non-isolated builds are broken
- TST: Upcoming dependency test failures HOT 1
- How to change the particle size in function "ParticlePhasePlot" HOT 2
- BUG: Multiple fields break sanitization HOT 2
- BUG: segault on manylinux2014 image HOT 5
- Deprecation warning in GDF (and maybe more?) HOT 3
- Try to project gas particles (SPH) to a mesh with octree structure HOT 2
- ImportError when compiling with gcc 14.1.1 and conda HOT 5
- DOC: docs builds are failing HOT 7
- Incorrect parameter sanitation to np.logspace HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yt.