Skip to content

How to adjust pyplot to screens #3277

Closed Answered by falkoschindler
Guilhermwn asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a workaround adding "width:100%;height:100%" to the inner HTML:

with ui.card().classes('w-[400px]'):
    with ui.pyplot() as plot:
        plot.fig.gca().plot()
    plot._props['innerHTML'] = plot._props['innerHTML'].replace('<svg', '<svg style="width:100%;height:100%"')
    plot.update()

But I think we can add these attributes by default so that the SVG automatically fills the size of the ui.pyplot element.

Replies: 4 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@Guilhermwn
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Guilhermwn
Comment options

Comment options

You must be logged in to vote
10 replies
@falkoschindler
Comment options

@evnchn
Comment options

evnchn Apr 8, 2025
Collaborator

@falkoschindler
Comment options

@moi90
Comment options

@falkoschindler
Comment options

Answer selected by Guilhermwn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants