Skip to content

Put plotting tools in visualization, rather than examples #2

@joseortiz3

Description

@joseortiz3

Hi there, your package works well in Python 3.7.1 on Windows.

For plotting, instead of giving examples in the documentation page, perhaps put plotting tools inside the visualization module / library.

For instance,

def plot_copula_3d(copula,plot_type='pdf',subplot=None):
    """Plots a pycopula copula object's pdf or cdf.

        Usage: 
            plt.figure()
            plot_copula_3d(copula,'pdf')
            plt.figure()
            plt.subplot(2,1,1)
            plot_copula_3d(copula, 'pdf', (2,1,1))
            plt.subplot(2,1,2)
            plot_copula_3d(copula, 'cdf', (2,1,2))
            plt.show()
    """
    if subplot is None: ax = plt.gca(projection='3d')
    else: # Overwrites the entire figure with single plot
        fig = plt.gcf()
        ax = fig.add_subplot(*subplot,projection='3d')
    if plot_type=='pdf':
        u,v,C = pycopula.visualization.pdf_2d(copula)
    elif plot_type=='cdf':
        u,v,C = pycopula.visualization.cdf_2d(copula)
    X, Y = np.meshgrid(u,v)
    ax.plot_surface(X,Y,C)
    ax.plot_wireframe(X,Y,C,color='black',alpha=0.3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions