Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
YAPSUT
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
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
Michele Maris
YAPSUT
Commits
68c97646
Commit
68c97646
authored
1 year ago
by
Michele Maris
Browse files
Options
Downloads
Patches
Plain Diff
u
parent
14b66f9a
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
src/yapsut/graphics.py
+41
-6
41 additions, 6 deletions
src/yapsut/graphics.py
with
41 additions
and
6 deletions
src/yapsut/graphics.py
+
41
−
6
View file @
68c97646
...
...
@@ -35,6 +35,30 @@ def curveXY2patch(x,y,returnVectors=False,closed=True,draw=True, ax=None,color=N
else
:
return
plt
.
gca
().
add_collection
(
PatchCollection
([
pol
]))
def
curves2xy
(
Cup
,
Cdown
,
closed
=
True
)
:
"""
converts an up curve and a down curve into a list of points to generate a partch
Cup, Cdown = curves = [X,Y]
assumed that Cup, Cdown have increasing X
the composed curve [X,Y] is oriented anticlockwise sense:
up: increasing X
down: decreasing X
closed = True, the curve is closed, otherwise is left open
Example:
X,Y=curves2xy([np.arange(5),np.arange(5)+10],[np.arange(5),-np.arange(5)])
plt.plot(X,Y)
"""
import
numpy
as
np
idxU
=
np
.
argsort
(
Cup
[
0
])
idxD
=
np
.
argsort
(
Cdown
[
0
])
idxD
=
np
.
array
([
idxD
[
k
]
for
k
in
range
(
len
(
idxD
)
-
1
,
-
1
,
-
1
)],
dtype
=
int
)
idxO
=
np
.
array
([
0
],
dtype
=
int
)
if
closed
else
[]
X
=
np
.
concatenate
([
Cup
[
0
][
idxU
],
Cdown
[
0
][
idxD
],
Cup
[
0
][
idxO
]])
Y
=
np
.
concatenate
([
Cup
[
1
][
idxU
],
Cdown
[
1
][
idxD
],
Cup
[
1
][
idxO
]])
return
X
,
Y
class
_SaveFig
:
class
__history_fig
:
...
...
@@ -260,14 +284,25 @@ class StandardFig() :
# list of handles for various objects
self
.
_handle
=
{}
#
self
.
setfonts4paper
()
#
self
.
legend_framealpha
=
None
def
setfonts4paper
(
self
)
:
"""
sets figures with proportions for paper
"""
self
.
fontsize_xylabels
=
18
self
.
fontsize_ticks
=
16
self
.
fontsize_labels
=
18
self
.
fontsize_xylabels
=
18
self
.
fontsize_title
=
18
self
.
fontsize_legend
=
18
self
.
fontsize_legend_title
=
18
#
self
.
legend_framealpha
=
None
def
setfonts4slides
(
self
)
:
"""
sets figures with proportions for 16:9 slides
"""
self
.
fontsize_xylabels
=
32
self
.
fontsize_ticks
=
28
self
.
fontsize_labels
=
self
.
fontsize_xylabels
self
.
fontsize_title
=
32
self
.
fontsize_legend
=
self
.
fontsize_xylabels
self
.
fontsize_legend_title
=
self
.
fontsize_xylabels
def
copy
(
self
)
:
import
copy
return
self
.
deepcopy
(
self
)
...
...
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