[Scilab-users] periodical X-Axis in 2d plot

Tim Wescott tim at wescottdesign.com
Tue May 12 18:46:35 CEST 2015


On Tue, 2015-05-12 at 06:55 +0200, Philipp Mühlmann wrote:
> Dear all,
> 
> for a display I'l like to have the heading at the x-axis and the
> altitude at the y-axis.
> 
> The display will show a cross made of two xpoly lines.
> 
> Both axes will change accordingly to the data input, which results
> that the cross will stay in the midle of the display.
> 
> This means: axes data bounds are changing.
> 
> Now the question:
> 
> Since the heading can be only between 0 and 360°, how is it possible
> to have the x-axis build in such a way, that it shows 270° <---0--> 90
> °, when the heading value is 0?.
> 
> Is it possible to achieve this by using two x-axes?
> 
> The same would be if one reaches values heading >270°...then from the
> right side 0° and later on 45° as a tick should slide into the display
> instead of 360° and 405°.

This is probably a horrible and non-portable way to do it, but here's
the results for a graph I happened to have up:

--> g = scf(0);

-->g.children
 ans  =
 
Handle of type "Axes" with properties:
======================================
parent: Figure
children: "Compound"
 
visible = "on"
axes_visible = ["on","on","on"]
axes_reverse = ["off","off","off"]
grid = [2,2]
grid_position = "background"
grid_thickness = [1,1]
grid_style = [3,3]
x_location = "bottom"
y_location = "left"
title: "Label"
x_label: "Label"
y_label: "Label"
z_label: "Label"
auto_ticks = ["on","on","on"]
x_ticks.locations = matrix 10x1
y_ticks.locations = [0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95]
z_ticks.locations = []
x_ticks.labels = matrix 10x1

If you look at x_ticks.labels you'll see that it's just a matrix of
numbers, located as specified in x_ticks.locations (so you can move the
ticky marks, too).  I did:

-->g.children.x_ticks.labels = ['bob' 'mary' 'ralph' 'sue' 'yassar'
'george' 'jean' 'osama' 'francis' 'molly']';

(note the transposition ticky at the end, so it's 10x1 and not 1x10).

Results are attached for you to see, if the group allows attachments.

To actually graph your example, you'd want to graph from 270 < theta <
450, then change the ticky marks modulo 360.  (or graph from -90 to 90,
ditto, although it'll be a bit harder to get the ticky marks right --
pmodulo is your friend here).

-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graph_names.png
Type: image/png
Size: 10368 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20150512/bce34221/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graph_numbers.png
Type: image/png
Size: 9880 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20150512/bce34221/attachment-0001.png>


More information about the users mailing list