Ronald Michaels |
Hi -
New member Ron here. I like the new graphics package; however, I am having a little trouble understanding how it works. Using Scilab v.5.1.1 on 64 bit Linux I wish to make a histogram using the hist3d() function. I would like the y axis to run from 0 to 36 with subdivisions of 6 units. Below is some code that takes me most of the way, but it involves a redefinition of data_bounds that results in subdivisions of 6 units. I would appreciate having someone show me the correct way to get y axis subdivisions of 6 units and to end the y axis at 36. // start Scilab code clear shape = rand(14,36); size(shape) shape_rev = [shape(:,19:36) shape(:,1:18)]; hist3d(shape_rev); a=get("current_axes"); a.data_bounds=[0,0,0;14,30,10]; // x,y,x;x,y,z set y to 0 - 30 a.y_ticks.locations=[0;6;12;18;24;30;36]; // works set to 30 a.y_ticks.labels=["-90";"-60";"30";"0";"30";"60";"90"];// works a.data_bounds=[0,0,0;14,36,10]; // reset y to 0 - 36 a.rotation_angles=[40,30]; // end Scilab code Thanks Ron |
Mathieu Dubois |
Hello Ron,
I took some time to investigate your problem. Would you tell us if the following code solves your problem? // start Scilab code clear shape = rand(14,36); [m, n] = size(shape); shape_rev = [shape(:,19:36) shape(:,1:18)]; hist3d(shape_rev); a=get("current_axes"); a.auto_ticks(2)="off"; // Disable auto-ticks on y axis - not mandatory a.y_ticks = tlist(["ticks", "locations", "labels"], 0:6:36, string(0:6:36)); // Set the ticks we want for y axis a.sub_ticks(2)=0; // Disable sub-ticks for y axis a.rotation_angles=[40,30]; // end Scilab code It's just a modification of your code. You can see that it uses the y_ticks member of the axis properties. This member is a tlist (typed list). I have to admit that I don't master this completely but I have found examples on the internet. The basic idea is that you specify the number of ticks, their position and the associated label (text) in one object. Maybe there are more convenient functions to do that. Alternatively you can simply plot the histogram and use the figure property editor to manually set the ticks... Hope that helps, Mathieu P.S.: I use scilab 4 at home because my video driver under Linux doesn't support scilab 5 but I think the graphic API is more or less the same. > Hi - > > New member Ron here. I like the new graphics package; however, I am > having a little trouble understanding how it works. > > Using Scilab v.5.1.1 on 64 bit Linux > > I wish to make a histogram using the hist3d() function. I would like > the y axis to run from 0 to 36 with subdivisions of 6 units. Below is > some code that takes me most of the way, but it involves a redefinition > of data_bounds that results in subdivisions of 6 units. > > I would appreciate having someone show me the correct way to get y axis > subdivisions of 6 units and to end the y axis at 36. > > // start Scilab code > > clear > shape = rand(14,36); > size(shape) > shape_rev = [shape(:,19:36) shape(:,1:18)]; > hist3d(shape_rev); > a=get("current_axes"); > a.data_bounds=[0,0,0;14,30,10]; // x,y,x;x,y,z set y to 0 - 30 > a.y_ticks.locations=[0;6;12;18;24;30;36]; // works set to 30 > a.y_ticks.labels=["-90";"-60";"30";"0";"30";"60";"90"];// works > a.data_bounds=[0,0,0;14,36,10]; // reset y to 0 - 36 > a.rotation_angles=[40,30]; > > // end Scilab code > > Thanks > > Ron > > > test_hist3D.sce (632 bytes) Download Attachment |
Free forum by Nabble | Edit this page |