Wrong location of Y-tick-labels.
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- matplotlib, python
调研方向
首先使用链接的屏幕截图和 data.zip,复现 issue 中报告的 set_fibs() 函数行为,尤其是 axes[0].secondary_yaxis('left') 和刻度标签配置。完成的标准是确定次 Y 轴标签是否可以与其刻度对齐,同时不丢失主价格网格;未指定任何仓库文件或测试。
由索引模型根据 Issue 内容生成。
描述
Dear Mr. Goldfarb, once again I ask for your assistance in solving a problem. I'm still working on an all in one solution, but this time it is build around mplfinance and pandas_ta. As you can see in the screen dump, this plot is based on the default style of mplfinance. But I can change it on the fly by the button 'settings'. With settings you can choose out all the mplfinance types and styles. It is too hard to discus at once all the options i wrote so far. But it is interactive and based on tkinter and TkAgg or Agg backend.
The problem:
Adding a secondary Yaxis on the first plot of mplfinance 'the date-price plot'. The secondary Y-axis contain the fibonacci levels and the values feeded by a dict. As you can see the lines will be plot correct, no problem. The major failure is that the Y-tick-labels don't follow the Y- ticks. The tick-labels always will be plotted on de opposite site of the Y-ticks. Whatever I try. The 'twinx' is not a solution because it block the cursor acces to the first plot axes[0] the 'date-price plot', for a dark reason. I don't offer the cursor for it, because it works fast and fine. It plot the date and price value left on the bottom toolbar. The minor problem after adding the fibonacci levels, the grid of the price ticks will be lost. Below you will find the function how I plot the fibonacci lines and config of the secondary Y-axis. I will hope You will and can help me ? Many thanks in advance.
def set_fibs():
global fib, axes
bolds = ['0.0', '100.0', '200.0', '300.0', '400.0', '500.0', '600.0', '700.0', '800.0', '900.0']
yliFor = []
yliLoc = []
limit = axes[0].get_ylim()
y2 = axes[0].secondary_yaxis('left')
y2.set_ylim(limit[0], limit[1])
for k, v in fib.items():
if v <= limit[1] and v >= limit[0]:
tmp = k + ': ' + "{:.3f}".format(v)
yliFor.append(tmp)
yliLoc.append(v)
if any(sb in k for sb in bolds):
axes[0].axhline(v, linestyle='solid', color='brown', lw=0.9, label=k)
else:
if 'Fs' in k:
axes[0].axhline(v, linestyle='dashed', color='orange', lw=0.5, label=k)
else:
axes[0].axhline(v, linestyle='dashed', color='brown', lw=0.5, label=k)
y2.axes.set_yticks(yliLoc)
y2.axes.yaxis.set_ticklabels(yliFor, fontsize=8, color='brown')
for it in y2.get_yticklabels():
txt = it.get_text()
if 'Fs' in txt:
it.set_color('orange')
y2.set_ylabel('Fibonacci', color='brown')
return

- 主要语言
- Python
- 星标
- 4.4k
- 派生
- 678
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
matplotlib/mplfinance 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
matplotlib/mplfinance#672 ·
-
难度 5/5 一周以上 新手友好度 10/100
matplotlib/mplfinance#700 ·
-
enhancement
难度 5/5 一周以上 新手友好度 30/100
matplotlib/mplfinance#695 ·
-
question
难度 3/5 1-2 天 新手友好度 25/100
matplotlib/mplfinance#691 · 1 条评论 ·
-
question
难度 4/5 3-5 天 新手友好度 52/100
matplotlib/mplfinance#690 · 5 条评论 ·
查看 matplotlib/mplfinance 的全部 Issue
相似的 Issue
-
area: harness bug status: needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
Human-Agent-Society/reef#625 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 80/100
learningequality/kolibri#15351 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
Name consistency 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eellak/triplestore#65 · 1 条评论 ·