[Scilab-users] arrows in axis

classic Classic list List threaded Threaded
7 messages Options
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] arrows in axis


Dear all,

Is there any standard way to add an arrow head to axes in a plot?

I have found a function xarrows which allows drawing arrows, so it could be used as a workaround. But what I actually mean is something specific for axes which instead of using a plain line style uses one ended with an arrow head.

Regards,

Federico Miyara

Libre de virus. www.avast.com

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: arrows in axis

Hello Federico,

Le 03/04/2019 à 17:42, Federico Miyara a écrit :

Dear all,

Is there any standard way to add an arrow head to axes in a plot?

I have found a function xarrows which allows drawing arrows, so it could be used as a workaround. But what I actually mean is something specific for axes which instead of using a plain line style uses one ended with an arrow head.

There is no dedicated axes property to do that.

You may use xstring() as below.
Bounds and arrows directions to use to set the arrows positions will depend on the axes orientation (reverse or not) and position (top/bottom | left/right)

Regards
Samuel
clf
plot2d()
ax = gca();
ax.box = "off";
b = ax.data_bounds

xstring(b(1),b(4),"")
set(gce(), "clip_state","off", "text_box_mode","centered", "font_size",4)

xstring(b(2),b(3),"")
set(gce(), "clip_state","off", "text_box_mode","centered", "font_size",4)


Le 03/04/2019 à 17:42, Federico Miyara a écrit :
Dear all, Is there any standard way to add an arrow head to axes in a plot? I have found a function xarrows which allows drawing arrows, so it could be used as a workaround. But what I actually mean is something specific for axes which instead of using a plain line style uses one ended with an arrow head. Regards, Federico Miyara

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

Re: arrows in axis


Thanks, Samuel.

It is an acceptable workaround.

I believe an axes property might be included in future versions, since it is frequent practice in books and papers to use box-like plots for empirical data and arrow axes for generic functions.

Regards,

Federico


On 03/04/2019 17:21, Samuel Gougeon wrote:
Hello Federico,

Le 03/04/2019 à 17:42, Federico Miyara a écrit :

Dear all,

Is there any standard way to add an arrow head to axes in a plot?

I have found a function xarrows which allows drawing arrows, so it could be used as a workaround. But what I actually mean is something specific for axes which instead of using a plain line style uses one ended with an arrow head.

There is no dedicated axes property to do that.

You may use xstring() as below.
Bounds and arrows directions to use to set the arrows positions will depend on the axes orientation (reverse or not) and position (top/bottom | left/right)

Regards
Samuel
clf
plot2d()
ax = gca();
ax.box = "off";
b = ax.data_bounds

xstring(b(1),b(4),"")
set(gce(), "clip_state","off", "text_box_mode","centered", "font_size",4)

xstring(b(2),b(3),"")
set(gce(), "clip_state","off", "text_box_mode","centered", "font_size",4)


Le 03/04/2019 à 17:42, Federico Miyara a écrit :
Dear all, Is there any standard way to add an arrow head to axes in a plot? I have found a function xarrows which allows drawing arrows, so it could be used as a workaround. But what I actually mean is something specific for axes which instead of using a plain line style uses one ended with an arrow head. Regards, Federico Miyara


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


Libre de virus. www.avast.com

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

Re: arrows in axis

In reply to this post by Samuel GOUGEON

Samuel,

Investigating your example, you use the property clip_state and set it to "off", clearly to allow the arrow to go a bit outside the axes. I wondered whythis is necessary, considering that the documentation says the default value is "off". But after running some examples, I find "clipgrf" to be the default. Am I right?

Regards,

Federico

On 03/04/2019 17:21, Samuel Gougeon wrote:
Hello Federico,

Le 03/04/2019 à 17:42, Federico Miyara a écrit :

Dear all,

Is there any standard way to add an arrow head to axes in a plot?

I have found a function xarrows which allows drawing arrows, so it could be used as a workaround. But what I actually mean is something specific for axes which instead of using a plain line style uses one ended with an arrow head.

There is no dedicated axes property to do that.

You may use xstring() as below.
Bounds and arrows directions to use to set the arrows positions will depend on the axes orientation (reverse or not) and position (top/bottom | left/right)

Regards
Samuel
clf
plot2d()
ax = gca();
ax.box = "off";
b = ax.data_bounds

xstring(b(1),b(4),"")
set(gce(), "clip_state","off", "text_box_mode","centered", "font_size",4)

xstring(b(2),b(3),"")
set(gce(), "clip_state","off", "text_box_mode","centered", "font_size",4)


Le 03/04/2019 à 17:42, Federico Miyara a écrit :
Dear all, Is there any standard way to add an arrow head to axes in a plot? I have found a function xarrows which allows drawing arrows, so it could be used as a workaround. But what I actually mean is something specific for axes which instead of using a plain line style uses one ended with an arrow head. Regards, Federico Miyara
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

Libre de virus. www.avast.com

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: arrows in axis

Le 04/04/2019 à 06:03, Federico Miyara a écrit :

Samuel,

Investigating your example, you use the property clip_state and set it to "off", clearly to allow the arrow to go a bit outside the axes. I wondered whythis is necessary, considering that the documentation says the default value is "off".

Where have you read this?

The default value is not documented in the text_properties page:
https://help.scilab.org/docs/6.0.2/en_US/text_properties.html

Regards


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

Re: arrows in axis


Samuel,

Probably my comment was considered as regards text_properties, but it actually was referred to axes_properties

https://help.scilab.org/docs/6.0.2/en_US/axes_properties.html

Close to the end, before the examples, it says:

clip_state:

This field contains the default clip_state property value for all objects. Its value should be :

  1. "off" this means that all objects created after that are not clipped (default value).

  2. "clipgrf" this means that all objects created after that are clipped outside the Axes boundaries.

  3. "on" this means that all objects created after that are clipped outside the rectangle given by property clip_box.

But after any plotting process I get

--> gca().clip_state
 ans  =

 clipgrf

So it seems the default (for axes) is not "off" but "clipgrf", so there is an issue in the documantation.

Regards,

Federico Miyara


On 04/04/2019 12:12, Samuel Gougeon wrote:
Le 04/04/2019 à 06:03, Federico Miyara a écrit :

Samuel,

Investigating your example, you use the property clip_state and set it to "off", clearly to allow the arrow to go a bit outside the axes. I wondered whythis is necessary, considering that the documentation says the default value is "off".

Where have you read this?

The default value is not documented in the text_properties page:
https://help.scilab.org/docs/6.0.2/en_US/text_properties.html

Regards



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


Libre de virus. www.avast.com

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: arrows in axis

Le 05/04/2019 à 03:22, Federico Miyara a écrit :

Samuel,

Probably my comment was considered as regards text_properties, but it actually was referred to axes_properties

https://help.scilab.org/docs/6.0.2/en_US/axes_properties.html

Close to the end, before the examples, it says:

clip_state:

This field contains the default clip_state property value for all objects. Its value should be :

  1. "off" this means that all objects created after that are not clipped (default value).

  2. "clipgrf" this means that all objects created after that are clipped outside the Axes boundaries.

  3. "on" this means that all objects created after that are clipped outside the rectangle given by property clip_box.

But after any plotting process I get

--> gca().clip_state
 ans  =

 clipgrf

So it seems the default (for axes) is not "off" but "clipgrf", so there is an issue in the documantation.

You are right. I will fix the error in the page.
Thanks

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users