[LON-CAPA-users] gnuplot labels
Stuart Peter Raeburn
lon-capa-users@mail.lon-capa.org
Fri, 02 Sep 2005 15:08:49 -0400
Jay,
Looks like you need to add
<key pos="bottom left" title="" box="off" />
to cause it to display the legend. (See second example in
http://help.loncapa.org/fom/cache/150.html). I copied your xml code, added
this line, and it worked on the VCU server (loncapa 2.0 on RHEL). Complete
xml code will be in a separate direct e-mail.
As regards location variables for the plot: note the x and y coordinates you
use correspond to coordinates in the plot itself.
So adding:
<label justify="center" xpos="2" ypos="4">Plot label for VCU</label>
to this plot added a label which appeared at the appropriate location (as
the xpos and ypos values both fell within the range defined by the x and y
axes).
Stuart
Stuart Raeburn
MSU LON-CAPA development/support
James Sullivan writes:
> 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):
>
>
> [snip]
> <problem>
> <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);
> }
> </script>
> <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"
> color="x000000">
> <data>@X</data>
> <data>@Y</data>
> </curve>
> </gnuplot>
> <startouttext/><br/>
> What is the amplitude of this function?
> <endouttext/>
> <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"/>
> </numericalresponse>
> </problem>
> [end]
>
>
> 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.....
>
> Jay
>
>
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>