-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blank squares in output plots #137
Comments
Hi Siqi, from catmap import analyze
vm = analyze.VectorMap(model)
vm.plot_variable = 'rate' #tell the model which output to plot
vm.log_scale = True #rates should be plotted on a log-scale
vm.min = 1e-25 #minimum rate to plot
vm.max = 1e2 #maximum rate to plot
+ vm.colormap = "jet"
vm.plot(save='rate.pdf') #draw the plot and save it as "rate.pdf" and the colormap will use the older version "jet" pattern, which in my sense is more beautiful. |
Perfect, I'll try this out, thanks for letting me know! And here's my email address [email protected] |
I've found that this issue is caused by a data-structure transferring error in the function ReactionModel.map_to_array(), and some of the values are lower than your set vm.min (e.g. 1e-25) would be wrongly transferred to -1e-25, so the following np.log10() function would return a NaN, which leads to the blank in the output plot. This numerical error can be fixed by adding the following code in row 272 of https://github.com/SUNCAT-Center/catmap/blob/master/catmap/analyze/analysis_base.py and reinstalling the package: if self.log_scale and dim == 2:
for i in range(0,len(maparray)):
for j in range(0,len(maparray[0])):
for k in range(0,len(maparray[0][0])):
if maparray[i][j][k] < 0:
maparray[i][j][k]=-1*maparray[i][j][k]
maparray = np.log10(maparray) |
Inspired by your comment, I found a mistake of model.py in data interpolation. The following code in row 1292 of https://github.com/SUNCAT-Center/catmap/blob/master/catmap/model.py need to be adjusted。 It should be |
See more choices for colormaps here: https://matplotlib.org/stable/tutorials/colors/colormaps.html Note that you should never use jet for anything. The reason is that brightness and contrast vary non-linearly, thus misrepresenting distance between values. It misrepresents values even worse if printed in black and white or viewed by a colorblind person. I think the perceptually uniform sequential colormaps are best suited for volcano plots. |
Thanks for your advice! |
Hi,
I tried running the codes provided in the tutorial, but instead of getting the same volcano plots as demonstrated in the tutorial, there are some blank squares in my output plots (attached). Anyone understand what the problem might be?
I'm using:
Python: 3.8
matplotlib: 3.3.4
numpy: 1.20.1
scipy: 1.6.0
mpmath: 1.2.1
ase: 3.21.1
pretty_production_rate.pdf
all_rates.pdf
The text was updated successfully, but these errors were encountered: