ax1.add_feature(state_boundaries, linestyle=':', edgecolor='black') ax1.add_feature(cfeat.BORDERS, linewidth='2', edgecolor='black') im = ax1.imshow(goes_image, extent=(x.min(), x.max(), y.min(), y.max()), origin='upper') im.set_cmap('Greys') im.set_norm(plt.Normalize(200, 330)) # Plot text on the satellite image text_time = ax1.text(0.99, 0.01, time.strftime('%d %B %Y %H%MZ'), horizontalalignment='right', transform=ax1.transAxes, color='white', fontsize='x-large', weight='bold') text_channel = ax1.text(0.5, 0.97, 'Experimental GOES-16 Channel 13', horizontalalignment='center', transform=ax1.transAxes, color='white', fontsize='large', weight='bold') # Make the text stand out even better using matplotlib's path effects outline_effect = [patheffects.withStroke(linewidth=2, foreground='black')] text_time.set_path_effects(outline_effect) text_channel.set_path_effects(outline_effect) add_logo(fig, size='large') plt.savefig('plots/{:06d}.png'.format(frame_number+start_number)) plt.close() frame_number += 1 break except: print('Failed, retry {}'.format(retries)) retries += 1
color='white', fontsize='x-large', weight='bold') text_channel = ax1.text(0.5, 0.97, 'Experimental GOES-16 Channel 13', horizontalalignment='center', transform=ax1.transAxes, color='white', fontsize='large', weight='bold') # Make the text stand out even better using matplotlib's path effects outline_effect = [ patheffects.withStroke(linewidth=2, foreground='black') ] text_time.set_path_effects(outline_effect) text_channel.set_path_effects(outline_effect) add_logo(fig, size='large') plt.savefig('plots/{:06d}.png'.format(frame_number + start_number)) plt.close() frame_number += 1 break except: print('Failed, retry {}'.format(retries)) retries += 1
ax1.scatter(station_longitude, station_latitude, s=80, color='r', marker='*', transform=ccrs.PlateCarree()) # Plot text on the satellite image text_time = ax1.text(0.99, 0.01, time.strftime('%d %B %Y %H%MZ'), horizontalalignment='right', transform=ax1.transAxes, color='white', fontsize='x-large', weight='bold') text_channel = ax1.text(0.5, 0.97, 'Experimental GOES-16 Channel 14', horizontalalignment='center', transform=ax1.transAxes, color='white', fontsize='large', weight='bold') # Make the text stand out even better using matplotlib's path effects outline_effect = [patheffects.withStroke(linewidth=2, foreground='black')] text_time.set_path_effects(outline_effect) text_channel.set_path_effects(outline_effect) # Plot the seismic data ax2.plot(trace_time, trace_data, color='k') ax2.axvline(x=time, color='red', linewidth=2) ax2.xaxis.set_major_formatter(DateFormatter('%m/%d')) ax2.xaxis.set_minor_formatter(DateFormatter('%HZ')) ax2.xaxis.set_major_locator(DayLocator()) ax2.xaxis.set_minor_locator(HourLocator([6, 12, 18])) add_logo(fig, size='small', x=45, y=270) ax2.get_yaxis().set_ticks([]) plt.savefig('plots/{:04d}.png'.format(i+start_number)) plt.close()
def test_add_logo_invalid_size(): """Test adding a logo to a figure with an invalid size specification.""" fig = plt.figure(figsize=(9, 9)) with pytest.raises(ValueError): add_logo(fig, size='jumbo')
def test_add_logo_large(): """Test adding a logo to a figure.""" fig = plt.figure(figsize=(9, 9)) add_logo(fig, size='large') return fig
def test_add_logo_small(): """Test adding a logo to a figure.""" fig = plt.figure(figsize=(9, 9)) add_logo(fig) return fig
weight='bold') text_channel = ax1.text(0.5, 0.97, 'Experimental GOES-16 Channel 14', horizontalalignment='center', transform=ax1.transAxes, color='white', fontsize='large', weight='bold') # Make the text stand out even better using matplotlib's path effects outline_effect = [patheffects.withStroke(linewidth=2, foreground='black')] text_time.set_path_effects(outline_effect) text_channel.set_path_effects(outline_effect) # Plot the seismic data ax2.plot(trace_time, trace_data, color='k') ax2.axvline(x=time, color='red', linewidth=2) ax2.xaxis.set_major_formatter(DateFormatter('%m/%d')) ax2.xaxis.set_minor_formatter(DateFormatter('%HZ')) ax2.xaxis.set_major_locator(DayLocator()) ax2.xaxis.set_minor_locator(HourLocator([6, 12, 18])) add_logo(fig, size='small', x=45, y=270) ax2.get_yaxis().set_ticks([]) plt.savefig('plots/{:04d}.png'.format(i + start_number)) plt.close()