def HexBin(ages, weights, bins=None):
    """Make a hexbin plot and save it.

    ages: sequence of float
    weights: sequence of float
    bins: 'log' or None for linear
    """
    thinkplot.HexBin(ages, weights, bins=bins)
    thinkplot.Config(xlabel='age (years)', ylabel='weight (lbs)', legend=False)
Beispiel #2
0
def HexBin(heights, weights, bins=None):
    """Make a hexbin plot and save it.

    heights: sequence of float
    weights: sequence of float
    bins: 'log' or None for linear
    """
    thinkplot.HexBin(heights, weights, bins=bins)
    thinkplot.Config(xlabel='height (cm)',
                     ylabel='weight (kg)',
                     axis=[140, 210, 20, 200],
                     legend=False)
Beispiel #3
0
def HexBin(root, heights, weights, bins=None):
    """Make a hexbin plot and save it.

    root: string filename root
    heights: sequence of float
    weights: sequence of float
    bins: 'log' or None for linear
    """
    thinkplot.HexBin(heights, weights, bins=bins)
    thinkplot.Save(root=root,
                   xlabel='Height (cm)',
                   ylabel='Weight (kg)',
                   axis=[140, 210, 20, 200],
                   legend=False)
Beispiel #4
0
    sample = SampleRows(df, 5000)
    heights, weights = sample.htm3, sample.wtkg2

    ## Jitter data
    heights = Jitter(heights, 1.4)
    weights = Jitter(weights, 0.5)

    ## make scatter plot
    thinkplot.Scatter(heights, weights, alpha=0.1, s=10)
    thinkplot.Show(xlabel='Height (cm)',
                   ylabel='Weight (kg)',
                   axis=[140, 210, 20, 200],
                   legend=False)

    ## make HexBin plot
    thinkplot.HexBin(heights, weights)
    thinkplot.Show(xlabel='Height (cm)',
                   ylabel='Weight (kg)',
                   axis=[140, 210, 20, 200],
                   legend=False)

    ## now use entire dataset
    heights_all, weights_all = sample.htm3, sample.wtkg2
    heights_all = Jitter(heights, 1.4)
    weights_all = Jitter(weights, 0.5)

    ## make scatter plot
    thinkplot.PrePlot(num=2, cols=2)
    thinkplot.SubPlot(1)
    thinkplot.Scatter(heights_all, weights_all, alpha=0.1, s=10)
    thinkplot.Show(xlabel='Height (cm)',
def HexBin(ages, weights, bins=None):
    thinkplot.HexBin(ages, weights, bins=bins)
    thinkplot.Config(xlabel='age (years)', ylabel='weight (lbs)', legend=False)