예제 #1
0
    def to_pw(self, fields=None, center='c', width=None, axes_unit=None):
        r"""Create a :class:`~yt.visualization.plot_window.PWViewerMPL` from this
        object.

        This is a bare-bones mechanism of creating a plot window from this
        object, which can then be moved around, zoomed, and on and on.  All
        behavior of the plot window is relegated to that routine.
        """
        normal = self.normal
        center = self.center
        self.fields = ensure_list(fields) + [
            k for k in self.field_data.keys() if k not in self._key_fields
        ]
        from yt.visualization.plot_window import get_oblique_window_parameters, PWViewerMPL
        from yt.visualization.fixed_resolution import FixedResolutionBuffer
        (bounds,
         center_rot) = get_oblique_window_parameters(normal, center, width,
                                                     self.ds)
        pw = PWViewerMPL(self,
                         bounds,
                         fields=self.fields,
                         origin='center-window',
                         periodic=False,
                         oblique=True,
                         frb_generator=FixedResolutionBuffer,
                         plot_type='OffAxisSlice')
        if axes_unit is not None:
            pw.set_axes_unit(axes_unit)
        pw._setup_plots()
        return pw
    def to_pw(self, fields=None, center='c', width=None, axes_unit=None):
        r"""Create a :class:`~yt.visualization.plot_window.PWViewerMPL` from this
        object.

        This is a bare-bones mechanism of creating a plot window from this
        object, which can then be moved around, zoomed, and on and on.  All
        behavior of the plot window is relegated to that routine.
        """
        normal = self.normal
        center = self.center
        self.fields = ensure_list(fields) + [k for k in self.field_data.keys()
                                             if k not in self._key_fields]
        from yt.visualization.plot_window import get_oblique_window_parameters, PWViewerMPL
        from yt.visualization.fixed_resolution import ObliqueFixedResolutionBuffer
        (bounds, center_rot) = get_oblique_window_parameters(normal, center, width, self.ds)
        pw = PWViewerMPL(
            self, bounds, fields=self.fields, origin='center-window', 
            periodic=False, oblique=True,
            frb_generator=ObliqueFixedResolutionBuffer, 
            plot_type='OffAxisSlice')
        if axes_unit is not None:
            pw.set_axes_unit(axes_unit)
        pw._setup_plots()
        return pw