Changeset 981 in lmdz_wrf for trunk/tools
- Timestamp:
- Aug 8, 2016, 6:22:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing_tools.py
r976 r981 5647 5647 return 5648 5648 5649 def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, gloc, kfig): 5649 def plot_lines(vardv, varvv, vaxis, dtit, linesn, vtit, vunit, gtit, gloc, cs, ls, \ 5650 ps, ws, ss, fv, fign, kfig): 5650 5651 """ Function to plot a collection of lines 5651 5652 vardv= list of set of dimension values … … 5661 5662 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', 5662 5663 9: 'upper center', 10: 'center' 5664 cs= list of color names 5665 ls= list of style of lines 5666 ps= list of style of points 5667 ws= list of withs of lines 5668 ss= list of size of points 5669 fv= frequency of values 5670 fign= name of the figure 5663 5671 kfig= kind of figure 5664 5672 plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)', \ 5665 ['2.5'], 'sin', '-', 'sinus frequency dependency', ' pdf')5673 ['2.5'], 'sin', '-', 'sinus frequency dependency', 'sinus', 'pdf') 5666 5674 """ 5667 5675 fname = 'plot_lines' … … 5673 5681 5674 5682 # Canging line kinds every 7 lines (end of standard colors) 5675 linekinds=['.-','x-','o-']5676 pointkindsauto=['.', ',', 'x', 'o', '*', '+', '<', '|', '_', '>', '1', '8', 's', \5677 'p', 'h', 'D']5678 5679 5683 Ntraj = len(vardv) 5680 5684 5681 N7lines = 05685 cols, lins, pts, lws, pss = ColorsLinesPointsStyles(Ntraj, cs, ls, ps, ws, ss, fv) 5682 5686 5683 5687 xmin = 100000. … … 5702 5706 if vaxis == 'x': 5703 5707 for il in range(Ntraj): 5704 plt.plot(varvv[il], vardv[il], lin ekinds[N7lines], label= linesn[il])5705 if il == 6: N7lines = N7lines + 15708 plt.plot(varvv[il], vardv[il], lins[il], marker=pts[il], \ 5709 linewidth=lws[il], markersize=pss[il], label= linesn[il], color=cols[il]) 5706 5710 5707 5711 plt.xlabel(vtit + ' (' + vunit + ')') … … 5712 5716 else: 5713 5717 for il in range(Ntraj): 5714 plt.plot(vardv[il], varvv[il], lin ekinds[N7lines], label= linesn[il])5715 if il == 6: N7lines = N7lines + 15718 plt.plot(vardv[il], varvv[il], lins[il], marker=pts[il], \ 5719 linewidth=lws[il], markersize=pss[il], label= linesn[il], color=cols[il]) 5716 5720 5717 5721 plt.xlabel(dtit) … … 5721 5725 plt.ylim(xmin,xmax) 5722 5726 5723 figname = 'lines'5724 5727 graphtit = gtit.replace('_','\_').replace('&','\&') 5725 5728 … … 5727 5730 plt.legend(loc=gloc) 5728 5731 5729 output_kind(kfig, fign ame, True)5732 output_kind(kfig, fign, True) 5730 5733 5731 5734 return … … 5766 5769 Ncols = len(colorsauto) 5767 5770 for ic in range(Nstyles): 5768 i ic = np.mod(ic,Ncols) - 15769 i f iic == 0: iic = Ncols - 15771 imc = int(ic/Ncols) 5772 iic = ic - imc * Ncols 5770 5773 usecolors.append(colorsauto[iic]) 5771 5774 else: … … 5786 5789 Nklns = len(linekindsauto) 5787 5790 for il in range(Nstyles): 5788 i il = np.mod(il,Nklns) - 15789 i f iil == 0: iil = Nklns - 15791 iml = int(il/Nklns) 5792 iil = il - iml * Nklns 5790 5793 uselines.append(linekindsauto[iil]) 5791 5794 else: … … 5806 5809 Nkpts = len(pointkindsauto) 5807 5810 for ip in range(Nstyles): 5808 i ip = np.mod(ip,Nkpts) - 15809 i f iip == 0: iip = Nkpts - 15811 imc = int(ip/Nkpts) 5812 iip = ip - imc * Nkpts 5810 5813 usepoints.append(pointkindsauto[iip]) 5811 5814 else: … … 5826 5829 Nwlns = len(linewidthsauto) 5827 5830 for il in range(Nstyles): 5828 i il = np.mod(il,Nwlns) - 15829 i f iil == 0: iil = Nwlns - 15831 iml = int(il/Nwlns) 5832 iil = il - iml * Nwlns 5830 5833 usewlines.append(linewidthsauto[iil]) 5831 5834 else: … … 5846 5849 Nspts = len(pointsizesauto) 5847 5850 for ip in range(Nstyles): 5848 i ip = np.mod(ip,Nspts) - 15849 i f iip == 0: iip = Nspts - 15851 ipc = int(ip/Nspts) 5852 iip = ip - ipc * Nspts 5850 5853 usespoints.append(pointsizesauto[iip]) 5851 5854 else: … … 5884 5887 5885 5888 #Nstyles = 3 5886 #colors = ['blue'] 5889 ##colors = ['blue'] 5890 #colors = None 5887 5891 #lines = ['-'] 5888 5892 #points = ['x', '*', 'o'] … … 5999 6003 if vardv == 'h': 6000 6004 print fname + '_____________________________________________________________' 6001 print plot_lines .__doc__6005 print plot_lines_time.__doc__ 6002 6006 quit() 6003 6007
Note: See TracChangeset
for help on using the changeset viewer.