Python matplotlib.colors.hex2color() Examples
The following are 16
code examples of matplotlib.colors.hex2color().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.colors
, or try the search function
.
Example #1
Source File: vista_aux.py From gempy with GNU Lesser General Public License v3.0 | 6 votes |
def call_back_plane_move_changes(self, indices): df_changes = self.model._orientations.df.loc[np.atleast_1d(indices).astype(int)][['X', 'Y', 'Z', 'G_x', 'G_y', 'G_z', 'id']] for index, new_values_df in df_changes.iterrows(): new_center = new_values_df[['X', 'Y', 'Z']].values new_normal = new_values_df[['G_x', 'G_y', 'G_z']].values new_source = vtk.vtkPlaneSource() new_source.SetCenter(new_center) new_source.SetNormal(new_normal) new_source.Update() plane1 = self.orientations_widgets[index] # plane1.SetInputData(new_source.GetOutput()) plane1.SetNormal(new_normal) plane1.SetCenter(new_center[0], new_center[1], new_center[2]) _color_lot = self._get_color_lot(is_faults=True, is_basement=False, index='id') plane1.GetPlaneProperty().SetColor(mcolors.hex2color(_color_lot[int(new_values_df['id'])])) plane1.GetHandleProperty().SetColor(mcolors.hex2color(_color_lot[int(new_values_df['id'])]))
Example #2
Source File: specialdraw.py From ibeis with Apache License 2.0 | 5 votes |
def lighten_hex(hexcolor, amount): import plottool_ibeis as pt import matplotlib.colors as colors return pt.color_funcs.lighten_rgb(colors.hex2color(hexcolor), amount)
Example #3
Source File: sf_heatmap.py From pancanatlas_code_public with MIT License | 5 votes |
def _get_heatmap_row_colors(meta_df, index): cnc_to_color = utils.load_color_scheme(config.color_scheme_path) for key, value in cnc_to_color.items(): rgb = hex2color(value) cnc_to_color[key] = rgb + (1.0,) cnc_to_color[key + ' (Normal)'] = rgb + (.5,) row_colors = meta_df['cnc'].map(cnc_to_color).loc[index] return row_colors, cnc_to_color
Example #4
Source File: colors.py From infopanel with GNU General Public License v3.0 | 5 votes |
def rgb_from_name(color_name): """Get a rgb color from a color name.""" rgb_norm = mcolor.hex2color(mcolor.cnames[color_name]) rgb = [int(x * 255) for x in rgb_norm] return rgb
Example #5
Source File: plot_utils.py From videograph with GNU General Public License v3.0 | 5 votes |
def colors_256(): indexcolors = ["#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58", "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87", "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80", "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100", "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F", "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09", "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66", "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C", "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81", "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00", "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700", "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329", "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C", "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800", "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51", "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58"] rgb_colors = np.array([colors.hex2color(c) for c in indexcolors]) return rgb_colors
Example #6
Source File: plot_utils.py From videograph with GNU General Public License v3.0 | 5 votes |
def hex_to_int(hex_colors): rgb_colors = np.array([colors.hex2color(c) for c in hex_colors]) rgb_colors = np.multiply(rgb_colors, 255).astype(np.int) return rgb_colors
Example #7
Source File: plot.py From seqc with GNU General Public License v2.0 | 5 votes |
def tatarize(n): """ Return n-by-3 RGB color matrix using the "tatarize" color alphabet (n <= 269) :param n: :return: """ with open(os.path.expanduser('~/.seqc/tools/tatarize_269.txt')) as f: s = f.read().split('","') s[0] = s[0].replace('{"', '') s[-1] = s[-1].replace('"}', '') s = [hex2color(s) for s in s] return s[:n]
Example #8
Source File: vista_aux.py From gempy with GNU Lesser General Public License v3.0 | 5 votes |
def call_back_sphere_move_changes(self, indices): df_changes = self.model._surface_points.df.loc[np.atleast_1d(indices)][['X', 'Y', 'Z', 'id']] for index, df_row in df_changes.iterrows(): new_center = df_row[['X', 'Y', 'Z']].values # Update renderers s1 = self.surface_points_widgets[index] r_f = s1.GetRadius() * 2 s1.PlaceWidget(new_center[0] - r_f, new_center[0] + r_f, new_center[1] - r_f, new_center[1] + r_f, new_center[2] - r_f, new_center[2] + r_f) _color_lot = self._get_color_lot(is_faults=True, is_basement=False, index='id') s1.GetSphereProperty().SetColor(mcolors.hex2color(_color_lot[(df_row['id'])]))
Example #9
Source File: _vista.py From gempy with GNU Lesser General Public License v3.0 | 5 votes |
def call_back_sphere_move_changes(self, indices): df_changes = self.model._surface_points.df.loc[np.atleast_1d(indices)][['X', 'Y', 'Z', 'id']] for index, df_row in df_changes.iterrows(): new_center = df_row[['X', 'Y', 'Z']].values # Update renderers s1 = self.s_widget.loc[index, 'val'] r_f = s1.GetRadius() * 2 s1.PlaceWidget(new_center[0] - r_f, new_center[0] + r_f, new_center[1] - r_f, new_center[1] + r_f, new_center[2] - r_f, new_center[2] + r_f) s1.GetSphereProperty().SetColor(mcolors.hex2color(self._color_lot[df_row['id']]))
Example #10
Source File: visualization_3d.py From gempy with GNU Lesser General Public License v3.0 | 5 votes |
def create_sphere(self, X, Y, Z, fn, n_sphere=0, n_render=0, n_index=0, r=0.03): """ Method to create the sphere that represent the surface_points points Args: X: X coord Y: Y coord Z: Z corrd fn (int): id n_sphere (int): Number of the sphere n_render (int): Number of the render where the sphere belongs n_index (int): index value in the PandasDataframe of InupData.surface_points r (float): radius of the sphere Returns: vtk.vtkSphereWidget """ s = vtk.vtkSphereWidget() s.SetInteractor(self.interactor) s.SetRepresentationToSurface() s.SetPriority(2) Z = Z * self.ve s.r_f = self._e_d_avrg * r s.PlaceWidget(X - s.r_f, X + s.r_f, Y - s.r_f, Y + s.r_f, Z - s.r_f, Z + s.r_f) s.GetSphereProperty().SetColor(mcolors.hex2color(self.geo_model._surfaces.df.set_index('id')['color'][fn]))#self.C_LOT[fn]) s.SetCurrentRenderer(self.ren_list[n_render]) s.n_sphere = n_sphere s.n_render = n_render s.index = n_index s.AddObserver("EndInteractionEvent", self.sphereCallback) # EndInteractionEvent s.AddObserver("InteractionEvent", self.Callback_camera_reset) s.On() return s
Example #11
Source File: visualization_3d.py From gempy with GNU Lesser General Public License v3.0 | 5 votes |
def set_geological_map(self): assert self.geo_model.solutions.geological_map is not None, 'Geological map not computed. First' \ 'set active the topography grid' arr_ = np.empty((0, 3), dtype='int') # Convert hex colors to rgb for idx, val in self.geo_model._surfaces.df['color'].iteritems(): rgb = (255 * np.array(mcolors.hex2color(val))) arr_ = np.vstack((arr_, rgb)) sel = np.round(self.geo_model.solutions.geological_map[0]).astype(int)[0] nv = numpy_to_vtk(arr_[sel - 1], array_type=3) self._topography_delauny.GetOutput().GetPointData().SetScalars(nv)
Example #12
Source File: visualization_3d.py From gempy with GNU Lesser General Public License v3.0 | 5 votes |
def SphereCallbak_move_changes(self, indices): # print(indices) df_changes = self.geo_model._surface_points.df.loc[np.atleast_1d(indices)][['X', 'Y', 'Z', 'id']] for index, df_row in df_changes.iterrows(): new_center = df_row[['X', 'Y', 'Z']].values # Update renderers s1 = self.s_rend_1.loc[index, 'val'] s1.PlaceWidget(new_center[0] - s1.r_f, new_center[0] + s1.r_f, new_center[1] - s1.r_f, new_center[1] + s1.r_f, new_center[2] - s1.r_f, new_center[2] + s1.r_f) s1.GetSphereProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][df_row['id']]))#self.C_LOT[df_row['id']]) s2 = self.s_rend_2.loc[index, 'val'] s2.PlaceWidget(new_center[0] - s2.r_f, new_center[0] + s2.r_f, new_center[1] - s2.r_f, new_center[1] + s2.r_f, new_center[2] - s2.r_f, new_center[2] + s2.r_f) s2.GetSphereProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][df_row['id']])) s3 = self.s_rend_3.loc[index, 'val'] s3.PlaceWidget(new_center[0] - s3.r_f, new_center[0] + s3.r_f, new_center[1] - s3.r_f, new_center[1] + s3.r_f, new_center[2] - s3.r_f, new_center[2] + s3.r_f) s3.GetSphereProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][df_row['id']])) s4 = self.s_rend_4.loc[index, 'val'] s4.PlaceWidget(new_center[0] - s4.r_f, new_center[0] + s4.r_f, new_center[1] - s4.r_f, new_center[1] + s4.r_f, new_center[2] - s4.r_f, new_center[2] + s4.r_f) s4.GetSphereProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][df_row['id']]))
Example #13
Source File: _vista.py From gempy with GNU Lesser General Public License v3.0 | 4 votes |
def plot_topography(self, topography = None, scalars='geo_map', **kwargs): """ Args: topography: gp Topography object, np.array or None scalars: **kwargs: Returns: """ if topography is None: topography = self.model._grid.topography.values rgb = False # Create vtk object cloud = pv.PolyData(topography) # Set scalar values if scalars == 'geo_map': arr_ = np.empty((0, 3), dtype='int') # Convert hex colors to rgb for val in list(self._color_lot): rgb = (255 * np.array(mcolors.hex2color(val))) arr_ = np.vstack((arr_, rgb)) sel = np.round(self.model.solutions.geological_map[0]).astype(int)[0] # print(arr_) # print(sel) scalars_val = numpy_to_vtk(arr_[sel-1], array_type=3) cm = None rgb = True elif scalars == 'topography': scalars_val = topography[:, 2] cm = 'terrain' elif type(scalars) is np.ndarray: scalars_val = scalars scalars = 'custom' cm = 'terrain' else: raise AttributeError() topo_actor = self.p.add_mesh(cloud.delaunay_2d(), scalars=scalars_val, cmap=cm, rgb=rgb, **kwargs) self.vista_topo_actors[scalars] = topo_actor return topo_actor
Example #14
Source File: _vista.py From gempy with GNU Lesser General Public License v3.0 | 4 votes |
def plot_topography( self, topography = None, scalars="geomap", **kwargs ): if not topography: try: topography = self.model._grid.topography.values except AttributeError: print("Unable to plot topography: Given geomodel instance " "does not contain topography grid.") return polydata = pv.PolyData(topography) rgb = False if scalars == "geomap": arr_ = np.empty((0, 3), dtype=int) # convert hex colors to rgb for val in list(self._get_color_lot(faults=False)): rgb = (255 * np.array(mcolors.hex2color(val))) arr_ = np.vstack((arr_, rgb)) sel = np.round(self.model.solutions.geological_map[0]).astype(int)[0] scalars_val = numpy_to_vtk(arr_[sel - 1], array_type=3) cm = None rgb = True elif scalars == "topography": scalars_val = topography[:, 2] cm = 'terrain' elif type(scalars) is np.ndarray: scalars_val = scalars scalars = 'custom' cm = 'terrain' else: raise AttributeError("Parameter scalars needs to be either \ 'geomap', 'topography' or a np.ndarray with scalar values") topography_actor = self.p.add_mesh( polydata.delaunay_2d(), scalars=scalars_val, cmap=cm, rgb=rgb, **kwargs ) self._surface_actors["topography"] = topography_actor return topography_actor
Example #15
Source File: visualization_3d.py From gempy with GNU Lesser General Public License v3.0 | 4 votes |
def create_foliation(self, X, Y, Z, fn, Gx, Gy, Gz, n_plane=0, n_render=0, n_index=0, alpha=0.5): """ Method to create a plane given a foliation Args: X : X coord Y: Y coord Z: Z coord fn (int): id Gx (str): Component of the gradient x Gy (str): Component of the gradient y Gz (str): Component of the gradient z n_plane (int): Number of the plane n_render (int): Number of the render where the plane belongs n_index (int): index value in the PandasDataframe of InupData.surface_points alpha: Opacity of the plane Returns: vtk.vtkPlaneWidget """ Z = Z * self.ve d = vtk.vtkPlaneWidget() d.SetInteractor(self.interactor) d.SetRepresentationToSurface() # Position source = vtk.vtkPlaneSource() source.SetNormal(Gx, Gy, Gz) source.SetCenter(X, Y, Z) a, b, c, d_, e, f = self.extent source.SetPoint1(X+self._e_dx*.01, Y-self._e_dy*.01, Z) source.SetPoint2(X-self._e_dx*.01, Y+self._e_dy*.01, Z) source.Update() d.SetInputData(source.GetOutput()) d.SetHandleSize(.05) min_extent = np.min([self._e_dx, self._e_dy, self._e_dz]) d.SetPlaceFactor(0.1) d.PlaceWidget(a, b, c, d_, e, f) d.SetNormal(Gx, Gy, Gz) d.SetCenter(X, Y, Z) d.GetPlaneProperty().SetColor(mcolors.hex2color(self.geo_model._surfaces.df.set_index('id')['color'][fn]))#self.C_LOT[fn]) d.GetHandleProperty().SetColor(mcolors.hex2color(self.geo_model._surfaces.df.set_index('id')['color'][fn]))#self.C_LOT[fn]) d.GetHandleProperty().SetOpacity(alpha) d.SetCurrentRenderer(self.ren_list[n_render]) d.n_plane = n_plane d.n_render = n_render d.index = n_index d.AddObserver("EndInteractionEvent", self.planesCallback) d.AddObserver("InteractionEvent", self.Callback_camera_reset) d.On() return d
Example #16
Source File: visualization_3d.py From gempy with GNU Lesser General Public License v3.0 | 4 votes |
def planesCallback_move_changes(self, indices): df_changes = self.geo_model._orientations.df.loc[np.atleast_1d(indices)][['X', 'Y', 'Z', 'G_x', 'G_y', 'G_z', 'id']] for index, new_values_df in df_changes.iterrows(): new_center = new_values_df[['X', 'Y', 'Z']].values new_normal = new_values_df[['G_x', 'G_y', 'G_z']].values new_source = vtk.vtkPlaneSource() new_source.SetCenter(new_center) new_source.SetNormal(new_normal) new_source.Update() plane1 = self.o_rend_1.loc[index, 'val'] # plane1.SetInputData(new_source.GetOutput()) plane1.SetNormal(new_normal) plane1.SetCenter(new_center[0], new_center[1], new_center[2]) plane1.GetPlaneProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']]))#self.C_LOT[new_values_df['id']]) plane1.GetHandleProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']])) plane2 = self.o_rend_2.loc[index, 'val'] plane2.SetInputData(new_source.GetOutput()) plane2.SetNormal(new_normal) plane2.SetCenter(new_center[0], new_center[1], new_center[2]) plane2.GetPlaneProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']])) plane2.GetHandleProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']])) plane3 = self.o_rend_3.loc[index, 'val'] plane3.SetInputData(new_source.GetOutput()) plane3.SetNormal(new_normal) plane3.SetCenter(new_center[0], new_center[1], new_center[2]) plane3.GetPlaneProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']])) plane3.GetHandleProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']])) plane4 = self.o_rend_4.loc[index, 'val'] plane4.SetInputData(new_source.GetOutput()) plane4.SetNormal(new_normal) plane4.SetCenter(new_center[0], new_center[1], new_center[2]) plane4.GetPlaneProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']])) plane4.GetHandleProperty().SetColor(mcolors.hex2color( self.geo_model._surfaces.df.set_index('id')['color'][new_values_df['id']]))