-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af9826a
commit 7218e94
Showing
5 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import mesop as me | ||
|
||
|
||
@me.page(path="/grid") | ||
def app(): | ||
with me.box(style=me.Style(display="grid", grid_template_columns="1fr 1fr")): | ||
me.text("hi1") | ||
me.text("hi2") | ||
me.text("hi3") | ||
me.text("hi4") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from mesop.examples.integrations import ( | ||
matplotlib as matplotlib, | ||
) | ||
from mesop.examples.integrations import ( | ||
matplotlib_grid as matplotlib_grid, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,3 @@ def app(): | |
|
||
me.text("Resize plot:") | ||
me.plot(fig, style=me.Style(width=200, height=200)) | ||
me.plot(fig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from matplotlib.figure import Figure | ||
|
||
import mesop as me | ||
|
||
|
||
@me.page(path="/integrations/matplotlib_grid") | ||
def app(): | ||
with me.box( | ||
style=me.Style( | ||
display="grid", | ||
grid_template_columns="1fr 1fr", | ||
gap="16px", | ||
padding=me.Padding( | ||
top=16, | ||
left=16, | ||
right=16, | ||
bottom=16, | ||
), | ||
overflow_y="auto", | ||
) | ||
): | ||
graph() | ||
graph() | ||
graph() | ||
graph() | ||
|
||
|
||
def graph(): | ||
border_side = me.BorderSide(width=1, color="#ddd", style="solid") | ||
with me.box( | ||
style=me.Style( | ||
background="#fff", | ||
border=me.Border( | ||
top=border_side, | ||
right=border_side, | ||
bottom=border_side, | ||
left=border_side, | ||
), | ||
border_radius=16, | ||
padding=me.Padding( | ||
top=16, | ||
left=16, | ||
right=16, | ||
bottom=16, | ||
), | ||
) | ||
): | ||
# Create matplotlib figure without using pyplot: | ||
fig = Figure() | ||
ax = fig.subplots() # type: ignore | ||
ax.plot([1, 2]) # type: ignore | ||
|
||
me.text("Example using matplotlib:") | ||
me.plot(fig, style=me.Style(width="100%")) |