pynbody.plot.sph.velocity_image

Contents

pynbody.plot.sph.velocity_image#

pynbody.plot.sph.velocity_image(sim, qty='rho', vector_qty='vel', width='10 kpc', mode='quiver', vector_color='black', vector_edgecolor='black', vector_resolution=40, vector_scale=None, key=True, key_x=0.5, key_y=0.88, key_color='k', key_edge_color='k', key_bg_color='w', key_length='100 km s**-1', stream_density=1.0, stream_linewidth=1.0, weight=None, restrict_depth=False, **kwargs)[source]#

Make an SPH image of the given simulation with velocity vectors overlaid on top.

Any keyword argument that can be passed to image() can also be passed to this function. See that function for a full list of options.

Parameters:
  • sim (pynbody.snapshot.simsnap.SimSnap) – The simulation snapshot to plot. The image is generated in the plane z=0, or projected along the z axis.

  • qty (str | pynbody.array.SimArray) – The name of the array to interpolate. Default is ‘rho’, which gives a density image. Alternatively, an array can be passed in.

  • vector_qty (str) – The name of the array to use for the vectors. Default is ‘vel’.

  • width (str or float, optional) – The overall width and height of the plot. If a float, it is assumed to be in units of sim[‘pos’]. It can also be passed in as a string indicating the units, e.g. ‘10 kpc’. (Default is ‘10 kpc’)

  • mode (str, optional) – The type of plot to make. Options are ‘quiver’ or ‘stream’. (Default is ‘quiver’)

  • vector_color (str, optional) – The color of the velocity vectors. (Default is ‘black’)

  • vector_edgecolor (str, optional) – The color for the edges of the velocity vectors. (Default is ‘black’)

  • vector_resolution (int, optional) – The number of velocity vectors to generate in each dimension. (Default is 40)

  • vector_scale (str or float, optional) – The length of a vector that would result in a displayed length of the figure width/height. This can be provided as a unit string or a float, in which case it is interpreted as having the same units as the vector array being plotted. Default is None, in which case the vectors are scaled by matplotlib’s quiver function. This option is only used in ‘quiver’ mode.

  • key (bool, optional) – Whether or not to inset a key showing the scale of the vectors. Only used if in ‘quiver’ mode. (Default is True)

  • key_x (float, optional) – The x position of the key in ‘quiver’ mode, if key is True. (Default is 0.5)

  • key_y (float, optional) – The y position of the key in ‘quiver’ mode, if key is True. (Default is 0.88)

  • key_color (str, optional) – The color of the key arrow/text in ‘quiver’ mode, if key is True. (Default is ‘white’)

  • key_edge_color (str, optional) – The color of the border around the key in ‘quiver’ mode, if key is True. (Default is ‘black’)

  • key_bg_color (str, optional) – The color of the background of the key in ‘quiver’ mode, if key is True. (Default is ‘white’)

  • key_length (str, optional) – The velocity to use for the key in ‘quiver’ mode, if key is True. (Default is ‘100 km s**-1’)

  • stream_density (float, optional) – The density of stream lines in ‘stream’ mode. (Default is 1.0)

  • stream_linewidth (float, optional) – The width of stream lines in ‘stream’ mode. (Default is 1.0)

  • **kwargs – Any additional keyword arguments to pass to image().