1
/*------------------------------------------------------------------------
3
* Copyright (C) 1998-2000 Enpc/Jean-Philippe Chancelier
5
--------------------------------------------------------------------------*/
14
static void Plo2d3RealToPixel __PARAMS((integer *n1, integer *n2, double *x, double *y, integer *xm, integer *ym, char *xf));
16
/*--------------------------------------------------------------------
17
C2F(plot2d3)(xf,x,y,n1,n2,style,strflag,legend,brect,aaint)
19
used to plot only vertical bars form (x_i,0) to (x_i,y_i)
20
the arguments are similar to those of plot2d
21
the only difference is that style must have positive values
22
which are considered as dash-styles
23
--------------------------------------------------------------------------*/
25
int C2F(plot2d3)(xf,x,y,n1,n2,style,strflag,legend,brect,aaint,l1,l2,l3)
26
double x[],y[],brect[];
27
integer *n1,*n2,style[],aaint[];
28
char legend[],strflag[],xf[];
34
/** Attention : 2*(*n2) **/
36
if ( CheckxfParam(xf)== 1) return(0);
38
/** Boundaries of the frame **/
39
update_frame_bounds(0,xf,x,y,n1,n2,aaint,strflag,brect);
41
/* Storing values if using the Record driver */
43
StorePlot("plot2d3",xf,x,y,n1,n2,style,strflag,legend,brect,aaint);
49
xm = graphic_alloc(0,n,sizeof(int));
50
ym = graphic_alloc(1,n,sizeof(int));
51
if ( xm == 0 || ym == 0)
53
sciprint("Running out of memory \n");
57
/** Real to Pixel values **/
58
Plo2d3RealToPixel(n1,n2,x,y,xm,ym,xf);
60
/** Draw Axis or only rectangle **/
65
/** Drawing the curves **/
67
/** to get the default dash **/
68
for ( j = 0 ; j < (*n1) ; j++)
70
integer lstyle,iflag=0;
71
/** style must be negative **/
72
lstyle = (style[j] < 0) ? -style[j] : style[j];
73
C2F(dr)("xsegs","v",&xm[2*(*n2)*j],&ym[2*(*n2)*j],&nn2
74
,&lstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
77
/** Drawing the Legends **/
78
if ((int)strlen(strflag) >=1 && strflag[0] == '1')
79
Legends(style,n1,legend);
85
static void Plo2d3RealToPixel(n1, n2, x, y, xm, ym, xf)
95
/** Computing y-values **/
96
if ((int)strlen(xf) >= 3 && xf[2]=='l')
98
for ( i=0 ; i < (*n2) ; i++)
99
for (j=0 ; j< (*n1) ; j++)
101
ym[2*i+1+2*(*n2)*j]= YScale(0);
102
ym[2*i+2*(*n2)*j]= YLogScale(y[i+(*n2)*j]);
107
for ( i=0 ; i < (*n2) ; i++)
108
for (j=0 ; j< (*n1) ; j++)
110
ym[2*i+1+2*(*n2)*j]= YScale(0);
111
ym[2*i+2*(*n2)*j]= YScale(y[i+(*n2)*j]);
115
/** Computing x-values **/
119
/** No X-value given by the user **/
120
if ((int)strlen(xf) >= 2 && xf[1]=='l')
121
for (j=0 ; j< (*n1) ; j++)
123
for ( i=0 ; i < (*n2) ; i++)
125
xm[2*i+2*(*n2)*j]= XLogScale(i+1.0);
126
xm[2*i+1+2*(*n2)*j]=xm[2*i+2*(*n2)*j];
131
for (j=0 ; j< (*n1) ; j++)
133
for ( i=0 ; i < (*n2) ; i++)
135
xm[2*i+2*(*n2)*j]= XScale((i+1.0));
136
xm[2*i+1+2*(*n2)*j]=xm[2*i+2*(*n2)*j];
142
if ((int)strlen(xf) >= 2 && xf[1]=='l')
143
for (j=0 ; j< (*n1) ; j++)
145
for ( i=0 ; i < (*n2) ; i++)
148
xm[2*i+2*(*n2)*j]= XLogScale(x[i]);
149
xm[2*i+1+2*(*n2)*j]=xm[2*i+2*(*n2)*j];
153
for (j=0 ; j< (*n1) ; j++)
155
for ( i=0 ; i < (*n2) ; i++)
157
xm[2*i+2*(*n2)*j]= XScale(x[i]);
158
xm[2*i+1+2*(*n2)*j]=xm[2*i+2*(*n2)*j];
165
if ((int)strlen(xf) >= 2 && xf[1]=='l')
166
for (j=0 ; j< (*n1) ; j++)
168
for ( i=0 ; i < (*n2) ; i++)
170
xm[2*i+2*(*n2)*j]= XLogScale(x[i+(*n2)*j]);
171
xm[2*i+1+2*(*n2)*j]=xm[2*i+2*(*n2)*j];
176
for (j=0 ; j< (*n1) ; j++)
178
for ( i=0 ; i < (*n2) ; i++)
180
xm[2*i+2*(*n2)*j]= XScale(x[i+(*n2)*j]);
181
xm[2*i+1+2*(*n2)*j]=xm[2*i+2*(*n2)*j];