mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Plot: Fill between in KPC and fill water zone in XY.
parent
24bc373827
commit
6356bab320
|
|
@ -90,6 +90,11 @@ class PlotKPC(APlot):
|
|||
color='b',
|
||||
)
|
||||
|
||||
self.canvas.axes.fill_between(
|
||||
kp, z_min, water_z,
|
||||
color='blue', alpha=0.5, interpolate=True
|
||||
)
|
||||
|
||||
self.canvas.figure.tight_layout()
|
||||
self.canvas.figure.canvas.draw_idle()
|
||||
if self.toolbar is not None:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from functools import reduce
|
||||
|
||||
from tools import timer, trace
|
||||
|
|
@ -27,6 +29,8 @@ from PyQt5.QtCore import (
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
class PlotXY(APlot):
|
||||
def __init__(self, canvas=None, results=None,
|
||||
reach_id=0, profile_id=0,
|
||||
|
|
@ -109,7 +113,23 @@ class PlotXY(APlot):
|
|||
for x, y in zip(x_complete, y_complete)
|
||||
]
|
||||
|
||||
if self.display_current:
|
||||
# Current profile
|
||||
profile = reach.profile(self._current_profile_id).geometry
|
||||
|
||||
self.plot_selected, = self.canvas.axes.plot(
|
||||
profile.x(),
|
||||
profile.y(),
|
||||
lw=1., markersize=3,
|
||||
marker='+', color="b"
|
||||
)
|
||||
self.plot_selected.set_visible(False)
|
||||
|
||||
# Display point under water
|
||||
poly_l_x = []
|
||||
poly_l_y = []
|
||||
poly_r_x = []
|
||||
poly_r_y = []
|
||||
for profile in reach.profiles:
|
||||
water_z = profile.get_ts_key(
|
||||
self._current_timestamp, "Z"
|
||||
|
|
@ -125,24 +145,23 @@ class PlotXY(APlot):
|
|||
([], [])
|
||||
)
|
||||
|
||||
poly_l_x.append(x[0])
|
||||
poly_l_y.append(y[0])
|
||||
poly_r_x.append(x[-1])
|
||||
poly_r_y.append(y[-1])
|
||||
|
||||
self.canvas.axes.plot(
|
||||
x, y, lw=1.,
|
||||
color='b',
|
||||
markersize=4,
|
||||
markersize=1,
|
||||
marker='o'
|
||||
)
|
||||
|
||||
if self.display_current:
|
||||
# Current profile
|
||||
profile = reach.profile(self._current_profile_id).geometry
|
||||
|
||||
self.plot_selected, = self.canvas.axes.plot(
|
||||
profile.x(),
|
||||
profile.y(),
|
||||
lw=1., markersize=3,
|
||||
marker='+', color="b"
|
||||
)
|
||||
self.plot_selected.set_visible(False)
|
||||
poly_x = poly_l_x + list(reversed(poly_r_x)) + [poly_l_x[0]]
|
||||
poly_y = poly_l_y + list(reversed(poly_r_y)) + [poly_l_y[0]]
|
||||
# FIXME: Fill do not works ? (tmp fix: use plot)
|
||||
self.canvas.axes.fill(poly_x, poly_y, color='blue', alpha=0.5)
|
||||
self.canvas.axes.plot(poly_x, poly_y, color='blue', alpha=0.5)
|
||||
|
||||
self.canvas.axes.autoscale_view(True, True, True)
|
||||
self.canvas.axes.autoscale()
|
||||
|
|
|
|||
Loading…
Reference in New Issue