More small updates to alaraplot#248
Conversation
gonuke
left a comment
There was a problem hiding this comment.
Looks pretty good... just few little cleanup items - thanks for the quick turnaround
| cmap_name='Dark2', | ||
| plot_type='plot', | ||
| separate_legend=False, | ||
| control_run='' |
There was a problem hiding this comment.
| control_run='' | |
| control_run=None |
| ) | ||
| data_list.append((run_lbl, filtered, piv, style)) | ||
|
|
||
| if run_lbl == control_run and ratio_plotting: |
There was a problem hiding this comment.
These seems redundant... the first condition can only match if 'control_runis not empty which is the same condition used to determineratio_plotting`
| if separate_legend argument is False. | ||
| ''' | ||
|
|
||
| ratio_plotting = True if control_run else False |
There was a problem hiding this comment.
| ratio_plotting = True if control_run else False | |
| ratio_plotting = (control_run is not None) |
gonuke
left a comment
There was a problem hiding this comment.
Just a couple of places to unwind some of the clever use of the comprehension
| prev_isotope = isotope | ||
|
|
||
| ax.legend( | ||
| target_ax = legend_ax if legend_ax else ax |
There was a problem hiding this comment.
It might be clearer to combine all the conditionals in one block here:
| target_ax = legend_ax if legend_ax else ax | |
| if legend_ax: | |
| target_ax = legend_ax | |
| loc = 'center' | |
| bbox_to_anchor = None | |
| else: | |
| target_ax = ax | |
| loc = 'center left' | |
| bbox_to_anchor = (1.025, 0.5) |
And then use these variables below
| ax.set_ylabel( | ||
| f'Proportion of Total {variable}' if relative | ||
| else f'{variable} [{filtered['var_unit'].unique()[0]}]' | ||
| f'Ratio of {variable} against {control_run}' if ratio_plotting | ||
| else (f'Proportion of Total {variable}' if relative | ||
| else f'{variable} [{filtered['var_unit'].unique()[0]}]') | ||
| ) |
There was a problem hiding this comment.
Might be clearer in simple if block to set a variable ylabel and then use that...
Or ax.set_ylabel in each of the if block sections
gonuke
left a comment
There was a problem hiding this comment.
Deleting left over commented line
| prev_isotope = isotope | ||
|
|
||
| ax.legend( | ||
| #target_ax = legend_ax if legend_ax else ax |
This PR includes a couple more small changes to
tools/alara_output_processing/alara_output_plotting.pyto improve versatility:control_run, wherein the user can select one of the runs contained in the ADF against which to divide to calculate a time-series of ratios.matplotlib.legend.Legendobject, which can be helpful for plotting with legends with many series.