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

Animated for-loop plots as embedded videos #1

Open
FannoFlow opened this issue Sep 11, 2021 · 2 comments
Open

Animated for-loop plots as embedded videos #1

FannoFlow opened this issue Sep 11, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@FannoFlow
Copy link

when plotting code is drawn in a loop, matlab live scripts will covert them to a video playback.

This would be really cool to see exported in markdown. perhaps as a gif?

a = axes;
axis(a, [0,2*pi,-1,1])
hold(a, "on")

for i = linspace(0, 2*pi)
    scatter(a, i, cos(i), 'b')
    drawnow limitrate
end

image

@apjanke
Copy link
Member

apjanke commented Sep 11, 2021

Great idea! Let's do this.

They could be embedded as animated GIFs, or maybe as real video formats.

First thing to do is figure out what format Matlab's "Export Live Script to LaTeX" dumps them out as. And have a look at what its "Export to HTML" does with them, too; that may support different media formats.

@apjanke apjanke self-assigned this Sep 11, 2021
@apjanke apjanke added the enhancement New feature or request label Sep 11, 2021
@apjanke apjanke added this to the 1.0.0 milestone Sep 11, 2021
@apjanke apjanke changed the title export embedded video playback Embedded video playback Sep 11, 2021
@apjanke
Copy link
Member

apjanke commented Sep 11, 2021

Okay, I added a TODO and an example .mlx for this: 94fe644.

Hmmm. This might be nontrivial: I think what you're actually seeing when you Run the Live Script is just Matlab progressively updating the preview image upon passes through the loop, and once execution of that code block is finished, what's left is just a static image, not a video of any sorts.

When exporting the mlx to latex with Matlab (R2019b), you get just a static .png file, and when exporting to HTML, you end up with a PNG embedded inside the HTML file using a <img src="data:image/png;base64,..."> tag.

@apjanke apjanke changed the title Embedded video playback Animated for-loop plots as embedded videos Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants