TheChymera / chr-helpers

The Christian Helpers
GNU General Public License v3.0
1 stars 1 forks source link

Colormap not working if nanmax(data)<abs(nanmin(data)) #2

Open leogargu opened 9 years ago

leogargu commented 9 years ago

In that situation, stop<midpoint, and the color map is wrong (original cmap below = 'seismic'): example

TheChymera commented 9 years ago

Could you send me a link to your dataset?

leogargu commented 9 years ago

The dataset that generated the figure above is here: https://www.dropbox.com/s/6johdg4ss4x8ljs/data.dat?dl=0 I have narrowed the issue down to this smaller subset (i.e. nan's and small values are not the problem, start=0.0, midpoint=0.730, stop=0.315): https://www.dropbox.com/s/nq456iljpys9qgm/data_simplified.dat?dl=0

TheChymera commented 9 years ago

could you also paste the code you use to generate the figure above?

leogargu commented 9 years ago

Here it is:

import matplotlib.pyplot as plt
import numpy as np
import imp
col = imp.load_source('remappedColorMap', './chr_matplotlib.py')

#Loading data
test_data = np.loadtxt("data.dat") #data_simplified.dat

#Creating remapped color map
original_cmap = plt.get_cmap('seismic')
remapped_cmap = col.remappedColorMap(original_cmap, data=test_data)

#Plotting
test_plot = plt.imshow(test_data,cmap=remapped_cmap ,interpolation='nearest')
plt.colorbar(test_plot,orientation='vertical')

#Saving plot
plt.savefig("test_fig.png",bbox_inches='tight')
TheChymera commented 9 years ago

I tried out plotting your simplified data set - you can see it in this notebook.

I can't seem to find anything wrong with it. Where exactly is the issue?