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 figsize option in _repr_html_ #22

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

Conversation

BibMartin
Copy link
Contributor

My idea when computing 3f4fc1b was to display in the notebook a figure with the same size as matplotlib figures. If you tune your figsize, it will keep the same shape :

fig = plt.figure(figsize=(17,10))
plt.plot(...)
mplleaflet.display(fig)

But as @jwass notice in 1c1ce59, the defaut matplotlib figure is tiny (and ugly for a map).

This PR adds a figsize option in the display, so that mplleaflet.display(fig) will keep the figure size, and mplleaflet.display(fig,figsie="100%") will enalble to use the full width of the output cell.
By the way, this latter example will keep the figure's aspect ratio.

You can also force the output size like:

mplleaflet.display(fig, figsize=("60%","150px"))
mplleaflet.display(fig, figsize=(17,5))
mplleaflet.display(fig, figsize="60%")

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.

2 participants