r47338 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47337‎ | r47338 | r47339 >
Date:21:42, 16 February 2009
Author:jnatividad
Status:deferred
Tags:
Comment:
added sample PLOTICUS_CONFIG file; expanded README re PLOTICUS_CONFIG; added replacement scatter plot prefab (scats.pl); renamed addons dir to prefabs.
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Ploticus/README (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/README (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/addons (deleted) (history)
  • /trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/ploticus.config (added) (history)
  • /trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/prefabs (added) (history)
  • /trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/prefabs/scat.pl (added) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/prefabs/scat.pl
@@ -0,0 +1,272 @@
 2+// ploticus data display engine. Software, documentation, and examples.
 3+// Copyright 1998-2002 Stephen C. Grubb (scg@jax.org).
 4+// Covered by GPL; see the file 'Copyright' for details.
 5+// http://ploticus.sourceforge.net
 6+
 7+//// SCAT - do a scatterplot of two variables with pearson coefficient and regression line
 8+
 9+//// set scat-specific defaults..
 10+#if @CM_UNITS = 1
 11+ #setifnotgiven rectangle = "2.5 2.5 10 10"
 12+ #setifnotgiven ptsize = "0.1"
 13+ #set LBLDIST = 1.38
 14+ #set REGLBL = 1.5
 15+ #set PTLBL = 0.18
 16+ #set TAILS = 0.05
 17+#else
 18+ #setifnotgiven rectangle = "1 1 4 4"
 19+ #setifnotgiven ptsize = "0.04"
 20+ #set LBLDIST = 0.55
 21+ #set REGLBL = 0.6
 22+ #set PTLBL = 0.07
 23+ #set TAILS = 0.02
 24+#endif
 25+#setifnotgiven ptshape = "circle"
 26+#setifnotgiven ptcolor = "blue"
 27+#setifnotgiven ptcolor2 = "red"
 28+#setifnotgiven ptcolor3 = "green"
 29+#setifnotgiven ptcolor4 = "black"
 30+#setifnotgiven corrcolor = "green"
 31+#setifnotgiven xerr = ""
 32+#setifnotgiven err2 = ""
 33+#setifnotgiven xerr2 = ""
 34+#setifnotgiven errcolor = "gray(0.7)"
 35+#setifnotgiven id = ""
 36+#setifnotgiven idcolor = "orange"
 37+
 38+#setifnotgiven x2 = ""
 39+#setifnotgiven y2 = ""
 40+#setifnotgiven ptshape2 = square
 41+#setifnotgiven color2 = red
 42+#setifnotgiven x3 = ""
 43+#setifnotgiven y3 = ""
 44+#setifnotgiven ptshape3 = diamond
 45+#setifnotgiven color3 = black
 46+#setifnotgiven x4 = ""
 47+#setifnotgiven y4 = ""
 48+#setifnotgiven ptshape4 = triangle
 49+#setifnotgiven color4 = powderblue
 50+#setifnotgiven ptstyle = filled
 51+#if @ptstyle !in filled,outline
 52+ #set ptstyle = filled
 53+#endif
 54+
 55+#setifnotgiven name = "#usefname"
 56+#setifnotgiven name2 = "#usefname"
 57+#setifnotgiven name3 = "#usefname"
 58+#setifnotgiven name4 = "#usefname"
 59+#if @CM_UNITS = 1
 60+ #setifnotgiven legend = "max+1.5 max"
 61+#else
 62+ #setifnotgiven legend = "max+0.6 max"
 63+#endif
 64+
 65+//// load standard vars..
 66+#include $chunk_setstd
 67+
 68+//// read data..
 69+#include $chunk_read
 70+
 71+//// required vars..
 72+#musthave x y
 73+
 74+#if @cats = yes
 75+ #proc categories
 76+ axis: x
 77+ datafield: @x
 78+#endif
 79+
 80+
 81+//// set up plotting area..
 82+#include $chunk_area
 83+#if @xrange != ""
 84+ xrange: @xrange
 85+#elseif @cats = yes
 86+ xscaletype: categories
 87+ // xcategories: @x
 88+ // following added 9/2/02 scg
 89+ // catcompmethod: exact
 90+
 91+#else
 92+ xautorange: datafields=@x,@x2,@x3,@x4 incmult=2.0 nearest=@xnearest
 93+#endif
 94+#if @yrange != ""
 95+ yrange: @yrange
 96+#else
 97+ yautorange: datafields=@y,@y2,@y3,@y4 incmult=2.0 nearest=@ynearest
 98+#endif
 99+
 100+//// x axis
 101+#include $chunk_xaxis
 102+stubcull: yes
 103+
 104+//// y axis
 105+#include $chunk_yaxis
 106+stubcull: yes
 107+labeldistance: @LBLDIST
 108+
 109+//// title
 110+#include $chunk_title
 111+
 112+//// user pre-plot include
 113+#if @include1 != ""
 114+ #include @include1
 115+#endif
 116+
 117+
 118+//// do regression line and correlation..
 119+#if @corr = yes
 120+ #proc curvefit
 121+ curvetype: regression
 122+ xfield: @x
 123+ yfield: @y
 124+ linedetails: color=@corrcolor width=0.5
 125+ #ifspec maxinpoints
 126+//// JQN 2/16/09 - changed location and textdetails so left-justified coz Annotations dont show up in vector formats
 127+ #proc annotate
 128+ location: @DATAXMIN min-@REGLBL
 129+ textdetails: align=L size=8 color=@corrcolor
 130+ text: r = @CORRELATION
 131+ @REGRESSION_LINE
 132+#endif
 133+
 134+
 135+//// do labels..
 136+#if @id != ""
 137+ #proc scatterplot
 138+ xfield: @x
 139+ yfield: @y
 140+ #if @id != ""
 141+ labelfield: @id
 142+ #endif
 143+ textdetails: size=6 color=@idcolor adjust=0,@PTLBL
 144+ #ifspec cluster
 145+#endif
 146+
 147+
 148+
 149+//// do error bars..
 150+#if @err != ""
 151+ #proc bars
 152+ locfield: @x
 153+ lenfield: @y
 154+ errbarfield: @err
 155+ thinbarline: color=@errcolor width=0.5
 156+ tails: @TAILS
 157+ truncate: yes
 158+ #ifspec ptselect select
 159+ #saveas EB
 160+#endif
 161+
 162+#if @xerr != ""
 163+ #proc bars
 164+ #clone EB
 165+ locfield: @y
 166+ lenfield: @x
 167+ horizontalbars: yes
 168+ errbarfield: @xerr
 169+ #ifspec ptselect select
 170+#endif
 171+
 172+//// do 2nd set of error bars..
 173+#if @err2 != ""
 174+ #proc bars
 175+ #clone EB
 176+ locfield: @x2
 177+ lenfield: @y2
 178+ errbarfield: @err2
 179+ #ifspec ptselect2 select
 180+#endif
 181+
 182+#if @xerr2 != ""
 183+ #proc bars
 184+ #clone EB
 185+ locfield: @y2
 186+ lenfield: @x2
 187+ errbarfield: @xerr2
 188+ horizontalbars: yes
 189+ #ifspec ptselect2 select
 190+#endif
 191+
 192+// scat prefab will always attempt to use pix* shapes..
 193+#if @ptshape !like pix*
 194+ #set ptshape = "pix" @ptshape
 195+#endif
 196+
 197+//// do the data points last so they are on top of the rest of the stuff..
 198+#proc scatterplot
 199+xfield: @x
 200+yfield: @y
 201+symbol: shape=@ptshape style=@ptstyle radius=@ptsize color=@ptcolor
 202+#ifspec clickmapurl
 203+#ifspec clickmaplabel
 204+legendlabel: @name
 205+#ifspec ptselect select
 206+#ifspec cluster
 207+
 208+
 209+//// optional 2nd set of points...
 210+#if @x2 != "" && @y2 != ""
 211+ #if @ptshape2 !like pix*
 212+ #set ptshape2 = "pix" @ptshape2
 213+ #endif
 214+
 215+ #proc scatterplot
 216+ xfield: @x2
 217+ yfield: @y2
 218+ symbol: shape=@ptshape2 style=@ptstyle radius=@ptsize color=@ptcolor2
 219+ legendlabel: @name2
 220+ #ifspec ptselect2 select
 221+ #ifspec cluster
 222+#endif
 223+
 224+//// optional 3d set of points...
 225+#if @x3 != "" && @y3 != ""
 226+ #if @ptshape3 !like pix*
 227+ #set ptshape3 = "pix" @ptshape3
 228+ #endif
 229+
 230+ #proc scatterplot
 231+ xfield: @x3
 232+ yfield: @y3
 233+ symbol: shape=@ptshape3 style=@ptstyle radius=@ptsize color=@ptcolor3
 234+ legendlabel: @name3
 235+ #ifspec ptselect3 select
 236+ #ifspec cluster
 237+#endif
 238+
 239+//// optional 4th set of points...
 240+#if @x4 != "" && @y4 != ""
 241+ #if @ptshape4 !like pix*
 242+ #set ptshape4 = "pix" @ptshape4
 243+ #endif
 244+
 245+ #proc scatterplot
 246+ xfield: @x4
 247+ yfield: @y4
 248+ symbol: shape=@ptshape4 style=@ptstyle radius=@ptsize color=@ptcolor4
 249+ legendlabel: @name4
 250+ #ifspec ptselect4 select
 251+ #ifspec cluster
 252+#endif
 253+
 254+// do legend
 255+#if @name != "#usefname" || @header = yes
 256+ #proc legend
 257+ location: @legend
 258+ #ifspec legendfmt format
 259+ #ifspec legendsep sep
 260+ #ifspec legwrap wraplen
 261+ #ifspec legbreak extent
 262+ #ifspec legtitle title
 263+ #ifspec legbox backcolor
 264+ #ifspec legframe frame
 265+ #ifspec legtextdet textdetails
 266+
 267+#endif
 268+
 269+
 270+//// user post-plot include..
 271+#if @include2 != ""
 272+ #include @include2
 273+#endif
Index: trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/ploticus.config
@@ -0,0 +1,11 @@
 2+// model ploticus config file
 3+// for SRF-Ploticus
 4+// be sure modify specify PLOTICUS_CONFIG with the $srfgEnvSettings var in LocalSettings.php
 5+// e.g. $srfgEnvSettings = 'PLOTICUS_CONFIG=[FULLPATH]/ploticus.config SWF_FONTS_DIR=/usr/share/ming/fonts/ttf-dejavu/fdb';
 6+// see http://ploticus.sourceforge.net/doc/config.html for more info
 7+
 8+// this requires the encodeclickmapurls patch
 9+encodeclickmapurls: yes
 10+
 11+// so we don't need to specify comma for the CSVs
 12+option: delim=comma
Property changes on: trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/ploticus.config
___________________________________________________________________
Name: svn:eol-style
113 + native
Index: trunk/extensions/SemanticResultFormats/Ploticus/ploticus-addons/README
@@ -1,12 +1,19 @@
22 ploticus_encodeclickmapurls.patch
3 - - required to support imagemaps in SVG.
 3+- required to support imagemaps in SVG.
44 To apply the patch, be sure to patch Ploticus 2.40 up the last available patch in Dec 08.
55 To use, set "encodeclickmapurls:yes" in PLOTICUS_CONFIG.
66 This will force Ploticus to use underscores (_) instead of plus signs (+) when generating imagemap URLs.
77
8 -addons directory
9 - - additional SMW prefabs. To use, copy the files in this directory into the PLOTICUS prefabs directory.
 8+prefabs directory
 9+=================
 10+- additional SMW prefabs. To use, copy the files in this directory into the PLOTICUS prefabs directory.
1011
11 - - pietopn prefab (In Development)
12 - - similar to pie but with an additional parameter
13 - topn (specifies the number of top pie slices after which, remaining slices are aggregated into one slice)
\ No newline at end of file
 12+* pietopn.pl (In Development)
 13+- similar to pie but with an additional parameter
 14+ topn (specifies the number of top pie slices after which, remaining slices are aggregated into one slice)
 15+
 16+* scats.pl
 17+- modified version of scats.pl. To install, just replace the existing scats.pl.
 18+For scatter plots, when corr=yes, the Pearson coefficient is displayed.
 19+In the stock version, the variables are displayed right-justified which works without problems using
 20+raster formats (png, gif, jpeg). However, vector formats (eps,ps,swf,svg) crop the variables out.
Index: trunk/extensions/SemanticResultFormats/Ploticus/README
@@ -13,6 +13,7 @@
1414 any other semantic result printer (refer to the separate README for that).
1515
1616 LocalSettings.php Modifications:
 17+-------------------------------
1718 * $srfgPloticusPath (REQUIRED)
1819 - path to ploticus executable. Typically /usr/bin/ploticus (Debian/Ubuntu) or /usr/bin/pl (RedHat/CentOS, most other envs)
1920
@@ -24,11 +25,11 @@
2526 E.g. if you plan to use additional fonts in SWF files
2627 SWF_FONTS_DIR=/usr/share/ming/fonts/ttf-dejavu/fdb
2728
28 - E.g. set global ploticus config parameters with a config file. See http://ploticus.sourceforge.net/doc/config.html for details.
29 - PLOTICUS_CONFIG=/etc/ploticus/ploticus.conf
 29+ E.g. set global ploticus config parameters with a config file. See ./ploticus-addons/ploticus.config for a sample config file.
 30+ PLOTICUS_CONFIG=/etc/ploticus/ploticus.config
3031
3132 Remember, you can pass multiple environment variables, e.g.
32 - GDFONTPATH=/usr/share/fonts/truetype/freefont PLOTICUS_CONFIG=/etc/ploticus/ploticus.conf
 33+ GDFONTPATH=/usr/share/fonts/truetype/freefont PLOTICUS_CONFIG=/etc/ploticus/ploticus.config
3334
3435 * $srfgPloticusCacheAgeHours (default: 168 - 7 days)
3536 - number of hours cached plot files are stored in the ploticus cache before they are forcibly purged.
@@ -51,6 +52,14 @@
5253 (e.g. 0,1,2,3...9,a,b,c,d,e,f) should also be created, all with permission 777.
5354 (see http://www.mediawiki.org/wiki/Manual:$wgUploadPath)
5455
 56+PLOTICUS_CONFIG:
 57+---------------
 58+Ploticus' default delimiter is set to space. For CSV files, this needs to be set to comma (,). One can do this by explicitly specifying
 59+delim=comma in ploticusparam, or better still, by setting it once and for all using the PLOTICUS_CONFIG env variable.
 60+
 61+To do this, ensure the PLOTICUS_CONFIG environment variable is set and the file it points to contains "option: delim=comma".
 62+See $srfgEnvSettings above.
 63+
5564 == Configuration and Usage ==
5665
5766 The SRF-ploticus Result Format has the following parameters:

Status & tagging log