Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Wrong location of Y-tick-labels.

Đang mở
#587 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
matplotlib, python
Lĩnh vực
data-visualization

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hành vi được báo cáo của hàm set_fibs() trong issue, đặc biệt là axes[0].secondary_yaxis('left') và cấu hình nhãn tick, bằng ảnh chụp màn hình được liên kết và data.zip. Hoàn thành có nghĩa là xác định xem các nhãn của trục Y phụ có thể được căn thẳng với các tick tương ứng mà không làm mất lưới giá chính hay không; không có tệp repository hoặc test nào được nêu tên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

question

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

screendump

data.zip

Ngôn ngữ chính
Python
Star
4.4k
Fork
678
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của matplotlib/mplfinance

Tất cả issue của matplotlib/mplfinance

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.