[Scilab-users] Colorbar_same color code, different graphs

Mike Page Mike at Page-One.Waitrose.com
Mon Jul 22 18:21:56 CEST 2013


Hi Larissa,

Sorry, but I don't know how to do what you want.  As far as I know, when you assign a colormap to a figure, the colors span across the range of the data (so zmax = red and zmin = blue for example).  I think you want them to span across the data bounds of the figure, but I don't know how to do that.

The idea I mentioned before will produce a colorbar that spans the right set of colors and has the right legend, but I don't know how to get the colors on the figure right.  I'm sure it can be done some way, but I don't know how.  Perhaps you could add an artificial point to your data to make it span the full range?

Mike.

  -----Original Message-----
  From: users-bounces at lists.scilab.org [mailto:users-bounces at lists.scilab.org]On Behalf Of Larissa Schultze
  Sent: 22 July 2013 13:24
  To: Mike.PageOne at Googlemail.com
  Cc: International users mailing list for Scilab.
  Subject: [Scilab-users] Colorbar_same color code, different graphs


  Hi everybody,

  thank you a lot for your reply, Mike.
  The suggestion sounds really good, but I couldn't make it work yet, unfortunately.
  So again, for the table:

  Nan     0.     20.     60.     100.    140.    180.    200.  
      0.      Nan    0.      Nan     Nan     Nan     Nan     Nan   
      5.      Nan    68.     73.     61.     63.     67.     Nan   
      40.     Nan    17.     9.      10.     12.     17.     Nan   
      75.     Nan    14.     7.      6.      6.      12.     Nan   
      110.    Nan    15.     6.      4.      6.      21.     Nan   
      145.    Nan    21.     28.     26.     20.     34.     Nan   
      150.    Nan    Nan     Nan     Nan     Nan     Nan     Nan 


  I used the following commands:

  "
  [fd,SST,Sheetnames,Sheetpos] = xls_open('E:\XXXXXX.xls')
  Sheets = readxls('E:\XXXXXXX.xls');
  typeof(Sheets);
  s1=Sheets(1);
  data=s1.value;
  x=data(1,2:8);
  y=data(2:8,1);
  z=data(2:8,2:8);
  xx = linspace(0,200,200);
  yy = linspace(0,150,200);
  [xp,yp] = ndgrid(xx,yy);
  zp = linear_interpn(xp,yp, x, y, z);
  clf();
  surf(xx,yy,zp);
  f=get("current_figure");
  f.color_map=jetcolormap(512);
  h=get("hdl") //get handle on current entity (here the surface)
  h.color_flag=1;
  a=gca();
  a.auto_scale="off";
  a.tight_limits="on";
  a.data_bounds=[0,0,0;200,150,1300]
  colorbar(0,1300);
  "

  Still, the colors in the figure do not correspond to those of the colorbar. I mean, according to the colorbar, this dataset should have basically different dark blue tones...and that is what I am aiming at. ...but...how can I possibly make it work? Can anybody help me please?
  It would be great!!!!

  thank you in advance and kind regards,
  Larissa







  Gesendet: Dienstag, 16. Juli 2013 um 11:09 Uhr
  Von: "Mike Page" <Mike at Page-One.Waitrose.com>
  An: "International users mailing list for Scilab." <users at lists.scilab.org>
  Betreff: Re: [Scilab-users] Colorbar_same color code, different graphs
  Hi Larissa,

  I'm no expert on this, but have you tried changing the data_bounds for the figure's children independently?  I think if you just set the colorbar limits with colorbar(a,b), that only changes the legend on the bar itself.

  Try f=gcf(); then look at f.children(1),data_bounds or f.children(2).data_bounds.  I think one will be for the plot and the other for the colorbar.  If you change these limits directly you may get the effect you are looking for.

  Sorry if I misunderstood your question.

  Mike.

    -----Original Message-----
    From: users-bounces at lists.scilab.org [mailto:users-bounces at lists.scilab.org]On Behalf Of Larissa Schultze
    Sent: 16 July 2013 08:48
    To: International users mailing list for Scilab.
    Subject: Re: [Scilab-users] Colorbar_same color code, different graphs
     
    Hello everyone, 

    I have to plot several graphs with measurements ranging from 6 to 1300. I would like that these graphs obey the same color code, so that, in the example of jetcolormap, "1300" would always be dark red and "0" would always be dark blue for each graph. Now the values that I have for the different graphs are quite diverse: graph 1 has values ranging between "6" and "68" whereas graph 6 has values between "600" and "1300".

    How can I manage that the colorbar and the colorcode for both these graphs remains the same? (in this case, graph 1 would presumably have only a gradient of dark blue colors and graph 6 would have rather orange to red colors)
    I tried changing the command of colorbar to "colorbar(0,1300)", but it didn't work at all...so I thought may be someone could give me a hint on how I would be able to align the color code these graphs...

    I put an example of my tables on the annex as well as the scilab commands that I have been using for that. I simply need the values of both tables to be registered according to one color code (1300=dark red, 6=dark blue)...I would appreciate it a lot if someone could help me. :) 

    Thank you guys in advance!!!!
    Larissa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130722/468e498d/attachment.htm>


More information about the users mailing list