Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SOHViewer
Manage
Activity
Members
Labels
Plan
Issues
11
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Public
PASSOFT
SOHViewer
Commits
0f8160f8
Commit
0f8160f8
authored
1 year ago
by
Lan Dam
Browse files
Options
Downloads
Patches
Plain Diff
simplify drawing sample numbers' labels to give plotting function have more control on this
parent
c4570703
No related branches found
No related tags found
2 merge requests
!180
Make GPS Lk/Unlk and GPS Clock Power to plot in the same channel
,
!179
Give the option to plot three lines for different values and colors
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sohstationviewer/view/plotting/plotting_widget/plotting_axes.py
+34
-45
34 additions, 45 deletions
...tionviewer/view/plotting/plotting_widget/plotting_axes.py
with
34 additions
and
45 deletions
sohstationviewer/view/plotting/plotting_widget/plotting_axes.py
+
34
−
45
View file @
0f8160f8
...
@@ -12,7 +12,6 @@ from sohstationviewer.controller.plotting_data import (
...
@@ -12,7 +12,6 @@ from sohstationviewer.controller.plotting_data import (
get_time_ticks
,
get_unit_bitweight
,
get_disk_size_format
)
get_time_ticks
,
get_unit_bitweight
,
get_disk_size_format
)
from
sohstationviewer.conf
import
constants
from
sohstationviewer.conf
import
constants
from
sohstationviewer.view.util.color
import
clr
class
PlottingAxes
:
class
PlottingAxes
:
...
@@ -154,10 +153,32 @@ class PlottingAxes:
...
@@ -154,10 +153,32 @@ class PlottingAxes:
ax
.
patch
.
set_alpha
(
0
)
ax
.
patch
.
set_alpha
(
0
)
return
ax
return
ax
def
create_sample_no_label
(
self
,
ax
:
Axes
,
pos_y
:
float
,
sample_no
:
int
,
color
:
str
)
->
None
:
"""
Create label to display sample number
:param ax: the axes of the label
:param pos_y: vertical position for the label
:param sample_no: total of samples
:param color: color of the text in the label
"""
if
sample_no
is
None
:
return
return
ax
.
text
(
1.005
,
pos_y
,
sample_no
,
horizontalalignment
=
'
left
'
,
verticalalignment
=
'
center
'
,
rotation
=
'
horizontal
'
,
transform
=
ax
.
transAxes
,
color
=
color
,
size
=
self
.
parent
.
font_size
)
def
set_axes_info
(
self
,
ax
:
Axes
,
def
set_axes_info
(
self
,
ax
:
Axes
,
sample_no_list
:
List
[
int
],
sample_no_list
:
List
[
int
],
sample_no_colors
:
List
[
str
]
=
[
clr
[
'
W
'
],
clr
[
'
W
'
]]
,
sample_no_colors
:
List
[
str
],
sample_no_pos
:
List
[
float
]
=
[
0.05
,
0.95
]
,
sample_no_pos
:
List
[
float
],
label
:
Optional
[
str
]
=
None
,
label
:
Optional
[
str
]
=
None
,
info
:
str
=
''
,
info
:
str
=
''
,
y_list
:
Optional
[
np
.
ndarray
]
=
None
,
y_list
:
Optional
[
np
.
ndarray
]
=
None
,
...
@@ -221,48 +242,16 @@ class PlottingAxes:
...
@@ -221,48 +242,16 @@ class PlottingAxes:
)
)
# set samples' total on right side
# set samples' total on right side
if
len
(
sample_no_list
)
==
1
:
# bottom
# center_total_point_lbl: The label to display total number of data
ax
.
bottom_total_point_lbl
=
self
.
create_sample_no_label
(
# points for plots whose ax has attribute x_list.
ax
,
sample_no_pos
[
0
],
sample_no_list
[
0
],
sample_no_colors
[
0
])
# The plotTypes that use this label are linesDot, linesSRate,
# center
# linesMassPos, dotForTime, multiColorDot
ax
.
center_total_point_lbl
=
self
.
create_sample_no_label
(
ax
.
center_total_point_lbl
=
ax
.
text
(
ax
,
sample_no_pos
[
1
],
sample_no_list
[
1
],
sample_no_colors
[
1
])
1.005
,
0.5
,
# top
sample_no_list
[
0
],
ax
.
top_total_point_lbl
=
self
.
create_sample_no_label
(
horizontalalignment
=
'
left
'
,
ax
,
sample_no_pos
[
2
],
sample_no_list
[
2
],
sample_no_colors
[
2
])
verticalalignment
=
'
center
'
,
rotation
=
'
horizontal
'
,
transform
=
ax
.
transAxes
,
color
=
sample_no_colors
[
0
],
size
=
self
.
parent
.
font_size
)
else
:
# bottom_total_point_lbl, top_total_point_lbl are label to diplay
# total number of data points which are splitted into top
# and bottom. The ax needs to include attributes x_bottom and x_top
# The plotTypes that use these labels are upDownDots and linesDot
# with channel='GPS Lk/Unlk'
ax
.
bottom_total_point_lbl
=
ax
.
text
(
1.005
,
sample_no_pos
[
0
],
sample_no_list
[
0
],
horizontalalignment
=
'
left
'
,
verticalalignment
=
'
center
'
,
rotation
=
'
horizontal
'
,
transform
=
ax
.
transAxes
,
color
=
sample_no_colors
[
0
],
size
=
self
.
parent
.
font_size
)
# top
ax
.
top_total_point_lbl
=
ax
.
text
(
1.005
,
sample_no_pos
[
1
],
sample_no_list
[
1
],
horizontalalignment
=
'
left
'
,
verticalalignment
=
'
center
'
,
rotation
=
'
horizontal
'
,
transform
=
ax
.
transAxes
,
color
=
sample_no_colors
[
1
],
size
=
self
.
parent
.
font_size
)
if
linked_ax
is
not
None
:
if
linked_ax
is
not
None
:
ax
.
set_yticks
([])
ax
.
set_yticks
([])
return
return
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment