[Scilab-users] moving axis ticks around orthogonally to their axes?

Philipp Mühlmann p.muehlmann at gmail.com
Wed Nov 16 09:39:35 CET 2016


Hi Christoph,

do you want to do something like this?

x = linspace(-2*%pi,2*%pi,201);y = cos(x);plot2d(x,y,2)a=get("current_axes");
set(a,"box","on");set(a,"grid",[1
1]);set(a,"x_location","origin")set(a,"y_location","origin")a.x_label.text
= "x axis";a.x_label.position = [-0.5770492 -1.2550725];a.y_label.text
= "y axis";a.y_label.position = [-9.084153 -0.0956522];
// getting number of tics from x & y axisnr_xticks =
length(a.x_ticks(2));nr_yticks = length(a.y_ticks(2));
// changing x-ticks from first axisx_ticks = a.x_ticksfor i = 1:nr_xticks
  x_ticks.labels(i) = "";  // replace label enda.x_ticks = x_ticks
// changing y-ticks from first axisy_ticks = a.y_ticksfor i = 1:nr_yticks
  y_ticks.labels(i) = "";  enda.y_ticks = y_ticksa.sub_ticks = [0,0]
//draw second axisa2 =
newaxes();set(a2,"x_location","bottom")set(a2,"y_location","left")a2.filled
= "off";a2.axes_visible = ["on","on","off"]


best regards,
Philipp


2016-11-15 23:44 GMT+01:00 christophk <christoph.knappe at gmail.com>:

> Hello folks,
>
> sorry for spamming this forum. I came across another interesting problem:
> Consider the following code example:
>
> x = linspace(-2*%pi,2*%pi,201);
> y = cos(x);
> plot2d(x,y,2)
> a=get("current_axes");
> set(a,"box","on");
> set(a,"grid",[1 1]);
> set(a,"x_location","origin")
> set(a,"y_location","origin")
> a.x_label.text = "x axis";
> a.x_label.position = [-0.5770492 -1.2550725];
> a.y_label.text = "y axis";
> a.y_label.position = [-9.084153 -0.0956522];
>
> In this example I have chosen the x- and y- axis to go through the origin
> [0,0]. However, I didn't like the axis ticks and axis labels to be inside
> the box as they come into the way of my data points. I found out how to
> move
> the axis labels back to the outside of the graph. The coordinates here are
> a
> bit clunky as I just copy-pasted the location coordinates manually from an
> earlier run when x_location and y_location were set to "bottom" and "left"
>
> Here is the problem: I couldn't find a property of "current_axes" that
> allows me to move the axis ticks out of the graph again. Is it possible at
> all to move the axis ticks out of the graph while leaving the axes where
> they are? I want them back at their position where they were when the axes
> are set to be at the bottom and left.
>
> If moving the axis ticks alone is not possible, I suppose a proper
> work-around would be to leave the axes locations at "bottom" and "left" and
> instead draw two perpendicular lines through the origin of the graph. Those
> would need to be dynamic though to find the origin position in the graph by
> themselves. Does anyone know how to do this?
>
>
>
> --
> View this message in context: http://mailinglists.scilab.
> org/moving-axis-ticks-around-orthogonally-to-their-axes-tp4034989.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive
> at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>



-- 
In Kanada is' ka' na' da. Sonst wär' Kanada Jemanda.

There we have the salad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161116/e507e253/attachment.htm>


More information about the users mailing list