Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plotter-nse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
数学の武士
plotter-nse
Commits
00deb98f
Commit
00deb98f
authored
10 months ago
by
数学の武士
Browse files
Options
Downloads
Patches
Plain Diff
Add new arguments to multiple_plot:
Add linewidth, legend, colors, dpi
parent
fbf060aa
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
plotter/Args.py
+5
-1
5 additions, 1 deletion
plotter/Args.py
plotter/Plotter.py
+39
-22
39 additions, 22 deletions
plotter/Plotter.py
plotter/main.py
+2
-2
2 additions, 2 deletions
plotter/main.py
with
46 additions
and
25 deletions
plotter/Args.py
+
5
−
1
View file @
00deb98f
import
sys
import
sys
import
numpy
as
np
import
numpy
as
np
class
Args
:
class
Args
:
def
__init__
(
self
,
filename
,
func
,
var
=
None
,
mval
=
None
,
oname
=
None
,
out
=
None
,
ndim
=
None
,
min_y
=
None
,
max_y
=
None
,
title
=
None
,
levels
=
None
,
plane_type
=
None
,
slice_position
=
None
,
ifTranspose
=
False
):
def
__init__
(
self
,
filename
,
func
,
var
=
None
,
mval
=
None
,
oname
=
None
,
out
=
None
,
ndim
=
None
,
min_y
=
None
,
max_y
=
None
,
title
=
None
,
levels
=
None
,
plane_type
=
None
,
slice_position
=
None
,
ifTranspose
=
False
,
linewidth
=
None
,
legend
=
None
,
colors
=
None
,
dpi
=
None
):
if
out
==
"
plotter_lib_pngs/
"
:
if
out
==
"
plotter_lib_pngs/
"
:
print
(
"
Output directory name can
'
t be equal to
"
+
out
)
print
(
"
Output directory name can
'
t be equal to
"
+
out
)
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
...
@@ -20,6 +20,10 @@ class Args:
...
@@ -20,6 +20,10 @@ class Args:
self
.
plane_type
=
plane_type
self
.
plane_type
=
plane_type
self
.
slice_position
=
slice_position
self
.
slice_position
=
slice_position
self
.
ifTranspose
=
ifTranspose
self
.
ifTranspose
=
ifTranspose
self
.
linewidth
=
linewidth
self
.
legend
=
legend
self
.
colors
=
colors
self
.
dpi
=
dpi
self
.
CorrVals
()
self
.
CorrVals
()
...
...
This diff is collapsed.
Click to expand it.
plotter/Plotter.py
+
39
−
22
View file @
00deb98f
...
@@ -14,23 +14,27 @@ class Plotter:
...
@@ -14,23 +14,27 @@ class Plotter:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
ani_period
=
float
(
1.
/
20.
)
self
.
ani_period
=
float
(
1.
/
20.
)
self
.
filename
=
None
# self.filename = None
self
.
out
=
None
# self.out = None
self
.
oname
=
None
# self.oname = None
self
.
var
=
None
# self.var = None
self
.
mval
=
None
# self.mval = None
self
.
function
=
None
# self.function = None
self
.
file_column_names
=
None
# self.file_column_names = None
self
.
title
=
None
# self.title = None
self
.
file_data
=
None
# self.file_data = None
self
.
plt_max_val
=
None
# self.plt_max_val = None
self
.
plt_min_val
=
None
# self.plt_min_val = None
self
.
min_y
=
None
# self.min_y = None
self
.
max_y
=
None
# self.max_y = None
self
.
min_max_var_vals
=
None
# self.min_max_var_vals = None
self
.
plane_type
=
None
# self.plane_type = None
self
.
slice_position
=
None
# self.slice_position = None
self
.
ifTranspose
=
False
# self.ifTranspose = False
# self.linewidth = 4
# self.legend = None
# self.colors = None
# self.dpi = None
def
__check_arg_dim_equiv
(
self
,
args
):
def
__check_arg_dim_equiv
(
self
,
args
):
if
args
.
var
!=
None
and
args
.
mval
!=
None
:
if
args
.
var
!=
None
and
args
.
mval
!=
None
:
...
@@ -92,6 +96,10 @@ class Plotter:
...
@@ -92,6 +96,10 @@ class Plotter:
self
.
plane_type
=
args
.
plane_type
self
.
plane_type
=
args
.
plane_type
self
.
slice_position
=
args
.
slice_position
self
.
slice_position
=
args
.
slice_position
self
.
ifTranspose
=
args
.
ifTranspose
self
.
ifTranspose
=
args
.
ifTranspose
self
.
linewidth
=
args
.
linewidth
self
.
legend
=
args
.
legend
self
.
colors
=
args
.
colors
self
.
dpi
=
args
.
dpi
if
args
.
levels
!=
None
:
if
args
.
levels
!=
None
:
self
.
levels
=
args
.
levels
self
.
levels
=
args
.
levels
...
@@ -205,15 +213,20 @@ class Plotter:
...
@@ -205,15 +213,20 @@ class Plotter:
y_name
=
self
.
var
[
i
]
y_name
=
self
.
var
[
i
]
fig
=
plt
.
figure
()
fig
=
plt
.
figure
()
color_i
=
0
for
read_data
in
self
.
file_data
:
for
read_data
in
self
.
file_data
:
if
self
.
ifTranspose
:
if
self
.
ifTranspose
:
plt
.
plot
(
read_data
.
data
[
y_name
],
read_data
.
data
[
x_name
],
linewidth
=
4
)
plt
.
plot
(
read_data
.
data
[
y_name
],
read_data
.
data
[
x_name
],
linewidth
=
self
.
linewidth
,
color
=
self
.
colors
[
color_i
]
)
else
:
else
:
plt
.
plot
(
read_data
.
data
[
x_name
],
read_data
.
data
[
y_name
],
linewidth
=
4
)
plt
.
plot
(
read_data
.
data
[
x_name
],
read_data
.
data
[
y_name
],
linewidth
=
self
.
linewidth
,
color
=
self
.
colors
[
color_i
])
color_i
+=
1
if
self
.
legend
is
not
None
:
plt
.
legend
(
self
.
legend
)
else
:
plt
.
legend
(
self
.
filename
)
plt
.
legend
(
self
.
filename
)
if
self
.
ifTranspose
:
if
self
.
ifTranspose
is
False
:
plt
.
xlabel
(
x_name
,
fontsize
=
10
,
fontweight
=
'
bold
'
)
plt
.
xlabel
(
x_name
,
fontsize
=
10
,
fontweight
=
'
bold
'
)
plt
.
ylabel
(
y_name
,
fontsize
=
10
,
fontweight
=
'
bold
'
)
plt
.
ylabel
(
y_name
,
fontsize
=
10
,
fontweight
=
'
bold
'
)
else
:
else
:
...
@@ -222,7 +235,11 @@ class Plotter:
...
@@ -222,7 +235,11 @@ class Plotter:
if
self
.
if_manual_plot
:
plt
.
show
()
if
self
.
if_manual_plot
:
plt
.
show
()
else
:
plt
.
close
(
fig
)
else
:
plt
.
close
(
fig
)
if
self
.
if_save_result
:
fig
.
savefig
(
self
.
out
+
self
.
fig_names
[
i
]
+
self
.
fig_end
)
if
self
.
if_save_result
:
if
self
.
dpi
is
not
None
:
fig
.
savefig
(
self
.
out
+
self
.
fig_names
[
i
]
+
self
.
fig_end
,
dpi
=
self
.
dpi
)
else
:
fig
.
savefig
(
self
.
out
+
self
.
fig_names
[
i
]
+
self
.
fig_end
)
def
__get_min_max_ax
(
self
):
def
__get_min_max_ax
(
self
):
min_max_var_vals
=
{
var
:
[]
for
var
in
self
.
var
}
min_max_var_vals
=
{
var
:
[]
for
var
in
self
.
var
}
...
...
This diff is collapsed.
Click to expand it.
plotter/main.py
+
2
−
2
View file @
00deb98f
...
@@ -26,9 +26,9 @@ def joint_plot(filename, out = './', oname = [None], var=[None], mval=[None], mi
...
@@ -26,9 +26,9 @@ def joint_plot(filename, out = './', oname = [None], var=[None], mval=[None], mi
Plot
.
set
(
args
,
if_manual_plot
=
manual_plot
,
if_save_result
=
save_result
)
Plot
.
set
(
args
,
if_manual_plot
=
manual_plot
,
if_save_result
=
save_result
)
Plot
.
joint_plot
()
Plot
.
joint_plot
()
def
multiple_plot
(
filename
,
out
=
'
./
'
,
oname
=
'
fig.png
'
,
var
=
[
None
],
mval
=
[
None
],
min_y
=
None
,
max_y
=
None
,
ifTranspose
=
False
):
def
multiple_plot
(
filename
,
out
=
'
./
'
,
oname
=
'
fig.png
'
,
var
=
[
None
],
mval
=
[
None
],
min_y
=
None
,
max_y
=
None
,
ifTranspose
=
False
,
linewidth
=
None
,
legend
=
None
,
colors
=
None
,
dpi
=
None
):
Plot
=
Plotter
()
Plot
=
Plotter
()
args
=
Args
(
filename
,
Plot
.
multiple_plot
,
var
=
var
,
mval
=
mval
,
oname
=
oname
,
out
=
out
,
ifTranspose
=
ifTranspose
)
args
=
Args
(
filename
,
Plot
.
multiple_plot
,
var
=
var
,
mval
=
mval
,
oname
=
oname
,
out
=
out
,
ifTranspose
=
ifTranspose
,
linewidth
=
linewidth
,
legend
=
legend
,
colors
=
colors
,
dpi
=
dpi
)
Plot
.
set
(
args
,
if_manual_plot
=
manual_plot
,
if_save_result
=
save_result
)
Plot
.
set
(
args
,
if_manual_plot
=
manual_plot
,
if_save_result
=
save_result
)
Plot
.
multiple_plot
()
Plot
.
multiple_plot
()
...
...
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