Theschill
2012-05-08 19:25:05 UTC
Hello,
I'm new to guiqwt and I am using the the CurveDialog Example to add
plots on both the left and right axis. I can get the curves to plot to
the right axis but the axis ticks and label do not appear until I go
to the axes parameters of the curve on the right axes and hit apply
(In this case, curve 2). After this, the right axis ticks and label
appears. Is there a wayto make the right axis visible without manually
opening the parameters dialog box and hitting apply?
Here is my modified code:
----------------------------------------------------------------------------------------------------------------------------
# -*- coding: utf-8 -*-
from guidata.qt.QtGui import QFont
from guiqwt.plot import CurveDialog
from guiqwt.builder import make
def plot(*items):
win = CurveDialog(edit=False, toolbar=True, wintitle="AMI Plot
Tool",
options=dict(title="Plot Title",
xlabel="xlabel",
ylabel=("Left Title", "Right
Title")))
plot = win.get_plot()
for item in items:
plot.add_item(item)
plot.set_axis_font("right", QFont("Courier"))
plot.set_axis_font("left", QFont("Courier"))
win.get_itemlist_panel().show()
plot.set_items_readonly(False)
win.show()
win.exec_()
def test():
"""Test"""
# -- Create QApplication
import guidata
_app = guidata.qapplication()
# --
from numpy import linspace, sin
x = linspace(-10, 10, 200)
y = sin(sin(sin(x)))
x2 = linspace(-10, 10, 20)
y2 = sin(sin(sin(x2)))
plot(make.curve(x, y, color="b", yaxis = "left"),
make.curve(x2, y2, color="g", curvestyle="Sticks", yaxis =
"right"),
make.curve(x, sin(2*y), color="r", yaxis = "left"))
if __name__ == "__main__":
test()
I'm new to guiqwt and I am using the the CurveDialog Example to add
plots on both the left and right axis. I can get the curves to plot to
the right axis but the axis ticks and label do not appear until I go
to the axes parameters of the curve on the right axes and hit apply
(In this case, curve 2). After this, the right axis ticks and label
appears. Is there a wayto make the right axis visible without manually
opening the parameters dialog box and hitting apply?
Here is my modified code:
----------------------------------------------------------------------------------------------------------------------------
# -*- coding: utf-8 -*-
from guidata.qt.QtGui import QFont
from guiqwt.plot import CurveDialog
from guiqwt.builder import make
def plot(*items):
win = CurveDialog(edit=False, toolbar=True, wintitle="AMI Plot
Tool",
options=dict(title="Plot Title",
xlabel="xlabel",
ylabel=("Left Title", "Right
Title")))
plot = win.get_plot()
for item in items:
plot.add_item(item)
plot.set_axis_font("right", QFont("Courier"))
plot.set_axis_font("left", QFont("Courier"))
win.get_itemlist_panel().show()
plot.set_items_readonly(False)
win.show()
win.exec_()
def test():
"""Test"""
# -- Create QApplication
import guidata
_app = guidata.qapplication()
# --
from numpy import linspace, sin
x = linspace(-10, 10, 200)
y = sin(sin(sin(x)))
x2 = linspace(-10, 10, 20)
y2 = sin(sin(sin(x2)))
plot(make.curve(x, y, color="b", yaxis = "left"),
make.curve(x2, y2, color="g", curvestyle="Sticks", yaxis =
"right"),
make.curve(x, sin(2*y), color="r", yaxis = "left"))
if __name__ == "__main__":
test()