code: def plot_error_curves_pyplot(
      log_files, names, filename=None, metric="top1_err"
  ):
      """Plot error curves using matplotlib.pyplot and save to file."""
      plot_data = prepare_plot_data(log_files, names, metric)
      colors = get_plot_colors(len(names))
      for ind, d in enumerate(plot_data):
          c, lbl = colors[ind], d["test_label"]
          plt.plot(d["x_train"], d["y_train"], "--", c=c, alpha=0.8)
          plt.plot(
              d["x_test"], d["y_test"], "-", c=c, alpha=0.8, label=lbl
          )
      plt.title(
          metric + " vs. epoch\n[dash=train, solid=test]", fontsize=14
      )
      plt.xlabel("epoch", fontsize=14)
      plt.ylabel(metric, fontsize=14)
      plt.grid(alpha=0.4)
      plt.legend()
      if filename:
          plt.savefig(filename)
          plt.clf()
      else:
          plt.show()
  
file_path: pycls/pycls/core/plotting.py
imports: import colorlover
  import matplotlib.pyplot
  import plotly.graph_objs
  import plotly.offline
  import pycls.core.logging
label_desc: Use image node_id 4 for calling a global function with example usage: plot_error_curves_pyplot(log_files, names, filename, metric) without return types