Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
formula student elo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Service Desk
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
GET racing FOSS
formula student elo
Commits
38c41fc3
Commit
38c41fc3
authored
4 months ago
by
Marius Heidenreich
Browse files
Options
Downloads
Patches
Plain Diff
Delete test.py
parent
1786c087
No related branches found
No related tags found
No related merge requests found
Pipeline
#277541
passed
4 months ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test.py
+0
-50
0 additions, 50 deletions
test.py
with
0 additions
and
50 deletions
test.py
deleted
100644 → 0
+
0
−
50
View file @
1786c087
import
matplotlib.pyplot
as
plt
import
numpy
as
np
np
.
random
.
seed
(
19680801
)
def
gradient_image
(
ax
,
direction
=
1
,
cmap_range
=
(
0
,
1
),
**
kwargs
):
"""
Draw a gradient image based on a colormap.
Parameters
----------
ax : Axes
The Axes to draw on.
direction : float
The direction of the gradient. This is a number in
range 0 (=vertical) to 1 (=horizontal).
cmap_range : float, float
The fraction (cmin, cmax) of the colormap that should be
used for the gradient, where the complete colormap is (0, 1).
**kwargs
Other parameters are passed on to `.Axes.imshow()`.
In particular, *cmap*, *extent*, and *transform* may be useful.
"""
phi
=
direction
*
np
.
pi
/
2
v
=
np
.
array
([
np
.
cos
(
phi
),
np
.
sin
(
phi
)])
X
=
np
.
array
([[
v
@
[
1
,
0
],
v
@
[
1
,
1
]],
[
v
@
[
0
,
0
],
v
@
[
0
,
1
]]])
a
,
b
=
cmap_range
X
=
a
+
(
b
-
a
)
/
X
.
max
()
*
X
im
=
ax
.
imshow
(
X
,
interpolation
=
'
bicubic
'
,
clim
=
(
0
,
1
),
aspect
=
'
auto
'
,
**
kwargs
)
return
im
def
gradient_bar
(
ax
,
x
,
y
,
width
=
0.5
,
bottom
=
0
):
for
left
,
top
in
zip
(
x
,
y
):
right
=
left
+
width
gradient_image
(
ax
,
extent
=
(
left
,
right
,
bottom
,
top
),
cmap
=
plt
.
cm
.
Blues_r
,
cmap_range
=
(
0
,
0.8
))
fig
,
ax
=
plt
.
subplots
()
ax
.
set
(
xlim
=
(
0
,
10
),
ylim
=
(
0
,
1
))
N
=
10
x
=
np
.
arange
(
N
)
+
0.15
y
=
np
.
random
.
rand
(
N
)
gradient_bar
(
ax
,
x
,
y
,
width
=
0.7
)
plt
.
show
()
\ No newline at end of file
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