help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slow carpet plots (octave 2.9.12 CVS/gnuplot)


From: A. Scottedward Hodel
Subject: Re: Slow carpet plots (octave 2.9.12 CVS/gnuplot)
Date: Thu, 14 Jun 2007 12:57:25 -0500

Thanks!  I'll try that patch ASAP.

Here's another carpet plot example that causes trouble:  m-file carpetExample.m:
tt = linspace(0,0.5,200);
omega = linspace(-1,1,250);
xx = sin((tt')*omega);
figure(1, 'visible', 'off')
xlabel('hi there');
plot(tt,xx,'-',);
xlabel('time');
ylabel('sinusoids');
grid on
set ( gcf, 'visible', 'on');

The first time the above m-file is run, there is a stream of errors from gnuplot.  However, the second time the script is run the plot appears correctly on the screen.  Is  this a gnuplot issue, or an octave-gnuplot interface issue?  (Or is  this an octave on Mac issue?)

octave:1> carpetExample

gnuplot> plot "-" using ($1):($2) title "" with lines linestyle 1 , "-" using ($1):($2) title "" with lines linestyle 2 , "-" using ($1):($2) title "" with lines linestyle 3 , "-" using ($1):($2) title "" with lines linestyle 4 , "-" using ($1):($2) title "" with lines linestyle 5 , "-" using ($1):($2) title "" with lines linestyle 6 , "-" using ($1):($2) title "" with lines linestyle 7 , "-" using ($1):($2) title "" with lines linestyle 8 , "-" using ($1):($2) title "" with lines linestyle 9 , "-" using ($1):($2) title "" with lines linestyle 10 , "-" using ($1):($2) title "" with lines linestyle 11 , "-" using ($1):($2) title "" with lines linestyle 12 , "-" using ($1):($2) title
[snip]
using ($1):($2) title "" with lines linestyle 245 , "-" using ($1):($2) title "" with lines linestyle 246 , "-" using ($1):($2) title "" with lines linestyle 247 , "-" using ($1):($2) title "" with lines linestyle 248 , "-" using ($1):($2) title "" with lines linestyle 249 , "-" using ($1):($2) title "" with lines linestyle 250 ;
                                                                                                                                                                                                                                                                  
                                      ^
         line 0: invalid complex constant


gnuplot> 0 0
         ^
         line 0: invalid command


gnuplot> 0.00251256 -0.00251256
         ^
         line 0: invalid command


gnuplot> 0.00502513 -0.0050251
         ^
         line 0: invalid command



On Jun 14, 2007, at 11:33 AM, John W. Eaton wrote:

On 14-Jun-2007, A. Scottedward Hodel wrote:

| I just noticed that I didn't put a subject line on my last note.
| Add to the mix the following sample error message:
| text(3,txty,'3: 0.75s','Rotation',90);
| warning: set: invalid property `Rotation'
| The text command above worked with octave 2.1.7x, but fails with the  
| current CVS.  I can't find a list of valid properties for the text  
| command, so I'm kind of stumped.

The graphics system has been completely rewritten.  The new text
function works in a completely different way from the old one, and not
all graphics properties have been implemented yet.  In any case,
please try the following patch which should fix the problem with the
rotation property for text objects.

Note for everyone:  this patch also shows how it is relatively easy to
handle new properties.  Interested parties should not wait for me or
other active Octave maintainers to implement all the properties.  We
will probably only add those that we care about.  If you would like to
help out, then please submit some patches.  It is probably best to
submit patches that add just one property at a time, or at most a few
related properties.

jwe

scripts/ChangeLog:

2007-06-14  John W. Eaton  <address@hidden>

* plot/__go_draw_axes__.m: Handle text rotation property.


src/ChangeLog:

2007-06-14  John W. Eaton  <address@hidden>

* graphics.h (text::text_properties::rotation): New data member.
* graphics.cc (text::text_properties::text_properties, 
text::text_properties::set, text::text_properties::get, 
text::text_properties::factory_defaults): Handle rotation property.


Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.19
diff -u -u -r1.19 __go_draw_axes__.m
--- scripts/plot/__go_draw_axes__.m 9 May 2007 16:46:50 -0000 1.19
+++ scripts/plot/__go_draw_axes__.m 14 Jun 2007 16:23:59 -0000
@@ -525,14 +525,17 @@
    lpos = obj.position;
    label = obj.string;
    halign = obj.horizontalalignment;
+   angle = obj.rotation;
    if (nd == 3)
-     fprintf (plot_stream, "set label \"%s\" at %g,%g,%g %s;\n",
+     fprintf (plot_stream,
+     "set label \"%s\" at %g,%g,%g %s rotate by %f;\n",
      undo_string_escapes (label),
-     lpos(1), lpos(2), lpos(3), halign);
+     lpos(1), lpos(2), lpos(3), halign, angle);
    else
-     fprintf (plot_stream, "set label \"%s\" at %g,%g %s;\n",
+     fprintf (plot_stream,
+     "set label \"%s\" at %g,%g %s rotate by %f;\n",
      undo_string_escapes (label),
-     lpos(1), lpos(2), halign);
+     lpos(1), lpos(2), halign, angle);
    endif

  otherwise
Index: src/graphics.cc
===================================================================
RCS file: /cvs/octave/src/graphics.cc,v
retrieving revision 1.16
diff -u -u -r1.16 graphics.cc
--- src/graphics.cc 13 Jun 2007 05:42:25 -0000 1.16
+++ src/graphics.cc 14 Jun 2007 16:24:02 -0000
@@ -1706,6 +1706,7 @@
     string (""),
     units ("data"),
     position (Matrix (1, 3, 0.0)),
+    rotation (0),
     horizontalalignment ("left")
 { }

@@ -1729,6 +1730,8 @@
     units = val;
   else if (name.compare ("position"))
     position = val;
+  else if (name.compare ("rotation"))
+    rotation = val;
   else if (name.compare ("horizontalalignment"))
     horizontalalignment = val;
   else
@@ -1753,6 +1756,7 @@
   m.assign ("string", string);
   m.assign ("units", units);
   m.assign ("position", position);
+  m.assign ("rotation", rotation);
   m.assign ("horizontalalignment", horizontalalignment);

   return m;
@@ -1777,6 +1781,8 @@
     retval = units;
   else if (name.compare ("position"))
     retval = position;
+  else if (name.compare ("rotation"))
+    retval = rotation;
   else if (name.compare ("horizontalalignment"))
     retval = horizontalalignment;
   else
@@ -1793,6 +1799,7 @@
   m["string"] = "";
   m["units"] = "data";
   m["position"] = Matrix (1, 3, 0.0);
+  m["rotation"] = 0;
   m["horizontalalignment"] = "left";

   return m;
Index: src/graphics.h
===================================================================
RCS file: /cvs/octave/src/graphics.h,v
retrieving revision 1.2
diff -u -u -r1.2 graphics.h
--- src/graphics.h 13 Jun 2007 05:42:25 -0000 1.2
+++ src/graphics.h 14 Jun 2007 16:24:02 -0000
@@ -1426,6 +1426,7 @@
     octave_value string;
     octave_value units;
     octave_value position;
+    octave_value rotation;
     octave_value horizontalalignment;

     static std::string go_name;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]