so have been playing pyqtgraph , came problem needed add strings x axis tick label (instead of default float). looked around , found show string values on x-axis in pyqtgraph the solution kind of need (the first solution on page, second 1 cause problems because on python 3.5). tried modified first solution, did not work. from pyqt4 import qtcore import pyqtgraph pg x = ['a', 'b', 'c', 'd', 'e', 'f'] y = [1, 2, 3, 4, 5, 6] xdict = dict(enumerate(x)) win = pg.graphicswindow() stringaxis = pg.axisitem(orientation='bottom') stringaxis.setticks([xdict.items()]) plot = win.addplot(axisitems={'bottom': stringaxis}) curve = plot.plot(xdict.keys(),y) if __name__ == '__main__': import sys if sys.flags.interactive != 1 or not hasattr(qtcore, 'pyqt_version'): pg.qtgui.qapplication.exec_() the error getting typeerror: 'dict_keys' object not support indexing on line curve = plot.plo...
Comments
Post a Comment