Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fsleyes
fsleyes-widgets
Commits
cda06c70
Commit
cda06c70
authored
Jun 01, 2018
by
Paul McCarthy
🚵
Browse files
BF: Fixed some colour bar alignemnt issues
parent
4e8c0be0
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsleyes_widgets/utils/colourbarbitmap.py
View file @
cda06c70
...
...
@@ -44,48 +44,50 @@ def colourBarBitmap(cmap,
:align: center
:arg cmap: Name of a registered :mod:`matplotlib` colour map.
:arg cmap:
Name of a registered :mod:`matplotlib` colour map.
:arg width: Colour bar width in pixels.
:arg width:
Colour bar width in pixels.
:arg height: Colour bar height in pixels.
:arg height:
Colour bar height in pixels.
:arg
negCmap: If provided, two colour maps are drawn, centered at 0
.
:arg
cmapResolution: Colour map resolution (number of distinct colours)
.
:arg
invert:
If
``True``
, t
he
colour map
is inv
er
t
ed.
:arg
negCmap:
If
provided
, t
wo
colour map
s are drawn, cent
ered
at 0
.
:arg gamma: Gamma correction factor - exponentially weights the
colour map scale towards one end.
:arg invert: If ``True``, the colour map is inverted.
:arg
ticks
:
Locations of tick labels. Ignored if
``ticklabels i
s
N
one
``
.
:arg
gamma
:
Gamma correction factor - exponentially weights the
colour map scale toward
s one
end
.
:arg ticklabels: Tick labels.
:arg ticks: Locations of tick labels. Ignored if
``ticklabels is None``.
:arg tickalign: Tick alignment (one for each tick, either ``'left'``,
``'right'``, or ``'center'``).
:arg ticklabels: Tick labels.
:arg label: Text label to show next to the colour bar.
:arg tickalign: Tick alignment (one for each tick, either ``'left'``,
``'right'``, or ``'center'``).
:arg
orientation: Either ``vertical`` or ``horizontal``
.
:arg
label: Text label to show next to the colour bar
.
:arg labelside: Side of the colour bar to put the label - ``top``,
``bottom``, ``left`` or ``right``. If
``orientation='vertical'``, then ``top``/``bottom``
are interpreted as ``left``/``right`` (and vice-versa
when ``orientation='horizontal'``).
:arg orientation: Either ``vertical`` or ``horizontal``.
:arg alpha: Colour bar transparency, in the range ``[0.0 - 1.0]``.
:arg labelside: Side of the colour bar to put the label - ``top``,
``bottom``, ``left`` or ``right``. If
``orientation='vertical'``, then ``top``/``bottom``
are interpreted as ``left``/``right`` (and vice-versa
when ``orientation='horizontal'``).
:arg
fontsize: Label font size in points
.
:arg
alpha: Colour bar transparency, in the range ``[0.0 - 1.0]``
.
:arg bgColour: Background colour - can be any colour specification
that is accepted by :mod:`matplotlib`.
:arg fontsize: Label font size in points.
:arg
text
Colour:
Label
colour - can be any colour specification
that
is accepted by :mod:`matplotlib`.
:arg
bg
Colour:
Background
colour - can be any colour specification
that
is accepted by :mod:`matplotlib`.
:arg scale: DPI scaling factor.
:arg textColour: Label colour - can be any colour specification that
is accepted by :mod:`matplotlib`.
:arg scale: DPI scaling factor.
"""
# These imports are expensive, so we're
...
...
@@ -116,6 +118,12 @@ def colourBarBitmap(cmap,
if
labelside
==
'left'
:
labelside
=
'top'
else
:
labelside
=
'bottom'
# force tick positions to
# the left edge of the
# corresponding colour
if
ticks
is
not
None
:
ticks
=
[
t
-
0.5
/
cmapResolution
for
t
in
ticks
]
# Default is 96 dpi to an inch
winches
=
width
/
96.0
hinches
=
height
/
96.0
...
...
@@ -210,7 +218,7 @@ def colourBarBitmap(cmap,
for
l
,
a
in
zip
(
ticklabels
,
tickalign
):
l
.
set_horizontalalignment
(
a
)
ax
.
set_xlim
((
0
,
ncols
-
1
))
ax
.
set_xlim
((
-
0.5
,
ncols
-
0.5
))
canvas
.
draw
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment