Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
landscape_opt_networks_submission
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
Container 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
Francois Hamonic
landscape_opt_networks_submission
Commits
489ee9e4
There was an error fetching the commit references. Please try again later.
Commit
489ee9e4
authored
3 years ago
by
Francois Hamonic
Browse files
Options
Downloads
Patches
Plain Diff
whiskers plot
parent
cae52ce0
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_scripts/contraction_benefits_whiskers.py
+44
-34
44 additions, 34 deletions
plot_scripts/contraction_benefits_whiskers.py
with
44 additions
and
34 deletions
plot_scripts/contraction_benefits_whiskers.py
+
44
−
34
View file @
489ee9e4
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
csv
import
csv
import
pylab
def
readCSV
(
file_name
,
delimiter
=
'
'
):
def
readCSV
(
file_name
,
delimiter
=
'
'
):
file
=
csv
.
DictReader
(
open
(
file_name
),
delimiter
=
delimiter
)
file
=
csv
.
DictReader
(
open
(
file_name
),
delimiter
=
delimiter
)
return
list
([
row
for
row
in
file
])
return
list
([
row
for
row
in
file
])
rows
=
readCSV
(
'
output/contraction_benefits.csv
'
,
"
,
"
)
rows
=
readCSV
(
'
output/contraction_benefits.csv
'
,
"
,
"
)
x_datas
=
range
(
0
,
105
,
5
)
x_datas
=
range
(
0
,
105
,
5
)
def
get_datas
(
t
,
percent
):
def
get_datas
(
t
,
percent
):
return
[
100
*
(
1
-
float
(
row
[
"
nb_{}_contract
"
.
format
(
t
)])
/
float
(
row
[
"
nb_{}
"
.
format
(
t
)]))
for
row
in
rows
if
int
(
row
[
"
percent_arcs
"
])
==
percent
]
return
[
100
*
(
1
-
float
(
row
[
"
nb_{}_contract
"
.
format
(
t
)])
/
float
(
row
[
"
nb_{}
"
.
format
(
t
)]))
for
row
in
rows
if
int
(
row
[
"
percent_arcs
"
])
==
percent
]
datas
=
[
# get_datas("constraints", p)
get_datas
(
"
vars
"
,
p
)
# get_datas("elems", p)
for
p
in
x_datas
]
fig_size
=
plt
.
rcParams
[
"
figure.figsize
"
]
fig_size
[
0
]
=
10
fig_size
[
1
]
=
5
plt
.
rcParams
[
"
figure.figsize
"
]
=
fig_size
plt
.
subplots_adjust
(
left
=
0.125
,
right
=
0.95
,
top
=
0.92
,
bottom
=
0.13
)
plt
.
rcParams
.
update
({
'
font.size
'
:
16
})
ymin
=
0
ymax
=
100
yrange
=
ymax
-
ymin
y_border_percent
=
7.5
y_bottom
=
ymin
-
y_border_percent
*
yrange
/
100
y_top
=
ymax
+
y_border_percent
*
yrange
/
100
plt
.
ylim
(
y_bottom
,
y_top
)
vars_datas
=
[
get_datas
(
"
vars
"
,
p
)
for
p
in
x_datas
]
# plt.title("quebec-{}-{}-ECA value vs available budget.pdf".format(orig, median))
constr_datas
=
[
plt
.
ylabel
(
'
percentage of elements
\n
removed by the preprocessing
'
,
rotation
=
90
,
fontweight
=
'
bold
'
)
get_datas
(
"
constraints
"
,
p
)
for
p
in
x_datas
plt
.
xlabel
(
"
percentage of restored arcs
"
,
fontweight
=
'
bold
'
)
]
elems_datas
=
[
get_datas
(
"
elems
"
,
p
)
for
p
in
x_datas
]
plt
.
boxplot
(
datas
,
showfliers
=
False
)
plt
.
rcParams
[
"
figure.figsize
"
]
=
(
10
,
8
)
pylab
.
xticks
(
range
(
1
,
1
+
len
(
datas
)),
x_datas
)
plt
.
rcParams
[
"
font.size
"
]
=
13.75
fig
,
axs
=
plt
.
subplots
(
3
)
for
i
in
[
0
,
1
,
2
]:
# axs[i].axhline(y=75, color='lightblue', linestyle='--')
# axs[i].axhline(y=50, color='dodgerblue', linestyle='--')
# axs[i].axhline(y=25, color='lightblue', linestyle='--')
axs
[
i
].
axhline
(
y
=
20
,
color
=
'
lightblue
'
,
linestyle
=
'
--
'
)
axs
[
i
].
axhline
(
y
=
40
,
color
=
'
lightblue
'
,
linestyle
=
'
--
'
)
axs
[
i
].
axhline
(
y
=
60
,
color
=
'
lightblue
'
,
linestyle
=
'
--
'
)
axs
[
i
].
axhline
(
y
=
80
,
color
=
'
lightblue
'
,
linestyle
=
'
--
'
)
bplot1
=
axs
[
0
].
boxplot
(
vars_datas
,
showfliers
=
False
,
patch_artist
=
True
)
axs
[
0
].
set
(
xlabel
=
None
,
ylabel
=
'
removed variables
'
)
axs
[
0
].
set_xticklabels
([])
bplot2
=
axs
[
1
].
boxplot
(
constr_datas
,
showfliers
=
False
,
patch_artist
=
True
)
axs
[
1
].
set
(
xlabel
=
None
,
ylabel
=
'
removed constraints
'
)
axs
[
1
].
set_xticklabels
([])
bplot3
=
axs
[
2
].
boxplot
(
elems_datas
,
showfliers
=
False
,
patch_artist
=
True
)
axs
[
2
].
set
(
xlabel
=
"
percentage of improvable arcs
"
,
ylabel
=
'
removed entries
'
)
axs
[
2
].
set_xticklabels
([
x
if
x
%
10
==
0
else
""
for
x
in
x_datas
])
for
bplot
in
(
bplot1
,
bplot2
,
bplot3
):
for
patch
in
bplot
[
'
boxes
'
]:
patch
.
set_facecolor
(
'
white
'
)
# legend = plt.legend(loc='lower right', shadow=True, fontsize='medium')
# legend = plt.legend(loc='lower right', shadow=True, fontsize='medium')
plt
.
show
()
plt
.
tight_layout
()
fig
.
subplots_adjust
(
hspace
=
0.08
)
plt
.
savefig
(
"
output/contraction_benefits_whiskers.pdf
"
,
dpi
=
500
)
plt
.
savefig
(
"
output/contraction_benefits_whiskers.pdf
"
,
dpi
=
500
)
plt
.
show
()
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