def sb_scatter(self, req, debug=False):
image_list = []
image_filename = req["ImgFile"]
import seaborn as sns
import numpy as np
from matplotlib import pyplot
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.patches import Rectangle
from matplotlib.finance import volume_overlay
import pandas as pd
from pandas.tseries.offsets import BDay
source_df = req["SourceDF"]
ds_name = req["DSName"]
sns.set_style("whitegrid", {'axes.grid' : True})
sns.color_palette("Set1", n_colors=8, desat=.5)
cur_xlabel = "measurement"
cur_ylabel = "value"
cur_hue = "ResultLabel"
cur_width = 10.0
cur_height = 10.0
if "X" in req:
cur_xlabel = str(req["X"])
if "Y" in req:
cur_ylabel = str(req["Y"])
if "Width" in req:
cur_width = float(req["Width"])
if "Height" in req:
cur_height = float(req["Height"])
if "Hue" in req:
cur_hue = str(req["Hue"])
# end of parsing inputs
# Add custom plots here
plt.figure(figsize=(cur_width, cur_height))
ax = sns.swarmplot(x=cur_xlabel, y=cur_ylabel, hue=cur_hue, data=source_df)
if debug:
self.lg("Saving File(" + str(image_filename) + ")", 6)
self.pd_add_footnote(ax.figure)
ax.figure.savefig(image_filename)
image_list.append(image_filename)
if req["ShowPlot"] == True:
plt.show()
return image_list
# end of sb_scatter
评论列表
文章目录