1#    Copyright 2015-2017 ARM Limited
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16"""These are the default plotting Attributes"""
17WIDTH = 7
18"""Default Width of a MatPlotlib Plot"""
19LENGTH = 7
20"""Default Length of a MatPlotlib Plot"""
21PER_LINE = 2
22"""Default Graphs per line"""
23CONCAT = False
24"""Default value for concat in :mod:`trappy.plotter.LinePlot`
25and :mod:`trappy.plotter.ILinePlot`
26"""
27PIVOT = "__TRAPPY_PIVOT_DEFAULT"
28"""Default pivot when None specified"""
29PIVOT_VAL = "__TRAPPY_DEFAULT_PIVOT_VAL"
30"""Default PivotValue for the default pivot"""
31XLIM = None
32"""Default value for xlimit"""
33YLIM = None
34"""Default value for ylim"""
35FILL = False
36"""Default value for "fill" in :mod:`trappy.plotter.LinePlot`
37and :mod:`trappy.plotter.ILinePlot`"""
38ALPHA = 0.75
39"""Default value for the alpha channel"""
40TITLE = None
41"""Default figure title (no title)"""
42TITLE_SIZE = 24
43"""Default size for the figure title"""
44LEGEND_NCOL = 3
45"""Default number of columns in the legend"""
46
47MPL_STYLE = {
48    'axes.axisbelow': True,
49    'axes.edgecolor': '#bcbcbc',
50    'axes.facecolor': 'white',
51    'axes.grid': True,
52    'axes.labelcolor': '#555555',
53    'axes.labelsize': 'large',
54    'axes.linewidth': 1.0,
55    'axes.titlesize': 'x-large',
56    'figure.edgecolor': 'white',
57    'figure.facecolor': 'white',
58    'figure.figsize': (6.0, 4.0),
59    'figure.subplot.hspace': 0.5,
60    'font.size': 10,
61    'interactive': True,
62    'keymap.all_axes': ['a'],
63    'keymap.back': ['left', 'c', 'backspace'],
64    'keymap.forward': ['right', 'v'],
65    'keymap.fullscreen': ['f'],
66    'keymap.grid': ['g'],
67    'keymap.home': ['h', 'r', 'home'],
68    'keymap.pan': ['p'],
69    'keymap.save': ['s'],
70    'keymap.xscale': ['L', 'k'],
71    'keymap.yscale': ['l'],
72    'keymap.zoom': ['o'],
73    'legend.fancybox': True,
74    'lines.antialiased': True,
75    'lines.linewidth': 1.0,
76    'patch.antialiased': True,
77    'patch.edgecolor': '#EEEEEE',
78    'patch.facecolor': '#348ABD',
79    'patch.linewidth': 0.5,
80    'toolbar': 'toolbar2',
81    'xtick.color': '#555555',
82    'xtick.direction': 'in',
83    'xtick.major.pad': 6.0,
84    'xtick.major.size': 0.0,
85    'xtick.minor.pad': 6.0,
86    'xtick.minor.size': 0.0,
87    'ytick.color': '#555555',
88    'ytick.direction': 'in',
89    'ytick.major.pad': 6.0,
90    'ytick.major.size': 0.0,
91    'ytick.minor.pad': 6.0,
92    'ytick.minor.size': 0.0
93}
94
95from distutils.version import LooseVersion
96import matplotlib
97
98colors = ['#348ABD', '#7A68A6', '#A60628', '#467821', '#CF4457', '#188487',
99          '#E24A33']
100if LooseVersion(matplotlib.__version__) < LooseVersion("1.5.1"):
101    MPL_STYLE['axes.color_cycle'] = colors
102else:
103    MPL_STYLE['axes.prop_cycle'] = matplotlib.cycler("color", colors)
104
105ARGS_TO_FORWARD = [
106    "marker",
107    "markersize",
108    "markevery",
109    "linestyle",
110    "linewidth",
111    "drawstyle"]
112"""kwargs that will be forwarded to matplotlib API calls
113"""
114HTML_HEIGHT = 400
115"""Default height for HTML based plots"""
116DEFAULT_SYNC_ZOOM = False
117"""Sync Graph zoom by default in
118:mod:`trappy.plotter.ILinePlot` graph groups
119"""
120EVENT_PLOT_STRIDE = False
121"""Default value for stride which enables sampled
122EventPlots for :mod:`trappy.plotter.EventPlot`
123"""
124PLOT_SCATTER = False
125"""Default value for creating Scatter Plots"""
126POINT_SIZE = 2
127"""Default Point Size for plots (in pts)"""
128LINE_WIDTH = 1.0
129"""Default Line Width for plotter"""
130