MCPcopy Create free account
hub / github.com/COLA-Laboratory/TransOPT / plot_all_2d

Function plot_all_2d

demo/comparison/analysis_plot.py:377–404  ·  view source on GitHub ↗
(workload, algorithm="")

Source from the content-addressed store, hash-verified

375
376# 2D plot all
377def plot_all_2d(workload, algorithm=""):
378 # df = load_and_prepare_data(llvm_samples_path / f"LLVM_{workload}.json")
379 # df = load_and_prepare_data(gcc_samples_path / f"GCC_{workload}.json")
380 # df = load_data(workload, algorithm, 65535)
381 df = load_and_prepare_data(dbms_samples_path / f"DBMS_{workload}.json")
382 df_normalized = (df - df.min()) / (df.max() - df.min())
383 df_normalized = df
384
385 # Create a 2D scatter plot
386 fig = plt.figure()
387 ax = fig.add_subplot(111)
388 ax.set_title(f"All samples for {workload}")
389 ax.set_xlabel(objectives[0])
390 ax.set_ylabel(objectives[1])
391
392 # Scatter plot for Pareto front
393 points = df_normalized[objectives]
394
395 # Convert Series to NumPy array before plotting
396 x_values = points[objectives[0]].values
397 y_values = points[objectives[1]].values
398
399 ax.scatter(x_values, y_values, c='b', marker='o')
400
401 # Save the plot as a file
402 file_path = package_path / "demo" / "comparison" / "pngs" / f"{target}_{workload}.png"
403 plt.savefig(file_path)
404 plt.close(fig) # Close the plot to free memory
405
406if __name__ == "__main__":
407 # workloads = load_workloads()

Callers 1

analysis_plot.pyFile · 0.85

Calls 2

closeMethod · 0.80
load_and_prepare_dataFunction · 0.70

Tested by

no test coverage detected