Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

draw contour plot without number labels?

596 views
Skip to first unread message

Wei-Chih Liu

unread,
May 14, 1999, 3:00:00 AM5/14/99
to
Dear Scilab guru:

I am try to use Scilab to draw contour plots of some complex
patterns. However, there are always number (or captions) with contour
lines to label the values of contour lines. When the pattern is complex,
these number labels are so close and I can't make use of them.

How could I get rid of these number labels?


Thanks!


Sincerely,

Wei-Chih Liu

Lydia van Dijk

unread,
May 17, 1999, 3:00:00 AM5/17/99
to
In article
<Pine.LNX.3.96URPAS-R.99...@alfalfa.pas.rochester.edu>,


Currently, I don't see a possibility to switch off the labeling of the
contour-lines from within the interpreter. Maybe, one of the true
Scilab gurus knows...

Following the call to contour(), I reached the function
ContourTrace(double Cont, integer style)
in file $SCI/routines/graphics/Contour.c. It is responsible for the
plotting of the level-labels. If you definitely want to use Scilab
for your output, and do not want to spawn an external like PlotMTV or
GnuPlot, you can apply the following patch to your Scilab-2.4.1:


--- routines/graphics/Contour.c 1999/05/16 16:20:03 1.1
+++ routines/graphics/Contour.c 1999/05/16 16:48:14
@@ -907,15 +907,18 @@
integer style;
{
char *F;
+ const integer mod = 100; /* inserted by lvd, Sun May 16 16:30:59 UTC
1999 */
+ integer s2 = style % mod;
integer verbose=0 ,Dnarg,Dvalue[10];
integer close=0, flag=0;
double angle=0.0;
char str[100];

C2F(dr)("xget","dashes",&verbose,Dvalue,&Dnarg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
/* Just the lines **/
-
C2F(dr)("xset","dashes",&style,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
+
C2F(dr)("xset","dashes",&s2,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);

C2F(dr)("xlines","void",&cont_size,xcont,ycont,&close,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);

C2F(dr)("xset","dashes",Dvalue,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
+ if (abs(style) > mod) return;
F=getFPF();
if ( F[0] == '\0')
sprintf(str,ContNumFormat,ContNumPrec,Cont);


Admittedly, it is nothing but a dirty hack, but it allows you to stick
with Scilab. Now, if the magnitude of the plot-style is larger than
100, then the plotting of the contour-labels is switched off. I have
tested the patch only briefly. It does not seem to have a major
advert effect on the workings of the f?contour(2d)?-functions. So, to
summarize, we have the following behavior:

style result
======== ========
1: 99 colored contour lines with labels
-1: -99 black contour lines with labels
100: ... colored contour lines without labels
-100: ... black contour lines without labels

Hope this helps! Of course, this problem should be solved in
a cleaner way in a future Scilab version.


Lydia van Dijk


PS: I'm not a guru :)


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---

Enrico Segre

unread,
May 17, 1999, 3:00:00 AM5/17/99
to
Funnily, it's trivial, but I also kept being puzzled and looking for a way until someone posted on the group some time ago. The trick is:

xset("fpf"," ")

note the second string is " " and not "". Maybe dr. Scilab would better put it into the faq...
 
 

pyun...@gmail.com

unread,
May 18, 2013, 12:15:29 AM5/18/13
to
понедельник, 17 мая 1999 г., 11:00:00 UTC+4 пользователь Enrico Segre написал:
Thank you very much! It's cool options!
0 new messages