Skip to content
Snippets Groups Projects
Commit 77d5b840 authored by Richter, Manuela's avatar Richter, Manuela
Browse files

Versuche, figure zu übergeben

parent 8e975d7c
No related branches found
No related tags found
1 merge request!12v.0.1 for alpha release
......@@ -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
......@@ -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
# -*- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment