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

Made fb.plot.images more customizable. #616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mike111177
Copy link

Example:

distances = fb.distances.l2(images, advs)
dist_labels = [round(x,4) for x in distances.tolist()]
fb.plot.images(advs - images, labels=dist_labels, bounds=(-.1, .1))

Result:
Capture

foolbox/plot.py Outdated Show resolved Hide resolved
@Mike111177 Mike111177 force-pushed the improve-plot branch 2 times, most recently from c643f20 to dd60b71 Compare February 11, 2021 23:06
@coveralls
Copy link

coveralls commented Feb 11, 2021

Coverage Status

Coverage increased (+56.2%) to 93.724% when pulling dd3b180 on Mike111177:improve-plot into 2343d58 on bethgelab:master.

@jonasrauber
Copy link
Member

jonasrauber commented Feb 23, 2021

Thanks @Mike111177. Happy to make it more customizable. Instead of the return_fig parameter, we might just always return fig and axes. And if we return the axes anyway, it would be easy enough to set the titles outside of the function. If we accept labels (should probably be called titles to not confuse it with class labels), then it should also be able to handle distances and labels tensors out of the box (but for distances, it then gets difficult to adjust the rounding; maybe use exponential representation by default?).
Do you want to adjust the PR accordingly?

Either just returning fig and axes.
Or returning fig and axes, and adding a titles parameter that supports a list of strings but also a tensor of labels (ints rendered as ints) or a tensor of distances (floats rendered with scientific notation and maybe two digits after the dot).

@jonasrauber jonasrauber reopened this Feb 23, 2021
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.

None yet

3 participants