Esempio n. 1
0
show_saved.py

Restores saved data and displays graph.

"""

import myplot
import util

# Get full path to the .txt file that was saved when the graph was produced

file_name = util.input_no_default('Enter name of data file to be restored: ')

# Restore data into all of the myplot module global variables that are used
# by the different graphs

plot_name = myplot.restore_data(file_name) 

# Call the graphing routine that was used for this plot

if plot_name == 'stacked_bar':
    myplot.stacked_bar()
elif plot_name == 'line':
    myplot.line()
elif plot_name == 'line_2subplots':
    myplot.line_2subplots()
elif plot_name == 'line_4subplots':
    myplot.line_4subplots()
else:
    print('Invalid plot_name = '+plot_name)
Esempio n. 2
0
myplot.xlabels = []
for r in results:
    myplot.xlabels.append(r[0])

# Build a list of lists of y values
# and a list of the labels for each y value

myplot.ylists = []
myplot.ylistlabels = []

for i in range(1, len(column_names)):
    yl = []
    for r in results:
        val = 100.0 * myplot.nonetozero(r[i])
        yl.append(val)
    myplot.ylists.append(yl)
    myplot.ylistlabels.append(column_names[i])

# Misc labels and names

myplot.title = database.upper() + ' CPU Working Hours ' + day.capitalize(
) + 's'
myplot.ylabel1 = 'CPU % Utilization'
myplot.yticksuffix = '%'
myplot.filename = day.lower() + '.png'

# Run stacked bar graph

myplot.stacked_bar()