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

Added an example on how to integrate Matplotlib #1930

Merged
merged 25 commits into from
Oct 31, 2024

Conversation

SGCODEX
Copy link
Contributor

@SGCODEX SGCODEX commented Oct 4, 2024

This example shows how to create a Matplotlib chart and how to integrate it in a Taipy page using the figure property.
Screenshot of Taipy page:
Example SS

fixes #558
Please review @jrobinAV sir
Thank you

@jrobinAV jrobinAV added 🖰 GUI Related to GUI hacktoberfest hacktoberfest issues hacktoberfest - 300💎💎💎 Issues rewarded by 300 points 📄 Documentation Internal or public documentation 🟧 Priority: High Must be addressed as soon labels Oct 5, 2024
FabienLelaquais
FabienLelaquais previously approved these changes Oct 5, 2024
Copy link
Member

@FabienLelaquais FabienLelaquais left a comment

Choose a reason for hiding this comment

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

Excellent!
Simple and effective. Well done!

Now we will have to move this at another location, and add a Markdown version of this.
And add a little piece of doc referring to this and explain what's going on.
But that's an easy shot that I'll take care of.

Thank you!

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 5, 2024

Thank you sir @FabienLelaquais
Sure sir, and please let me know if I can also help more in this issue.
Also sir, will this PR be merged after the changes?

Thank you sir

@FabienLelaquais
Copy link
Member

FabienLelaquais commented Oct 5, 2024

This PR will certainly be merged, yes, @SGCODEX!
Hacktoberfest PRs are not merged right away though, because of the rewarding process that goes on.
But I promise I'll let you know when this gets is (a matter of days) so we all celebrate!

Thanks again

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 5, 2024

Thank you so much sir,
Looking forward towards the celebration and more meaningful contributions. 😇

@jrobinAV jrobinAV added the ✅ hacktoberfest: approved An approved PR for Hacktoberfest rewarding label Oct 6, 2024
Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

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

Can you fix the linter issues please ?
And update your branch ?
Tx @SGCODEX

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 7, 2024

@FredLL-Avaiga Sir,
I have updated the branch.
Can you tell me about linter issues? I don't know about them. Please help sir on what to fix.

Copy link
Member

@FlorianJacta FlorianJacta left a comment

Choose a reason for hiding this comment

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

Little comments, but otherwise, great!

doc/gui/examples/matplotlib_example.py Outdated Show resolved Hide resolved
doc/gui/examples/matplotlib_example.py Outdated Show resolved Hide resolved
@FredLL-Avaiga
Copy link
Member

FredLL-Avaiga commented Oct 7, 2024

@FredLL-Avaiga Sir, I have updated the branch. Can you tell me about linter issues? I don't know about them. Please help sir on what to fix.

image

Click on the details link

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 8, 2024

@FredLL-Avaiga @FlorianJacta Sir, working on these issues. Will submit the commits solving them soon. Thank you sirs.

@FredLL-Avaiga
Copy link
Member

here is your code with the import sorted

import matplotlib.pyplot as plt
import numpy as np

import taipy.gui.builder as tgb
from taipy.gui import Gui

fig = plt.figure(figsize=(5, 4))
xx = np.arange(0, 2 * np.pi, 0.01)
plot = fig.subplots(1, 1)
plot.fill(xx, np.sin(xx), facecolor="none", edgecolor="purple", linewidth=2)

# Create a Taipy Page
with tgb.Page() as page:
    tgb.part(content="{fig}", height="520px")

# Run the Taipy Application:
if __name__ == "__main__":
    Gui(page=page).run(title="Matplotlib Example")

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

@FredLL-Avaiga Sir,
Have made both the examples exactly similar to each other. Added copyright to both the files.
Screenshot of both the file's output:
image

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

Is it not possible to have the exact same example in markdown and builder? If it is, change the structure to a directory with

  • markdown.py
  • builder.py

You can check out the other directory at the same level

I have tried to rename the files to markdown.py and builder.py sir in a directory "matplotlib", but I think taipy has some other file named as builder.py as I was getting this circular import error:
image

So have renamed like this:
matplotlib

  • builder_example.py
  • markdown_example.py

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

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

doc/gui/examples/matplotlib/builder_example.py Outdated Show resolved Hide resolved
@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

@FredLL-Avaiga Sir, Have organized the files like the given example and defined the style in tgb.Page()

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

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

a last comment

doc/gui/examples/charts/matplotlib/builder.py Outdated Show resolved Hide resolved
doc/gui/examples/charts/matplotlib/builder.py Outdated Show resolved Hide resolved
@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

Done sir @FredLL-Avaiga

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

@FredLL-Avaiga Not understanding how to fix the import linter issues. Please help sir.

doc/gui/examples/charts/matplotlib/builder.py Outdated Show resolved Hide resolved
doc/gui/examples/charts/matplotlib/markdown.py Outdated Show resolved Hide resolved
@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

Thank you sir @FredLL-Avaiga

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

Anything else remains in this sir? Or can this be merged?

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

@FredLL-Avaiga Please review sir. Thank you.

@FredLL-Avaiga
Copy link
Member

can you resolves the GitHUb discussions, once you answered them ?

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

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

excellent job @SGCODEX

@FredLL-Avaiga
Copy link
Member

@jrobinAV Can you merge this PR ?

@jrobinAV jrobinAV merged commit 3527d06 into Avaiga:develop Oct 31, 2024
55 of 56 checks passed
@jrobinAV
Copy link
Member

Rock on !!

@SGCODEX
Copy link
Contributor Author

SGCODEX commented Oct 31, 2024

Thank you sirs @FredLL-Avaiga @jrobinAV
(Sure, I will resolve the Github discussions too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 Documentation Internal or public documentation 🖰 GUI Related to GUI hacktoberfest - 300💎💎💎 Issues rewarded by 300 points ✅ hacktoberfest: approved An approved PR for Hacktoberfest rewarding hacktoberfest hacktoberfest issues 🟧 Priority: High Must be addressed as soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an example on how to integrate Matplotlib
5 participants