Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Yori Fournier
myplotlib
Commits
d694ec69
Commit
d694ec69
authored
Mar 03, 2017
by
Philipp Gast
Browse files
next try
parent
4991080b
Changes
1
Hide whitespace changes
Inline
Side-by-side
myFig.py
View file @
d694ec69
...
...
@@ -124,27 +124,38 @@ class MyFig(Figure):
# UPDATE ----------------------------------------------------------
def
update
(
self
,
**
kwargs
):
# check attributes in keywords
for
keyword
in
kwargs
.
keys
():
# if it is the rawdata use the function
if
keyword
==
'rawdata'
:
self
.
set_rawdata
(
kwargs
[
'rawdata'
])
# For each axes update the keywords
for
ax
in
self
.
get_axes
():
# if it is an attribute
elif
keyword
in
self
.
_attributesToUpdateKeys
:
# update value
setattr
(
self
,
keyword
,
kwargs
[
keyword
])
forax
=
{}
elif
keyword
in
self
.
aliases
.
keys
():
# if it is a alias update only the coresponding axes
alax
,
alkey
=
self
.
aliases
[
keyword
]
alax
.
update
(
**
{
alkey
:
kwargs
[
keyword
]})
else
:
# otherwise update all axes with keyword (not matching keywords are ignored by axes)
for
ax
in
self
.
get_axes
():
ax
.
update
(
**
{
keyword
:
kwargs
[
keyword
]})
# check attributes in keywords
for
keyword
in
kwargs
.
keys
():
# if it is the rawdata use the function
if
keyword
==
'rawdata'
:
self
.
set_rawdata
(
kwargs
[
'rawdata'
])
# if it is an attribute
elif
keyword
in
self
.
_attributesToUpdateKeys
:
# update value
setattr
(
self
,
keyword
,
kwargs
[
keyword
])
# Check if a key of kwargs has an alias for this axes
elif
keyword
in
self
.
aliases
.
keys
():
alax
,
alkey
=
self
.
aliases
[
keyword
]
# If an alias is found then update axkwargs
if
ax
==
alax
:
forax
.
update
(
**
{
alkey
:
kwargs
[
keyword
]})
# use keyword as it is for the axes
else
:
if
keyword
in
ax
.
keywords
.
keys
()
:
#not nessesarry. axes takes care of that
forax
.
update
(
**
{
keyword
:
kwargs
[
keyword
]})
# Then eventually all collected Keywords are updated in one go
ax
.
update
(
**
forax
)
return
(
True
)
# DECLARE ALIASES -------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment