[LON-CAPA-users] gnuplot labels

James Sullivan lon-capa-users@mail.lon-capa.org
Fri, 2 Sep 2005 12:23:59 -0400

Hi Stuart,

Thanks for your email. I just tried what you suggested, but to no avail.
Here is the problem xml code (after removing all the superfluous spaces):

<script type="loncapa/perl">
$amplitude = &random(3,5,1);
for ($x=-6.0; $x<=6.0; $x+=0.05) {
     push @X,$x;
     push @Y, $amplitude * sin($x);
<gnuplot font="medium" width="400" grid="on" height="300" border="on"
fgcolor="x000000" alttag="dynamically generated plot" align="center"
bgcolor="xffffff" transparent="off">
     <axis ymin="-6.0" ymax="6.0" xmin="-5.0" xmax="5.0" color="x000000"/> 
     <curve linestyle="lines" pointtype="1" pointsize="1" name="test"
What is the amplitude of this function?
<numericalresponse answer="$amplitude">
<responseparam type="tolerance" default="5%" name="tol"
description="Numerical Tolerance"/>
<responseparam name="sig" type="int_range,0-16" default="0,15"
description="Significant Figures"/>

I don't see any label on my plot. I expected to see "test" as the legend for
the plot. On a related note, when I try to use the <label> tag to explicitly
put a label in the plot, I cannot place it anywhere other than (0,0). I have
tried setting the "location" variables x and y but they have no effect.
Could you explicitly paste your code in an email and send it to me directly?
Maybe I am just doing something silly..........

This is loncapa 2.0 on RHEL.

Thanks for your help, and your patience with all my questions.....


> James,
> I tried the example from http://help.loncapa.org/fom/cache/150.html in my
> author account (created when I first installed LON-CAPA in January) on the
> VCU library server.  I included a name attribute in the curve tag, and it
> was displayed in the legend correctly, in both web brwoser and in PDF
> printout.
> It may be that an extra space before the closing > in one or more XML tags
> are causing the problems in your case.   In order to get the FAQ-o-matic
> to
> display LON-CAPA problem XML code in a readable form, an extra space
> typically was added before the ending > in a tag.  After pasting example
> code from FAQ-o-matic pages into the LON-CAPA XML editor I always begin by
> removing these spaces to avoid potential rendering problems.
> Stuart Raeburn
> MSU LON-CAPA development/support
> James Sullivan writes:
> > Loncapers,
> >
> >
> >
> > Not sure if this is a loncapa, gnuplot, or OS issue. I am trying to use
> the
> > "name" field in a <gnuplot> to get a label (basically a legend for the
> > plot).
> >
> > No longer seems to work. I am trying the example from
> >
> >
> >
> > http://help.loncapa.org/cgi-bin/fom?_highlightWords=gnuplot
> > <http://help.loncapa.org/cgi-bin/fom?_highlightWords=gnuplot&file=150>
> > &file=150
> >
> >
> >
> > Help please.
> >
> >
> >
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users