Get the width of the plot.
(ds, xlim=None, ylim=None, zlim=None)
| 158 | field = args.var |
| 159 | |
| 160 | def get_width(ds, xlim=None, ylim=None, zlim=None): |
| 161 | """ Get the width of the plot. """ |
| 162 | |
| 163 | if xlim is None: xlim = ds.domain_left_edge[0], ds.domain_right_edge[0] |
| 164 | else: xlim = xlim[0] * cm, xlim[1] * cm |
| 165 | |
| 166 | if ylim is None: ylim = ds.domain_left_edge[1], ds.domain_right_edge[1] |
| 167 | else: ylim = ylim[0] * cm, ylim[1] * cm |
| 168 | |
| 169 | xwidth = (xlim[1] - xlim[0]).in_cgs() |
| 170 | ywidth = (ylim[1] - ylim[0]).in_cgs() |
| 171 | |
| 172 | if ds.domain_dimensions[2] == 1: |
| 173 | zwidth = 0.0 |
| 174 | else: |
| 175 | if zlim is None: zlim = ds.domain_left_edge[2], ds.domain_right_edge[2] |
| 176 | else: zlim = zlim[0] * cm, zlim[1] * cm |
| 177 | |
| 178 | zwidth = (zlim[1] - zlim[0]).in_cgs() |
| 179 | |
| 180 | return xwidth, ywidth, zwidth |
| 181 | |
| 182 | def get_center(ds, xlim=None, ylim=None, zlim=None): |
| 183 | """ Get the coordinates of the center of the plot. """ |