-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplotting.py
More file actions
31 lines (27 loc) · 893 Bytes
/
Copy pathplotting.py
File metadata and controls
31 lines (27 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 20:36:33 2020
@author: Stuart
"""
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import matplotlib.ticker as ticker
import numpy as np
def showPlot(points, model_name, stamp):
r"""Showing and saving plots.
Inputs:.
- points: loss valus (a list of floats)
- model_name: string
- stamp: a string from struc UTC-time
"""
plt.figure()
fig, ax = plt.subplots()
# this locator puts ticks at regular intervals
loc = ticker.MultipleLocator(base=0.2)
ax.yaxis.set_major_locator(loc)
#plt.plot(losses)
plt.plot(points)
try:
plt.savefig('./dataset/model/%(model_name)s/%(stamp)s/%(stamp)s.png'%{ "model_name":model_name, "stamp":stamp } )
except:
plt.savefig('./dataset/model/%(model_name)s/%(stamp)s.png'%{ "model_name":model_name, "stamp":stamp } )