- Timestamp:
- 06/27/11 17:54:21 (13 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/years_matplotlib.xsl
r111 r113 6 6 7 7 <!-- 8 module : 9 production d'un fichier de commande gnuplot avec données incorporées pour 8 9 DESCRIPTION 10 =========== 11 12 production d'un fichier de commande matplotlb avec données incorporées pour 10 13 le graphe publications/année 11 14 12 update : 15 EXAMPLES 16 ======== 17 18 :: 19 20 $ xsltproc \-\-param makedate $((date)) \-\-param path "'.'" \-\-output ginette.py years_matplotlib.xsl biblio.xml 21 $ python ginette.py 22 $ open ++.png 23 24 TODO 25 ==== 26 27 x time axe with yyyy labels 28 29 add in makefile 30 31 see http://matplotlib.sourceforge.net/examples/pylab_examples/demo_ribbon_box.html 32 33 EVOLUTIONS 34 ========== 35 13 36 $Id$ 14 fplod 2008-04-30T06:50:45Z aedon.locean-ipsl.upmc.fr (Darwin) 15 chgt for dbk5 in 16 fplod 2007-05-21T12:52:07Z aedon.locean-ipsl.upmc.fr (Darwin) 17 d'après /Users/pinsard/ES/src/estimation/src/estimation_graph1_gnuplot.xsl 18 creation 37 $URL$ 38 39 - fplod 20110627T144044Z aedon.locean-ipsl.upmc.fr (Darwin) 40 41 * creation draft 42 19 43 --> 20 44 … … 29 53 30 54 <xsl:template match="d:bibliography"> 55 """" 56 57 EXAMPLES 58 ======== 59 60 :: 61 62 $ python graph1_<xsl:value-of select="years"/>.py 63 64 65 EVOLUTIONS 66 ========== 67 68 <xsl:value-of select="$makedate"/> 69 70 """ 71 72 import matplotlib.pyplot as plot 73 import numpy as np 74 import datetime 75 76 fig = plot.figure() 77 ax = fig.gca() 78 79 # definition of axes 80 ax.set_xlabel('Year') 81 ax.set_ylabel('Nb of publications') 82 # titre sur le graphique 83 plot.title('nb of publications by year date : <xsl:value-of select="$makedate"/>') 31 84 # 32 # $ gnuplot graph1_<xsl:value-of select="years"/>.gnu33 #34 # source :35 # ++/graph1_<xsl:value-of select="years"/>.gnu36 #37 # update :38 # <xsl:value-of select="$makedate"/>39 #40 reset41 #42 # codage iso pour les diacritiques43 set encoding iso_8859_144 #45 set size 1.0, 1.046 set origin 0.0, 0.047 #48 # pas de légendes49 set nokey50 #51 # definition of axes52 set xlabel "Year"53 set xdata time54 set timefmt "%Y"55 set format x "%Y"56 #++set xrange ++ year min year max57 set ylabel "Nb of publications"58 # titre sur le graphique59 set title "nb of publications by year date : <xsl:value-of select="$makedate"/>"60 #61 #set term svg dynamic62 #set output "years.svg"63 #++set output "fichier_svg"64 set term png65 set output "<xsl:value-of select="$path"/>/years.png"66 85 67 plot '-' using 1:2 with linespoints 86 dates=[] 87 values=[] 68 88 <!-- loop on years --> 69 89 <xsl:for-each select="$list_years"> … … 73 93 </xsl:call-template> 74 94 </xsl:for-each> 75 <xsl:text>e</xsl:text> 76 <xsl:text>
</xsl:text> 95 96 ax.set_xlim(dates[0]-0.5, dates[-1]+0.5) 97 plot.bar(dates, values,width=0.5) 98 99 # avoid overlap on labels 100 fig.autofmt_xdate() 101 # 102 fig.savefig('<xsl:value-of select="$path"/>/years.png') 103 104 plot.show() 105 77 106 </xsl:template> 78 107 79 108 <xsl:template name="one_year"> 80 109 <xsl:param name="year"/> 81 <xsl:value-of select="$year"/> 110 dates.append(<xsl:value-of select="$year"/>) 82 111 <xsl:text> </xsl:text> 83 <xsl:value-of select="count(/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$year]]) "/> 112 values.append(<xsl:value-of select="count(/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$year]]) "/>) 84 113 <xsl:text>
</xsl:text> 85 114 </xsl:template>
Note: See TracChangeset
for help on using the changeset viewer.