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

Add coords and ax arguments to all plotting functions #835

Merged
merged 3 commits into from
Nov 10, 2019

Conversation

OriolAbril
Copy link
Member

@OriolAbril OriolAbril commented Sep 29, 2019

Most plot_xyz have coords and ax arguments, but there are some exceptions. This PR intends to add these arguments in all functions (if they make sense, plot_compare will continue not having coords argument).

I have started with plot_forest, fixes #813. Similarly to what happened in plot_density, it can also accept a list of inferencedata objects, so I modified get_coords. I set it to accept 3 combinations:

  • dataset and coords dict,
  • list of datasets and coords dict
  • list of dataset and list of coords dicts

This allows to handle idata objects with different dimensions, but I am not totally convinced by this approach. Any ideas will be welcome.

ax argument added to plot_joint

Modified get_coords to work on tuple or lists of
xarray datasets too
It is added as ax_tuple argument to mimic the output type of the
function.
@@ -20,6 +20,7 @@ def plot_joint(
fill_last=True,
joint_kwargs=None,
marginal_kwargs=None,
ax_tuple=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe axes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather ax like the other functions or something clearly different like I tried. It it is okey I'll change it by ax

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is conceptually different than the other functions but you can always overlay plots doing:

ax = plot_xyz(data1)
az.plot_xyz(data2, ax=ax)

so maybe for the end users there is not much difference

@aloctavodia
Copy link
Contributor

Is this ready to merge?

@OriolAbril
Copy link
Member Author

Yes! I was originally planning on addind ax argument to plot_trace but now it would be best to wait to do this. Therefore, unless there are any comments or reviews it is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Add ax argument to plot_forest
3 participants