Greetings,
I'm having considerable difficulties in getting the axes grid to display
they way I would like it to. Basically, I'm wanting to grid to be shown for
all of the x/y-ticks displayed, but only an irregular number show up. What
I'm wanting to know is if my code is wrong or am I'm completely overlooking
something. My code is below and an image can be found at
http://forwarn.org/images/USDIFFtest.png.
Also, I might as well ask...is there a way to manually specify the labels
that are displayed on the colorbar? For instance, in the example below, my
values range from -5 to 4...how would I go about making sure the last 5 was
included in the colorbar? I'll admit I haven't looked into this much as of
now since the first question was / is more pressing.
Thanks!
-Patrick Marsh
from __future__ import division
import numpy as np
import pylab as P
import copy
def open_text(REGION,FIELD):
#
#
#
global DATAPATH1
global DATAPATH2
xaxis1,yaxis1,freq1 = np.loadtxt(DATAPATH1+'bin_CUR_%s_%s.txt' % (REGION,
FIELD), unpack=True)
xaxis2,yaxis2,freq2 = np.loadtxt(DATAPATH2+'bin_FUT_%s_%s.txt' % (REGION,
FIELD), unpack=True)
return(xaxis1,yaxis1,freq1,xaxis2,yaxis2,freq2)
if __name__ == '__main__':
#Main Program
TIME = 'CUR'
REGION = 'PLAINS'
FIELD = 'CAPE-SHR6'
# PATHS TO THE INPUT (DATA) AND OUTPUT (IMAGES) DIRECTORIES
DATAPATH1 = 'E:/RESEARCH/CCSM_OUTPUT/CURRENT/BIN/'
DATAPATH2 = 'E:/RESEARCH/CCSM_OUTPUT/FUTURE/BIN/'
IMAGEPATH = 'E:/RESEARCH/IMAGES/%s/%s/%s/' % (REGION, TIME, FIELD)
xaxis1,yaxis1,freq1,xaxis2,yaxis2,freq2 = open_text(REGION, FIELD)
# TRANSFORM INTO THE CORRECT FORMAT
xaxis1 = xaxis1.reshape(51,-1).T
yaxis1 = yaxis1.reshape(51,-1).T
freq1 = freq1.reshape(51,-1).T
freq2 = freq1.reshape(51,-1).T
freq1 = freq1 / (12 * 12 * 20) # (12*12*20 for PLAINS).....(29*43*20
for EUR)
freq2 = freq2 / (12 * 12 * 20) # (12*12*20 for PLAINS).....(29*43*20
for EUR)
diff = freq1 - freq2
xaxis = np.log10(xaxis1)
yaxis = np.log10(yaxis1)
# xaxis = xaxis1
# yaxis = yaxis1
# levs = np.arange(0,10,.1)
levs = np.arange(-5,5,.1)
xticks = [1,2,5,10,20,50,100,200,500,1000,2000,5000]
yticks = [1,2,5,10,20,50,100]
x = np.arange(1,10000,1)
P.figure(figsize=(8,8))
CS = P.contourf(xaxis,yaxis,diff,levs)
P.xlabel('\nCAPE')
P.ylabel('0-6 km Shear')
P.xlim(0,3)
P.ylim(0,2)
P.xticks(np.log10(xticks),xticks,)
P.yticks(np.log10(yticks),yticks,)
P.plot(np.log10(x),(np.log10(10000/x)),color='black', linewidth=2)
P.colorbar(drawedges=False, orientation='horizontal')
P.grid(True)
P.gca().xaxis.grid(True, which='minor',xdata=xticks,ydata=yticks)
P.title('Difference\nCentral U.S. Normalized Frequency Distribution')
P.savefig('USDIFFtest.png',dpi = 200)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users