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
5f41614a
Commit
5f41614a
authored
Nov 18, 2020
by
Germain Clavier
Browse files
Options
Downloads
Patches
Plain Diff
Added symbols (circles only) to qp. Not yet compatible with error bars.
parent
7847911a
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
plot/qp
+40
-45
40 additions, 45 deletions
plot/qp
with
40 additions
and
45 deletions
plot/qp
+
40
−
45
View file @
5f41614a
...
...
@@ -15,9 +15,7 @@ import povray as pov
from
itertools
import
cycle
import
numpy
as
np
import
scipy
as
sp
from
scipy.signal
import
savgol_filter
from
scipy.interpolate
import
interp1d
from
matplotlib
import
pyplot
as
plt
# plt.rcParams.update({'lines.markeredgewidth': 4})
...
...
@@ -62,7 +60,7 @@ def read_columns(fle, columns_list, fmt, skip, xsca, ysca, sg):
return
output
def
plot_sep_col
(
data
,
colors
,
fmt
,
is_log
,
legend
):
def
plot_sep_col
(
data
,
colors
,
fmt
,
is_log
,
legend
,
sy
):
'''
Makes separated ordered columns
wise: all 1:2 together, all 1:3 together
...
...
@@ -89,6 +87,10 @@ def plot_sep_col(data, colors, fmt, is_log, legend):
break
plot_nb
=
len
(
columns
)
if
sy
:
symbols
=
{
'
linestyle
'
:
"
None
"
,
'
marker
'
:
"
o
"
}
else
:
symbols
=
{
'
linestyle
'
:
'
-
'
,
'
marker
'
:
"
None
"
}
if
plot_nb
%
3
==
0
:
fig
,
axes
=
plt
.
subplots
(
plot_nb
//
3
,
3
,
sharex
=
True
,
figsize
=
(
20
,
10
))
elif
plot_nb
%
2
==
0
:
...
...
@@ -111,7 +113,8 @@ def plot_sep_col(data, colors, fmt, is_log, legend):
y_data
=
subdata
[
3
]
if
fmt
==
'
xy
'
:
ax
.
plot
(
x_data
,
y_data
,
label
=
lab
,
color
=
color
label
=
lab
,
color
=
color
,
**
symbols
)
elif
fmt
==
'
xydy
'
:
dy
=
subdata
[
4
]
...
...
@@ -125,11 +128,6 @@ def plot_sep_col(data, colors, fmt, is_log, legend):
alpha
=
0.2
,
edgecolor
=
color
,
facecolor
=
color
,
linewidth
=
0
)
# ax.errorbar(x_data, y_data,
# yerr=dy,
# capsize=4, capthick=2,
# label=lab, color=color
# )
elif
fmt
==
'
xydx
'
:
dx
=
subdata
[
4
]
ax
.
errorbar
(
x_data
,
y_data
,
...
...
@@ -149,7 +147,6 @@ def plot_sep_col(data, colors, fmt, is_log, legend):
ax
.
set_xscale
(
'
log
'
)
if
is_log
[
1
]:
ax
.
set_yscale
(
'
log
'
)
# color = next(color_iter)
if
legend
:
ncol
=
max
([
1
,
len
(
data
)
//
3
])
ax
.
legend
(
loc
=
'
upper left
'
,
ncol
=
ncol
)
...
...
@@ -158,8 +155,12 @@ def plot_sep_col(data, colors, fmt, is_log, legend):
return
[
fig
,
axes
]
def
plot_sep_fil
(
data
,
colors
,
fmt
,
is_log
,
legend
):
def
plot_sep_fil
(
data
,
colors
,
fmt
,
is_log
,
legend
,
sy
):
plot_nb
=
len
(
data
)
if
sy
:
symbols
=
{
'
linestyle
'
:
"
None
"
,
'
marker
'
:
"
o
"
}
else
:
symbols
=
{
'
linestyle
'
:
'
-
'
,
'
marker
'
:
"
None
"
}
if
plot_nb
%
3
==
0
:
fig
,
axes
=
plt
.
subplots
(
plot_nb
//
3
,
3
,
sharex
=
True
,
figsize
=
(
20
,
10
))
elif
plot_nb
%
2
==
0
:
...
...
@@ -178,7 +179,8 @@ def plot_sep_fil(data, colors, fmt, is_log, legend):
y_data
=
subdata
[
3
]
if
fmt
==
'
xy
'
:
ax
.
plot
(
x_data
,
y_data
,
label
=
lab
,
color
=
color
label
=
lab
,
color
=
color
,
**
symbols
)
elif
fmt
==
'
xydy
'
:
dy
=
subdata
[
4
]
...
...
@@ -192,11 +194,6 @@ def plot_sep_fil(data, colors, fmt, is_log, legend):
alpha
=
0.2
,
edgecolor
=
color
,
facecolor
=
color
,
linewidth
=
0
)
# ax.errorbar(x_data, y_data,
# yerr=dy,
# capsize=4, capthick=2,
# label=lab, color=color
# )
elif
fmt
==
'
xydx
'
:
dx
=
subdata
[
4
]
ax
.
errorbar
(
x_data
,
y_data
,
...
...
@@ -216,7 +213,6 @@ def plot_sep_fil(data, colors, fmt, is_log, legend):
ax
.
set_xscale
(
'
log
'
)
if
is_log
[
1
]:
ax
.
set_yscale
(
'
log
'
)
# color = next(color_iter)
if
legend
:
ncol
=
max
([
1
,
len
(
data
)
//
3
])
ax
.
legend
(
loc
=
'
upper left
'
,
ncol
=
ncol
)
...
...
@@ -225,10 +221,14 @@ def plot_sep_fil(data, colors, fmt, is_log, legend):
return
[
fig
,
axes
]
def
plot_data
(
data
,
colors
,
fmt
,
is_log
,
legend
,
names
):
def
plot_data
(
data
,
colors
,
fmt
,
is_log
,
legend
,
names
,
sy
):
color_iter
=
cycle
(
colors
)
plt
.
figure
(
figsize
=
(
40
,
30
))
namelist
=
iter
(
names
)
if
sy
:
symbols
=
{
'
linestyle
'
:
"
None
"
,
'
marker
'
:
"
o
"
}
else
:
symbols
=
{
'
linestyle
'
:
'
-
'
,
'
marker
'
:
"
None
"
}
for
d
in
data
:
color
=
next
(
color_iter
)
try
:
...
...
@@ -248,7 +248,8 @@ def plot_data(data, colors, fmt, is_log, legend, names):
y_data
=
subdata
[
3
]
if
fmt
==
'
xy
'
:
plt
.
plot
(
x_data
,
y_data
,
label
=
lab
,
color
=
color
label
=
lab
,
color
=
color
,
**
symbols
)
elif
fmt
==
'
xydy
'
:
dy
=
subdata
[
4
]
...
...
@@ -262,11 +263,6 @@ def plot_data(data, colors, fmt, is_log, legend, names):
alpha
=
0.2
,
edgecolor
=
color
,
facecolor
=
color
,
linewidth
=
0
)
# plt.errorbar(x_data, y_data,
# yerr=dy,
# capsize=4, capthick=2,
# label=lab, color=color
# )
elif
fmt
==
'
xydx
'
:
dx
=
subdata
[
4
]
plt
.
errorbar
(
x_data
,
y_data
,
...
...
@@ -286,9 +282,7 @@ def plot_data(data, colors, fmt, is_log, legend, names):
plt
.
xscale
(
'
log
'
)
if
is_log
[
1
]:
plt
.
yscale
(
'
log
'
)
# color = next(color_iter)
if
legend
:
# plt.legend(loc='upper left')
ncol
=
max
([
1
,
len
(
data
)
//
3
])
plt
.
legend
(
ncol
=
ncol
)
return
...
...
@@ -299,14 +293,15 @@ def main():
Main function.
'''
parser
=
ap
.
ArgumentParser
(
description
=
'
Script to plot a list of files.
'
)
parser
.
add_argument
(
'
-v
'
,
'
--verbose
'
,
dest
=
'
verbosity
'
,
action
=
'
store_true
'
,
help
=
'
Verbosity.
'
)
parser
.
add_argument
(
'
-sf
'
,
'
--separated-files
'
,
dest
=
'
sf
'
,
default
=
False
,
action
=
'
store_true
'
,
help
=
'
Plot in separated windows based on filename.
[default = False]
'
)
action
=
'
store_true
'
,
help
=
'
Plot in separated windows based on filename.
'
)
parser
.
add_argument
(
'
-sc
'
,
'
--separated-columns
'
,
dest
=
'
sc
'
,
default
=
False
,
action
=
'
store_true
'
,
help
=
'
Plot in separated windows based on columns. [default = False]
'
)
action
=
'
store_true
'
,
help
=
'
Plot in separated windows based on columns.
'
)
parser
.
add_argument
(
'
-sy
'
,
'
--symbols
'
,
dest
=
'
sy
'
,
action
=
'
store_true
'
,
help
=
'
Use symbols and not lines
'
)
parser
.
add_argument
(
'
-fmt
'
,
'
--fmt
'
,
dest
=
'
fmt
'
,
default
=
'
xy
'
,
help
=
'
Format of the plot (xy, xydy, xydxdy, xydx). [default = xy]
'
)
...
...
@@ -349,9 +344,9 @@ def main():
args
=
parser
.
parse_args
()
verbose
=
args
.
verbosity
sep_files
=
args
.
sf
sep_col
=
args
.
sc
sy
=
args
.
sy
fmt
=
args
.
fmt
inpt
=
args
.
input
graph_title
=
args
.
ttl
...
...
@@ -433,11 +428,11 @@ def main():
data
.
append
(
read_columns
(
fle
,
columns_list
,
fmt
,
skip
,
xsca
,
ysca
,
sg
))
if
sep_col
:
fig
,
axes
=
plot_sep_col
(
data
,
colors
,
fmt
,
is_log
,
legend
)
fig
,
axes
=
plot_sep_col
(
data
,
colors
,
fmt
,
is_log
,
legend
,
sy
)
elif
sep_files
:
fig
,
axes
=
plot_sep_fil
(
data
,
colors
,
fmt
,
is_log
,
legend
)
fig
,
axes
=
plot_sep_fil
(
data
,
colors
,
fmt
,
is_log
,
legend
,
sy
)
else
:
plot_data
(
data
,
colors
,
fmt
,
is_log
,
legend
,
names
)
plot_data
(
data
,
colors
,
fmt
,
is_log
,
legend
,
names
,
sy
)
plt
.
xlabel
(
xlab
)
plt
.
ylabel
(
ylab
)
...
...
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