Plots a signal in time domain. Parameters (default), (type): ------------------------------ * sigObjs (), (list): a list with SignalObjs * xLabel ('Time [s]'), (str): x axis label. * yLabel ('Amplitude'), (str): y axis labe
(sigObjs, xLabel, yLabel, yLim, xLim, title, decimalSep, timeUnit)
| 30 | |
| 31 | |
| 32 | def time(sigObjs, xLabel, yLabel, yLim, xLim, title, decimalSep, timeUnit): |
| 33 | """ |
| 34 | Plots a signal in time domain. |
| 35 | |
| 36 | Parameters (default), (type): |
| 37 | ------------------------------ |
| 38 | |
| 39 | * sigObjs (), (list): |
| 40 | a list with SignalObjs |
| 41 | |
| 42 | * xLabel ('Time [s]'), (str): |
| 43 | x axis label. |
| 44 | |
| 45 | * yLabel ('Amplitude'), (str): |
| 46 | y axis label. |
| 47 | |
| 48 | * yLim (), (list): |
| 49 | inferior and superior limits. |
| 50 | |
| 51 | >>> yLim = [-100, 100] |
| 52 | |
| 53 | * xLim (), (list): |
| 54 | left and right limits |
| 55 | |
| 56 | >>> xLim = [0, 15] |
| 57 | |
| 58 | * title (), (str): |
| 59 | plot title |
| 60 | |
| 61 | * decimalSep (','), (str): |
| 62 | may be dot or comma. |
| 63 | |
| 64 | >>> decimalSep = ',' # in Brazil |
| 65 | |
| 66 | * timeUnit ('s'), (str): |
| 67 | 'ms' or 's'. |
| 68 | |
| 69 | Return: |
| 70 | -------- |
| 71 | |
| 72 | matplotlib.figure.Figure object. |
| 73 | """ |
| 74 | if decimalSep == ',': |
| 75 | locale.setlocale(locale.LC_NUMERIC, 'pt_BR.UTF-8') |
| 76 | plt.rcParams['axes.formatter.use_locale'] = True |
| 77 | elif decimalSep =='.': |
| 78 | locale.setlocale(locale.LC_NUMERIC, 'C') |
| 79 | plt.rcParams['axes.formatter.use_locale'] = False |
| 80 | else: |
| 81 | raise ValueError("'decimalSep' must be the string '.' or ','.") |
| 82 | |
| 83 | if timeUnit in ['s', 'seconds', 'S']: |
| 84 | timeScale = 1 |
| 85 | timeUnit = 's' |
| 86 | elif timeUnit in ['ms', 'milliseconds', 'mseconds', 'MS']: |
| 87 | timeScale = 1000 |
| 88 | timeUnit = 'ms' |
| 89 | else: |
nothing calls this directly
no test coverage detected