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

Figures in Jupyter Notebooks not being found #6

Open
furnstahl opened this issue Jul 22, 2021 · 5 comments
Open

Figures in Jupyter Notebooks not being found #6

furnstahl opened this issue Jul 22, 2021 · 5 comments
Assignees

Comments

@furnstahl
Copy link
Owner

furnstahl commented Jul 22, 2021

This was happening both for notebooks imported into the Jupyter Book and also when pressing the Binder button, even though the figures worked when the notebooks were run standalone.

@furnstahl
Copy link
Owner Author

This was fixed when we renamed the directory with figures to be _images and used an appropriate relative path. With the current directory structure this is ../../_images/.

I'm unsure how general this fix is, but you can also figure out the correct path by using the "view source" feature of your browser when on the page where the figure is supposed to appear.

@furnstahl furnstahl self-assigned this Jul 22, 2021
@furnstahl furnstahl reopened this Jul 28, 2021
@furnstahl
Copy link
Owner Author

For a standalone notebook, if starting jupyter notebook in the sub-directory of the notebook the figures are not found with the `../../_images/ path. It will work if the notebook is started in the LectureNotes directory.

How do we set it up so it works either way?

@furnstahl
Copy link
Owner Author

We could put the url for the image at the github repository.

@furnstahl
Copy link
Owner Author

The url from github didn't work, at least as implemented.

@furnstahl
Copy link
Owner Author

We can use the raw.githubusercontent.com URL prefix to make this work. Here is an example from the lighthouse problem notebook. Just replace the image filename in _images.

https://raw.githubusercontent.com/buqeye/LearningFromData/main/LectureNotes/_images/radioactive_lighthouse_problem_figure.png

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

1 participant