Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Germain Clavier
python-tools
Commits
14bf6cfd
You need to sign in or sign up before continuing.
Commit
14bf6cfd
authored
Jan 15, 2022
by
Germain Clavier
Browse files
Options
Downloads
Patches
Plain Diff
Added OldStyle file and new qp version with colour gradient.
parent
1b2f5552
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
plot/OldStyle.py
+79
-0
79 additions, 0 deletions
plot/OldStyle.py
plot/qp
+8
-6
8 additions, 6 deletions
plot/qp
with
87 additions
and
6 deletions
plot/OldStyle.py
0 → 100644
+
79
−
0
View file @
14bf6cfd
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
An old journal style plotting configuration file
'''
import
numpy
as
np
import
re
from
matplotlib
import
pyplot
as
plt
from
matplotlib
import
cm
from
matplotlib.colors
import
ListedColormap
,
LinearSegmentedColormap
import
sys
plt
.
rc
(
'
axes
'
,
linewidth
=
2
)
label_fontsize
=
20
ticks_fontsize
=
20
linewidth
=
3
axes_linewidth
=
1
major_tick_length
=
15
minor_tick_length
=
major_tick_length
//
2
no_tick
=
0
# print(plt.rcParams.keys())
# sys.exit()
plt
.
rcParams
[
'
font.family
'
]
=
'
Latin Modern Math
'
plt
.
rcParams
[
'
font.weight
'
]
=
'
normal
'
plt
.
rcParams
[
'
font.variant
'
]
=
'
small-caps
'
# Unfortunately, this does not work yet with matplotlib
plt
.
rcParams
[
'
axes.linewidth
'
]
=
axes_linewidth
plt
.
rcParams
[
'
lines.linewidth
'
]
=
linewidth
plt
.
rcParams
[
'
axes.labelsize
'
]
=
label_fontsize
plt
.
rcParams
[
'
legend.fontsize
'
]
=
label_fontsize
plt
.
rcParams
[
'
xtick.major.size
'
]
=
major_tick_length
plt
.
rcParams
[
'
xtick.minor.visible
'
]
=
True
plt
.
rcParams
[
'
xtick.minor.size
'
]
=
minor_tick_length
plt
.
rcParams
[
'
xtick.labelsize
'
]
=
ticks_fontsize
plt
.
rcParams
[
'
ytick.labelsize
'
]
=
ticks_fontsize
plt
.
rcParams
[
'
xtick.direction
'
]
=
'
in
'
plt
.
rcParams
[
'
xtick.top
'
]
=
True
plt
.
rcParams
[
'
ytick.direction
'
]
=
'
in
'
plt
.
rcParams
[
'
ytick.right
'
]
=
True
plt
.
rcParams
[
'
ytick.major.size
'
]
=
major_tick_length
plt
.
rcParams
[
'
ytick.minor.visible
'
]
=
True
plt
.
rcParams
[
'
ytick.minor.size
'
]
=
minor_tick_length
plt
.
rcParams
[
'
xtick.major.width
'
]
=
axes_linewidth
plt
.
rcParams
[
'
ytick.major.width
'
]
=
axes_linewidth
plt
.
rcParams
[
'
xtick.minor.width
'
]
=
axes_linewidth
plt
.
rcParams
[
'
ytick.minor.width
'
]
=
axes_linewidth
plt
.
rcParams
[
'
lines.markerfacecolor
'
]
=
'
white
'
plt
.
rcParams
[
'
lines.markeredgecolor
'
]
=
'
black
'
nlinestyle
=
4
linestyle_list
=
[
'
-
'
,
'
--
'
,
'
-.
'
,
'
:
'
]
color_list
=
[
'
#000000
'
,
'
#888888
'
,
'
#CCCCCC
'
]
marker_list
=
[
'
o
'
,
'
s
'
,
'
v
'
,
'
^
'
]
plt
.
rcParams
[
'
axes.prop_cycle
'
]
=
plt
.
cycler
(
color
=
color_list
)
*
(
plt
.
cycler
(
linestyle
=
linestyle_list
)
+
plt
.
cycler
(
marker
=
marker_list
))
##### SOME EXAMPLES FOR TESTING PURPOSE ####
##### WITH SOME PERSONAL ADVICES
# 1) Better to set font and stuff for each axes
# 2) The bigger the better
##### Plotting linear data
npoints
=
10
for
i
in
range
(
12
):
data
=
np
.
linspace
(
0
,
1
,
10
)
plt
.
plot
((
i
+
1
)
*
data
,
label
=
"
"
.
join
([
'
data
'
,
str
(
i
+
1
)]))
ax
=
plt
.
gca
()
# Get current axes to set properties
ax
.
legend
(
frameon
=
False
)
# Fat font, no frame
ax
.
set_xlabel
(
r
"
PIF ($\int_{-\infty}^{3} \frac{x}{l_0}$)
"
)
ax
.
set_ylabel
(
"
POUET
"
)
##### Plotting heatmap
# data = np.random.rand(20, 20)
# plt.pcolormesh(data, cmap=GCcmap, rasterized=True) # Data is output from ListedColormap
# plt.colorbar(ax = plt.gca()) # Puts the colorbar on the side
##### Show result
plt
.
show
()
This diff is collapsed.
Click to expand it.
plot/qp
+
8
−
6
View file @
14bf6cfd
...
...
@@ -11,12 +11,12 @@ import sys
import
re
import
GCcolors
import
povray
as
pov
from
itertools
import
cycle
import
numpy
as
np
from
scipy.signal
import
savgol_filter
import
matplotlib
as
mpl
from
matplotlib
import
pyplot
as
plt
# plt.rcParams.update({'lines.markeredgewidth': 4})
plt
.
rcParams
.
update
({
'
font.size
'
:
22
,
'
lines.linewidth
'
:
3.
})
...
...
@@ -310,7 +310,7 @@ def main():
help
=
'
File name followed by columns and optionally lines to skip.
'
)
parser
.
add_argument
(
'
-n
'
,
'
--names
'
,
dest
=
'
names
'
,
nargs
=
'
+
'
,
action
=
'
append
'
,
default
=
[],
default
=
[
''
],
help
=
'
Names for the legend.
'
)
parser
.
add_argument
(
'
-l
'
,
'
--loglog
'
,
dest
=
'
is_log_xy
'
,
action
=
'
store_true
'
,
...
...
@@ -401,11 +401,13 @@ def main():
'
steelblue
'
,
'
blue
'
,
'
darkblue
'
,
'
indigo
'
]
elif
grad
:
colors
=
[]
g
=
pov
.
gradient
(
name
=
'
aquatic
'
)
col1
=
np
.
array
([
2.
,
242.
,
245.
])
/
255.
col2
=
np
.
array
([
252.
,
44.
,
255.
])
/
255.
for
i
in
range
(
grad
):
x
=
i
/
grad
c
=
g
.
extract
(
x
)
color
=
(
c
.
r
,
c
.
g
,
c
.
b
)
x
=
i
/
(
grad
-
1
)
# c = g.extract(x)
# color = (c.r, c.g, c.b)
color
=
(
1
-
x
)
*
col1
+
x
*
col2
colors
.
append
(
color
)
else
:
colors
=
GCcolors
.
color_list
...
...
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