我有一個類似的問題here。我有一個IPython筆記本,我希望輸出具有中心圖。我已經複製了CSS文件和上面鏈接中指示的所有內容,並且,雖然情節改變了樣式,但它們並不集中在我的屏幕上。在IPython筆記本上集中輸出
4
A
回答
4
這可能會有點晚,但也許Google會帶來更多的人在這裏尋找解決方案。 我們可以風格IPython的輪廓在custom.css輸出,並添加以下內容:
與(以上)的IPython
.ui-wrapper {
margin-left: auto !important;
margin-right: auto !important;
}
之後,你只需要重新加載頁面你的瀏覽器。
ui-wrapper
-div包含ui-resizable
-image,可以在其父代output-subarea
中對齊。 margin-left
和margin-right
設置爲auto
將居中。必須使用關鍵字!important
才能避免筆記本進行內聯樣式覆蓋。據我所知,使用!重要不是最好的事情,但在這裏完成這項工作。
如果你不知道在哪裏IPython的曲線可以發現,你可以運行此代碼:
%%bash
ipython locate
通常它位於〜/ .ipython,其中〜是你的主文件夾。該css文件應該位於〜/ .ipython/profile_default/static/custom/custom.css,並且如果您以前沒有使用過,它應該是空的。
與Jupyter(4.1.0)
筆記本電腦和文件位置的HTML輸出,因爲我的第一篇文章已經改變。但即使我們不再需要!important
,通用方法仍然保持不變:
查找和/或創建custom.css
文件。它應該位於* nix系統上的$USER/.jupyter/custom/custom.css
。如果它不存在,請創建它並重新啓動筆記本服務器。這應該給你一個關於在何處尋找提示:
import jupyter_core
custom_css = jupyter_core.paths.jupyter_config_dir() + '/custom/custom.css'
print "File: %s" % custom_css
在Windows上必須更換/
與\\
我猜。
要居中的元素是output_png
div中的圖像。
.output_png img {
display: block;
margin-left: auto;
margin-right: auto;
}
這已經過Firefox 44.0.2和Chrome 49.0的測試。
隨着Jupyter主題
此外,也有一些主題化工具各地。我沒有既不
測試自己,但他們可能會有所幫助。
相關問題
- 1. 在IPython中/ Jupyter筆記本
- 2. Heroku上的IPython筆記本
- 3. iPython筆記本:如何防止在imshow()上輸出圖像?
- 4. 在現有筆記本服務器上打開ipython筆記本
- 5. 在ipython筆記本的sympy輸出中使用乘法符號
- 6. ipython筆記本中的ASCIIMathMl
- 7. ipython筆記本中的OptionParser?
- 8. 在IPython的筆記本
- 9. IPython筆記本在生產
- 10. 啓動IPython筆記本MPI羣集
- 11. 在IPython筆記本上更改圖標
- 12. 在Github上託管ipython筆記本
- 13. IPython筆記本錯誤:加載筆記本時出錯
- 14. 如何將輸出集中在Python Jupyter筆記本上?
- 15. 在IPython的另一個筆記本中包含筆記本?
- 16. 如何在ipython筆記本中創建新筆記本?
- 17. IPython筆記本輸出中的HTML CSS樣式
- 18. 將ipython筆記本中ggplot的輸出保存到文件
- 19. ipython筆記本rmagic擴展空行在輸出
- 20. Tensor.eval()不輸出。就在IPython的筆記本
- 21. 使用ipython筆記本在茱莉亞沒有輸出
- 22. 在IPython筆記本中居中標題
- 23. 啓動iPython筆記本時出錯
- 24. 出口jupyter ipython筆記本到pdf
- 25. 加載IPython Jupyter筆記本時出錯:
- 26. 轉換Ipython筆記本時出錯
- 27. 64位運行ipython筆記本出錯
- 28. 在IPython筆記本中選擇文件
- 29. 在代理中使用iPython筆記本
- 30. 在ipython筆記本中的Unicode
你使用哪個IPython版本? – Jakob
iPython 1.1.0,Python 2.7.3 – James