Skip to content
Browse files

rounding errors fixed

  • Loading branch information...
1 parent 48f6687 commit dff3b343d285aa111d57251db63afa9806ecfbb6 @pchilds committed Jun 16, 2011
View
2,013 PlotLinear/src/plotlinear0-1-0.c
@@ -46,6 +46,8 @@
#define WHP 0.020207259 /* wiggle height proportion */
#define DZE 0.00001 /* divide by zero threshold */
#define NZE -0.00001 /* negative of this */
+#define FAC 0.05 /* floating point accuracy check for logarithms etc */
+#define NAC 0.95 /* conjugate of this */
#define JT 5 /* major tick length */
#define JTI 6 /* this incremented */
#define NT 3 /* minor tick length */
@@ -70,13 +72,13 @@ typedef enum
PLOT_LINEAR_AXES_LT = 1 << 5
} PlotLinearAxes;
G_DEFINE_TYPE (PlotLinear, plot_linear, GTK_TYPE_DRAWING_AREA);
-enum {PROP_0, PROP_BXN, PROP_BXX, PROP_BYN, PROP_BYX, PROP_XTJ, PROP_YTJ, PROP_XTN, PROP_YTN, PROP_XC, PROP_YC, PROP_FA};
+enum {PROP_0, PROP_BXN, PROP_BXX, PROP_BYN, PROP_BYX, PROP_XTJ, PROP_YTJ, PROP_XTN, PROP_YTN, PROP_FA};
enum {MOVED, LAST_SIGNAL};
static guint plot_linear_signals[LAST_SIGNAL]={0};
typedef struct _PlotLinearPrivate PlotLinearPrivate;
struct xs {gdouble xmin, ymin, xmax, ymax;};
struct tk {guint xj, yj, xn, yn;};
-struct _PlotLinearPrivate {struct xs bounds, rescale; struct tk ticks, range; guint xcs, ycs, flaga, flagr;};
+struct _PlotLinearPrivate {struct xs bounds, rescale; struct tk ticks, range; guint flaga, flagr;};
static void drawz(GtkWidget *widget, cairo_t *cr)
{
@@ -155,7 +157,8 @@ static void draw(GtkWidget *widget, cairo_t *cr)
PlotLinearPrivate *priv;
PlotLinear *plot;
gint j, k, xw, yw, xr, xr2, yr, yr2, xa, ya, xl, yl, xu, yu, tf, tz, to, tn, tnn, xv, yv, xvn, yvn, dtt, tx, wd, hg, ft, lt, xt;
- gdouble vv, wv, zv, av, dt, lr1, lr2, lr3;
+ gdouble vv, wv, zv, av, dt, lr1, lr2, delx, dely;
+ guint lr3;
gchar *str1=NULL, *str2=".", *str3=NULL;
gchar lbl[10];
PangoLayout *lyt;
@@ -168,6 +171,8 @@ static void draw(GtkWidget *widget, cairo_t *cr)
yw=(widget->allocation.height);
priv=PLOT_LINEAR_GET_PRIVATE(plot);
(priv->flaga)&=(PLOT_LINEAR_AXES_LT|PLOT_LINEAR_AXES_LR);
+ delx=((priv->bounds.xmax)-(priv->bounds.xmin))/(priv->ticks.xj);
+ dely=((priv->bounds.ymax)-(priv->bounds.ymin))/(priv->ticks.yj);
lyt=pango_cairo_create_layout(cr);
pango_layout_set_font_description(lyt, (plot->lfont));
str1=g_strconcat((plot->xlab), (plot->ylab), NULL);
@@ -193,7 +198,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
if ((priv->bounds.ymax)<=DZE) /* determine positions of axes */
{
(priv->flaga)|=PLOT_LINEAR_AXES_LT;
- g_snprintf(lbl, (priv->ycs), "%f", (priv->bounds.ymin));
+ lr3=3;
+ if ((priv->bounds.ymin)<-1) lr3+=floor(log10(-(priv->bounds.ymin)));
+ if ((plot->ydp)!=0) g_snprintf(lbl, lr3+(plot->ydp)+1, "%f", (priv->bounds.ymin));
+ else g_snprintf(lbl, lr3, "%f", (priv->bounds.ymin));
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
yl=yw-(wd/2)-1; /* allow space for lower label */
@@ -215,7 +223,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{
if ((priv->bounds.ymin)+(priv->bounds.ymax)<=0)
{
- g_snprintf(lbl, (priv->ycs), "%f", (priv->bounds.ymin));
+ lr3=3;
+ if ((priv->bounds.ymin)<-1) lr3+=floor(log10(-(priv->bounds.ymin)));
+ if ((plot->ydp)!=0) g_snprintf(lbl, lr3+(plot->ydp)+1, "%f", (priv->bounds.ymin));
+ else g_snprintf(lbl, lr3, "%f", (priv->bounds.ymin));
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
yl=yw-(wd/2)-1; /* allow space for lower label */
@@ -247,7 +258,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
yl=yw;
if ((priv->bounds.ymin)+(priv->bounds.ymax)<=0)
{
- g_snprintf(lbl, (priv->ycs), "%f", (priv->bounds.ymin));
+ lr3=3;
+ if ((priv->bounds.ymin)<-1) lr3+=floor(log10(-(priv->bounds.ymin)));
+ if ((plot->ydp)!=0) g_snprintf(lbl, lr3+(plot->ydp)+1, "%f", (priv->bounds.ymin));
+ else g_snprintf(lbl, lr3, "%f", (priv->bounds.ymin));
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
yl+=wd/2;
@@ -262,7 +276,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
if (priv->bounds.xmax<=DZE)
{
(priv->flaga)|=PLOT_LINEAR_AXES_LR;
- g_snprintf(lbl, (priv->xcs), "%f", (priv->bounds.xmin));
+ lr3=3;
+ if ((priv->bounds.xmin)<-1) lr3+=floor(log10(-(priv->bounds.xmin)));
+ if ((plot->xdp)!=0) g_snprintf(lbl, lr3+(plot->xdp)+1, "%f", (priv->bounds.xmin));
+ else g_snprintf(lbl, lr3, "%f", (priv->bounds.xmin));
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
xl=wd/2; /* allow space for left label */
@@ -284,7 +301,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{
if ((priv->bounds.xmin)+(priv->bounds.xmax)<=0)
{
- g_snprintf(lbl, (priv->xcs), "%f", (priv->bounds.xmin));
+ lr3=3;
+ if ((priv->bounds.xmin)<-1) lr3+=floor(log10(-(priv->bounds.xmin)));
+ if ((plot->xdp)!=0) g_snprintf(lbl, lr3+(plot->xdp)+1, "%f", (priv->bounds.xmin));
+ else g_snprintf(lbl, lr3, "%f", (priv->bounds.xmin));
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
xl=wd/2; /* allow space for left label */
@@ -320,7 +340,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{
if ((priv->bounds.xmin)+(priv->bounds.xmax)<=0)
{
- g_snprintf(lbl, (priv->xcs), "%f", (priv->bounds.xmin));
+ lr3=3;
+ if ((priv->bounds.xmin)<-1) lr3+=floor(log10(-(priv->bounds.xmin)));
+ if ((plot->xdp)!=0) g_snprintf(lbl, lr3+(plot->xdp)+1, "%f", (priv->bounds.xmin));
+ else g_snprintf(lbl, lr3, "%f", (priv->bounds.xmin));
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
xl=wd/2; /* allow space for left label */
@@ -386,34 +409,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, to, ya);
cairo_line_to(cr, to, ya-JT);
cairo_stroke(cr);
- if ((priv->bounds.xmin)>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(priv->bounds.xmin))-1);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>=NZE) lr1=0;
- else if ((priv->bounds.xmin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.xmin)*exp(G_LN10*(plot->xdp)));
+ if ((priv->bounds.xmin)>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.xmin)<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-(priv->bounds.xmin)))-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, to-(wd/2), ya-JTI-hg);
@@ -440,35 +468,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya-JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin)))/(priv->ticks.xj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx);
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya-JTI-hg);
@@ -492,34 +525,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, to, ya);
cairo_line_to(cr, to, ya+JT);
cairo_stroke(cr);
- if ((priv->bounds.xmin)>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(priv->bounds.xmin))-1);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>=NZE) lr1=0;
- else if ((priv->bounds.xmin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.xmin)*exp(G_LN10*(plot->xdp)));
+ if ((priv->bounds.xmin)>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.xmin)<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-(priv->bounds.xmin)))-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, to-(wd/2), ya+JTI);
@@ -546,35 +584,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya+JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin)))/(priv->ticks.xj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx);
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya+JTI);
@@ -602,34 +645,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, to, ya);
cairo_line_to(cr, to, ya-JT);
cairo_stroke(cr);
- if ((priv->bounds.xmin)>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(priv->bounds.xmin))-1);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>=NZE) lr1=0;
- else if ((priv->bounds.xmin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.xmin)*exp(G_LN10*(plot->xdp)));
+ if ((priv->bounds.xmin)>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.xmin)<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-(priv->bounds.xmin)))-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, to-(wd/2), ya-JTI-hg);
@@ -656,35 +704,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya-JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin)))/(priv->ticks.xj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx);
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya-JTI-hg);
@@ -726,34 +779,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, to, ya);
cairo_line_to(cr, to, ya+JT);
cairo_stroke(cr);
- if ((priv->bounds.xmin)>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(priv->bounds.xmin))-1);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>=NZE) lr1=0;
- else if ((priv->bounds.xmin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.xmin)*exp(G_LN10*(plot->xdp)));
+ if ((priv->bounds.xmin)>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.xmin)<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-(priv->bounds.xmin)))-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, to-(wd/2), ya+JTI);
@@ -780,35 +838,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya+JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin)))/(priv->ticks.xj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx);
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya+JTI);
@@ -878,35 +941,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya-JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmax)-((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(xu-tf))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmax)-(j*delx*(xu-tf)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya-JTI-hg);
@@ -944,35 +1012,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya-JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmax)-((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(xu-tf))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmax)-(j*delx*(xu-tf)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya-JTI-hg);
@@ -1024,35 +1097,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya+JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmax)-((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(xu-tf))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmax)-(j*delx*(xu-tf)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
- }
- else
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya+JTI);
@@ -1090,35 +1168,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya+JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmax)-((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(xu-tf))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmax)-(j*delx*(xu-tf)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya+JTI);
@@ -1156,34 +1239,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, to, ya);
cairo_line_to(cr, to, ya-JT);
cairo_stroke(cr);
- if ((priv->bounds.xmin)>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(priv->bounds.xmin))-1);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>=NZE) lr1=0;
- else if ((priv->bounds.xmin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.xmin)*exp(G_LN10*(plot->xdp)));
+ if ((priv->bounds.xmin)>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.xmin)<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-(priv->bounds.xmin)))-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, to-(wd/2), ya-JTI-hg);
@@ -1210,35 +1298,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya-JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(tf-xl))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx*(tf-xl)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya-JTI-hg);
@@ -1276,35 +1369,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya-JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(tf-xl))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx*(tf-xl)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya-JTI-hg);
@@ -1335,34 +1433,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, to, ya);
cairo_line_to(cr, to, ya+JT);
cairo_stroke(cr);
- if ((priv->bounds.xmin)>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(priv->bounds.xmin))-1);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.xmin)>=NZE) lr1=0;
- else if ((priv->bounds.xmin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.xmin)*exp(G_LN10*(plot->xdp)));
+ if ((priv->bounds.xmin)>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.xmin)<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-(priv->bounds.xmin)))-2);
- lr2=(priv->bounds.xmin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, to-(wd/2), ya+JTI);
@@ -1389,35 +1492,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya+JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(tf-xl))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx*(tf-xl)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya+JTI);
@@ -1455,35 +1563,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, tn, ya);
cairo_line_to(cr, tn, ya+JT);
cairo_stroke(cr);
- lr3=(priv->bounds.xmin)+((j*((priv->bounds.xmax)-(priv->bounds.xmin))*(tf-xl))/((xu-xl)*(priv->ticks.xj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->xcs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->xcs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.xmin)+(j*delx*(tf-xl)/(xu-xl));
+ lr1=round(lr2*exp(G_LN10*(plot->xdp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->xcs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->xcs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->xdp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->xdp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->xdp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->xdp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->xcs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, tn-(wd/2), ya+JTI);
@@ -1523,34 +1636,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
pango_cairo_show_layout(cr, lyt);
g_object_unref(lyt);
cairo_identity_matrix(cr);
- if ((priv->bounds.ymax)>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(priv->bounds.ymax))-1);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.ymax)>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.ymax)>=NZE) lr1=0;
- else if ((priv->bounds.ymax)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.ymax)*exp(G_LN10*(plot->ydp)));
+ if ((priv->bounds.ymax)>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.ymax)<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-(priv->bounds.ymax)))-2);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, to-(wd/2));
@@ -1583,35 +1701,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa+JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin)))/(priv->ticks.yj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely);
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, tn-(wd/2));
@@ -1638,34 +1761,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
pango_cairo_show_layout(cr, lyt);
g_object_unref(lyt);
cairo_identity_matrix(cr);
- if ((priv->bounds.ymax)>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(priv->bounds.ymax))-1);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.ymax)>DZE)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.ymax)*exp(G_LN10*(plot->ydp)));
+ if ((priv->bounds.ymax)>DZE)
{
- lr1=G_LN10*((priv->ycs)-2);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else if ((priv->bounds.ymax)>=NZE) lr1=0;
- else if ((priv->bounds.ymax)>-10)
+ else if ((priv->bounds.ymax)<NZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
- }
- else
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(-(priv->bounds.ymax)))-2);
- lr2=(priv->bounds.ymax)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa-JTI-hg, to+(wd/2));
@@ -1698,35 +1826,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa-JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin)))/(priv->ticks.yj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely);
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa-JTI-hg, tn+(wd/2));
@@ -1781,35 +1914,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa+JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin)))/(priv->ticks.yj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely);
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, tn-(wd/2));
@@ -1860,35 +1998,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa-JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin)))/(priv->ticks.yj));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely);
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa-JTI-hg, tn+(wd/2));
@@ -1946,35 +2089,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa+JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin))*(tf-yu))/((yl-yu)*(priv->ticks.yj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely*(tf-yu)/(yl-yu));
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, tn-(wd/2));
@@ -2015,35 +2163,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa+JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin))*(tf-yu))/((yl-yu)*(priv->ticks.yj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely*(tf-yu)/(yl-yu));
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, tn-(wd/2));
@@ -2101,35 +2254,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa-JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin))*(tf-yu))/((yl-yu)*(priv->ticks.yj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely*(tf-yu)/(yl-yu));
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa-JTI-hg, tn+(wd/2));
@@ -2170,35 +2328,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa-JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymax)-((j*((priv->bounds.ymax)-(priv->bounds.ymin))*(tf-yu))/((yl-yu)*(priv->ticks.yj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymax)-(j*dely*(tf-yu)/(yl-yu));
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
- }
- else
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa-JTI-hg, tn+(wd/2));
@@ -2239,34 +2402,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
pango_cairo_show_layout(cr, lyt);
g_object_unref(lyt);
cairo_identity_matrix(cr);
- if ((priv->bounds.ymin)>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(priv->bounds.ymin))-1);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.ymin)>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.ymin)>=NZE) lr1=0;
- else if ((priv->bounds.ymin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.ymin)*exp(G_LN10*(plot->ydp)));
+ if ((priv->bounds.ymin)>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.ymin)<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-(priv->bounds.ymin)))-2);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, to-(wd/2));
@@ -2299,35 +2467,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa+JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymin)+((j*((priv->bounds.ymax)-(priv->bounds.ymin))*(yl-tf))/((yl-yu)*(priv->ticks.yj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymin)+(j*dely*(yl-tf)/(yl-yu));
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, tn-(wd/2));
@@ -2368,35 +2541,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa+JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymin)+((j*((priv->bounds.ymax)-(priv->bounds.ymin))*(yl-tf))/((yl-yu)*(priv->ticks.yj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymin)+(j*dely*(yl-tf)/(yl-yu));
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa+JTI+hg, tn-(wd/2));
@@ -2430,34 +2608,39 @@ static void draw(GtkWidget *widget, cairo_t *cr)
pango_cairo_show_layout(cr, lyt);
g_object_unref(lyt);
cairo_identity_matrix(cr);
- if ((priv->bounds.ymin)>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(priv->bounds.ymin))-1);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.ymin)>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if ((priv->bounds.ymin)>=NZE) lr1=0;
- else if ((priv->bounds.ymin)>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr1=round((priv->bounds.ymin)*exp(G_LN10*(plot->ydp)));
+ if ((priv->bounds.ymin)>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if ((priv->bounds.ymin)<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-(priv->bounds.ymin)))-2);
- lr2=(priv->bounds.ymin)*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);
cairo_move_to(cr, xa-JTI-hg, to+(wd/2));
@@ -2490,35 +2673,40 @@ static void draw(GtkWidget *widget, cairo_t *cr)
cairo_move_to(cr, xa, tn);
cairo_line_to(cr, xa-JT, tn);
cairo_stroke(cr);
- lr3=(priv->bounds.ymin)+((j*((priv->bounds.ymax)-(priv->bounds.ymin))*(yl-tf))/((yl-yu)*(priv->ticks.yj)));
- if (lr3>=10)
- {
- lr1=G_LN10*((priv->ycs)-floor(log10(lr3))-1);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>DZE)
- {
- lr1=G_LN10*((priv->ycs)-2);
- lr2=lr3*exp(lr1);
- lr1=(++lr2)*exp(-lr1);
- }
- else if (lr3>=NZE) lr1=0;
- else if (lr3>-10)
+ lyt=pango_cairo_create_layout(cr);
+ pango_layout_set_font_description(lyt, (plot->afont));
+ lr2=(priv->bounds.ymin)+(j*dely*(yl-tf)/(yl-yu));
+ lr1=round(lr2*exp(G_LN10*(plot->ydp)));
+ if (lr2>DZE)
{
- lr1=G_LN10*((priv->ycs)-3);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1+=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1>=1)
+ {
+ lr2=floor(log10(lr1));
+ lr2=log10(lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+2, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+3, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+3, "%f", lr1);
}
- else
+ else if (lr2<NZE)
{
- lr1=G_LN10*((priv->ycs)-floor(log10(-lr3))-2);
- lr2=lr3*exp(lr1);
- lr1=(--lr2)*exp(-lr1);
+ lr1-=0.1;
+ lr1*=exp(-G_LN10*(plot->ydp));
+ if (lr1<=-1)
+ {
+ lr2=log10(-lr1);
+ if (fmod(lr2,1)<NAC) lr3=(guint)lr2;
+ else lr3=(guint)ceil(lr2);
+ if ((plot->ydp)==0) g_snprintf(lbl, lr3+3, "%f", lr1);
+ else g_snprintf(lbl, (plot->ydp)+lr3+4, "%f", lr1);
+ }
+ else g_snprintf(lbl, (plot->ydp)+4, "%f", lr1);
}
- lyt=pango_cairo_create_layout(cr);
- pango_layout_set_font_description(lyt, (plot->afont));
- g_snprintf(lbl, (priv->ycs), "%f", lr1);
+ else g_snprintf(lbl, 2, "%f", 0.0);
pango_layout_set_text(lyt, lbl, -1);
pango_layout_get_pixel_size(lyt, &wd, &hg);