Skip to content

Commit

Permalink
updated 2d flux visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
jirhiker committed Sep 18, 2024
1 parent a898a6f commit 8c88dd0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 34 deletions.
90 changes: 57 additions & 33 deletions pychron/pipeline/editors/flux_visualization_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from operator import itemgetter
from pprint import pprint

from chaco.examples.demo.basic.scatter import bgcolor
from chaco.plot_containers import VPlotContainer
from numpy import (
linspace,
meshgrid,
Expand Down Expand Up @@ -405,7 +407,15 @@ def _graph_contour(self, x, y, z, r, reg, refresh):
cg = self.graph
if not isinstance(cg, FluxVisualizationGraph):
cg = FluxVisualizationGraph(
container_dict={"kind": "h", "bgcolor": self.plotter_options.bgcolor}
container_dict={"kind": "h",
"padding_left": 60,
"padding_right":0,
"padding_top": 60,
"padding_bottom": 60,
# "bgcolor": 'yellow',
# "fill_padding": True,
"bgcolor": self.plotter_options.bgcolor
}
)
self.graph = cg
else:
Expand All @@ -415,11 +425,13 @@ def _graph_contour(self, x, y, z, r, reg, refresh):
xtitle="X",
ytitle="Y",
add=False,
padding=0,
width=550,
height=550,
resizable="",
aspect_ratio=1,
padding=20,
# width=550,
# height=550,
resizable="hv",
# aspect_ratio=1,
# bgcolor='red',
# fill_padding=True,
)

ito = IrradiationTrayOverlay(
Expand Down Expand Up @@ -465,14 +477,22 @@ def predict_func(ptx, pty):

# add 1D slices
bottom_plot = cg.new_plot(
add=False, height=175, resizable="h", padding=0, xtitle="mm", ytitle="J"
add=False,
height=175,
# width=550,
resizable="h",
padding=20,
xtitle="mm", ytitle="J"
)

right_plot = cg.new_plot(
add=False,
width=175,
# height=600,
resizable="v",
padding=0,
padding_bottom=235,
orientation="v",
padding=20,
# xtitle='J',
ytitle="mm",
)
Expand Down Expand Up @@ -503,10 +523,10 @@ def predict_func(ptx, pty):

center_plot.x_axis.orientation = "top"

right_plot.orientation = "v"
right_plot.x_axis.orientation = "top"
right_plot.x_axis.tick_label_rotate_angle = 45
right_plot.y_axis.orientation = "right"
# right_plot.orientation = "v"
# right_plot.x_axis.orientation = "top"
# right_plot.x_axis.tick_label_rotate_angle = 45
# right_plot.y_axis.orientation = "right"
right_plot.x_axis.axis_line_visible = False
right_plot.y_axis.axis_line_visible = False

Expand Down Expand Up @@ -534,26 +554,21 @@ def predict_func(ptx, pty):

center.index.on_trait_change(cg.metadata_changed, "metadata_changed")

gridcontainer = container_factory(
kind="g",
# fill_padding=True,
# bgcolor='red',
padding_left=100,
padding_right=20,
padding_top=100,
padding_bottom=40,
shape=(2, 2),
spacing=(5, 5),
)

gridcontainer.add(center_plot)
gridcontainer.add(right_plot)
gridcontainer.add(bottom_plot)

# cb = cg.make_colorbar(center)
# cb.width = 50
# cb.padding_left = 50
# cg.plotcontainer.add(cb)
# gridcontainer = container_factory(
# kind="g",
# # fill_padding=True,
# # bgcolor='red',
# padding_left=100,
# padding_right=20,
# padding_top=100,
# padding_bottom=40,
# shape=(2, 2),
# spacing=(5, 5),
# )

# gridcontainer.add(center_plot)
# gridcontainer.add(right_plot)
# gridcontainer.add(bottom_plot)

# plot means
s = cg.new_series(
Expand All @@ -571,7 +586,16 @@ def predict_func(ptx, pty):
cg.x = reg.xs
cg.y = reg.ys

cg.plotcontainer.add(gridcontainer)
# cg.plotcontainer = gridcontainer
# cg.plotcontainer.add(gridcontainer)
# cg.plotcontainer.add(center_plot)

inner_container = VPlotContainer(padding=0)

inner_container.add(bottom_plot)
inner_container.add(center_plot)
cg.plotcontainer.add(inner_container)
cg.plotcontainer.add(right_plot)

@property
def cleaned_analyses(self):
Expand Down
2 changes: 1 addition & 1 deletion pychron/pipeline/editors/irradiation_tray_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class IrradiationTrayOverlay(AbstractOverlay):
def overlay(self, other_component, gc, view_bounds=None, mode="normal"):
with gc:
comp = self.component
gc.clip_to_rect(comp.x, comp.y, comp.width, comp.height)
gc.clip_to_rect(float(comp.x), float(comp.y), float(comp.width), float(comp.height))
# gc.set_fill_color((1, 0, 1))
if self._cached_pts is None:
self._cached_pts = self._gather_points()
Expand Down

0 comments on commit 8c88dd0

Please sign in to comment.