yt.visualization.plot_modifications.LinePlotCallback — The yt Project 3.2-dev documentation

# yt.visualization.plot_modifications.LinePlotCallback

class `yt.visualization.plot_modifications.` `LinePlotCallback`(p1, p2, data_coords=False, coord_system='data', plot_args=None)

  annotate_line(p1, p2, coord_system=”data”, plot_args=None):

  Overplot a line with endpoints at p1 and p2. p1 and p2 should be 2D or 3D coordinates consistent with the coordinate system denoted in the “coord_system” keyword.

  Parameters: | p1, p2 : 2- or 3-element tuples, lists, or arrays These are the coordinates of the endpoints of the line. coord_system : string, optional This string defines the coordinate system of the coordinates p1 and p2. Valid coordinates are: “data” – the 3D dataset coordinates “plot” – the 2D coordinates defined by the actual plot limits “axis” – the MPL axis coordinates: (0,0) is lower left; (1,1) is upper right “figure” – the MPL figure coordinates: (0,0) is lower left, (1,1) is upper right plot_args : dictionary, optional This dictionary is passed to the MPL plot function for generating the line. By default, it is: {‘color’:’white’, ‘linewidth’:2}

  Examples

      >>> # Overplot a diagonal white line from the lower left corner to upper
      >>> # right corner
      >>> import yt
      >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
      >>> s = yt.SlicePlot(ds, 'z', 'density')
      >>> s.annotate_line([0,0], [1,1], coord_system='axis')
      >>> s.save()

      >>> # Overplot a red dashed line from data coordinate (0.1, 0.2, 0.3) to
      >>> # (0.5, 0.6, 0.7)
      >>> import yt
      >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
      >>> s = yt.SlicePlot(ds, 'z', 'density')
      >>> s.annotate_line([0.1, 0.2, 0.3], [0.5, 0.6, 0.7], coord_system='data',
                          plot_args={'color':'red', 'lineStyles':'--'})
      >>> s.save()

  Methods