python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -
let's consider axis has multiple lines colors such blue, green, yellow, red, magenta, cyan etc. when user selects curve , presses ok without changing anything, automatically yellow , green colors changed slight difference.
this happens yellow, green colors.
import sys import numpy np matplotlib.figure import figure import matplotlib matplotlib.use("qt4agg") matplotlib.rcparams['backend.qt4']='pyside' matplotlib.backends.backend_qt4agg import figurecanvasqtagg figurecanvas, navigationtoolbar2qtagg navigationtoolbar matplotlib.figure import figure import pyside pyside import qtgui, qtcore class myapp(qtgui.qmainwindow): def __init__(self, parent=none): qtgui.qmainwindow.__init__(self, parent) self.widget = qtgui.qwidget() self.fig = figure((5.0, 4.0), dpi=100) self.canvas = figurecanvas(self.fig) self.toolbar = navigationtoolbar(self.canvas, self) vbox = qtgui.qvboxlayout() vbox.addwidget(self.canvas) # matplotlib canvas vbox.addwidget(self.toolbar) self.widget.setlayout(vbox) self.setcentralwidget(self.widget) self.axes = self.fig.add_subplot(111) x = np.linspace(-np.pi, np.pi, 256, endpoint=true) c, s = np.cos(x), np.sin(x) self.axes.plot(x, c, linewidth=1.0, linestyle="-", label="cosine") self.axes.plot(x, s, linewidth=1.0, linestyle="-", label="sine") self.axes.legend() self.canvas.draw() def main(): app = qtgui.qapplication(sys.argv) form = myapp() form.show() app.exec_() if __name__ == "__main__": main()
now run script , click on edit curves , axes parameters button of toolbar , click ok without changes. can notice green color changing. same happens yellow color also.
thanks, haney.
Comments
Post a Comment