l14107cb 发表于 2024-10-3 19:05:00

你可能并不晓得这般定制炫酷的jupyter主题


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">之前用多了mac,习惯了苹果“友好”的字体和界面,<span style="color: black;">近期</span>在windows上<span style="color: black;">运用</span>jupyter notebook的时候,总觉得界面不是很舒服,见下面的效果图,尤其是字体,看着挺难受的,严重影响了<span style="color: black;">运用</span>的心情哈哈哈。那<span style="color: black;">这般</span>“丑”的界面有<span style="color: black;">无</span>办法更改呢,答案是肯定的,今天带<span style="color: black;">大众</span>来看一种比较简便的<span style="color: black;">办法</span>,修改windows默认的jupyter主题。</span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/0151be2948bf4afca53f9566ddd94cb8~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=RS2lp3aCcRvQsj6Zqbq1PZCoaPc%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">咱们</span>要<span style="color: black;">运用</span>的是github上的一个开源的jupyter主题定制工具:</span><span style="color: black;"><span style="color: black;">jupyter-themes</span></span><span style="color: black;">,安装方便,<span style="color: black;">运用</span>简单,下面<span style="color: black;">一块</span>来学习一下,链接为:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">https://github.com/dunovank/jupyter-themes。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">安装</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在windows下打开anaconda自带的</span><span style="color: black;"><span style="color: black;">Anaconda Prompt</span></span><span style="color: black;">命令行工具,<span style="color: black;">运用</span>最基本简便的pip安装<span style="color: black;">就可</span></span></p>pip&nbsp;<span style="color: black;">install</span>&nbsp;jupyterthemes&nbsp;<span style="color: black;">#安装jupyterthemes</span>
    pip&nbsp;<span style="color: black;">install</span>&nbsp;<span style="color: black;">--upgrade&nbsp;jupyterthemes&nbsp;#更新到最新版本的jupyterthemes</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">查看可选的主题列表</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">仍然在</span><span style="color: black;"><span style="color: black;">Anaconda Prompt</span></span><span style="color: black;">中执行下面的命令</span></p><span style="color: black;">jt</span>&nbsp;-l&nbsp;<span style="color: black;">#查看可用的jupytertheme主题</span>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/758a5aed62fc461aaf23a87002547638~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=WVnTYtTdnySOzIp1Cfcnt3z5fPg%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">选取</span>主题</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">运用</span>-t选项<span style="color: black;">选取</span>主题</span></p><span style="color: black;">jt</span>&nbsp;-t&nbsp;chesterish<span style="color: black;">#&nbsp;<span style="color: black;">选取</span>chesterish主题</span>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/5f7b501f613843aba3169b4ddf9daf5a~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=VmyVTx9vEPTiXW8YcNOBLkNEdt8%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">此时<span style="color: black;">起步</span>jupyter notebook 就会<span style="color: black;">发掘</span>界面变<span style="color: black;">成为了</span>酷酷的黑色,<span style="color: black;">然则</span>字体并<span style="color: black;">无</span>变化,这是<span style="color: black;">由于</span><span style="color: black;">咱们</span>并<span style="color: black;">无</span>指定字体。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">设置代码字体和字号</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">运用</span>-f选项设置字体</span></p><span style="color: black;">jt</span>&nbsp;-t&nbsp;chesterish&nbsp;-f&nbsp;roboto&nbsp;-fs&nbsp;<span style="color: black;">12</span>
    <span style="color: black;">#设置主题为chesterish,字体为roboto,字体<span style="color: black;">体积</span>为12&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">效果如下:</span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/5001fcf9c7b64abe8519a21951a93662~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=Zz5Uvxq2QDfWcAEIO28kORC9z4k%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">咱们</span><span style="color: black;">发掘</span>字体<span style="color: black;">出现</span>了变化,舒服多了,<span style="color: black;">然则</span>原来菜单栏下方的工具条不见了,文件名<span style="color: black;">亦</span><span style="color: black;">无</span>了。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">表示</span>工具条、log</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">运用</span>-T命令使工具条可见,<span style="color: black;">运用</span>-N使Name和logo可见</span></p><span style="color: black;">jt</span>&nbsp;-t&nbsp;chesterish&nbsp;-f&nbsp;roboto&nbsp;-fs&nbsp;<span style="color: black;">12</span>&nbsp;-T&nbsp;-N&nbsp;<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">执行完后刷新页面,效果如下</span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/cc67aae3ca994708bdc1e38f26411b5e~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=fhSU%2BnjrZmQRMMyy%2FPhAYYZHkc0%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">看一下其他选项</span></strong></p><span style="color: black;">-tf&nbsp;设置markdown的字体</span>
    <span style="color: black;">-tfs&nbsp;设置markdown字体<span style="color: black;">体积</span></span>
    <span style="color: black;">-dfs&nbsp;设置Pandas&nbsp;DataFrame的字体<span style="color: black;">体积</span></span>
    <span style="color: black;">-ofs&nbsp;设置输出的字体<span style="color: black;">体积</span></span>
    <span style="color: black;">-altp&nbsp;关掉输入输出前面的数字</span>
    ....其他详见官网<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/1214f159f2db499abcccab6aae660334~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=zmi59nHb12xkE0NAdYIPj13dKEg%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">恢复原主题</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">倘若</span>你不想<span style="color: black;">运用</span><span style="color: black;">此刻</span>的主题,<span style="color: black;">能够</span><span style="color: black;">运用</span>-r选项进行重置</span></p><span style="color: black;">jt</span>&nbsp;-r&nbsp;<span style="color: black;">#恢复原主题</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">看一下别的主题什么样子</span></strong></p><span style="color: black;">jt</span>&nbsp;-t&nbsp;grade3<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/9de3a9f312004500be34552c2c29ca10~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=0Td8tzef3LTbB1H3XCEgUKaK0w0%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">jt</span>&nbsp;-t&nbsp;gruvboxd<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/c12af4eed4124d6d8e6843ef00e54000~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=5WWoFcD1mtt5W9lT2mwL4DtjnNI%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">jt</span>&nbsp;-t&nbsp;gruvboxl&nbsp;<span style="color: black;">#最后一位的l应该是light的缩写</span>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/f25928c667b0405ab8b98b397d77a10b~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=uHNcmnhhGh5v4pepnPRT36Ejntg%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">jt</span>-t&nbsp;solarizedd<span style="color: black;">#最后一位的d应该是dark的缩写</span>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/f41d017cdd064465b40a10ab3b352090~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=WdFFo1r%2BbafsiPazksCCP5Z5fyA%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">分享一个设置</span></strong></p><span style="color: black;">jt</span>&nbsp;<span style="color: black;">-t</span>&nbsp;<span style="color: black;">oceans16</span>&nbsp;<span style="color: black;">-f</span>&nbsp;<span style="color: black;">fira</span>&nbsp;<span style="color: black;">-fs</span>&nbsp;<span style="color: black;">13</span>&nbsp;<span style="color: black;">-cellw</span>&nbsp;<span style="color: black;">90</span><span style="color: black;">%</span>&nbsp;<span style="color: black;">-ofs</span>&nbsp;<span style="color: black;">11</span>&nbsp;<span style="color: black;">-dfs</span>&nbsp;<span style="color: black;">11</span>&nbsp;<span style="color: black;">-T</span>
    <span style="color: black;"><span style="color: black;">源自</span>:https://blog.csdn.net/qq_30565883/article/details/79444750</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">画图风格的设置</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">咱们</span><span style="color: black;">能够</span><span style="color: black;">运用</span>jtplot设置matplotlib的rcParams字典属性,以便图形风格能够适配<span style="color: black;">咱们</span><span style="color: black;">选取</span>的主题。</span></p><span style="color: black;">from</span>&nbsp;jupyterthemes&nbsp;<span style="color: black;">import</span>&nbsp;jtplot
    jtplot.style(theme=<span style="color: black;">onedork</span>)&nbsp;<span style="color: black;">#<span style="color: black;">选取</span>一个绘图主题</span>

    <span style="color: black;">#设置绘图的额风格,如坐标轴字体,网格样式等</span>jtplot.style(context=<span style="color: black;">talk</span>,&nbsp;fscale=<span style="color: black;">1.4</span>,&nbsp;spines=<span style="color: black;">False</span>,&nbsp;gridlines=<span style="color: black;">--</span>)

    <span style="color: black;">#设置坐标轴,网格的开闭,图形<span style="color: black;">体积</span>等</span>
    jtplot.style(ticks=<span style="color: black;">True</span>,&nbsp;grid=<span style="color: black;">False</span>,&nbsp;figsize=(<span style="color: black;">6</span>,&nbsp;<span style="color: black;">4.5</span>))

    <span style="color: black;">#重置设置</span>
    jtplot.reset()<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">总结</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">咱们</span>简要学习了<span style="color: black;">运用</span>jupytertheme进行jupyter主题的定制,<span style="color: black;">大众</span><span style="color: black;">能够</span>尝试一下自己<span style="color: black;">爱好</span>的主题风格,<span style="color: black;">这般</span>在<span style="color: black;">运用</span>的时候能够保持一个愉悦的状态。<span style="color: black;">更加多</span>未详述的细节,<span style="color: black;">能够</span>参考github上的文档进行学习~欢迎交流~</span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/a51fdee18d6d47f994319dbb662e6533~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728117782&amp;x-signature=vO31mRnkpGhU4HcEx16yO3udXP4%3D" style="width: 50%; margin-bottom: 20px;"></div>




nqkk58 发表于 2024-10-21 09:49:25

期待与你深入交流,共探知识的无穷魅力。

nykek5i 发表于 2024-10-22 11:05:06

你说得对,我们一起加油,未来可期。

nqkk58 发表于 前天 08:19

楼主果然英明!不得不赞美你一下!

nqkk58 发表于 4 小时前

请问、你好、求解、谁知道等。
页: [1]
查看完整版本: 你可能并不晓得这般定制炫酷的jupyter主题