春江暮客

春江暮客的个人学习分享网站

包含标签 python 的文章

人工神经网络初探

人工神经网络初探

2018年12月10日 | 技术
本文用概念解释、房价预测例子和典型应用场景,帮助初学者快速理解人工神经网络的基本结构和它在 AI 中的常见用途。……

阅读全文

python画蝴蝶曲线图

python画蝴蝶曲线图

2018年11月7日 | 技术

蝴蝶曲线是由Temple H·Fay发现的可用极坐标函数表示的蝴蝶曲线。由于此曲线优美,因此就想把它作为博客favicon.ico,这里我使用python

matplotlib.pyplot包来绘制需要的蝴蝶曲线图。先看下漂亮的蝴蝶曲线吧。

butter

1.首先我们需要确定蝴蝶曲线的函数表达

math

math2

也可用球坐标表示

math3

2.选择python里面的matplotlib.pyplot作为画图工具

1.首先导入python包

import numpy as np
import matplotlib.pyplot as plt

2.设置个参数的值

t = np.arange(0.0, 12*np.pi, 0.01)
x = np.sin(t)*(np.e**np.cos(t) - 2*np.cos(4*t)-np.sin(t/12)**5)
y = np.cos(t)*(np.e**np.cos(t) - 2*np.cos(4*t)-np.sin(t/12)**5)

3.根据公式,使用numpy里面的函数使用plt画出所需图片

plt.figure(figsize=(8,6))
plt.axis('off')
plt.plot(x,y,color='blue',linewidth = '2')
#plt.show()
plt.savefig("butter.jpg",dpi=400)

butter_fly

4.使用Image重新调整图片到适当的大小使其符合favicon大小

from PIL import Image
im = Image.open("butter.jpg")
favicon = im.resize((50,50))
favicon.save("favicon.ico")

image_ico

至此,我们完成了使用python的matplotlib.pyplot包绘制漂亮的蝴蝶曲线的过程,把图片保存到网站跟目录就可以看到了!

……

阅读全文

标签

1024 12306 ablang adsense agents.md ai ai-agent ai-agents ai-seo algorithm amp antibodies apparmor argparse automation backup bash batch-processing binarycif bioinformatics biopython blockchain boltz bootstrapping boxes bubblewrap c-index cca cdn chatgpt checkpoint cli cloudflare codex cofoldarena copy cpu监控 cron csv cuda curl data-leakage data-processing data-quality data-validation datascience datavisualization debugging deployment desktop-app devtools disk-space disown docker dovecot download electron encoding esm esm2 esm3 esmc esmfold2 faceswap fasta fastmcp faulthandler ffmpeg file-descriptors file-io flashppi flask folium frontend game generator git github-actions google google-research grep gzip harness hls html http hugo indexnow javascript jev json jsonl just k-means kaggle langfuse leecode linux list litellm llm llms.txt logging logs lollipop lsof m3u8 machine-learning macos manacher matplotlib mcp mirror mmcif model-evaluation mp3 mp4 mpnn multiomics mutation mysql nanobert nanobodies networkx nginx normalize numpy ollama omegatherm pandas password pdb pep-723 phaser pillow pip postfix preprocessing print protein-alignment protein-design protein-embeddings protein-interactions protein-language-models protein-stability protein-structure proxy pydantic pyecharts pyqt python python3 r raincloud reproducibility requests reservoir-sampling rfoptimization rg ripgrep rosettafold3 roundcube rrsi rsi rsync s-tui sampling scale scikit-learn scrapy screen seaborn security selenium seo sequence-identity sha256 signals sklearn solana somaticsignatures spl sqlite ssh standardize static-site subprocess sysadmin system-one tensorflow tkinter toml tron tronpy troubleshooting turtle typesafe-ai ubuntu usdt uv vhhbert vite webp wordcloud wordpress workflow yaml 后台 寓言 概率 经济 贸易 迅雷解析 钱包

友情链接

其它