Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • v0.1
2 results

gridcorner

  • Clone with SSH
  • Clone with HTTPS
  • Gregory Ashton's avatar
    Gregory Ashton authored
    README: fix setup.py call, add prefix alternative
    
    See merge request !1
    6bbfed98
    History

    Grid corner plot

    A corner plot for an array of dependent values

    Given an N-dimensional set of data (i.e. some function evaluated over a grid of coordinates), plot all possible 1D and 2D projections in the style of a "corner" plot.

    Installation

    Clone the repository and then

    $ python setup.py install

    or add a prefix to install in userspace, e.g.

    $ python setup.py install --prefix=~/.local/

    Example

    Generating some fake data and plotting:

    import numpy as np
    import gridcorner
    
    # Generate example data
    x = np.linspace(0, 1, 50)
    y = np.linspace(20, 30, 60)
    z = np.linspace(-2, -1, 70)
    x0, y0, z0 = 0.5, 22, -1.5
    X, Y, Z = np.meshgrid(x, y, z, indexing='ij')
    sigmax = 0.1
    sigmay = 1
    sigmaz = 0.2
    D = (np.exp(-(X-x0)**2/sigmax**2)
         + np.exp(-(Y-y0)**2/sigmay**2)
         + np.exp(-(Z-z0)**2/sigmaz**2))
    
    fig, axes = gridcorner.gridcorner(
        D, xyz=[x, y, z], labels=['x', 'y', 'z', 'D'], projection='log_mean')
    fig.savefig('example')

    Example plot

    Acknowledgements

    The code uses both the central idea and some specific code from corner.py