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

Fix having to plot twice to get a file with size bigger than 3kb #2141

Merged
merged 6 commits into from
Jul 24, 2023

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Jun 23, 2023

Problem was that the graphics wasn't "flushed" after executing all the commands. Now using the context manager, we make sure we flush after running each plot command.

I also fixed the static images not being plot in jupyter notebooks, the key was relaxing the regex (PNG_IS_WRITTEN_TO_FILE) which decides if the plot was written to a file or not.
Also I had to flush (mapdl.show("close")) the graphics before plotting (otherwise the 3kb file gives error).

Close #1629

@github-actions github-actions bot added the BUG Issue, problem or error in PyMAPDL label Jun 23, 2023
@germa89 germa89 self-assigned this Jun 23, 2023
@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Merging #2141 (e501c06) into main (997e288) will increase coverage by 6.33%.
The diff coverage is 95.90%.

@@            Coverage Diff             @@
##             main    #2141      +/-   ##
==========================================
+ Coverage   80.82%   87.16%   +6.33%     
==========================================
  Files          44       45       +1     
  Lines        7489     8079     +590     
==========================================
+ Hits         6053     7042     +989     
+ Misses       1436     1037     -399     

@germa89 germa89 enabled auto-merge (squash) July 10, 2023 12:47
Copy link
Contributor

@clatapie clatapie left a comment

Choose a reason for hiding this comment

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

I think adding a test would be interesting but I let you decide @germa89 if it would be relevant or not!

@germa89
Copy link
Collaborator Author

germa89 commented Jul 19, 2023

I think adding a test would be interesting but I let you decide @germa89 if it would be relevant or not!

Unit test added in b3987bf

@germa89 germa89 requested a review from clatapie July 19, 2023 11:35
Copy link
Contributor

@clatapie clatapie left a comment

Choose a reason for hiding this comment

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

LGTM!

@germa89 germa89 merged commit a531e3d into main Jul 24, 2023
22 checks passed
@germa89 germa89 deleted the fix/plot-twice branch July 24, 2023 09:19
@germa89 germa89 mentioned this pull request Jul 24, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Issue, problem or error in PyMAPDL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command needs to run twice to generate PNG image
2 participants