commaticks#

commaticks(ax=None, axis='y', precision=2, cursor_precision=0)[source]#

Use commas in formatting the y axis of a figure (e.g., 34,000 instead of 34000).

To use something other than a comma, set the default separator via e.g. sc.options(sep='.').

Parameters:
  • ax (any) – axes to modify; if None, use current; else can be a single axes object, a figure, or a list of axes

  • axis (str/list) – which axis to change (default ‘y’; can accept a list)

  • precision (int) – shift how many decimal places to show for small numbers (+ve = more, -ve = fewer)

  • cursor_precision (int) – ditto, for cursor

Example:

data = pl.rand(10)*1e4
pl.plot(data)
sc.commaticks()

See http://stackoverflow.com/questions/25973581/how-to-format-axis-number-format-to-thousands-with-a-comma-in-matplotlib

New in version 1.3.0: ability to use non-comma thousands separator
New in version 1.3.1: added “precision” argument
New in version 2.0.0: ability to set x and y axes simultaneously