Input

Make scaterplot.

param x:

1D Coordinates x-axis.

type x:

numpy array

param y:

1D Coordinates y-axis.

type y:

numpy array

param z:

1D Coordinates z-axis.

type z:

numpy array

param s:

Size of the samples.

type s:

Int or list/array of sizes with same size as X

param c:

Color of samples in RGB colors.

type c:

list/array of RGB colors with same size as X

param labels:

labels of the samples.

type labels:

list of labels with same size as X

param marker:
Marker for the samples.
  • ‘x’ : All data points get this marker

  • (‘.’, ‘o’, ‘v’, ‘^’, ‘<’, ‘>’, ‘8’, ‘s’, ‘p’, ‘*’, ‘h’, ‘H’, ‘D’, ‘d’, ‘P’, ‘X’) : Specify per sample the marker type.

  • [0,3,0,1,2,1,..] : It is also possible to provide a list of labels. The markers will be assigned accordingly.

type marker:

list/array of strings (default: ‘o’).

param alpha:

The alpha blending value, between 0 (transparent) and 1 (opaque).

type alpha:

float, default: 0.8

param edgecolors:
The edge color of the marker. Possible values:
  • ‘face’: The edge color will always be the same as the face color.

  • ‘none’: No patch boundary will be drawn.

  • ‘#FFFFFF’ : A color or sequence of colors.

type edgecolors:

(default: ‘face’)

param gradient:

Hex color to make a lineair gradient for the scatterplot. ‘#FFFFFF’

type gradient:

String, (default: None)

param density:

Include the kernel density in the scatter plot.

type density:

Bool (default: False)

param density_on_top:

True : The density is the highest layer. False : The density is the lowest layer.

type density_on_top:

bool, (default: False)

param xlabel:

Xlabel. The default is None.

type xlabel:

String, optional

param ylabel:

Ylabel. The default is None.

type ylabel:

String, optional

param title:

Title of the figure. The default is None.

type title:

String, optional

param fontsize:

The fontsize of the y labels that are plotted in the graph. The default is 16.

type fontsize:

String, optional

param fontcolor:

None : Use same colorscheme as for c ‘#000000’ : If the input is a single color, all fonts will get this color.

type fontcolor:

list/array of RGB colors with same size as X (default : None)

param grid:

False or None : Do not plot grid True : Set axis color to: ‘#dddddd’ ‘#dddddd’ : Specify color with hex

type grid:

str or bool (default: False)

param norm:

Normalize datapoints. The default is False.

type norm:

Bool, optional

param legend:

None: Set automatically based number of labels. False : Disable. True : Best position. 1 : ‘upper right’ 2 : ‘upper left’ 3 : ‘lower left’ 4 : ‘lower right’

type legend:

int, default: 0

param jitter:
Add jitter to data points as random normal data. Values of 0.01 is usually good for one-hot data seperation.
  • None or False: Do not add jitter

  • True : adds 0.01

  • 0.05 : Specify the amount jitter to add.

type jitter:

float, default: None

param cmap:

‘Set1’ (default) ‘Set2’ ‘rainbow’ ‘bwr’ Blue-white-red ‘binary’ or ‘binary_r’ ‘seismic’ Blue-white-red ‘Blues’ white-to-blue ‘Reds’ white-to-red ‘Pastel1’ Discrete colors ‘Paired’ Discrete colors ‘Set1’ Discrete colors

type cmap:

String, optional

param figsize:

Figure size. The default is (15,10).

type figsize:

tuple, optional

param visible:

Visible status of the Figure. When False, figure is created on the background.

type visible:

Bool, default: True

param args_density:

Dictionary containing arguments for kernel density plotting.

type args_density:

dict()

rtype:

Fig, ax

Examples

>>> # Import library
>>> from scatterd import scatterd, import_example
>>>
>>> # Import example
>>> df = import_example()
>>>
>>> # Simple scatter
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], edgecolor='#FFFFFF')
>>>
>>> # Scatter with labels
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'])
>>>
>>> # Scatter with labels
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'])
>>>
>>> # Scatter with gradient
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], z=df['tsneY'], labels=df['labx'], gradient='#FFFFFF')
>>>
>>> # Change cmap
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], gradient='#FFFFFF', cmap='Set2')
>>>
>>> # Scatter with density
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], density=True)
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], density=False, gradient='#FFFFFF', edgecolor='#FFFFFF')
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], density=True, gradient='#FFFFFF', edgecolor='#FFFFFF')
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], density=True, gradient='#FFFFFF', c=None)
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], density=True, density_on_top=True, args_density={'alpha': 0.3}, gradient='#FFFFFF', edgecolor='#FFFFFF', grid=True, fontweight='normal', fontsize=26, legend=2)
>>>
>>> # Scatter with density and gradient
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], density=True, gradient='#FFFFFF')
>>>

References