mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
IC: Apply new PamhyrPlot features.
This commit is contained in:
1 parent
4f747f8fa7
commit
bfd166b717
3 files changed
+67
-50
No files matched your search
@@ -21,47 +21,49 @@ from View.Tools.PamhyrPlot import PamhyrPlot
|
||||
|
||||
|
||||
class PlotDischarge(PamhyrPlot):
|
||||
def __init__(self, canvas=None, trad=None, toolbar=None,
|
||||
data=None, parent=None):
|
||||
super(PlotDischarge, self).__init__(
|
||||
canvas=canvas,
|
||||
trad=trad,
|
||||
data=data,
|
||||
toolbar=toolbar,
|
||||
parent=parent
|
||||
)
|
||||
|
||||
self.label_x = self._trad["kp"]
|
||||
self.label_y = self._trad["discharge"]
|
||||
|
||||
self._isometric_axis = False
|
||||
|
||||
self._auto_relim_update = True
|
||||
self._autoscale_update = True
|
||||
|
||||
@timer
|
||||
def draw(self, highlight=None):
|
||||
self.canvas.axes.cla()
|
||||
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
|
||||
def draw(self):
|
||||
self.init_axes()
|
||||
|
||||
if self.data is None:
|
||||
return
|
||||
|
||||
self.canvas.axes.set_ylabel(
|
||||
self._trad["discharge"],
|
||||
color='black', fontsize=11
|
||||
)
|
||||
self.canvas.axes.set_xlabel(
|
||||
self._trad["kp"],
|
||||
color='black', fontsize=11
|
||||
)
|
||||
self.draw_data()
|
||||
|
||||
self.idle()
|
||||
self._init = True
|
||||
|
||||
def draw_data(self):
|
||||
kp = self.data.reach.reach.get_kp()
|
||||
|
||||
self.canvas.axes.set_xlim(
|
||||
left=min(kp), right=max(kp)
|
||||
)
|
||||
|
||||
if len(self.data) != 0:
|
||||
kp = self.data.get_kp()
|
||||
discharge = self.data.get_discharge()
|
||||
|
||||
self.line_kp_zmin = self.canvas.axes.plot(
|
||||
kp, discharge,
|
||||
color='r', lw=1.
|
||||
color=self.color_plot,
|
||||
**self.plot_default_kargs
|
||||
)
|
||||
|
||||
self.canvas.figure.tight_layout()
|
||||
self.canvas.figure.canvas.draw_idle()
|
||||
if self.toolbar is not None:
|
||||
self.toolbar.update()
|
||||
|
||||
# self._init = True
|
||||
|
||||
@timer
|
||||
def update(self, ind=None):
|
||||
if not self._init:
|
||||
self.draw()
|
||||
return
|
||||
self.draw()
|
||||
Reference in new issue
Block a user