# Re: [Scilab-users] Fwd: plotxxyyy

```Hello Frieder,
```
Your plots look better now. You can avoid overlapping of measurement numbers by sawtooth stacking them. See example code below.

```
xdel();
//Generating dummy measurements x,y
dx=0.5:50;
x=cumsum(dx);
y=sind(x);
nM=length(x);//number of measurements
plot(x,y,'r')
plot(x,y,'b+')
//Plotting the measurement numbers in stacks to avoid overlapping
nstack=6;//number of stacked measurement numbers
hstack=0.2;//height of measurement number stack (relative to window height)
ybase=-0.9;  //base ordinate for measurement numbers
yspan=max(y)-min(y);
for  m=1:nM//measurement number
xstring(x(m),ybase+(modulo(m,nstack)-1)*hstack*yspan/nstack,string(m))
end

Kind regards
Jens
------------------------------------------------------------------------------------------------------------------------------
Am 12.10.2016 10:52, schrieb Frieder Nikolaisen:
```
```
Hello,

thank you for all the feedback and help. It's really great.

```
I used the idea of Jens Simon Strom combined with some help from last week:
```
//Datensätze
x1  =  (A(:,1)  -  A(1,1))  *  24  *  3600;
y1  =  A(:,y_1);
y2  =  A(:,y_2);
y3  =  A(:,y_3);
drawlater()

subplot(3,  1,  1)
```
co = color("green"); plot2d(x1, y1, co);
```a  =  gca();
```
b.font_color = co; a.foreground = co;
```ylabel(string(kT(y_1)),"color",co)
a.x_location  =  'top';

subplot(3,  1,  2)
```
co = color("blue"); plot2d(x1, y2, co);
```b  =  gca();
```
b.font_color = co; b.foreground = co;
```ylabel(string(kT(y_2)),"color",co)
```
b.axes_visible(1) = "off"; //b.marings = [0.1 0.1 0.3 0.5];
```//b.filled ="off";
subplot(3,  1,  3)
co=color("red");
```
plot2d(x1, y3, co); c = gca(); c.font_color = co; c.foreground = co; //c.axes_visible(1) ="off";
```ylabel(string(kT(y_3)),"color",co)
//xlabel(string('Zeit [Sekunden]'), co)
x=  (A(:,1)  -  A(1,1))  *  24  *  3600;
for  k=1:A_size(1,1)   //Beschriftung
xstring(x(k),x(1),string(k))         // x(1) always 0
// xstring(x,y,str,[angle,[box]])
disp(x(1))
end
//c.marings = [0.1 0.1 0.5 0.3];
//c.filled ="off";

drawnow()
```
The printed plots are attached. I did plot different paramters, as I can choose then in my GUI.
```That works well:

* Three plots, having the same x axis.
* x axis on the top and bottom
* Line *numbers Fitting the x axis*.

That does not work:

* showing a *few line numbers* only, for reading (best case: Fitting
the automatic shown times in sec

```
Problem: I cannot tell, how many datapoints there are going to be. So it mus be choosen automaticly.
```
Best regards

Frieder

On 2016-10-11 21:04, Samuel Gougeon wrote:

```
```Hello,

Le 11/10/2016 14:46, Rafael Guerra a écrit :
```
```
Hi,

I was not able to follow the whole discussion

```
```Neither did i,
```
```
```
but concerning your subplot challenge: "/... I cannot add a second x-axis in a subplot by newaxis(). How to add a x-axis by using subplot?/"and your last example,
```
```
Couldn't you add a 4^th subplot at the bottom in order to plot the 2^nd x-axis (say by plotting only zeros)?
```
```
```.
```
Why not using drawaxis() as already suggested? drawaxis() is made for this kind of situation. In this thread, no logarithmic axis is involved. So i do to catch the reason of ignoring drawaxis().
```
```
By the way, IMO, a drawing of what exactly is required would be clearer than hundred of lines of description, with schematic curves, axes, arrows linking curves to their multiple axes in x and y.
```
BR
Samuel Gougeon

```
```

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
```
```
```
```_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
```