def plot(self, path, data, colors, legendNames, xLabels): fig, ax = plotHelper.createPlot() grapher = StackedBarGrapher() grapher.stackedBarPlot(ax, data, colors, xLabels, ylabel="latency [ms]", gap=0.4, yTicks=5) handles = map( lambda (color, label): matplotlib.patches.Patch(color=color, label=label), zip(colors, legendNames)) ax.yaxis.grid(True) ax.legend(handles=handles, frameon=1, bbox_to_anchor=(0., 1., 1., 0), ncol=2, borderaxespad=0) fig.patch.set_visible(True) plotHelper.savePlot(ax, fig, path, self.title, "legend title")
def plot2d(self, path, data): fig, ax = plotHelper.createPlot() ax.set_ylabel(self.yAxisText) ax.set_xlabel(self.xAxisText) x = [val[0] for val in data] y = [val[1] for val in data] plt.scatter(x, y) plotHelper.savePlot(ax, fig, path, self.title)
def plot(self, path, data, label, centerOn=None, comparision=False, captions=None, nonNumeric=False): fig, ax = plotHelper.createPlot() ax.set_title(self.title) if nonNumeric: cmap = ListedColormap( sns.cubehelix_palette(start=2.8, rot=.1, light=0.9, n_colors=3)) else: cmap = "viridis" if comparision: sns.heatmap(data, ax=ax, annot=True, fmt=".1f", cmap=cmap, center=centerOn, vmin=0, vmax=2, cbar=not nonNumeric) else: if captions is not None: sns.heatmap(data, ax=ax, annot=captions, fmt="", cmap=cmap, center=centerOn, cbar=not nonNumeric) else: sns.heatmap(data, ax=ax, annot=True, fmt=".1f", cmap=cmap, center=centerOn, cbar=not nonNumeric) if not nonNumeric: cbar = ax.collections[0].colorbar cbar.set_label(label) ax.invert_yaxis() plotHelper.savePlot(ax, fig, path, self.title)
def plot(self, path, data, xName, yName, hueName): fig, ax = plotHelper.createPlot() ax.set_ylabel(self.yAxisText) ax.set_xlabel(self.xAxisText) colors = sns.color_palette("Set3", 20) toRemove = colors[1] colors = filter(lambda x: x != toRemove, colors) sns.barplot(xName, yName, hueName, data, ax=ax, ci=None, palette=colors) plotHelper.savePlot(ax, fig, path, self.title, hueName)
def plot(self, path, data, xName=None, yName=None, hue=None, log=False): fig, ax = plotHelper.createPlot() ax.set_ylabel(self.yAxisText) if log: ax.set_yscale("log") #huePalette = sns.color_palette("viridis", desat=.5) colors = sns.color_palette("Set3", 20) toRemove = colors[1] colors = filter(lambda x: x != toRemove, colors) sns.boxplot(ax=ax,x=xName, y=yName, data=data, showfliers=False,linewidth=0.7, hue=hue, palette=colors)#palette="binary" if hue is None else huePalette) ax.set_xlabel(self.xAxisText) if hue is None: for box in ax.artists: box.set_facecolor("white") plotHelper.savePlot(ax, fig, path, self.title, hue, sortLegend=False, log=log)
def plot(self, path, dataArray, legendTitle, xLables=None, xLog=False, yLim=None): #print xLables #print "!!!!!" fig, ax = plotHelper.createPlot() ax.set_ylabel(self.yAxisText) ax.set_xlabel(self.xAxisText) if xLog: ax.set_xscale('log') filledMarkers = list(Line2D.filled_markers) xValues = [] xValueSet = set() colors = sns.color_palette("Set3", 20) toRemove = colors[1] colors = filter(lambda x: x != toRemove, colors) for i, el in enumerate(dataArray): label = el[0] data = el[1] xValues = [x[0] for x in data] xValueSet |= set(xValues) yValues = [x[1] for x in data] ax.plot(xValues, yValues, marker=filledMarkers[i], label=label, color=colors[i]) if xLables is not None: plt.xticks(sorted(list(xValueSet)), xLables) if yLim is not None: #lim = ax.get_ylim() #ax.set_ylim([lim[0] * yLim[0], lim[1] * yLim[1]]) ax.set_ylim(yLim) plotHelper.savePlot(ax, fig, path, self.title, legendTitle)