沿图的X轴自由移动峰的公式

问题描述

我绘制了一个指数图,现在我想沿X轴自由移动峰。
中心应该像铃铛,右边应该像我当前的图表,但完全相反。
我该怎么做?

import matplotlib
import math
import numpy as np
matplotlib.use('Agg')
import matplotlib.pyplot as plt

arr_name=[]
arr_value=[]
k=-0.01
for l in range(0,100):
    x=pow(k,2)*np.exp(-k*1.8);
    if (l%10)==0:
        arr_name.append(l/10)
    else:
        arr_name.append("")
    arr_value.append(x)
    k=k+0.05
    print x

y_pos = np.arange(len(arr_name))
plt.figure(figsize=(8,4))
plt.rcParams.update({'font.size': 8})
plt.subplot(1,1,1)
plt.plot(y_pos,arr_value,'-r')
plt.xticks(y_pos,arr_name)
plt.savefig('/var/www/html/bar/img/test_chart.png')

exponential chart

更新
可能的解决方案是在图表中心绘制峰值:

for l in range(0,5)*np.exp(-k*1.96);
    if (l%10)==0:
        arr_name.append(l/10)
    else:
        arr_name.append("")
    arr_value.append(x)
    if l>50:
        k=k-0.05
    else:
        k=k+0.05
    print x

enter image description here

增加可逆性:

arr_value.reverse()

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)