Changeset 684 in lmdz_wrf
- Timestamp:
- Jan 22, 2016, 7:15:20 PM (10 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r680 r684 1836 1836 9: 'upper center', 10: 'center' 1837 1837 [graphk]: kind of the graphic 1838 [lines]: ',' list of type of lines, None for automatic, single value all the same 1838 1839 [collines]: ',' list of colors for the lines, None for automatic, single 1839 1840 value all the same … … 1856 1857 1857 1858 expectargs = '[dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];' 1858 expectargs = expectargs + '[timevals];[locleg];[graphk];[ collines];[points];'1859 expectargs = expectargs + '[timevals];[locleg];[graphk];[lines];[collines];[points];' 1859 1860 expectargs = expectargs + '[pointfreq];[period]' 1860 1861 drw.check_arguments(fname,len(expectargs.split(';')),values,';',expectargs) … … 1870 1871 locleg = int(values.split(';')[7]) 1871 1872 graphk = values.split(';')[8] 1872 collines0 = values.split(';')[9] 1873 points0 = values.split(';')[10] 1874 pointfreq0 = values.split(';')[11] 1875 period = values.split(';')[12] 1873 lines0 = values.split(';')[9] 1874 collines0 = values.split(';')[10] 1875 points0 = values.split(';')[11] 1876 pointfreq0 = values.split(';')[12] 1877 period = values.split(';')[13] 1876 1878 1877 1879 Nfiles = len(ncfiles) … … 1888 1890 else: 1889 1891 varname = [varname0] 1892 1893 # Multiple lines types? 1894 if lines0.find(',') != -1: 1895 lines = lines0.split(',') 1896 elif lines0 == 'None': 1897 lines = None 1898 else: 1899 lines = [] 1900 for il in range(Nfiles): 1901 lines.append(lines0) 1890 1902 1891 1903 # Multiple color names? … … 1902 1914 if points0.find(',') != -1: 1903 1915 points = points0.split(',') 1904 for ip in range(len(points)):1905 points[ip] = points[ip]1906 1916 elif points0 == 'None': 1907 1917 points = None … … 1909 1919 points = [] 1910 1920 for ip in range(Nfiles): 1911 points.append(points0 +'-')1921 points.append(points0) 1912 1922 1913 1923 # Getting values … … 2051 2061 2052 2062 drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, legvals, vartit, \ 2053 varunits, timepos, timelabels, title, locleg, graphk, collines, points, pointfreq) 2063 varunits, timepos, timelabels, title, locleg, graphk, lines, collines, points, \ 2064 pointfreq) 2054 2065 2055 2066 return -
trunk/tools/drawing_tools.py
r683 r684 5399 5399 return 5400 5400 5401 def LinesPointsStyles(Nstyles, lines, points, ptfreq): 5402 """ Function to provide the lines & points styles 5403 Nstyles= total number of styles 5404 lines= list of lines, None for no value 5405 points= list of points, None for no value 5406 ptfreq= frequency for the points, None for all values 5407 >>> Nstyles = 3 5408 >>> lines = ['-'] 5409 >>> points = ['x', '*', 'o'] 5410 >>> ptfreq = 2 5411 >>> lines, points = LinesPointsStyles(Nstyles, lines, points, ptfreq) 5412 ['-', '-', '-'] 5413 ['x', '*', 'o'] 5414 """ 5415 fname = 'LinesPointsStyles' 5416 5417 # Canging line kinds every 7 lines (end of standard colors) 5418 uselines = [] 5419 usepoints = [] 5420 if lines is None: 5421 Nklns = len(linekindsauto) 5422 for il in range(Nstyles): 5423 iil = np.mod(il,Nklns) 5424 uselines.append(linekindsauto[iil]) 5425 else: 5426 Nklns = len(lines) 5427 if Nklns == 1: 5428 for il in range(Nstyles): 5429 uselines.append(lines[0]) 5430 else: 5431 if Nklns != Nstyles: 5432 print errormsg 5433 print ' ' + fname + ': number of provided lines:', Nklns, \ 5434 'and required:', Nstyles,'differ !!' 5435 quit(-1) 5436 uselines = lines 5437 5438 if points is None: 5439 Nkpts = len(pointkindsauto) 5440 for ip in range(Nstyles): 5441 iip = np.mod(ip,Nkpts) 5442 usepoints.append(pointkindsauto[iip]) 5443 else: 5444 Nkpts = len(points) 5445 if Nkpts == 1: 5446 for ip in range(Nstyles): 5447 usepoints.append(points[0]) 5448 else: 5449 if Nkpts != Nstyles: 5450 print errormsg 5451 print ' ' + fname + ': number of provided points:', Nkpts, \ 5452 'and required:', Nstyles,'differ !!' 5453 quit(-1) 5454 usepoints = points 5455 5456 Nlins = len(uselines) 5457 Npnts = len(usepoints) 5458 5459 lkinds = [] 5460 pkinds = [] 5461 if ptfreq is not None: 5462 lkinds = uselines 5463 pkinds = usepoints 5464 else: 5465 for ilp in range(Nstyles): 5466 lkinds.append(usepoints[ilp] + uselines[ilp]) 5467 5468 return lkinds, pkinds 5469 5401 5470 def plot_lines_time(vardv, varvv, vaxis, dtit, linesn0, vtit, vunit, tpos, tlabs, \ 5402 5471 gtit, gloc, kfig, lsl, coll, ptl, ptf): … … 5434 5503 quit() 5435 5504 5436 # Canging line kinds every 7 lines (end of standard colors)5437 linekinds = []5438 pointkinds = []5439 Nklns = len(linekindsauto)5440 Nkpts = len(pointkindsauto)5441 if ptl is None:5442 if ptf is None:5443 for il in range(Nklns):5444 for ip in range(Nkpts):5445 linekinds.append(pointkindsauto[ptype] + linekindsauto[il])5446 else:5447 for ptype in range():5448 for ip in range(Nkpts):5449 linekinds.append('-')5450 pointkinds.append(pointkindsauto[ptype])5451 else:5452 if ptf is None:5453 for pt in ptl:5454 linekinds.append(pt + '-')5455 else:5456 pointkinds = ptl5457 for pt in ptl:5458 linekinds.append('-')5459 5460 5505 Ntraj = len(vardv) 5461 5506 5462 N7lines = 05507 linekinds, pointkinds = LinesPointsStyles(Ntraj, lsl, ptl, ptf) 5463 5508 5464 5509 plt.rc('text', usetex=True)
Note: See TracChangeset
for help on using the changeset viewer.