# Changeset 419 for trunk

Ignore:
Timestamp:
02/27/08 07:09:03 (12 years ago)
Message:

Jgraph: Debian changes by pzn@…

Location:
trunk/Jgraph
Files:
7 edited

### Legend:

Unmodified
Removed

 r418 Author: Jim Plank Email:  jsp@princeton.edu USmail: Department of Computer Science Princeton University 35 Olden St. Princeton, NJ 08544-2087 Page:   http://www.cs.utk.edu/~plank Email:  plank@cs.utk.edu USmail: Associate Professor Department of Computer Science University of Tennessee 203 Claxton Complex 1122 Volunteer Blvd. Knoxville, TN 37996-3450
• ## trunk/Jgraph/draw.c

 r418 #include #include #include //by pzn@debian.org #include //by pzn@debian.org static char real_eof = EOF; } for (i = 0; i < 4; i++) { if (fscanf(f, "%d", &(bb[i])) != 1) { if (fscanf(f, "%d", &(bb[i])) == NULL) { fprintf(stderr, "Error: Eps file '%s': eof in %s\n", c->eps, "bounding box"); Graphs gs_p; Graph g; int page_counter=0; for (gs_p = first(gs); gs_p != nil(gs); gs_p = next(gs_p)) { page_counter++; draw_header(gs_p, pp, landscape); for (g = first(gs_p->g); g != nil(gs_p->g); g = next(g)) { } draw_footer(gs_p, pp); } if (pp) { printf("\n%%%%Trailer\n"); printf("%%%%Pages: %i\n",page_counter); printf("%%%%EOF\n"); } } char c; if (gs->page == 1) printf("%%!PS-Adobe-2.0 EPSF-1.2\n"); printf("%%%%Page: %d %d\n", gs->page, gs->page); if (landscape) { printf("%%%%BoundingBox: %d %d %d %d\n", gs->bb[1], gs->bb[0], gs->bb[3], gs->bb[2]); if (gs->page == 1) { if (pp) { printf("%%!PS-Adobe-3.0\n"); printf("%%%%Pages: (atend)\n"); printf("%%%%Creator: jgraph\n"); printf("%%%%EndComments\n\n"); printf("%%%%BeginProlog\n"); printf("%%%%EndProlog\n"); printf("%%%%BeginSetup\n"); printf("%%%%EndSetup\n"); } else { printf("%%!PS-Adobe-2.0 EPSF-1.2\n"); printf("%%%%Creator: jgraph\n"); } } if (pp) { printf("\n%%%%Page: %d %d\n", gs->page, gs->page); printf("%%%%BeginPageSetup\n"); printf("%%%%EndPageSetup\n\n"); } if ( (gs->page>1) && !pp ) { /* tring EPS with more than one page */ fprintf(stderr, "Error: 'newpage' token is not allowed" " without '-P' command line option.\n"); exit(1); } /* if (landscape) { printf("%%%%BoundingBox: %d %d %d %d\n", gs->bb[1], gs->bb[0], gs->bb[3], gs->bb[2]); } else { printf("%%%%BoundingBox: %d %d %d %d\n", gs->bb[0], gs->bb[1], gs->bb[2], gs->bb[3]); } printf("%%%%EndComments\n"); printf("%%%%BoundingBox: %d %d %d %d\n", gs->bb[0], gs->bb[1], gs->bb[2], gs->bb[3]); } printf("%%%%EndComments\n"); */ //BEGIN added by pzn@debian.org { // expands the bounding box to fit characters with tilde, acute,... // if user has set JGRAPH_BORDER enviroment variable int expandborder=0; char *s;                          \ s=(char *)getenv("JGRAPH_BORDER"); if (s!=NULL) { expandborder=atoi(s); } if (!pp) { if (landscape) { printf("%%%%BoundingBox: %d %d %d %d\n", gs->bb[1]-expandborder, gs->bb[0]-expandborder, gs->bb[3]+expandborder, gs->bb[2]+expandborder); } else { printf("%%%%BoundingBox: %d %d %d %d\n", gs->bb[0]-expandborder, gs->bb[1]-expandborder, gs->bb[2]+expandborder, gs->bb[3]+expandborder); } printf("%%%%EndComments\n\n"); } } if (gs->page==1) //reencode fonts to ISOLatin1 or other {   //NOTE: this is a preliminary version. It will only work with //      the default fonts, that are Times-Roman and Times-Bold // "export JGRAPH_ENCODING=ISOLatin1Encoding" will work in sh char *s;                          \ s=(char *)getenv("JGRAPH_ENCODING"); if ((s!=NULL) && (strlen(s)>0)) { comment("Setting font encoding by pzn@debian.org"); printf("/Times-Bold findfont\n"); printf("dup length dict begin\n"); printf(" {1 index /FID ne {def} {pop pop} ifelse} forall\n"); printf(" /Encoding %s def\n",s); printf(" currentdict\n"); printf("end\n"); printf("/Times-Bold exch definefont pop\n"); printf("/Times-Roman findfont\n"); printf("dup length dict begin\n"); printf(" {1 index /FID ne {def} {pop pop} ifelse} forall\n"); printf(" /Encoding %s def\n",s); printf(" currentdict\n"); printf("end\n"); printf("/Times-Roman exch definefont pop\n"); comment("End of font encoding"); printf("\n"); } } //END added by pzn if (landscape) { printf("-90 rotate\n"); grestore(); if (pp) printf("showpage\n"); else printf("\n"); } if (pp) { printf("%%%%PageTrailer\n"); } }
• ## trunk/Jgraph/ex2.jgr

 r418 marktype none linetype solid label : N log N / 35000 pts shell : nawk \ pts shell : awk \ ' $5 != 0 { \ print$5,  $5 * log($5) / 35000}' \ marktype none linetype solid\ label : N log N / 35000\ pts shell : nawk \\ pts shell : awk \\ ' $5 != 0 { \\ print$5,  $5 * log($5) / 35000}' \\
• ## trunk/Jgraph/exit.c

 r418 **-- **/ #include #include exit(va_alist)
• ## trunk/Jgraph/jgraph.1

 r418 function plotting, and pie graphs.  The latter is impossible to do with the aid of \fBjgraph, \fR \fBjgraph\fR, however, the others can be effected with \fBjgraph \fR error will be flagged. (copygraph does not copy the values of the \fB\fIhash_at\fB, \fImhash_at\fB,\fR \fB\fIhash_at\fR, \fImhash_at\fR,\fR and \fB\fI\fIhash_label\fB\fR is the same as appending together the output of separate calls of jgraph on the text before the \fB\fInewpage,\fB\fR \fB\fInewpage\fR,\fR and on the text after the \fB\fInewpage.\fB\fR \fB\fInewpage.\fR \fB\fINewpage\fB\fR will most likely produce bizarre results if the \fB\fIbbox\fB\fR command.  If there's more than one page in the jgraph file, \fB\fIY,\fB\fR \fB\fIY\fR,\fR \fB\fIX\fB\fR and jgraph output.  Its units are the final postscript units.  It's probably best to use the \fB\-p\FR \fB\-p\fR option to see what the bounding box is that jgraph produces, and then alter that accordingly with \fB\fIbbox.\fB\fR \fB\fIbbox.\fR The main use for this is to change the automatic centering that jgraph performs:  Usually the center of the bounding box that jgraph computes files (the token specifies the filename) which will be copied directly into jgraph's output. The \fIpreamble\fB is included at the beginning of the output The \fIpreamble\fR is included at the beginning of the output (after some initial postscript to set things up for jgraph), and the \fIepilogue\fB is included at the end.  A good use for the \fIpreamble\fB is to set up a postscript dictionary if you're and the \fIepilogue\fR is included at the end.  A good use for the \fIpreamble\fR is to set up a postscript dictionary if you're using postscript marks. .PD If the curve doesn't exist, then this command creates it and starts editing it. \fINewcurve\fB \fINewcurve\fR and \fIcurve\fB \fIcurve\fR interact as \fInewgraph\fB and \fIgraph\fB \fInewgraph\fR and \fIgraph\fR do. .TP .TP \fBcopystring \|[\fIinteger\fB\|]\fR \fIString\fB and \fIcopystring\fB \fIString\fR and \fIcopystring\fR are to \fInewstring\fB \fInewstring\fR as \fIcurve\fB and \fIcopycurve\fB \fIcurve\fR and \fIcopycurve\fR are to \fInewcurve.\fB \fInewcurve\fR. .TP \fBborder\fR .TP \fBnoborder\fR \fIBorder\fR\fB \fIBorder\fR draws a square border around the area defined by the axes. \fINoborder\fB \fINoborder\fR specifies no border. \fINoborder\fB \fINoborder\fR is the default. .TP .TP \fBnoclip\fR \fIClip\fB \fIClip\fR specifies that all curves in the graph will be clipped -- that is, no points outside of the of axes will be plotted.  Clipping can also be specified on a per-curve basis.  The default is \fInoclip.\fB \fInoclip\fR. .TP \fBinherit_axes\fR This is an old command which is kept for backward compatibility. \fICopycurve.\fB \fICopycurve\fR. is equivalent to: .PP By default, the bottom left-hand corner of each graph is at point (0,0) (final postscript units). \fIX_translate\fB and \fIY_translate\fB \fIX_translate\fR and \fIY_translate\fR translate the bottom left-hand corner of the graph \fB\|[\fIfloat\fB\|] \fR only one graph is drawn, it will always be centered on the page, regardless of its \fIX_translate\fB and \fIY_translate\fB \fIX_translate\fR and \fIY_translate\fR values.  These values are used for relative placement of the graphs. To change the centering of the graphs, use \fIbbox.\fB \fIbbox.\fR .TP \fBX \|[\fIfloat\fB\|]\fR \fBY \|[\fIfloat\fB\|]\fR These are the same as \fIX\fB \fIX\fR and \fIY\fB \fIY\fR in the Top-level commands, except that they let the user continue editing These commands act on the current axis as chosen by \fIxaxis\fB \fIxaxis\fR or \fIyaxis\fB \fIyaxis\fR (see GRAPH EDITING COMMANDS). Axis editing terminates when a graph or top-level command is given. default is linear.  If the axis is set to be logarithmic, then values <= 0.0 will be disallowed, as they are at negative infinity on the axis. axis. If you are using logarithmic axes and the labels shows 0 0 1 10 instead of 0.01 0.1 1 10, then you should read "hash_format" in this section. Hint: xaxis log hash_format g .TP \fBmin \|[\fIfloat\fB\|]\fR option.  Unless stated, all units (for example point plotting, string plotting, etc.) will be in terms of the \fImin\fB and \fImax\fB \fImin\fR and \fImax\fR values of the x and y axes. .TP for the value).  By default, each hash mark will be labeled with its value. \fIHash\fB \fIHash\fR and \fIshash\fB \fIshash\fR are ignored if the axes are logarithmic. = -1. If \fIhash\fB \fIhash\fR is set by the user, \fIshash\fB \fIshash\fR is defaulted to the \fImin\fB \fImin\fR value of the axis. .TP Draw the axis line at this point on the other axis. The default is usually the other axis's \fImin, \fB \fImin\fR, however if \fIhash_scale \fB \fIhash_scale \fR is positive (see \fIhash_scale \fB \fIhash_scale \fR under ADVANCED AXIS EDITING), it will be the other axis's \fImax.\fB \fImax\fR. .TP \fBnodraw\fR is useful for plotting points with no axes, and for overlaying graphs on top of one another with no clashes.  This is equivalent to \fIno_draw_axis,\fB \fIno_draw_axis_label,\fB \fIno_draw_hash_marks,\fB and \fIno_draw_hash_labels.\fB \fIno_draw_axis\fR, \fIno_draw_axis_label\fR, \fIno_draw_hash_marks\fR, and \fIno_draw_hash_labels\fR. .TP \fBdraw\fR Cancels the effect of \fInodraw.  \fB \fInodraw\fR. Default = \fIdraw.\fB \fIdraw\fR This is equivalent to \fIdraw_axis,\fB \fIdraw_axis_label,\fB \fIdraw_hash_marks,\fB \fIdraw_axis\fR, \fIdraw_axis_label\fR, \fIdraw_hash_marks\fR, and \fIdraw_hash_labels.\fB \fIdraw_hash_labels\fR. .TP \fBgrid_lines\fR .TP \fBno_grid_lines\fR \fIGrid_lines\fB \fIGrid_lines\fR specifies to plot a grid line at each major hash mark on this axis.  The default is \fIno_grid_lines.\fB \fIno_grid_lines.\fR .TP \fBmgrid_lines\fR .TP \fBno_mgrid_lines\fR \fIMgrid_lines\fB \fIMgrid_lines\fR specifies to plot a grid line at each minor hash mark on this axis.  The default is \fIno_mgrid_lines.\fB \fIno_mgrid_lines\fR. .PD .RE These commands act on the current curve as chosen by \fInewcurve\fB \fInewcurve\fR or \fIcurve\fB \fIcurve\fR (see GRAPH EDITING COMMANDS).  Curve editing terminates when a graph or top-level command is given. This sets the points to plot in this curve.  The first \fIfloat\fB \fIfloat\fR is the x value, and the second \fIfloat\fB \fIfloat\fR is the y value of the point.  Points are plotted in the order specified. This allows the user to specify points and confidence values'' (otherwise known as error bars'').  The first two \fIfloats\fB \fIfloats\fR specify the x and y values of the point, as above.  If \fBx_epts\fR is specified,  then the second two \fIfloats\fB \fIfloats\fR specify range or confidence values for the x value of the point. original point's y value) from the original point.  Similarly, \fIy_epts\fB \fIy_epts\fR specifies range or confidence values for the y value of the point. \fIpts\fB \fIx_epts\fB and \fIy_epts\fB \fIpts\fR \fIx_epts\fR and \fIy_epts\fR can all be intermixed. .TP curve points (units are units of the x and y axes). Default label values are 0 for x and y, and center justification. \fIPostscript:\fR See the \fIpostscript\fB token below. \fIEps:\fR See the \fIeps\fB token below. \fIPostscript\fR: See the \fIpostscript\fR token below. \fIEps\fR: See the \fIeps\fR token below. \fINone\fR means that no mark will be plotted (this is useful for drawing lines). There are four types of \fIgeneral\fR marks, which work using the \fIgmarks\fB command described below.  The four marktypes are \fIgmarks\fR command described below.  The four marktypes are \fIgeneral\fR, \fIgeneral_nf\fR, \fIgeneral_bez\fR, and \fIgeneral_bez_nf\fR. \fIgray\fR should be from 0 (black) to 1 (white).  Values for \fIcolor\fR\fB \fIcolor\fR should also be from 0 to 1.  They are RGB values, and thus define the amount of red, green and blue in the curve respectively.  Specifying color nullifies the gray value, and vice versa.  The default is \fIgray 0\fB \fIgray 0\fR .TP \fBfill \|[\fIfloat\fB\|]\fR This sets the filling of marks which define an area to fill (e.g.  \fIbox\fR, \fIcircle\fR, \fIxbar\fR). \fIfill\fB \fIfill\fR defines a gray value, and \fIcfill\fB \fIcfill\fR defines a color value (see \fIgray\fB and \fIcolor\fB \fIgray\fR and \fIcolor\fR above for a description of the units). The default is \fIfill 0\fB \fIfill 0\fR (black). .TP .TP \fBppattern \fItoken\fB \|[\fIfloat\fB\|]\fR \fIPoly\fB allows the user to make jgraph treat the curve as a \fIPoly\fR allows the user to make jgraph treat the curve as a closed polygon (or in the case of a bezier, a closed bezier curve). \fIpfill\fB, \fIpcfill\fB and \fIppattern\fB  specify the \fIpfill\fR, \fIpcfill\fR and \fIppattern\fR  specify the filling of the polygon, and work like \fIfill\fB, \fIcfill\fB and \fIpattern\fB above. The default is \fInopoly\fB. and work like \fIfill\fR, \fIcfill\fR and \fIpattern\fR above. The default is \fInopoly\fR. .TP \fBgmarks \|[\|{\fIfloat\fB\|} \|{\fIfloat\fB\|}\|]*\fR \fIGmarks\fB \fIGmarks\fR is a way for the user to define custom marks.  For each mark on \fI(x,y),\fB \fI(x,y)\fR, Each pair of \fB\|{\fIfloat_x\fB\|}, \|{\fIfloat_y\fB\|}, \fR be set up so that when the string or file is put to the output, (0, 0) of the the axes is in the middle of the mark, it is rotated by \fImrotate\fB degrees, and scaled by (\fImarksize_x\fB / 2), \fImarksize_y\fB / 2). \fImrotate\fR degrees, and scaled by (\fImarksize_x\fR / 2), \fImarksize_y\fR / 2). Thus, the \fIbox\fR mark could be defined as: .PP .fi .PP If the \fImarksize_x\fB is defined to be (0, 0), then jgraph does no If the \fImarksize_x\fR is defined to be (0, 0), then jgraph does no scaling.  This is useful when the postscript has strings, and the user does not want the strings to be scaled. This allows the user to include an encapsulated postscript file and treat it as a mark.  It automatically sets the marktype to \fIeps\fB.  The file will be scaled so that the bounding \fIeps\fR.  The file will be scaled so that the bounding box is \fImarksize\fR units.  Among other things, this allows the user to include whole jgraph files as marks.  Please see ad.jgr, .TP \fBnorarrows\fR \fIRarrows\fB \fIRarrows\fR specifies to draw an arrow at the end of every line segment in the curve. \fILarrows\fB \fILarrows\fR specifies to draw an arrow at the beginning of every line segment. The size of the arrows can be changed by using \fIasize.\fB \fIasize.\fR The default is \fInolarrows\fB and \fInorarrows\fB. \fInolarrows\fR and \fInorarrows\fR. Arrows always go exactly to the point specified, with the exception of when the marktype is circle''.  In this case, the arrow goes to .TP \fBnorarrow\fR This is analgous to the above, except that with \fIlarrow\fB, the This is analgous to the above, except that with \fIlarrow\fR, the only arrow drawn is to the beginning of the first segment in the curve, and with \fIrarrow\fB, the only arrow drawn is to the end curve, and with \fIrarrow\fR, the only arrow drawn is to the end of the last segment. .TP \fBapattern \fItoken\fB \|[\fIfloat\fB\|]\fR These control the grayness or color of arrowheads. \fIAfill\fB, \fIacfill\fB \fIAfill\fR, \fIacfill\fR and \fIapattern\fB \fIapattern\fR work in the same way as \fIfill\fB, \fIcfill\fB and \fIpattern\fB \fIfill\fR, \fIcfill\fR and \fIpattern\fR described above.  The default is \fIafill 0\fB \fIafill 0\fR (black). .TP \fInone\fR.  The default is \fInone\fR.  \fIGeneral\fR lets the user define his own linetype using the \fIglines\fB \fIglines\fR command described below.  Points are connected in the order in which they are inserted using the \fIpts\fB \fIpts\fR command. .TP is as in postscript -- the first number is the length of the first dash, the second is the length of the space after the first dash, etc.  For example, \fIdotdash\fB could be defined as \fIglines\fB 5 3 etc.  For example, \fIdotdash\fR could be defined as \fIglines\fR 5 3 1 3''. .TP .br .ns \fIBezier\fB \fIBezier\fR specifies to use the curve's points to define successive bezier curves. The first point is the starting point.  The next two are control points points, where n is at least 1. In bezier curves, marks and arrows only apply to every third point. \fINobezier\fB is the default. \fINobezier\fR is the default. .TP This turns off clipping.  If clipping was specified for the entire graph, then \fInoclip\fB \fInoclip\fR has no effect. \fINoclip\fB \fINoclip\fR is the default. .TP drawing a legend.  (see LABEL EDITING COMMANDS and LEGEND EDITING COMMANDS).  Unless the legend entry is \fIcustom\fB, \fIcustom\fR, setting any label attribute except for the text itself will have no effect. These set the horizontal justification to left, center, and right, respectively.  Default = \fIhjc.\fB \fIhjc.\fR .TP \fBvjt\fR These set the vertical justification to top center, and bottom, respectively.  Default = \fIvjb.\fB \fIvjb.\fR .TP \fBrotate \|[\fIfloat\fB\|]\fR \fB\|[\fIfloat\fB\|] \fR degrees.  The point of rotation is defined by the \fIvj\fB \fIvj\fR and \fIhj\fB \fIhj\fR commands.  For example, to rotate 90 degrees about the center of a string, one would use \fIvjc hjc rotate 90.\fB \fIvjc hjc rotate 90.\fR .TP \fBlgray \|[\fIfloat\fB\|]\fR \fBlcolor \|[\fIfloat\fB \fIfloat\fB \fIfloat\fB\|]\fR These control the color or the grayness of the label.  It works just as \fIgray\fB and \fIcolor\fB \fIgray\fR and \fIcolor\fR do for curves and axes.  The default depends on the context.  For example, for strings and the title, the default is black.  For axis labels and hash fontsize to be 18, you had to set it in each entry's curve.  Now, default legend entry characteristics are set using the \fIdefaults\fB \fIdefaults\fR keyword.  Unless a \fIcustom\fB \fIcustom\fR legend is specified, these default values override any values set in the entry's curve.  Thus, to get all entries to have a fontsize of 18, it must be set using \fIdefaults fontsize 18.\fB \fIdefaults fontsize 18\fR. If legend editing seems cryptic, try the following example: .ns .TP \fBoff\R \fBoff\fR These turn printing of the legend on and off.  The default is on (but, of course, if there are no curve labels defined, there will .ns .TP \fIright\fB \fIright\fR These will automatically produce a legend to the left or the right of the graph. \fILeft\fB \fILeft\fR is equivalent to \fIdefaults hjr vjc\fB and \fIright\fB \fIdefaults hjr vjc\fR and \fIright\fR is equivalent to \fIdefaults hjl vjc.\fB \fIdefaults hjl vjc\fR. .TP \fBtop\fR These will automatically produce a legend on the top or the bottom of the graph. \fITop\fB \fITop\fR is equivalent to \fIdefaults hjl vjb\fB \fIdefaults hjl vjb\fR and \fIbottom\fB \fIbottom\fR is equivalent to \fIdefaults hjl vjt.\fB \fIdefaults hjl vjt\fR. .TP \fBx \|[\fIfloat\fB\|]\fR These are included mainly for backward compatability to earlier versions of jgraph.  Setting \fIx\fB \fIx\fR and \fIy\fB \fIy\fR is equivalent to defaults x \fIfloat\fB \fIfloat\fR y \fIfloat\fB \fIfloat\fR hjl vjt'' .TP This lets the user control where each individual legend entry goes.  The values of the \fIdefaults\fB \fIdefaults\fR fields are ignored, and instead, the values of the curve's labels are used.  All justifications have defined results, except for \fIhjc\fB. \fIhjc\fR. Similarly, rotation other than 0 is likely to produce bad effects. .PD These specify either the grayness of the axis or its color.  Values for \fIgray\fB \fIgray\fR should be from 0 (black) to 1 (white).  Values for \fIcolor\fB \fIcolor\fR should also be from 0 to 1.  They are RGB values, and thus define the amount of red, green and blue in the axis respectively.  Specifying color nullifies the gray value, and vice versa.  The default is \fIgray 0\fB. \fIgray 0\fR. These values affect every part of the axis:  the label, the hash marks and labels, the axis line and the grid lines. axis lines. The default \fIgrid_gray\fB and \fIgrid_color\fB \fIgrid_gray\fR and \fIgrid_color\fR is the same as the axis's \fIgray\fB and \fIcolor\fB. \fIgray\fR and \fIcolor\fR. The default \fImgrid_gray\fB and \fImgrid_color\fB \fImgrid_gray\fR and \fImgrid_color\fR is the same as \fIgrid_gray\fB and \fIgrid_color\fB. \fIgrid_gray\fR and \fIgrid_color\fR. .TP \fBhash_at \|[\fIfloat\fB\|]\fR This is so that the user can change the fontsize, justification, etc., of the hash labels.  Editing \fIhash_labels \fB \fIhash_labels \fR is just like editing normal labels (see LABEL EDITING COMMANDS), except that the \fI:,\fB \fIx,\fB and \fIy\fB \fI:\fR, \fIx\fR, and \fIy\fR values are all ignored. Defaults for hash labels are as follows: Fontsize=9, Font=Times-Roman'', Justification is dependent on whether it is the x or y axis and whether \fIhash_scale\fB \fIhash_scale\fR is positive or negative. .TP either above or below the axis.  This command changes where they are drawn. \fIHash_scale\fB \fIHash_scale\fR still determines whether they are drawn above or below this point, and their size. drawn either above or below the hash marks (again, this is dependent on \fIhash_scale\fB). \fIhash_scale\fR). This command changes where they are drawn. Justification and fontsize, etc., can be changed with the \fIhash_labels\fB \fIhash_labels\fR command. .TP \fBjgraph \fR will automatically create hash marks according to \fIhash,\fB \fImhash\fB and \fIshash\fB \fIhash\fR, \fImhash\fR and \fIshash\fR (or \fIlog_base\fB and \fImhash\fB \fIlog_base\fR and \fImhash\fR for logarithmic axes). The default is \fIauto_hash_marks.\fB \fIauto_hash_marks\fR. .TP \fBauto_hash_labels\fR \fBjgraph \fR will automatically create hash labels for the \fIauto_hash_marks\fB. \fIauto_hash_marks\fR. Default = \fIauto_hash_labels\fB. \fIauto_hash_labels\fR. .TP \fBdraw_axis\fR This toggles whether or not the axis line is drawn.  Default = \fIdraw_axis.\fB \fIdraw_axis\fR. .TP \fBdraw_axis_label\fR This toggles whether or not the axis label (as editted by the \fIlabel\fB \fIlabel\fR command) is drawn. Default = \fIdraw_axis_label.\fB \fIdraw_axis_label\fR. .TP \fBdraw_hash_marks\fR This toggles whether or not the hash marks (both automatic and those created with \fIhash_at\fB \fIhash_at\fR and \fImhash_at\fB) \fImhash_at\fR) are drawn.  Default = \fIdraw_hash_marks.\fB \fIdraw_hash_marks\fR. .TP \fBdraw_hash_labels\fR This toggles whether or not the hash labels are drawn.  Default = \fIdraw_hash_labels.\fB \fIdraw_hash_labels\fR. .PD .RE along the appropriate axis.  As a default, they are printed at the place denoted by the most recent \fIhash_at\fB \fIhash_at\fR or \fImhash_at\fB \fImhash_at\fR for this axis, but this can be changed by the \fIat\fB \fIat\fR command.  If there has been no \fIhash_at\fB \fIhash_at\fR or \fImhash_at,\fB \fImhash_at\fR, then an \fIat\fB \fIat\fR command must be given, or there will be an error.  Hash editing terminates when either one of \fBFunction plotting\fR With the \fIinclude\fB \fIinclude\fR and \fIshell\fB \fIshell\fR statement, it's easy to create a file of points of a function with a c or awk program, and a user desires.  To embellish the graph with extra text, axes, lines, etc., it is helpful to use \fIcopygraph.\fB \fIcopygraph.\fR The following example graphs show a few examples of different features of jgraph.  They should be in the directory JGRAPH_DIR. of jgraph.  They should be in the directory /usr/doc/examples/jgraph. .sp - acc.jgr is a simple bar graph.  Acc.tex is also included to show - sin.jgr shows how a sin function can be plotted using a simple c program to produce the sin wave.  Moreover, this file shows a use of \fIcopygraph\fB \fIcopygraph\fR to plot an extra x and y axis at the 0 point. .sp complicated output graph can be quite concisely and simply stated. In this graph, the x axis is a time line.  It shows usage of the \fIhash_label\fB and \fIhash_labels\fB \fIhash_label\fR and \fIhash_labels\fR commands, as well as displaying how jgraph lets you extract data from output files with awk. To view these graphs, use jgraph -P, and view the resulting output file with \fIgs,\fB \fIgs\fR, or a similar postscript viewer. To make a hard copy of these graphs, pipe the output of jgraph -P directly to \fIlpr.\fB \fIlpr\fR. .SH USING JGRAPH TO DRAW PICTURES preprocessor to make drawings.  There are two advantages using jgraph to draw pictures instead of using standard drawing tools like \fIxfig\fB, \fIfigtool\fB, \fIxfig\fR, \fIfigtool\fR, or \fIidraw\fB. \fIidraw\fR. The first is that with jgraph, you know exactly where strings, lines, boxes, etc, will end up, because you plot them explicitly.  The second If you'd like to see some more complex pictures drawn with jgraph, as well as some hints to make picture-drawing easier, send me email (jsp@princeton.edu). .SH EMBEDDING THE OUTPUT IN LATEX I haven't read the manuals, but the way I've been loading these files into LaTeX has been as follows: .PP (plank@cs.utk.edu). .SH SUPPORT FOR OTHER FONT ENCODINGS If you want to use non-english characters to set labels or titles, set enviroment variable JGRAPH_ENCODING with the font encoding that you need. This value will be passed directly to the postscript. Ex. to use ISO-8859-1 characters, try: .nf 1.  Toward the beginning of my LaTeX file, I've had \\input{psfig}'' 2.  Where I've wanted my file, I've put: \\begin{figure} \\centerline{\\psfig{figure=/}} \\end{figure} Some versions of dvips or dvi2ps work without the path-name.  Others require that the path-name be present. 3.  After running latex on the file, do lpr -d file.dvi 4.  If that doesn't work, try dvips-ing the file and printing the postscript. export JGRAPH_ENCODING=ISOLatin1Encoding .fi .PP Note: that only works with default fonts. if you use 'font' in stdin to specify another font, it won't work. You also have the possibility to expand the bounding box if jgraph cuts some acute, tilde or special chars near the border; try: .nf export JGRAPH_BORDER=5 .fi This support is currently 'testing' code. Send bugs about it to pzn@debian.org .SH INTEGRATION WITH LATEX .PP .nf 1. At the top, say \\usepackage{graphics} 2. The floating object is done using: \\begin{figure} \\begin{center} \\includegraphics{a.eps} \\end{center} \\end{figure} 3. Now go through dvips as usual and the .ps file will work. .fi .PP .SH INTEGRATION WITH PDFLATEX If you are using pdflatex, it requires .pdf files and not .eps files. In that case, you have to run epstopdf on the .eps file to get a .pdf file. After that, .br \\includegraphics{a.pdf} .br does the trick. .SH SCALING THE INCLUDED GRAPHICS OBJECT Sometimes you need to change the size of the included object at LaTeX time. In that case, you need .br \\usepackage{graphicx} .br instead of graphics, and then say something like \\includegraphics[width=7cm]{a.eps} or \\includegraphics[height=7cm]{a.eps} you can also omit the .eps/.pdf suffix: \\includegraphics[height=7cm]{a} a.eps and a.pdf can both exist, and includegraphics will automatically choose the correct one for postscript or pdf output, depending if you are using latex of pdflatex. .SH AUTOMATION USING MAKE You can automate the mapping from .jgr -> .eps or .jgr -> .pdf in your Makefile using these rules: .nf --------- cut here --------- %.eps : %.jgr jgraph $< >$@ %.pdf : %.jgr jgraph $< | epstopdf --filter >$@ --------- cut here --------- .fi jgraph can also return the exit status correctly, so it is also a good idea to use it in your scripts to prevent bad .eps files if the .jgr source is bad. The following Makefile can handle its exit status. .nf --------- cut here --------- %.eps : %.jgr jgraph $< >$@; \\ if [ "$$?" != "0" ]; then \\ rm -f @; \\ exit 1; \\ fi %.pdf : %.jgr TMP=tempfile; jgraph < >$${TMP}; \\ if [ "$$?" == "0" ]; then \\ cat$${TMP} | epstopdf --filter > $@; \\ rm -f $${TMP}; \\ else \\ rm -f$${TMP}$@; \\ exit 1; \\ fi; --------- cut here --------- .fi .SH BUGS Logarithmic axes cannot contain points <= 0.  If I have own hash labels. .sp There may well be loads of other bugs.  Send to jsp@princeton.edu. There may well be loads of other bugs.  Send to plank@cs.utk.edu. .sp
• ## trunk/Jgraph/makefile

 r418 # jgraph.1 to be the directory containing the example jgraphs. CC = gcc -LCC CC = cc OBJS = draw.o \ edit.o \ jgraph.o \ list.o \ printline.o \ wortman.jps LOADLIBES = -lm all: jgraph .tex.dvi: latex $*.tex .c.o:$(CC)  -c -g $*.c #.c.o: #$(CC)  -c -g $*.c jgraph:$(OBJS) $(CC) -g$(OBJS) -lm -o jgraph #       $(CC) -g$(OBJS) -lm -o jgraph sin:    sin.o sin3.jps: sin3.pts tree1.jps: tree.awk ( echo "4 3" | nawk -f tree.awk ; echo "xaxis size 5.4" ) | \ ( echo "4 3" | awk -f tree.awk ; echo "xaxis size 5.4" ) | \ jgraph -P > tree1.jps tree2.jps: tree.awk ( echo "5 2" | nawk -f tree.awk ; echo "xaxis size 5.4" ) | \ ( echo "5 2" | awk -f tree.awk ; echo "xaxis size 5.4" ) | \ jgraph -P > tree2.jps token.o: token.c list.h clean: rm -f *.o a.out *.jps rm -f *.o a.out *.jps jgraph
• ## trunk/Jgraph/printline.c

 r418 #include "jgraph.h" #include #include //by pzn@debian.org #define LINEWIDTHFACTOR 0.700 float fnl; char *s; unsigned char *s_7bit; // added by pzn@debian.org if (l->label == CNULL) return; s = l->label; for (i = 0; i <= nlines; i++) { printf("(%s) dup stringwidth pop ", s); // BEGIN added by pzn@debian.org // converts 8bit ascii chars to octal value; // 7bit are not converted { int i, j=0, len; len=strlen(s); s_7bit=malloc(len*4+1); assert(s_7bit!=NULL); for (i=0; i<=len; i++) { if((unsigned char)s[i]<128) { //char is ascii 7bit s_7bit[j]=s[i]; j++; } else { //char must be converted to octal sprintf(s_7bit+j,"\\%03o",(unsigned char)s[i]); j+=4; } } s_7bit[j-1]=0; } //printf("(%s) dup stringwidth pop ", s); //disabled by pzn printf("(%s) dup stringwidth pop ", s_7bit); free(s_7bit); // END added by pzn if (l->hj == 'c') { printf("2 div neg 0 moveto\n");
Note: See TracChangeset for help on using the changeset viewer.