joint_density_scatter

Import in python using from mcutils.plot import joint_density_scatter

mcutils.plot.joint_density_scatter(x, y, data=None, max_dens_npoints=300, diagonal=False, xlim=None, ylim=None, hue=None, cmap='gist_heat', colors=None, **kwargs)[source]

Produces a scatter plot color-coded by density jointly with histograms

Parameters
  • x – (N, ) array or series with x-values (or string if data is not None)

  • y – (N, ) array or series with y-values (or string if data is not None)

  • data – pandas dataframe with the data

  • ylog – if True, makes the x-axis logarithmic

  • max_dens_npoints – maximum number of points to use in the density calculation. Computation time on my laptop is roughly (max_dens_points / 600) seconds.

  • diagonal – If True plots a diagonal straight line illustrating where both axes are equal

  • xlim – lower and upper bound in the x-direction

  • ylim – lower and upper bound in the y-direction

  • hue – (N, ) categorical array/series to set the color coding (or string if data is not None)

  • colors – seaborn color pallette or sequence of colors (default: matplotlib color cycle)

  • kwargs – keyword arguments passed on to plt.scatter. Particularly useful are adjusting the size (e.g. s=1) or the opacity (e.g. alpha=0.3).

Returns

seaborn JointGrid object with scatter plot and histograms