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

Interact destroyes Image display via markdown in Jupyter... :( #267

Closed
Datseris opened this issue Oct 8, 2018 · 9 comments
Closed

Interact destroyes Image display via markdown in Jupyter... :( #267

Datseris opened this issue Oct 8, 2018 · 9 comments

Comments

@Datseris
Copy link

Datseris commented Oct 8, 2018

MWE:

Create a Julia cell in Jupyter. Do using PyPlot.

Create a markdown cell, and add:

<img src="cardiac_tissue_doubling.png" width=40%/>
![](cardiac_tissue_doubling.png)

Here is the image: cardiac_tissue_doubling to use.

When you do this, it displays fine. Now add one more Julia cell and do:

using Interact
close()
f1 = figure(figsize = (7,4))
@manipulate for 🥕 = rangeslider(0:0.001:4; value = 0.5, label = "🥕") |> onchange
    withfig(f1, clear = true) do 
            
        plot(rand(10))
        title("$(🥕)")
    end
end

and run it. Interact will work properly.

Now go back to the Markdown cell, edit it and run it. The image doesn't display anymore !!! :( :( :(

The argument "just never run the markdown cell again" is invalid, because I am doing a RISE presentation.


p.s.: as my presentation is due to be done soon, I'd appreciate a workaround even if this can't be fixed on time...

@piever
Copy link
Collaborator

piever commented Oct 8, 2018

Can you reproduce the error without RISE? For me everything is working fine (though I'm testing it without PyPlot as I can never manage to install it...).

@Datseris
Copy link
Author

Datseris commented Oct 8, 2018

This MWE (that I have indeed tested) does not use RISE. Well, RISE is one of the installed addons I have but I did not "fire up" the RISE mode or anything.

@piever
Copy link
Collaborator

piever commented Oct 8, 2018

Note that you don't need markdown cells: you can put in images with WebIO (they could even become part of your GUI). For example:

node(:img, src = "https://user-images.githubusercontent.com/19669089/46616661-56771380-cb1b-11e8-8ddb-cbbab002fecd.png", style = Dict("width" => "40%"))

Note that you can use AssetRegistry to serve local assets with WebIO:

using AssetRegistry
key = AssetRegistry.register("path/to/asset")
node(:img, src = key)

A couple of questions:

  1. Image doesn't display means that you see the "image could not be found / placeholder" thingy, or nothing at all?
  2. Does the error still occur if you uninstall RISE?

@Datseris
Copy link
Author

Datseris commented Oct 8, 2018

This is how it looks: I get the placeholder

image

At the moment I can't afford to uninstall and re-install RISE, as its important for me to have my talk working and I can't risk it. I'll try to check after I present.

@Datseris
Copy link
Author

Datseris commented Oct 8, 2018

Thank you, doing

using AssetRegistry
key = AssetRegistry.register("cardiac_tissue_doubling.png")
node(:img, src = key)

works. But I find it kind of "bad" to have to display "weird code" just to show an image.... I'll have to use it for now though.

@piever
Copy link
Collaborator

piever commented Oct 8, 2018

Does passing a remote URL work? For example:

<img src="https://user-images.githubusercontent.com/19669089/46616661-56771380-cb1b-11e8-8ddb-cbbab002fecd.png" width=40%/>

@Datseris
Copy link
Author

Datseris commented Oct 8, 2018

lol.... this works yeah !!!!!

@piever
Copy link
Collaborator

piever commented Oct 8, 2018

I'm still confused as to what the local path is supposed to do / whether AssetRegistry is somehow messing up with it: will investigate. OTOH, I'm happy to now that RISE is working with Interact.

EDIT: for files stored locally it is quite interesting, the old syntax:

<img src="files/cardiac.png" width=40%/>

still works (using the "files" prefix), whereas the simpler

<img src="cardiac.png" width=40%/>

does not work (I finally managed to reproduce the issue, was doing something silly before).

@piever
Copy link
Collaborator

piever commented Oct 8, 2018

Closing as a duplicate of JuliaGizmos/AssetRegistry.jl#3

@piever piever closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants