Issue
I wish to write two different lines on heatmap. My code is
lines = [0,10,300,500,2560, 34500]
with sns.axes_style("white"):
f, ax = plt.subplots(figsize=(50, 50))
ax = sns.heatmap(X)
ax.axvline(4000, *ax.get_ylim(), ymin = lines[0], ymax = lines[4], lw = 8.0, color = 'red')
ax.axvline(4000, *ax.get_ylim(), ymin = lines[5], lw = 8.0, color = 'green')
and I get an error like
TypeError: axvline() got multiple values for argument 'ymin'.
What does that mean?
Solution
Okay there is a work around to the question. Commenter above mentioned that y axis should always take a number between 0 and 1.
So we can do a work around with percentage.
lines = [0,10,300,500,2560, 34500]
p_1 = lines[4]/lines[-1]
p_2 = 1
with sns.axes_style("white"):
f, ax = plt.subplots(figsize=(50, 50))
ax = sns.heatmap(X)
ax.axvline(4000, *ax.get_ylim(), ymin = 1-p1, ymax = p2, lw = 8.0, color = 'red')
ax.axvline(4000, *ax.get_ylim(), ymin = 0,ymax = 1-p1, lw = 8.0, color = 'green')
Answered By - Noob Programmer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.