def sb_jointplot(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_kind = "reg"
cur_width = 15.0
cur_height = 15.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 "Kind" in req:
cur_kind = str(req["Kind"])
# end of parsing inputs
# Add custom plots here
grid = sns.jointplot(cur_xlabel, cur_ylabel, kind=cur_kind, data=source_df, annot_kws=dict(stat="r"))
if debug:
self.lg("Saving File(" + str(image_filename) + ")", 6)
grid.fig.set_figwidth(cur_width)
grid.fig.set_figheight(cur_height)
ax = grid.ax_joint
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_jointplot
评论列表
文章目录