#! /usr/bin/env python #David Shean #[email protected] #Library of common matplotlib functions #Should migrate much of imview functionality here, update to work with ax import matplotlib import matplotlib.pyplot as plt import numpy as np from imview.lib import gmtColormap cpt_rainbow = gmtColormap.get_rainbow() plt.register_cmap(cmap=cpt_rainbow) cpt_rainbow_r = gmtColormap.get_rainbow(rev=True) plt.register_cmap(cmap=cpt_rainbow_r) #import itertools #color_list = ['b', 'g', 'r', 'c', 'm', 'y', 'k'] #colors = itertools.cycle(color_list) def hide_ticks(ax): ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) def best_scalebar_location(a, length_pad=0.2, height_pad=0.1): """ Attempt to determine best corner for scalebar based on number of unmasked pixels """
Simple interactive image viewer to generate good/bad lists from input list of filenames """ import sys import os import argparse from osgeo import gdal import matplotlib.pyplot as plt import matplotlib.image as mpimg from pygeotools.lib import iolib from pygeotools.lib import malib from imview.lib import gmtColormap cpt_rainbow = gmtColormap.get_rainbow() plt.register_cmap(cmap=cpt_rainbow) def query_yes_no(question, default="yes"): """Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is one of "yes" or "no". """ valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} if default == None: