Skip to content

Commit

Permalink
trying (vainly) to display date/time correctly in mtplotlib plots
Browse files Browse the repository at this point in the history
but it does not work for short time ranges (< 10 minutes), matplotlib
refuses to do its job. (#67)
  • Loading branch information
denisri committed Jan 18, 2023
1 parent d0685c8 commit f6b52a9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions python/soma_workflow/gui/workflowGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def utf8(string):
import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.pyplot
import matplotlib.dates as mdates
except ImportError as e:
print("Could not use Matplotlib: %s %s" % (type(e), e))
MATPLOTLIB = False
Expand Down Expand Up @@ -3707,7 +3708,12 @@ def key(j):
if nb_jobs:
self.axes.set_ylim(0, nb_jobs + 1)

self.axes.set_xlabel("Time")
# self.axes.set_xlabel("Time")
# locator = mdates.AutoDateLocator(minticks=3)
locator = mdates.MinuteLocator(interval=2)
self.axes.xaxis.set_major_locator(locator)
self.axes.xaxis.set_major_formatter(mdates.ConciseDateFormatter(
locator))
if self.plot_type == 1:
self.axes.set_ylabel("CPUs")
else:
Expand Down Expand Up @@ -3792,7 +3798,12 @@ def nbProcFctTime(self):
if nb_proc_max != 0:
self.axes.set_ylim(0, nb_proc_max + 1)

self.axes.set_xlabel("Time")
# self.axes.set_xlabel("Time")
locator = mdates.AutoDateLocator(minticks=3)
# locator = mdates.MinuteLocator() #interval=10)
self.axes.xaxis.set_major_locator(locator)
self.axes.xaxis.set_major_formatter(mdates.ConciseDateFormatter(
locator))
if self.plot_type == 3:
self.axes.set_ylabel("Nb of CPU")
else:
Expand Down

0 comments on commit f6b52a9

Please sign in to comment.