Skip to content

Commit

Permalink
consistant outputs for equatContour, radialContour, merContour, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
tgastine committed Feb 26, 2025
1 parent 02d155c commit 2ea923e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 8 additions & 7 deletions python/magic/plotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def equatContour(data, radius, minc=1, label=None, levels=defaultLevels,
ax.set_title(label, fontsize=24)
else:
if cbar:
fig = plt.figure(figsize=(6.5,5))
fig = plt.figure(figsize=(5,4))
ax = fig.add_axes([0.01, 0.01, 0.76, 0.98])
else:
fig = plt.figure(figsize=(5, 5))
Expand Down Expand Up @@ -335,17 +335,18 @@ def equatContour(data, radius, minc=1, label=None, levels=defaultLevels,
if title and label is not None:
cax = fig.add_axes([0.85, 0.46-0.7*h/2., 0.03, 0.7*h])
else:
cax = fig.add_axes([0.85, 0.5-0.7*h/2., 0.03, 0.7*h])
cax = fig.add_axes([0.85, 0.51-0.7*h/2., 0.05, 0.7*h])
#cax = fig.add_axes([0.9, 0.51-0.7*h/2., 0.03, 0.7*h])
mir = fig.colorbar(im, cax=cax)

#To avoid white lines on pdfs
if not pcolor:
for c in im.collections:
for c in ax.collections:
c.set_edgecolor('face')
if rasterized:
c.set_rasterized(True)

return fig, xx, yy
return fig, xx, yy, im


def merContour(data, radius, label=None, levels=defaultLevels, cm=defaultCm,
Expand Down Expand Up @@ -473,7 +474,7 @@ def merContour(data, radius, label=None, levels=defaultLevels, cm=defaultCm,

# To avoid white lines on pdfs
if not pcolor:
for c in im.collections:
for c in ax.collections:
c.set_edgecolor('face')
if rasterized:
c.set_rasterized(True)
Expand Down Expand Up @@ -730,9 +731,9 @@ def radialContour(data, rad=0.85, label=None, proj='hammer', lon_0=0., vmax=None

# To avoid white lines on pdfs
if not pcolor:
for c in im.collections:
for c in ax.collections:
c.set_edgecolor('face')
if rasterized:
c.set_rasterized(True)

return fig, x, y
return fig, x, y, im
6 changes: 3 additions & 3 deletions python/magic/surf.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ def equat(self, field='vr', levels=defaultLevels, cm=None,
if cm is None:
cm = default_cmap(field)

fig, xx, yy = equatContour(equator, self.gr.radius, self.gr.minc,
label, levels, cm, normed, vmax, vmin,
cbar, title, normRad, pcolor=pcolor)
fig, xx, yy, im = equatContour(equator, self.gr.radius, self.gr.minc,
label, levels, cm, normed, vmax, vmin,
cbar, title, normRad, pcolor=pcolor)
ax = fig.get_axes()[0]

if ic and data_ic is not None:
Expand Down

0 comments on commit 2ea923e

Please sign in to comment.