Average direction for each grid cell

See the flow between grid cells.

import traja

df = traja.generate(seed=0)

Average Flow (3D)

Flow can be plotted by specifying the kind parameter of traja.plotting.plot_flow() or by calling the respective functions.

import traja

traja.plotting.plot_surface(df, bins=32)
plot average direction
<Axes3DSubplot:xlabel='m', ylabel='m'>

Quiver

Quiver plot Additional arguments can be specified as a dictionary to quiverplot_kws.

traja.plotting.plot_quiver(df, bins=32)
plot average direction
<AxesSubplot:xlabel='m', ylabel='m'>

Contour

Parameters filled and quiver are both enabled by default and can be disabled. Additional arguments can be specified as a dictionary to contourplot_kws.

traja.plotting.plot_contour(df, filled=False, quiver=False, bins=32)
plot average direction
<AxesSubplot:xlabel='m', ylabel='m'>

Contour (Filled)

traja.plotting.plot_contour(df, bins=32, contourfplot_kws={"cmap": "coolwarm"})
plot average direction
<AxesSubplot:xlabel='m', ylabel='m'>

Stream

‘cmap’ can be specified, eg, ‘coolwarm’, ‘viridis’, etc. Additional arguments can be specified as a dictionary to ‘streamplot_kws’.

traja.plotting.plot_stream(df, cmap="jet", bins=32)
plot average direction
<AxesSubplot:xlabel='m', ylabel='m'>

Polar bar

traja.plotting.polar_bar(df)
plot average direction
/home/docs/checkouts/readthedocs.org/user_builds/traja/envs/latest/lib/python3.7/site-packages/pandas/core/indexing.py:1681: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self.obj[key] = empty_value
/home/docs/checkouts/readthedocs.org/user_builds/traja/envs/latest/lib/python3.7/site-packages/pandas/core/indexing.py:1773: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self._setitem_single_column(ilocs[0], value, pi)
/home/docs/checkouts/readthedocs.org/user_builds/traja/checkouts/latest/traja/plotting.py:1201: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  trj["turn_angle"] = feature_series
/home/docs/checkouts/readthedocs.org/user_builds/traja/checkouts/latest/traja/frame.py:162: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self[name] = value
/home/docs/checkouts/readthedocs.org/user_builds/traja/checkouts/latest/traja/plotting.py:1164: UserWarning: FixedFormatter should only be used together with FixedLocator
  ax.set_xticklabels(["0", "45", "90", "135", "180", "-135", "-90", "-45"])

<PolarAxesSubplot:>

Polar bar (histogram)

traja.plotting.polar_bar(df, overlap=False)
plot average direction
/home/docs/checkouts/readthedocs.org/user_builds/traja/envs/latest/lib/python3.7/site-packages/pandas/core/indexing.py:1681: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self.obj[key] = empty_value
/home/docs/checkouts/readthedocs.org/user_builds/traja/envs/latest/lib/python3.7/site-packages/pandas/core/indexing.py:1773: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self._setitem_single_column(ilocs[0], value, pi)
/home/docs/checkouts/readthedocs.org/user_builds/traja/checkouts/latest/traja/plotting.py:1201: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  trj["turn_angle"] = feature_series
/home/docs/checkouts/readthedocs.org/user_builds/traja/checkouts/latest/traja/frame.py:162: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self[name] = value
/home/docs/checkouts/readthedocs.org/user_builds/traja/checkouts/latest/traja/plotting.py:1164: UserWarning: FixedFormatter should only be used together with FixedLocator
  ax.set_xticklabels(["0", "45", "90", "135", "180", "-135", "-90", "-45"])

<PolarAxesSubplot:>

Total running time of the script: ( 0 minutes 13.829 seconds)

Gallery generated by Sphinx-Gallery