Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
StdInPlot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
technasium
StdInPlot
Commits
2e683d48
Commit
2e683d48
authored
1 year ago
by
Tammo Jan Dijkema
Browse files
Options
Downloads
Patches
Plain Diff
Make title an option, larger font
parent
8b5c1c5c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
power_plot.py
+9
-6
9 additions, 6 deletions
power_plot.py
with
9 additions
and
6 deletions
power_plot.py
+
9
−
6
View file @
2e683d48
...
@@ -14,7 +14,7 @@ import matplotlib
...
@@ -14,7 +14,7 @@ import matplotlib
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
from
matplotlib.widgets
import
Button
,
CheckButtons
from
matplotlib.widgets
import
Button
,
CheckButtons
from
matplotlib.collections
import
LineCollection
from
matplotlib.collections
import
LineCollection
from
matplotlib.dates
import
date2num
,
num2date
,
Auto
DateFormatter
from
matplotlib.dates
import
date2num
,
num2date
,
Concise
DateFormatter
from
matplotlib.figure
import
Figure
from
matplotlib.figure
import
Figure
from
PyQt5.QtWidgets
import
QApplication
,
QMainWindow
,
QVBoxLayout
,
QWidget
,
QComboBox
from
PyQt5.QtWidgets
import
QApplication
,
QMainWindow
,
QVBoxLayout
,
QWidget
,
QComboBox
...
@@ -31,6 +31,7 @@ from datetime import datetime
...
@@ -31,6 +31,7 @@ from datetime import datetime
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
plt
.
rcParams
.
update
({
'
font.size
'
:
14
})
class
PowerPlot
:
class
PowerPlot
:
"""
A power plot with two time scales
"""
"""
A power plot with two time scales
"""
...
@@ -42,8 +43,7 @@ class PowerPlot:
...
@@ -42,8 +43,7 @@ class PowerPlot:
self
.
ax
.
set_ylabel
(
yname
)
self
.
ax
.
set_ylabel
(
yname
)
self
.
ax
.
xaxis_date
()
self
.
ax
.
xaxis_date
()
formatter
=
AutoDateFormatter
(
self
.
ax
.
xaxis
.
get_major_locator
())
formatter
=
ConciseDateFormatter
(
self
.
ax
.
xaxis
.
get_major_locator
())
formatter
.
scaled
[
1
/
(
24
*
60
)]
=
"
%H:%M
"
self
.
ax
.
xaxis
.
set_major_formatter
(
formatter
)
self
.
ax
.
xaxis
.
set_major_formatter
(
formatter
)
if
offset
is
not
None
:
if
offset
is
not
None
:
...
@@ -96,7 +96,7 @@ class MyToolbar(NavigationToolbar):
...
@@ -96,7 +96,7 @@ class MyToolbar(NavigationToolbar):
class
PowerPlotMainWindow
(
QMainWindow
):
class
PowerPlotMainWindow
(
QMainWindow
):
"""
QT Application that reads data from stdin, plots in a PowerPlot
"""
"""
QT Application that reads data from stdin, plots in a PowerPlot
"""
def
__init__
(
self
,
offset
=
None
,
col_num
=
1
,
first_time
=
None
,
duration
=
2
):
def
__init__
(
self
,
offset
=
None
,
col_num
=
1
,
first_time
=
None
,
duration
=
2
,
title
=
None
):
super
().
__init__
()
super
().
__init__
()
self
.
setStyleSheet
(
"
background-color: white;
"
)
self
.
setStyleSheet
(
"
background-color: white;
"
)
self
.
autoscale_x
=
True
self
.
autoscale_x
=
True
...
@@ -155,7 +155,9 @@ class PowerPlotMainWindow(QMainWindow):
...
@@ -155,7 +155,9 @@ class PowerPlotMainWindow(QMainWindow):
# fig.canvas.manager.set_window_title("Dwingeloo Radio Telescope")
# fig.canvas.manager.set_window_title("Dwingeloo Radio Telescope")
self
.
powerplot
=
PowerPlot
(
fig
,
yname
,
offset
=
offset
)
if
title
is
None
:
title
=
yname
self
.
powerplot
=
PowerPlot
(
fig
,
title
,
offset
=
offset
)
self
.
read_stdin
()
self
.
read_stdin
()
self
.
stdin_notifier
=
QSocketNotifier
(
self
.
stdin_notifier
=
QSocketNotifier
(
...
@@ -210,6 +212,7 @@ if __name__ == "__main__":
...
@@ -210,6 +212,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"
-o
"
,
"
--offset
"
,
help
=
"
Offset along y-axis
"
,
type
=
float
,
default
=
None
)
parser
.
add_argument
(
"
-o
"
,
"
--offset
"
,
help
=
"
Offset along y-axis
"
,
type
=
float
,
default
=
None
)
parser
.
add_argument
(
"
-s
"
,
"
--start
"
,
help
=
"
Start time (default: now)
"
,
type
=
datetime
.
fromisoformat
,
default
=
None
)
parser
.
add_argument
(
"
-s
"
,
"
--start
"
,
help
=
"
Start time (default: now)
"
,
type
=
datetime
.
fromisoformat
,
default
=
None
)
parser
.
add_argument
(
"
-d
"
,
"
--duration
"
,
help
=
"
Duration in hours (default: 2
"
,
default
=
2
,
type
=
float
)
parser
.
add_argument
(
"
-d
"
,
"
--duration
"
,
help
=
"
Duration in hours (default: 2
"
,
default
=
2
,
type
=
float
)
parser
.
add_argument
(
"
-t
"
,
"
--title
"
,
help
=
"
Plot title
"
,
default
=
None
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
@@ -221,7 +224,7 @@ if __name__ == "__main__":
...
@@ -221,7 +224,7 @@ if __name__ == "__main__":
app
.
setWindowIcon
(
QtGui
.
QIcon
(
icon_path
))
app
.
setWindowIcon
(
QtGui
.
QIcon
(
icon_path
))
except
:
except
:
pass
pass
main_window
=
PowerPlotMainWindow
(
offset
=
args
.
offset
,
first_time
=
args
.
start
,
duration
=
args
.
duration
)
main_window
=
PowerPlotMainWindow
(
offset
=
args
.
offset
,
first_time
=
args
.
start
,
duration
=
args
.
duration
,
title
=
args
.
title
)
main_window
.
show
()
main_window
.
show
()
signal
.
signal
(
signal
.
SIGINT
,
handle_interrupt_signal
)
signal
.
signal
(
signal
.
SIGINT
,
handle_interrupt_signal
)
...
...
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