久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='9sHSd'><tr id='9sHSd'><dt id='9sHSd'><q id='9sHSd'><span id='9sHSd'><b id='9sHSd'><form id='9sHSd'><ins id='9sHSd'></ins><ul id='9sHSd'></ul><sub id='9sHSd'></sub></form><legend id='9sHSd'></legend><bdo id='9sHSd'><pre id='9sHSd'><center id='9sHSd'></center></pre></bdo></b><th id='9sHSd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='9sHSd'><tfoot id='9sHSd'></tfoot><dl id='9sHSd'><fieldset id='9sHSd'></fieldset></dl></div>

      <legend id='9sHSd'><style id='9sHSd'><dir id='9sHSd'><q id='9sHSd'></q></dir></style></legend>
    1. <small id='9sHSd'></small><noframes id='9sHSd'>

      <tfoot id='9sHSd'></tfoot>
        <bdo id='9sHSd'></bdo><ul id='9sHSd'></ul>

      1. 如何將 yaxis 刻度標簽設(shè)置在固定位置,以便當我

        How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設(shè)置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應(yīng)該可見
              <legend id='Blkwi'><style id='Blkwi'><dir id='Blkwi'><q id='Blkwi'></q></dir></style></legend>
              <tfoot id='Blkwi'></tfoot>
                  <bdo id='Blkwi'></bdo><ul id='Blkwi'></ul>
                • <small id='Blkwi'></small><noframes id='Blkwi'>

                    <tbody id='Blkwi'></tbody>
                  <i id='Blkwi'><tr id='Blkwi'><dt id='Blkwi'><q id='Blkwi'><span id='Blkwi'><b id='Blkwi'><form id='Blkwi'><ins id='Blkwi'></ins><ul id='Blkwi'></ul><sub id='Blkwi'></sub></form><legend id='Blkwi'></legend><bdo id='Blkwi'><pre id='Blkwi'><center id='Blkwi'></center></pre></bdo></b><th id='Blkwi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Blkwi'><tfoot id='Blkwi'></tfoot><dl id='Blkwi'><fieldset id='Blkwi'></fieldset></dl></div>

                  本文介紹了如何將 yaxis 刻度標簽設(shè)置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應(yīng)該可見?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在我的程序中,我先繪制了圖,然后將圖導入到畫布中.然后我將畫布導入滾動區(qū)域.當我運行我的程序時,如果我向左滾動 yaxis 刻度標簽會隱藏,或者我向右滾動 yaxis 刻度標簽也會隱藏.我采取了兩個軸.軸,軸 2.我已經(jīng)設(shè)置了 axes2.yaxis.tick_right() 和 axes.yaxis.tick_right().

                  in my program i have taken figure first then i import figue into canvas. Then i import canvas into scroll area. when i run my program ,then if i turn left scroll the yaxis tick label goes hide or i turn right scroll the yaxis tick label goes also hide. i have taken two axis. axis,axis2. i have set axes2.yaxis.tick_right() and axes.yaxis.tick_right().

                  我希望 yaxis 刻度標簽將保持在右側(cè)并且別名可見,無論我向左或向右滾動.

                  import sys
                  from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
                  import matplotlib.pyplot as plt
                  from matplotlib.figure import Figure
                  from PyQt5.QtWidgets import QMainWindow,QVBoxLayout
                  from PyQt5.QtWidgets import QApplication
                  from PyQt5 import QtCore, QtGui, QtWidgets
                  import datetime
                  from matplotlib.dates import num2date, date2num
                  from mpl_finance import candlestick_ochl as candlestick
                  import numpy as np
                  import matplotlib.ticker as ticker
                  import matplotlib.dates as mdates
                  import pylab as pl
                  class MainWindow_code_serarch(object):
                  
                      def setup_code_serarch(self, MainWindow):
                          MainWindow.setObjectName("MainWindow")
                          MainWindow.resize(870, 680)
                          self.centralwidget = QtWidgets.QWidget(MainWindow)
                          self.centralwidget.setObjectName("centralwidget")
                          self.verticalLayoutWidget1 = QtWidgets.QWidget(self.centralwidget)
                          self.verticalLayoutWidget1.setGeometry(QtCore.QRect(17, 30, 741, 13))
                          self.verticalLayoutWidget1.setObjectName("verticalLayoutWidget")
                          self.verticalLayout1 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget1)
                          self.verticalLayout1.setContentsMargins(0, 0, 0, 0)
                          self.verticalLayout1.setObjectName("verticalLayout1")
                          self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
                          self.verticalLayoutWidget.setGeometry(QtCore.QRect(17, 10, 940, 603))
                          self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
                          self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
                          self.verticalLayout.setContentsMargins(0, 0, 0, 0)
                          self.verticalLayout.setObjectName("verticalLayout")
                          self.figure = Figure(figsize=(100,7.2), dpi=80, facecolor='k')
                          self.canvas = FigureCanvas(self.figure)
                          self.widget = QtWidgets.QWidget()
                          self.scroll_area = QtWidgets.QScrollArea(self.widget)
                          self.scroll_area.setWidget(self.canvas)
                          self.verticalLayout.addWidget(self.scroll_area)
                          axes,axes2 = self.figure.subplots(nrows=2, sharex=True)
                          data = {
                              'date': ['2018/10/30', '2018/11/03', '2018/11/04', '2018/11/05', '2018/11/07', '2018/11/10', '2018/11/11'],
                              'open': [8824, 8726.31, 8642.14, 8531.51, 8630.25, 8602.50, 8640.22],
                              'high': [8858, 8748.60, 8551.36, 8653.16, 8476.69, 8630, 8570.56],
                              'low': [8688, 8743.67, 8550.76, 8449.50, 8631.83, 8602.18, 8743.22],
                              'close': [8820, 8747.17, 8550.52, 8553., 8517.10, 8628.78, 8588.52],
                              'volume': [17759.56, 120000.17, 18739.52, 38599.50, 16517.10, 17723.78, 15588.52]
                          }
                          x = date2num([datetime.datetime.strptime(d, '%Y/%m/%d').date() for d in data['date']])
                          t= np.arange(len(data['date']))
                          candle_trace = zip(t, data['open'], data['high'], data['low'], data['close'], data['volume'])
                          candlestick(axes, candle_trace, width=.75, colorup='g', colordown='r')
                          axes2.plot(t, [1, 2, 3, 4, 7, 8, 9])
                          axes.set_position([0.02, 0.37, 0.88, 0.6])
                          axes2.set_position([0.02, 0.15, 0.88, 0.22])
                          axes.tick_params(axis='both', color='#ffffff', labelcolor='#ffffff')
                          axes.yaxis.tick_right()
                          axes2.tick_params(axis='both', color='#ffffff', labelcolor='#ffffff')
                          axes2.grid(color='lightgray', linewidth=.5, linestyle=':')
                          axes.grid(color='lightgray', linewidth=.5, linestyle=':')
                          axes2.yaxis.tick_right()
                          axes.autoscale_view()
                          axes2.autoscale_view()
                          axes.set_facecolor('#041105')
                          axes2.set_facecolor('#041105')
                          # N = len(dates)
                          axes.set_xticks(range(0, len((x)), 1))
                          axes.set_xticklabels([mdates.num2date(d).strftime('%b-%d') for d in x])
                          axes.set_xticklabels([mdates.num2date(d).strftime('%Y-%m-%d') for d in x])
                          axes2.set_xticklabels([mdates.num2date(d).strftime('%Y-%m-%d') for d in x])
                          self.canvas.draw()
                          MainWindow.setCentralWidget(self.centralwidget)
                          self.menubar = QtWidgets.QMenuBar(MainWindow)
                          self.menubar.setGeometry(QtCore.QRect(0, 0, 246, 21))
                          self.menubar.setObjectName("menubar")
                          MainWindow.setMenuBar(self.menubar)
                          self.statusbar = QtWidgets.QStatusBar(MainWindow)
                          self.statusbar.setObjectName("statusbar")
                          MainWindow.setStatusBar(self.statusbar)
                          # self.pushButton.clicked.connect(self.graphShowCode)
                  
                          self.retranslateUi(MainWindow)
                          QtCore.QMetaObject.connectSlotsByName(MainWindow)
                  
                      def retranslateUi(self, MainWindow):
                          _translate = QtCore.QCoreApplication.translate
                          MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
                          # self.pushButton.setText(_translate("MainWindow", "OK"))
                  if __name__ == "__main__":
                      import sys
                      app = QtWidgets.QApplication(sys.argv)
                      MainWindow = QtWidgets.QMainWindow()
                      ui = MainWindow_code_serarch()
                      ui.setup_code_serarch(MainWindow)
                      MainWindow.show()
                      sys.exit(app.exec_())
                  

                  輸出圖像:

                  當我向左滾動輸出圖像 2:

                  when i turn scroll left output image 2:

                  推薦答案

                  這是一種使用 PyQt QtScrollBar 滾動軸內(nèi)容的方法.這是通過根據(jù)滾動條的值更改軸的限制來完成的.為此,注冊了對 QtScrollBaractionTriggered 方法的回調(diào),該方法會更改坐標軸的限制.

                  Here is a way to scroll the content of an axes with a PyQt QtScrollBar. This is done by changing the limits of the axes depending on the scroll bar's value. To this end, a callback to the QtScrollBar's actionTriggered method is registered that changes the limits of the axes.

                  import sys
                  import matplotlib
                  # Make sure that we are using QT5
                  matplotlib.use('Qt5Agg')
                  import matplotlib.pyplot as plt
                  from PyQt5 import QtWidgets, QtCore
                  from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
                  from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
                  import numpy as np
                  
                  class ScrollableWindow(QtWidgets.QMainWindow):
                      def __init__(self, fig, ax, step=0.1):
                          plt.close("all")
                          if not QtWidgets.QApplication.instance():
                              self.app = QtWidgets.QApplication(sys.argv)
                          else:
                              self.app = QtWidgets.QApplication.instance() 
                  
                          QtWidgets.QMainWindow.__init__(self)
                          self.widget = QtWidgets.QWidget()
                          self.setCentralWidget(self.widget)
                          self.widget.setLayout(QtWidgets.QVBoxLayout())
                          self.widget.layout().setContentsMargins(0,0,0,0)
                          self.widget.layout().setSpacing(0)
                  
                          self.fig = fig
                          self.ax = ax
                          self.canvas = FigureCanvas(self.fig)
                          self.canvas.draw()
                          self.scroll = QtWidgets.QScrollBar(QtCore.Qt.Horizontal)
                          self.step = step
                          self.setupSlider()
                          self.nav = NavigationToolbar(self.canvas, self.widget)
                          self.widget.layout().addWidget(self.nav)
                          self.widget.layout().addWidget(self.canvas)
                          self.widget.layout().addWidget(self.scroll)
                  
                          self.canvas.draw()
                          self.show()
                          self.app.exec_()
                  
                      def setupSlider(self):
                          self.lims = np.array(self.ax.get_xlim())
                          self.scroll.setPageStep(self.step*100)
                          self.scroll.actionTriggered.connect(self.update)
                          self.update()
                  
                      def update(self, evt=None):
                          r = self.scroll.value()/((1+self.step)*100)
                          l1 = self.lims[0]+r*np.diff(self.lims)
                          l2 = l1 +  np.diff(self.lims)*self.step
                          self.ax.set_xlim(l1,l2)
                          print(self.scroll.value(), l1,l2)
                          self.fig.canvas.draw_idle()
                  
                  
                  # create a figure and some subplots
                  fig, ax = plt.subplots()
                  t = np.linspace(0,3000,101)
                  x = np.cumsum(np.random.randn(len(t)))
                  ax.plot(t,x, marker="o")
                  
                  # pass the figure to the custom window
                  a = ScrollableWindow(fig,ax)
                  

                  對于圖中內(nèi)的滾動條,請參閱可滾動條形圖matplotlib

                  For a Scrollbar within the figure, see Scrollable Bar graph matplotlib

                  這篇關(guān)于如何將 yaxis 刻度標簽設(shè)置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應(yīng)該可見?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                  Erasing pen on a canvas(在畫布上擦筆)

                    <small id='1vdWo'></small><noframes id='1vdWo'>

                    • <bdo id='1vdWo'></bdo><ul id='1vdWo'></ul>

                            <tbody id='1vdWo'></tbody>
                          <legend id='1vdWo'><style id='1vdWo'><dir id='1vdWo'><q id='1vdWo'></q></dir></style></legend>
                        1. <i id='1vdWo'><tr id='1vdWo'><dt id='1vdWo'><q id='1vdWo'><span id='1vdWo'><b id='1vdWo'><form id='1vdWo'><ins id='1vdWo'></ins><ul id='1vdWo'></ul><sub id='1vdWo'></sub></form><legend id='1vdWo'></legend><bdo id='1vdWo'><pre id='1vdWo'><center id='1vdWo'></center></pre></bdo></b><th id='1vdWo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1vdWo'><tfoot id='1vdWo'></tfoot><dl id='1vdWo'><fieldset id='1vdWo'></fieldset></dl></div>
                          1. <tfoot id='1vdWo'></tfoot>
                            主站蜘蛛池模板: 日韩高清在线播放 | 免费av一区 | 中文字幕av一区二区三区 | 国产精品美女久久 | 亚洲国产精品suv | 欧美一级黄 | 亚洲午夜天堂 | 不卡视频在线观看 | 国产又粗又猛又黄又爽无遮挡 | 日本精品视频 | 中文字幕av久久爽av | 日韩一级二级三级 | 秋霞啪啪片 | 成人在线播放视频 | 亚洲第一色网 | 一级大片免费看 | 成人国产在线 | 国产亚洲视频在线观看 | 国产在线欧美 | 在线视频91 | 97超碰人人 | 五月色综合 | 久久久国 | 午夜天堂av| 视频在线一区二区 | 天堂成人在线 | 亚洲第一黄色 | 亚洲国产日本 | 欧美成人性生活视频 | 日本a在线观看 | 亚洲另类色图 | 亚洲欧美中文字幕 | 欧美黑人一区二区三区 | 成年人免费在线视频 | 久草福利视频 | 日韩a在线观看 | 国产欧美日韩视频 | 一区二区欧美日韩 | 国产黄色大片 | 黑人精品一区二区 | 欧美a级成人淫片免费看 |