Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
plotID_python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plotID
plotID_python
Commits
77d5b840
Commit
77d5b840
authored
Jul 27, 2021
by
Richter, Manuela
Browse files
Options
Downloads
Patches
Plain Diff
Versuche, figure zu übergeben
parent
8e975d7c
No related branches found
No related tags found
1 merge request
!12
v.0.1 for alpha release
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
example.py
+20
-4
20 additions, 4 deletions
example.py
fcn_help/TagPlot.py
+22
-3
22 additions, 3 deletions
fcn_help/TagPlot.py
fcn_help/test.py
+32
-0
32 additions, 0 deletions
fcn_help/test.py
with
74 additions
and
7 deletions
example.py
+
20
−
4
View file @
77d5b840
...
...
@@ -15,7 +15,8 @@ from numpy import random
import
h5py
as
h5
import
matplotlib.pyplot
as
plt
plt
.
style
.
use
(
'
fcn_help/FST.mplstyle
'
)
%
matplotlib
qt
#%matplotlib qt
%
matplotlib
inline
from
FST_colors
import
Colors
from
TagPlot
import
TagPlot
#%% Pfade hinzufügen
...
...
@@ -40,12 +41,27 @@ np.save(dataset1, x,y, y_2)
colors
=
Colors
()
# create instance from class
color_list
=
colors
.
get_color_names
()
# Plot erstellen
plt
.
plot
(
x
,
y
,
color
=
colors
.
get_rgb
(
'
black
'
))
plt
.
plot
(
x
,
y_2
,
color
=
colors
.
get_rgb
(
'
yellow
'
))
fig
=
plt
.
draw
()
color1
=
colors
.
get_rgb
(
'
black
'
)
color2
=
colors
.
get_rgb
(
'
yellow
'
)
#fig = plt.figure()
plt
.
plot
(
x
,
y
,
color
=
color1
)
plt
.
plot
(
x
,
y_2
,
color
=
color2
)
plt
.
draw
()
fig
=
plt
.
gcf
()
#print(type(Figure1))
[
figs
,
ID
]
=
TagPlot
(
fig
,
ProjectID
)
#figs.show()
numbers
=
plt
.
get_fignums
()
labels
=
plt
.
get_figlabels
()
print
(
numbers
)
print
(
labels
)
# plot taggen
This diff is collapsed.
Click to expand it.
fcn_help/TagPlot.py
+
22
−
3
View file @
77d5b840
...
...
@@ -4,6 +4,7 @@ Created on Tue Jul 27 10:50:20 2021
@author: Richter
"""
import
matplotlib.pyplot
as
plt
def
TagPlot
(
figs
,
prefix
):
...
...
@@ -13,8 +14,26 @@ def TagPlot(figs,prefix):
TagPlot can tag multiple figures at once
"""
figs
=
2
ID
=
3
ID
=
prefix
+
'
_
'
+
'
Test
'
rect
=
l
,
b
,
w
,
h
figs
.
add_axes
(
rect
)
#n_axes = plt.getp(Axes)
#print(n_axes)
# ylim = plt.get(axes, 'YLim')
#print("Funktion TagPlot aufgerufen")
#print(type(figs))
# Titel über get Funktion anpassen
# figs ist ein Objekt einer bestimmten Klasse
#Tag als Textobjekt im Diagramm
print
(
"
Funktion TagPlot aufgerufen
"
)
return
(
figs
,
ID
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
fcn_help/test.py
0 → 100644
+
32
−
0
View file @
77d5b840
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 27 11:40:58 2021
@author: Richter
"""
from
matplotlib
import
pyplot
as
plt
fig_size
=
(
10
,
5
)
f
=
plt
.
figure
(
figsize
=
fig_size
)
def
plot_signal
(
time
,
signal
,
title
=
''
,
xlab
=
''
,
ylab
=
''
,
line_width
=
1
,
alpha
=
1
,
color
=
'
k
'
,
subplots
=
False
,
show_grid
=
True
,
fig
=
f
):
# Skipping a lot of other complexity here
axarr
=
f
.
add_subplot
(
1
,
1
,
1
)
# here is where you add the subplot to f
plt
.
plot
(
time
,
signal
,
linewidth
=
line_width
,
alpha
=
alpha
,
color
=
color
)
plt
.
set_xlim
(
min
(
time
),
max
(
time
))
plt
.
set_xlabel
(
xlab
)
plt
.
set_ylabel
(
ylab
)
plt
.
grid
(
show_grid
)
plt
.
title
(
title
,
size
=
16
)
return
(
f
)
time
=
[
0
:
1
:
100
]
signal
=
[
200
:
300
:
100
]
f
=
plot_signal
(
time
,
signal
,
fig
=
f
)
\ No newline at end of file
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