> On Feb 23, 2017, at 7:24 AM, Peter Williams <[email protected]>
> wrote:
>
> I need to label my contours with floating point values. However, I seem
> to get strange results.
> I have a simplified example of what occurs in the program below. It
> draws an ellipse with contour value 1.0e10, i.e. x*x/4 + y*y = 1.0e10.
> The contour is good. The label is written as 1.0?#???10 where ? stands
> for a character I cannot recognise in this context. What am I doing wrong?
>
What is the OS and which version of PLplot are you using?
> /* Test of labelling contours by floats */
> #include "plplot.h"
>
> double xMin,xMax,yMin,yMax,dx,dy;
>
> double f(double x, double y)
> {
> return x*x/4 + y*y;
> }
>
> void transform(double i, double j, double *x, double *y, void *psiData)
> {
> *x = xMin + i*dx; *y = yMin + j*dy;
> }
>
> int main()
> {
> int i,j,m,n,nLevels= 1;
> double x,y,**z;
> double pLevels[] = {1.0e10};
> m = 32; n = 16;
> xMin = -2.5e5; xMax = 2.5e5; yMin = -1.5e5; yMax =1.5e5;
> dx = (xMax-xMin)/m; dy = (yMax-yMin)/n;
> plAlloc2dGrid(&z,m+1,n+1);
> for(i=0; i <= m; i++) for(j=0; j <= n; j++)
> {
> transform(i,j,&x,&y,NULL); z[i][j] = f(x,y);
> }
> plsfnam("Labelling.ps"); plsori(1);plsdev("ps");plinit();
> plenv(xMin,xMax,yMin,yMax,1,0);
> pl_setcontlabelformat(1,2); pl_setcontlabelparam(0.01,0.5,0.3,1);
> plcont((PLFLT_MATRIX)z,m+1,n+1,1,m,1,n,pLevels,nLevels,transform,NULL);
> pllab("x","y","Ellipse");
> plFree2dGrid(z,m+1,n+1);
> plend();
> return 1;
> }
>
> --
> Peter Williams
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Plplot-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/plplot-general
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general