* Rafael Laboissiere <rafael@debian.org> [2005-02-11 06:31]: > You are right. To make things clearer, I am attaching below the said patch. > They are trivial one-line patches against edsymbol.m and eglobpar.m. As we are at it, let me show you a patch that I am using privately here. It is attached below and seems longer than it really is, because many line changes are just re-indentation of code. This patch allows arbitrary text in the tics labels for the plot axes. An example of an output EPS file is attached below. The desired labels are put in the *ValueFormat global variables. For the attached result I used the follwoing: eXAxisNorthValueFormat = [" ";"FELL";" ";" ";" ";" ";" ";" ";" ";" "; \ " ";"FEHL"]; eXAxisSouthValueFormat = ""; for i=1:11 eXAxisSouthValueFormat = [eXAxisSouthValueFormat; (sprintf ("%d", i))]; endfor In upstream epsTK, these variables are scalar integers specifying the decimal precision of the labels. With my patch, I detect if they are vectors and, if it is the case, the elements of the vectors are printed instead of the numeric tic labels. There could be more elegant ways of doing this, but my solution has the advantage of keeping the API backwards compatible. This simple patch is really useful for my research papers and I am wondering if there would be interest to include it in the Debian package. What do you think? -- Rafael
#! /bin/sh /usr/share/dpatch/dpatch-run ## 50_axis-value-labels.dpatch by <rafael@debian.org> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Allow arbitrary labels to be plotted at axis tics @DPATCH@ --- octave-epstk-2.0.2.orig/m/escalexy.m +++ octave-epstk-2.0.2/m/escalexy.m @@ -58,22 +58,23 @@ signOfDelta=sign(step); deltaLabel=signOfDelta*step; end - if vForm==0 - expo=-log10(deltaLabel); - if rem(expo,1)>0 - expo=expo+1; + if is_scalar (vForm) + if vForm==0 + expo=-log10(deltaLabel); + if rem(expo,1)>0 + expo=expo+1; + end + autoForm=fix(expo); + if autoForm>0 + vForm=autoForm; + end end - autoForm=fix(expo); - if autoForm>0 - vForm=autoForm; + if vForm<0 + valueForm='%g'; + else + valueForm=sprintf('%%1.%df',vForm); end - end - if vForm<0 - valueForm='%g'; - else - valueForm=sprintf('%%1.%df',vForm); - end - + end %start ticNo and offset nShortTics=rem(startValue,deltaLabel)/deltaLabel*5*signOfDelta; @@ -104,6 +105,7 @@ currentTic=0; currentValue=firstTicValue; longTicPos=0; + currentLabel=1; nPos=0; while signOfDelta*currentValue<=signOfDelta*endValue currentPos=startPos+axisFac*(currentValue-startValue); @@ -122,6 +124,16 @@ currentValue=0; end fprintf(epsFile,moveValueForm); + if ! is_scalar (vForm) + valueForm='%s'; + if size(vForm,1) >= currentLabel + currentValue=vForm(currentLabel,:); + currentValue=currentValue(find(currentValue~=' ')); + currentLabel=currentLabel+1; + else + currentValue=' '; + end + end valueStr=sprintf(valueForm,currentValue); fprintf(epsFile,showForm,valueStr); end
Attachment:
helene.eps
Description: PostScript document