Commit b11ed04a authored by Vigeesh Gangadharan's avatar Vigeesh Gangadharan
Browse files

corrected plots, closes #45

parent e4e1f207
Pipeline #2968 passed with stage
in 3 minutes and 7 seconds
......@@ -1010,6 +1010,7 @@ def create_map(
dpi=100,
cticks=None,
cbar_title=None,
#bbox=None,
annotate_starttime=False,
annotate_endtime=False,
):
......@@ -1083,9 +1084,9 @@ def create_map(
# set lon_lat axis
if header['INSTRUME']=='GRIS':
set_axis_lon_lat(ax, grid=grid)
set_axis_lon_lat(ax, grid=grid,spacing = 5 * Unit.arcsec)
elif header['INSTRUME']=='GRIS-IFU':
set_axis_lon_lat(ax, grid=grid, spacing = 50 * Unit.arcsec)
set_axis_lon_lat(ax, grid=grid)#, spacing = 50 * Unit.arcsec)
# additonal axis
set_additional_axis(ax, header)
......@@ -1130,11 +1131,18 @@ def create_map(
cbar.ax.set_ylabel(cbar_title + f" ({data.unit})")
# save plot
# if bbox==None:
# bbox = fig.get_tightbbox(fig.canvas.get_renderer())
# plt.savefig(filename, bbox_inches="tight")
# else:
plt.savefig(filename, bbox_inches="tight")
#plt.show()
# close plot
plt.close("all")
return None#bbox
def plot_image(
data,
......@@ -1196,7 +1204,7 @@ def plot_image(
data[0, ...], unit_data, unit_vmax, cticks, cfmt
)
create_map(
bbox = create_map(
unit_data[0, ...],
header,
preview,
......@@ -1237,10 +1245,11 @@ def plot_image(
annotate_endtime = False
if imap == 0:
annotate_starttime = True
bbox=None
if imap == header["RMAPS"] - 1:
annotate_endtime = True
create_map(
bbox = create_map(
unit_data[imap, ...],
header,
outpath,
......@@ -1254,6 +1263,7 @@ def plot_image(
cbar_title=cbar_title,
annotate_starttime=annotate_starttime,
annotate_endtime=annotate_endtime,
#bbox=bbox
)
filelist = glob(os.path.join(td.name, "*"))
......@@ -1351,7 +1361,7 @@ def switch_coordinates(lon, lat, canvas):
canvas.draw()
def set_axis_lon_lat(ax, grid=None,spacing=5 * Unit.arcsec):
def set_axis_lon_lat(ax, grid=None, spacing=None):
"""Format the Longitude and Latitude axes"""
# get the longitude and latitude
lon = ax.coords["hpln"]
......@@ -1362,15 +1372,19 @@ def set_axis_lon_lat(ax, grid=None,spacing=5 * Unit.arcsec):
lat.set_axislabel("HPLT-TAN")
# set the ticks for the longitude and latitude
lon.set_ticks(spacing=spacing, color="dimgray")
lat.set_ticks(spacing=spacing, color="dimgray")
if spacing:
lon.set_ticks(spacing=spacing, color="dimgray")
lat.set_ticks(spacing=spacing, color="dimgray")
else:
lon.set_ticks(color="dimgray")
lat.set_ticks(color="dimgray")
# draw the figure
canvas = ax.figure.canvas
canvas.draw()
# Switch axis if the labels are not created.
# in cases where the slits are horionzatally-oriented.
# # Switch axis if the labels are not created.
# # in cases where the slits are horionzatally-oriented.
switch_coordinates(lon, lat, canvas)
# Add gris lines for longitude and latitude
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment