Skip to content

Commit

Permalink
proper label along the axes
Browse files Browse the repository at this point in the history
  • Loading branch information
teuben committed Aug 25, 2023
1 parent 0962df6 commit 053acf7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions plot2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,29 @@ def animate(i):
else:
d = data[i][zvar][0]
time = data[i]['time']
#xlim = data[i]['xlim']
#ylim = data[i]['ylim']
sax.set_xlim((-0.5,0.5))
xlim = data[i]['xlim']
ylim = data[i]['ylim']
extent=[xlim[0],xlim[1],ylim[0],ylim[1]]
#sax.set_xlim((-0.5,0.5))


ax.clear()
#ax.set_xlim(xlim)
#ax.set_ylim(ylim)
if True:
im = ax.imshow(d,cmap=kwargs['cmap'], # norm=norm, vmin=vmin, vmax=vmax,
interpolation='none', origin='lower')
interpolation='none', origin='lower', extent=extent)


# @todo this fig.colorbar() will recursively die
# fig.colorbar(im, cax=cax, orientation='vertical')
else:
# now broken after using extent=
im = ax.imshow(d,cmap=kwargs['cmap'], # norm=norm, vmin=vmin, vmax=vmax,
interpolation='none', origin='lower')

interpolation='none', origin='lower', extent=extent)
x = np.arange(d.shape[0])
y = np.arange(d.shape[1])
cs = ax.contour(x,y,d)
cs = ax.contour(x,y,d,extent=extent)

if not xlim and args.fix: # just need to check one since its either both or none
xlim = ax.get_xlim()
Expand Down Expand Up @@ -159,6 +162,8 @@ def update_cols(x, y):
def update_delay(x):
global delay
delay = x / 1000
# something odd about setting the delay
# print("DELAY:",delay)

def update_fslider(n):
global frame_sliding, current_frame
Expand All @@ -184,7 +189,6 @@ def reload_data():
print("Reading %d data-frames for %s" % (length,zvar))
for i in range(len(f)):
data[i] = athena_read.bin(f[i],False,**kwargs)
print("Done")


argparser = ArgumentParser(description='plots the athena tab files specified')
Expand Down

0 comments on commit 053acf7

Please sign in to comment.