help-octave
[Top][All Lists]
Advanced

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

Re: Text on plots


From: dmelliott
Subject: Re: Text on plots
Date: Fri, 6 Feb 2009 16:20:40 -0800 (PST)



Ben Abbott wrote:
> 
> 
> On Wednesday, January 28, 2009, at 08:15AM, "dmelliott"
> <address@hidden> wrote:
>>
>>  ----- Original Message ----- 
>>  From: Ben Abbott 
>>  To: dmelliott 
>>  Cc: GNU Octave ; address@hidden 
>>  Sent: Tuesday, January 27, 2009 9:33 AM
>>  Subject: Re: Text on plots
>>
>>
>>  On Tuesday, January 27, 2009, at 10:10AM, "dmelliott"
>> <address@hidden> wrote:
>>  >
>>  >  ----- Original Message ----- 
>>  >  From: Ben Abbott 
>>  >  To: dmelliott 
>>  >  Cc: GNU Octave 
>>  >  Sent: Monday, January 26, 2009 7:52 AM
>>  >  Subject: Re: Text on plots
>>  >
>>  >
>>  >On Monday, January 26, 2009, at 08:14AM, "dmelliott"
>> <address@hidden> wrote:
>>  >
>>  >>  ----- Original Message ----- 
>>  >>  From: Ben Abbott 
>>  >>  To: dmelliott 
>>  >>  Cc: address@hidden 
>>  >>  Sent: Sunday, January 25, 2009 2:49 PM
>>  >>  Subject: Re: Text on plots
>>  >>
>>  >>  On Jan 25, 2009, at 1:26 PM, dmelliott wrote:
>>  >>
>>  >>  >
>>  >>  > Dear Help,
>>  >>  >
>>  >>  >     When I copy the example in the "octave help" at the beginning
>> of  
>>  >>  > section 15.1.3 Plot Annotations into an m-file and try to run it,  
>>  >>  > absolutely no text appears on the graph other than the axis
>> numbering.
>>  >>  >     I have tried the methods that I used, successfully, in Matlab,  
>>  >>  > and they do not work either.  How can I make a graph title and
>> axis  
>>  >>  > labels on a figure generated with "plot"?
>>  >>  >     I am using the handle graphics.
>>  >>  >
>>  >>  >
>>  >>  >                                                                       
>>               
>> More 
>>  >>  >  than a bit frustrated,
>>  >>  >
>>  >>  >                                                                       
>>                              
>> Douglas 
>>  >>  >  M Elliott
>>  >>
>>  >>  I assume you are trying something like what is below?
>>  >>
>>  >>  set (get (gca, 'xlabel'), 'string', 'some xlabel'))
>>  >>
>>  >>  Depending upon the version of octave you are running that may not
>> work.
>>  >>
>>  >>  It does work for me (Octave 3.0.3). What version of Octave are your  
>>  >>  running?
>>  >>
>>  >>  If you are running an older version, you can update your octave or  
>>  >>  take the advice offered by Bill and Ivan.
>>  >>
>>  >>  Ben
>>  >>
>>  >>
>>  >>Dear Mr. Abbott,
>>  >>
>>  >>    Thank you for your very speedy reply.
>>  >>
>>  >>    The way you suggest makes perfect sense to me, having used Matlab
>> for years.  However, I can not get it to work.  If I could ask a small
>> favor of you, it would be greatly appreciated.
>>  >>
>>  >>    Could you rewrite and test the example from the directions:
>>  >>
>>  >>
>>  >>                                    x=-10:0.1:10;
>>  >>                                    plot(x,sin(x));
>>  >>                                    title("sin(x)  for 
>> x=-10:0.1:10");
>>  >>                                    xlabel("x");
>>  >>                                    ylabel("sin(x)");
>>  >>                                    text(pi,0.7,"arbitrary text");
>>  >>                                    legend("sin(x)");
>>  >>
>>  >>
>>  >>and send the working code back.  If I had something that I know should
>> work, then I might be able to proceed.
>>  >>
>>  >>    I have tried every combination of things that I can think of, with
>> no success.  I uninstalled V3.0.3, download it again, and installed it
>> only to have exactly the same results.  The OS is XP.  When installing,
>> every possible option was chosen.
>>  >>
>>  >>    There are several things that are working just fine such as line, 
>> toolbar, numbertitle, figure name and position, axes tics, grid, and
>> number formatting, etc.  Everything but the text.
>>  >>
>>  >>
>>  >>                                                                          
>>        
>> Thanking you in advance,
>>  >>
>>  >>                                                                          
>>                    
>> Douglas M. Elliott
>>  >
>>  >
>>  >Your code works perfectly for me. I have no experience with octave on
>> XP. In the event someone else can help, I've cc'd the help list again (we
>> dropped of at some point).
>>  >
>>  >It may be that octave is working properly and that the trouble is with
>> gnuplot. Please try to determine what version of gnuplot you have
>> installed, and were you got it from. It may also be useful to know where
>> you obtained Octave from.
>>  >
>>  >Regarding gnuplot, we can take a look at the information being sent
>> from octave to gnuplot. That should help us determine where your problem
>> lies. You can save the gnuplot stream by typing the following after the
>> plot commands have been executed.
>>  >
>>  >        drawnow ("windows", "/dev/null", true, "windows.gp")
>>  >
>>  >Please attach the result to your next reply and I'll look it over.
>>  >
>>  >Ben
>>  >
>>  >p.s. please respond at the bottom so that others who join the
>> discussion have an easier time following along. Thanks.
>>  >
>>  >
>>  >___________________________________
>>  >
>>  >
>>  >Dear Mr. Abbott,
>>  >
>>  >    Whatever it is that I have, I got from:
>>  >
>>  >       
>> http://sourceforge.net/project/showfiles.php?group_id=2888&package_id=40078
>>  >
>>  >selecting V3.0.3.
>>  >
>>  >
>>  >    As to the gnuplot version, using the function given in the included
>> docs:
>>  >
>>  >        version=__gnuplot_version__()
>>  >
>>  >version 4.3 is reported.  This strikes me as odd since SourceForge's
>> latest is 4.2.4.  The executables themselves were, for some reason,
>> written without a "properties" section, so I can not tell from that.
>>  >
>>  >
>>  >    Alternatively, it could be in the mfiles.  I was advised earlier,
>> for a related problem, to try:
>>  >
>>  >        pkg load jhandles
>>  >        help uicontrol
>>  >
>>  >by Mr. Goffioul, and got an error message saying that uicontrol was not
>> documented.  I get any number of "not there's" when I try to set
>> properties that the directions say I should be able to, so it could be in
>> the mfile interfaces.
>>  >
>>  >
>>  >    I note that there is a caution for the 4.2 versions at SourceForge:
>>  >
>>  >"- Octave has recently changed its method of sending data to gnuplot
>> for  plotting; data is passed in-line through the pipe to gnuplot's
>> stdin.   Unfortunately, the current Gnuplot 4.2 code does not support
>> mouse interaction with in-line data. This problem is fixed in the CVS
>> version, but not in the current release version 4.2.4."
>>  >
>>  >Now if I knew where the CVS version was, I might be able to download
>> it.
>>  >
>>  >
>>  >    I tried your suggestion:
>>  >
>>  >            drawnow ("windows","/dev/null",true,"windows.gp")
>>  >
>>  >thank you, and got:
>>  >
>>  >        error: unsupported output format: windows
>>
>>  ok, as I don't have a windows box, it is likely I got that wrong. Try
>>
>>          drawnow ("x11", "/dev/null", true, "x11.gp")
>>
>>  You will get some errors, but the x11.gp file should be written to the
>> current directory.
>>
>>  >This makes sense given the function file content:
>>  >
>>  >        function drawnow (term, file, mono, debugfile)
>>  >
>>  >        h = get(0, 'currentfigure');
>>  >        if (! isempty (h) && h != 0 && ishandle (h))
>>  >          fig = __get_object__ (h);
>>  >          if (nargin == 0)
>>  >            fig.redraw ();
>>  >          elseif (nargin >= 2)
>>  >            elt = cellstr (split (term, " "));
>>  >            switch elt{1}
>>  >            case {"png", "postscript"}
>>  >              fig.print (elt{1}, file);
>>  >            otherwise
>>  >              error ("unsupported output format: %s", term);
>>  >            endswitch
>>  >          endif
>>  >        endif
>>  >
>>  >        endfunction
>>
>>  hmmm ... that is definitely not the correct file. I'd guess you had an
>> earlier octave install and your present installation is pointed at its
>> path.
>>
>>  What do you get when you type the following
>>
>>      path
>>
>>  In any event, try typing the following lines ...
>>
>>      path (pathdef);
>>      savepath;
>>
>>  ... and then try some more plots. Hopefully, that will fix your problem.
>>
>>  Ben
>>____________________________________________________________________________________
>>
>>
>>Dear Mr. Abbott,
>>
>>    I forgot that you are using a different installation then mine.  The
>> "drawmow" that jhandles uses is the above.  There is another "drawnow",
>> which I suspect is the one you thought would be used.  The above is in:
>>
>>        "X:\Octave\share\octave\packages\jhandles-0.3.4"
>>
>>whereas the one I think you wanted is in:
>>
>>        "X:\Octave\share\octave\3.0.3\m\plot"
> 
> ok, I missed that you were using jhandles. Jhandles doesn't install on my
> Mac, so I won't be any help with that.
> 
>>Since I was using jhandles, the copied one is the one in the jhandles
path.  There are any number of similar files for both, since graphics is
graphics.
>>
>>    I decided to try the other graphics, so I uninstalled and reinstalled
>> Octave using the second copy obtained from the above source, and chose
>> gnuplot as the default.  Then I again tried the sample in the
>> instructions just after the start of section 15.1.3.  This yielded:
>>
>>>>(pgnuplot.exe:1572): Pango-WARNING **: couldn't load font "Helvetica
Not-Rotated 200", falling back to "Sans Not-Rotated 200", expect ugly
output.<<
>>
>>Apparently, there is some corruption in the plotting font file!  If both
graphics use the same font source, and the handle stuff is less mature, thus
having a bit weaker error trapping, this might be why no text appeared in
the handle graph, and there was no warning.
> 
> This sort of error isn't that unusual. Was a plot produced?
> 
> You can suppress the warning by setting the default axes font to something
> your system supports. Apparently you don't have a Helvetica font available
> (is that normal gnuplot on Windows ?). Try the command below before
> plotting (it looks like you have "Sans" available, but I'm only guessing
> what a proper fontname would be).
> 
>     set (0,"defaultaxesfontname", "Sans")
> 
> Ben
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Text-on-plots-tp21654908p21883449.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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