Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #+NAME: R_plot
- #+BEGIN_SRC R :exports both :results output graphics :file r_comparison.png
- # graph in R
- library("ggplot2")
- performance <- read.csv("comparison.csv", header=FALSE)$V1
- df <- data.frame(resource = c("1node1core", "1node8core", "2node8core"), performance = performance)
- p <- ggplot(data = df, aes(x=resource, y=performance)) +
- geom_bar(stat="identity", fill="steelblue") +
- theme_minimal() +
- ggtitle("Computation time (min) vs. Resource (type)")
- p
- #+END_SRC
- #+NAME: python_plot
- #+BEGIN_SRC python :exports both :results output graphics :file py_comparison.png
- import matplotlib.pyplot as plt; plt.rcdefaults()
- import matplotlib.pyplot as plt
- import csv
- objects = ['1node1core', '1node8core', '2node8core']
- y_pos = list(range(0, len(objects)))
- performance = []
- with open('comparison.csv', newline='') as csvfile:
- reader = csv.reader(csvfile)
- for row in reader:
- f_row = float(row[0])
- performance.append(f_row)
- plt.bar(y_pos, performance, align='center', alpha=0.5)
- plt.xticks(y_pos, objects)
- plt.ylabel('Time')
- plt.title('Resource vs. Time')
- plt.show()
- #+END_SRC
Add Comment
Please, Sign In to add comment