Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
DOC: Refactor code in the fishbone diagram example#28144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
0782ed6
to47f9ae1
CompareUh oh!
There was an error while loading.Please reload this page.
spine_length = [-2.1 - length, 2 + length] | ||
head_pos = [2 + length, 0] | ||
tail_pos = [[-2.8 - length, 0.8], [-2.8 - length, -0.8], [-2.0 - length, -0.01]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
tail_pos= [[-2.8-length,0.8], [-2.8-length,-0.8], [-2.0-length,-0.01]] | |
tail_pos= [[-2.8-length,0.8], [-2.8-length,-0.8], [-2.0-length,-0.01]] | |
draw_spine(spine_length,head_pos,tail_pos) |
Let's move drawing the spine up here, this is where all relevant input for the function is calculated. Also, it's the order , you would draw such a diagram by hand: first the spine, and then the problem categories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It may even be a good idea to pull all the positioning details in to the function, so that you do
draw_spine(-2 - length, 2 + length)
which gives the length of the line.
Note that the left ofspine_length
is -0.1 compared to that, which I assume is so that the line reaches into the tail triangle. Otherwise the transition may not look smooth. But that should be an implementation detail, i.e. (or so - untested)
def draw_spine(xmin, xmax): ... # draw main spine ax.plot([xmin-0.1, xmax], [0, 0], color='tab:blue', linewidth=2) # draw fish head ax.text(xmax + 0.1, - 0.05, 'PROBLEM', fontsize=10, weight='bold', color='white') semicircle = Wedge((xmax, 0), 1, 270, 90, fc='tab:blue') ax.add_patch(semicircle) # draw fishtail tail_pos = [[xmin - 0.8, 0.8], [xmin - 0.8, -0.8], [xmin, -0.01]] triangle = Polygon(tail, fc='tab:blue') ax.add_patch(triangle)
# the cause_arrow_x, cause_arrow_y coordinates. | ||
causes(problem, cause_arrow_x, cause_arrow_y, top=top_row) | ||
causes(problem, cause_arrow_x, cause_arrow_y, top=plot_above) | ||
draw_spine(spine_length, head_pos, tail_pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
draw_spine(spine_length, head_pos, tail_pos) |
e253aa2
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
…144-on-v3.9.xBackport PR#28144 on branch v3.9.x (DOC: Refactor code in the fishbone diagram example)
PR summary
cause
anddraw_body
functions.draw_spine
code fromdraw_body
and turn into its own function.