Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce redundancy with keyword-argument dictionaries #77

Open
klieret opened this issue Jul 25, 2022 · 1 comment
Open

Reduce redundancy with keyword-argument dictionaries #77

klieret opened this issue Jul 25, 2022 · 1 comment

Comments

@klieret
Copy link
Member

klieret commented Jul 25, 2022

Example in episode 4:

fig, (ax_1, ax_2) = plt.subplots(1, 2)
fig.set_size_inches((12, 8))
ax_1.set_title("MC samples without weights")
ax_1.hist(stack_mc_list_m4l, range=ranges[0], label=mc_samples, stacked=True, bins=bins)
ax_1.set_ylabel("Events")
ax_1.set_xlabel(var_name+units)
ax_1.legend(frameon=False)
ax_2.set_title("MC samples with weights")
ax_2.hist(stack_mc_list_m4l, range=rangos[0], label=mc_samples, stacked=True, weights=stack_weights_list, bins=bines)
ax_2.set_ylabel("Events")
ax_2.set_xlabel(var_name+units)
ax_2.tick_params(which="both",direction="in",top=True,right=True, length=6, width=1)
ax_2.legend(frameon=False)

just define

hist_kwargs = dict(stacked=True, bins=bins, ...)

ax_1.hist(..., **hist_kwargs)
@klieret klieret added the type:enhancement New feature or request label Jul 25, 2022
@klieret klieret added the good first issue Good for newcomers label Sep 14, 2022
@klieret klieret changed the title Do not copy paste options Reduce redundancy with keyword-argument dictionaries Sep 14, 2022
@stale
Copy link

stale bot commented Nov 29, 2022

This issue or pull request has been automatically marked as stale because it has not had recent activity. Please manually close it, if it is no longer relevant, or ask for help or support to help getting it unstuck. Let me bring this to the attention of @klieret @wdconinc @michmx for now.

@stale stale bot added the stale label Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant