Home > Back-end >  How to add verticale scatter with specific values on basic plot?
How to add verticale scatter with specific values on basic plot?

Time:10-21

I'm trying to reproduce the following plot Plot

The plot show the mean accuracy across five runs and the vertical values shows the min and max accuracy.

How can I add those verticale scatter with specific values ?

My current code :

def plot_losses(losses: Dict[float, Dict[float, List[float]]]) -> None:
    """
    Plot the evolution of the loss regarding the sparsity level and iteration step

    Args:
        losses (Dict[float, Dict[float, List[float]]]): Dict containing the losses regarding the sparsity level and iteration step
    """

    plt.clf()

    plt.figure(figsize=(20, 10))
    plt.tight_layout()

    sparsity_levels = [round(sparsity_level, 2) for sparsity_level in losses.keys()]

    for sparsity_level, key in zip(sparsity_levels, losses.keys()):
        plt.plot(list(losses[key].keys()), list(losses[key].values()), ' --', label=f"{100 - sparsity_level:.2f}%")

    plt.show()

CodePudding user response:

Prefer enter image description here

  • Related