The Cookbook¶
yt provides a great deal of functionality to the user, but sometimes it can be a bit complex. This section of the documentation lays out examples recipes for how to do a variety of tasks. Most of the early, simple code demonstrations are small scripts which you can easily copy and paste into your own code; however, as we move to more complex tasks, the recipes move to iPython notebooks to display intermediate steps. All of these recipes are available for download in a link next to the recipe.
Getting the Sample Data¶
All of the data used in the cookbook is freely available here, where you will find links to download individual datasets.
Note
To contribute your own recipes, please follow the instructions on how to contribute documentation code: How to Write Documentation.
Example Scripts¶
- Making Simple Plots
- Simple Slices
- Simple Projections (Non-Weighted)
- Simple Projections (Weighted)
- Simple Projections (Methods)
- Simple Projections (Weighted Standard Deviation)
- Simple Phase Plots
- Simple 1D Line Plotting
- Simple Probability Distribution Functions
- Simple 1D Histograms (Profiles)
- Simple Radial Profiles
- 1D Profiles Over Time
- Profiles with Standard Deviation
- Making Plots of Multiple Fields Simultaneously
- Off-Axis Slicing
- Off-Axis Projection
- Simple Particle Plot
- Non-spatial Particle Plots
- Single-color Particle Plots
- Simple Volume Rendering
- Showing and Hiding Axis Labels and Colorbars
- Setting Field Label Formats
- Calculating Dataset Information
- Average Field Value
- Mass Enclosed in a Sphere
- Global Phase Plot
- Radial Velocity Profile
- Simulation Analysis
- Time Series Analysis
- Simple Derived Fields
- Complicated Derived Fields
- Using Particle Filters to Calculate Star Formation Rates
- Making a Turbulent Kinetic Energy Power Spectrum
- Downsampling an AMR Dataset
- A Few Complex Plots
- Multi-Width Image
- Varying the resolution of an image
- Multipanel with Axes Labels
- Multipanel with PhasePlot
- Time Series Multipanel
- Multiple Slice Multipanel
- Multi-Plot Slice and Projections
- Advanced Multi-Plot Multi-Panel
- Time Series Movie
- Off-Axis Projection (an alternate method)
- Off-Axis Projection with a Colorbar (an alternate method)
- Thin-Slice Projections
- Plotting Particles Over Fluids
- Plotting Grid Edges Over Fluids
- Overplotting Velocity Vectors
- Overplotting Contours
- Simple Contours in a Slice
- Styling Radial Profile Plots
- Customized Profile Plot
- Customized Phase Plot
- Moving a Volume Rendering Camera
- Volume Rendering with Custom Camera
- Volume Rendering with a Custom Transfer Function
- Volume Rendering with Sigma Clipping
- Zooming into an Image
- Various Lens Types for Volume Rendering
- Opaque Volume Rendering
- Volume Rendering Multiple Fields
- Downsampling Data for Volume Rendering
- Volume Rendering with Bounding Box and Overlaid Grids
- Volume Rendering with Annotation
- Volume Rendering Multiple Fields And Annotation
- Volume Rendering with Points
- Volume Rendering with Lines
- Plotting Streamlines
- Plotting Isocontours
- Plotting Isocontours and Streamlines
- Constructing Data Objects