Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raise MissingDependencyError("matplotlib")
optionsStyle = ["light", "system"]
if style not in optionsStyle:
raise ValueError("possible style options: " + str(optionsStyle))
if len(color) != 3:
raise ValueError("(r,g,b) tuple required")
if style == "system":
self.__rcParams = mpl.rcParams
raise ValueError("not implemented, yet")
if style == "light":
self.__defaultColor = (0, 0, 0)
self.__defaultWidth = 1
self.__backgroundColor = (1, 1, 1)
self.__plotColor = Theme.RGBA2RGB(color, 0.6, self.__backgroundColor)
self.__plotWidth = 3
self.__faceColor = (color[0], color[1], color[2], 0.2)
self.__faceColorGray = "lightgray"
self.__edgeColor = (color[0], color[1], color[2], 0.6)
self.__edgeColorGray = (0, 0, 0)
self.__edgeWidth = 1
self.__gridColor = "lightgray"
self.__fontColor = (0, 0, 0)
self.__fontSize = 10
self.__color = color
self.__style = style
def __format(self, outputType, directory, filename, style, color, token, pageIndex, parallel):
""" layouts the profile """
confParser = configparser.ConfigParser()
confParser.read(getfilepath("description/descriptions.txt"))
theme = plot.Theme()
theme.set(style, color)
# TODO: refactor and use decorator design pattern instead if an 3rd format is supported
if outputType == "HTML":
plottype = "SVG"
options = []
templateProfile = readfile("html/profile.html", False)
templateMeasure = readfile("html/measure.html", False)
elif outputType == "LaTeX":
plottype = "PDF"
if directory[-1] == "/":
output_dir = directory + filename[:-1]
else:
output_dir = directory + "/" + filename[:-1]
if not os.path.isdir(output_dir):
os.mkdir(output_dir)
def funcHexBin(ax):
if not have_mpl:
raise MissingDependencyError("matplotlib")
gridsize = correlation["Binning"]["Grid Size"]
frequencies = correlation["Binning"]["Absolute Frequencies"]
max = correlation["Binning"]["Max Frequency"]
offsets = correlation["Binning"]["Offsets"]
paths = correlation["Binning"]["Paths"]
x_min = stat_1["Location"]["Min"]
x_max = stat_1["Location"]["Max"]
y_min = stat_2["Location"]["Min"]
y_max = stat_2["Location"]["Max"]
for i in range(len(frequencies)):
color = Theme.RGBA2RGB(
theme.getPlotColor(),
math.log(frequencies[i]+1,10)/math.log(max+1,10),
theme.getBackgroundColor()
)
path = paths.transformed(mpl.transforms.Affine2D().translate(
offsets[i][0],
offsets[i][1]
))
ax.add_patch(patches.PathPatch(
path,
facecolor = color,
linestyle = "solid",
linewidth = 0
))
ax.set_xlim([x_min, x_max])
ax.set_ylim([y_min, y_max])