Python matplotlib.pyplot.box() Examples

The following are 5 code examples of matplotlib.pyplot.box(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib.pyplot , or try the search function .
Example #1
Source File: plot.py    From parfit with MIT License 6 votes vote down vote up
def plot1DGrid(scores, paramsToPlot, scoreLabel, vrange):
    """
    Makes a line plot of scores, over the parameter to plot
    :param scores: A list of scores, estimated using scoreModels
    :param paramsToPlot: The parameter to plot, chosen automatically by plotScores
    :param scoreLabel: The specified score label (dependent on scoring metric used)
    :param vrange: The yrange of the plot
    """
    key = list(paramsToPlot.keys())
    plt.figure(figsize=(int(round(len(paramsToPlot[key[0]]) / 1.33)), 6))
    plt.plot(np.linspace(0, len(paramsToPlot[key[0]]), len(scores)), scores, "-or")
    plt.xlabel(key[0])
    plt.xticks(np.linspace(0, len(paramsToPlot[key[0]]), len(scores)), paramsToPlot[key[0]])
    if scoreLabel is not None:
        plt.ylabel(scoreLabel)
    else:
        plt.ylabel("Score")
    if vrange is not None:
        plt.ylim(vrange[0], vrange[1])
    plt.box(on=False)
    plt.show() 
Example #2
Source File: test_pyplot.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_pyplot_box():
    fig, ax = plt.subplots()
    plt.box(False)
    assert not ax.get_frame_on()
    plt.box(True)
    assert ax.get_frame_on()
    plt.box()
    assert not ax.get_frame_on()
    plt.box()
    assert ax.get_frame_on() 
Example #3
Source File: plot.py    From parfit with MIT License 5 votes vote down vote up
def plot2DGrid(scores, paramsToPlot, keysToPlot, scoreLabel, greater_is_better, vrange, cmap):
    """
    Plots a heatmap of scores, over the paramsToPlot
    :param scores: A list of scores, estimated using parallelizeScore
    :param paramsToPlot: The parameters to plot, chosen automatically by plotScores
    :param scoreLabel: The specified score label (dependent on scoring metric used)
    :param greater_is_better: Choice between optimizing for greater scores or lesser scores
        Used to make better scores darker on colormap
        Default True means greater and False means lesser
    :param vrange: The visible range of the heatmap (range you wish the heatmap to be specified over)
    :param cmap: The chosen colormap for 2D and 3D plotting. Default is YlOrRd
    """
    scoreGrid = np.reshape(scores, (len(paramsToPlot[keysToPlot[0]]), len(paramsToPlot[keysToPlot[1]])))
    plt.figure(
        figsize=(
            int(round(len(paramsToPlot[keysToPlot[1]]) / 1.33)),
            int(round(len(paramsToPlot[keysToPlot[0]]) / 1.33)),
        )
    )
    if not greater_is_better:
        if cmap.endswith("_r"):
            cmap = cmap[:-2]
        else:
            cmap = cmap + "_r"
    if vrange is not None:
        plt.imshow(scoreGrid, cmap=cmap, vmin=vrange[0], vmax=vrange[1])
    else:
        plt.imshow(scoreGrid, cmap=cmap)
    plt.xlabel(keysToPlot[1])
    plt.xticks(np.arange(len(paramsToPlot[keysToPlot[1]])), paramsToPlot[keysToPlot[1]])
    plt.ylabel(keysToPlot[0])
    plt.yticks(np.arange(len(paramsToPlot[keysToPlot[0]])), paramsToPlot[keysToPlot[0]])
    if scoreLabel is not None:
        plt.title(scoreLabel)
    else:
        plt.title("Score")
    plt.colorbar()
    plt.box(on=False)
    plt.show() 
Example #4
Source File: test_pyplot.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_pyplot_box():
    fig, ax = plt.subplots()
    plt.box(False)
    assert not ax.get_frame_on()
    plt.box(True)
    assert ax.get_frame_on()
    plt.box()
    assert not ax.get_frame_on()
    plt.box()
    assert ax.get_frame_on() 
Example #5
Source File: test_pyplot.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_pyplot_box():
    fig, ax = plt.subplots()
    plt.box(False)
    assert not ax.get_frame_on()
    plt.box(True)
    assert ax.get_frame_on()
    plt.box()
    assert not ax.get_frame_on()
    plt.box()
    assert ax.get_frame_on()