Skip to content

Commit fe2e780

Browse files
authored
Merge pull request #164 from danielhkl/master
missing yLabel at colorbar
2 parents c95d367 + a20cf6d commit fe2e780

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

matplotlib2tikz/axes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def __init__(self, data, obj):
300300
colorbar_ticklabels = colorbar.ax.get_xticklabels()
301301
colorbar_ticklabels_minor = colorbar.ax.get_xticklabels(
302302
'minor')
303+
303304
colorbar_styles.extend(
304305
_get_ticks(data, 'x', colorbar_ticks, colorbar_ticklabels)
305306
)
@@ -334,6 +335,7 @@ def __init__(self, data, obj):
334335
# Getting the labels via get_* might not actually be suitable:
335336
# they might not reflect the current state.
336337
colorbar_ticklabels = colorbar.ax.get_yticklabels()
338+
colorbar_ylabel = colorbar.ax.get_ylabel()
337339
colorbar_ticklabels_minor = colorbar.ax.get_yticklabels(
338340
'minor')
339341
colorbar_styles.extend(
@@ -344,6 +346,7 @@ def __init__(self, data, obj):
344346
data, 'minor y', colorbar_ticks_minor,
345347
colorbar_ticklabels_minor)
346348
)
349+
colorbar_styles.append('ylabel={'+ colorbar_ylabel +'}')
347350

348351
mycolormap, is_custom_cmap = _mpl_cmap2pgf_cmap(
349352
colorbar.get_cmap()

matplotlib2tikz/image.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ def draw_image(data, obj):
2727
# store the image as in a file
2828
img_array = obj.get_array()
2929

30-
if obj.origin == "lower":
31-
img_array = numpy.flipud(img_array)
32-
3330
dims = img_array.shape
3431
if len(dims) == 2: # the values are given as one real number: look at cmap
3532
clims = obj.get_clim()
@@ -45,6 +42,8 @@ def draw_image(data, obj):
4542
# RGB (+alpha) information at each point
4643
assert len(dims) == 3 and dims[2] in [3, 4]
4744
# convert to PIL image
45+
if obj.origin == "lower":
46+
img_array = numpy.flipud(img_array)
4847
image = PIL.Image.fromarray(img_array)
4948
image.save(filename, origin=obj.origin)
5049

test/test_line_collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ def plot():
5353

5454

5555
def test():
56-
helpers.assert_phash(plot(), '4b52b5bdb45ca462')
56+
helpers.assert_phash(plot(), '5356a5adac9cac62')

0 commit comments

Comments
 (0)