From 0a902eb619dae9f1ca8d14fae7affdceb3363d58 Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Mon, 7 Apr 2025 07:52:26 +0200 Subject: [PATCH] cosmetics --- isotables/isotopapp/views.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/isotables/isotopapp/views.py b/isotables/isotopapp/views.py index 1e5ed71..3b0c8ed 100644 --- a/isotables/isotopapp/views.py +++ b/isotables/isotopapp/views.py @@ -192,20 +192,30 @@ def position(request): for p in indices: #vline = Span(location=_z_coords[p]*1e3, dimension='height', line_color='gray', line_width=1) #plot.renderers.extend([vline]) - label = Label(x=_z_coords[p]*1e3+25, - y=-(np.sign(_z_coords[p]) *10) +(_gradients[p]), text=f"{_z_coords[p]*1e3:.2f},{_gradients[p]:.1f}T/m", text_baseline="middle", - text_align="center", text_font_size="11pt", - border_line_color="#D5D9FF", background_fill_color="white", - y_range_name="gradient") + label = Label( + x=_z_coords[p]*1e3+25, + y=-(np.sign(_z_coords[p])*30) + (_gradients[p]), + text=f"{_z_coords[p]*1e3:.2f},{_gradients[p]:.1f}T/m", + text_baseline="middle", + text_align="center", text_font_size="11pt", + border_line_color="#D5D9FF", + background_fill_color="white", + background_fill_alpha=0.7, + y_range_name="gradient", + ) plot.add_layout(label) #plot.circle(x=_z_coords[indices]*1e3, y=_fields[indices], radius=2, color="gray") plot.circle(x=_z_coords[indices]*1e3, y=_gradients[indices], radius=2, color="gray",y_range_name="gradient" ) # plot the B0 field hlines + hline0 = Span(location=0, dimension='width', line_color='black', line_width=4) hline1 = Span(location=field_T, dimension='width', line_color='gray', line_width=2) label1 = Label(x=frame_right, y=field_T, text=f"{field_T:.1f}T/m", text_baseline="middle") hline2 = Span(location=-field_T, dimension='width', line_color='gray', line_width=2) - plot.renderers.extend([hline1, hline2, label1]) + plot.renderers.extend([hline0, hline1, hline2, label1]) + + for i in indices: + plot.line(x=[_z_coords[i]*1e3, _z_coords[i]*1e3], y=[_fields[i], _gradients[i]/20. ] , color="gray", line_dash="dashed" ) close_isotopes = [] for isotope in Isotope.objects.all():