<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 22: Axis Ticks drawn at wrong angle </title><link href="https://sourceforge.net/p/nplot/bugs/22/" rel="alternate"/><link href="https://sourceforge.net/p/nplot/bugs/22/feed.atom" rel="self"/><id>https://sourceforge.net/p/nplot/bugs/22/</id><updated>2008-06-23T11:03:33Z</updated><subtitle>Recent changes to 22: Axis Ticks drawn at wrong angle </subtitle><entry><title>Axis Ticks drawn at wrong angle </title><link href="https://sourceforge.net/p/nplot/bugs/22/" rel="alternate"/><published>2008-06-23T11:03:33Z</published><updated>2008-06-23T11:03:33Z</updated><author><name>hywel thomas</name><uri>https://sourceforge.net/u/hywelthomas/</uri></author><id>https://sourceforge.netc35b1726975175b5fd90e08ad44beb80e020f0af</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;TicksAngle is defined to be anti-clockwise from the axis direction for a positive angle (as is conventional for 2D coordinates).&lt;br /&gt;
However, existing code draws ticks at wrong (ie clockwise) rotation.&lt;/p&gt;
&lt;p&gt;Demonstration:      AxisTestsForm.cs.patch has extra X-axes drawn to show this problem.&lt;br /&gt;
Test code in:   NPlot\demo\csharp\src\AxisTestForm.cs&lt;/p&gt;
&lt;p&gt;Cause: Because the physical (pixel) origin in System.Drawing.Graphics is at the top left of the screen, rotations  (as in RotateTransform) are clockwise.  This &lt;/p&gt;
&lt;p&gt;has caused some confusion when drawing the Ticks, and the existing code uses both the negative of the TicksAngle and the (A-B) trignometrical formula to &lt;/p&gt;
&lt;p&gt;rotate the tick.&lt;/p&gt;
&lt;p&gt;Resolution: The code in Axis.cs has been corrected and comments added to clarify its operation.&lt;/p&gt;
&lt;p&gt;In addition, it is conventional to place ticks *outside* the plot area (ie to the left of the positive Y_axis and below the positive X-axis) so that the default &lt;/p&gt;
&lt;p&gt;values for a new Axis should be:-&lt;/p&gt;
&lt;p&gt;TicksAngle_ = 3.0f * PI / 2.0f;  // or -PI/2.0f&lt;br /&gt;
TickTextNextToAxis = false;&lt;/p&gt;
&lt;p&gt;and these changes have been made to the Axis constructor routine.&lt;/p&gt;
&lt;p&gt;The axis constructors in PlotSurface2D.cs have the correct TicksAngle defined and do not need changing.&lt;/p&gt;
&lt;p&gt;Only one of the demo routines (Mockup demo) uses specific values for TicksAngle, and the default values will now be correct.  Lines have been removed &lt;/p&gt;
&lt;p&gt;from PlotSurface2DDemo.cs to allow the default values to stand.&lt;/p&gt;
&lt;p&gt;Note that in all demos, the Ticks are now drawn outside the plot area (which is the convention)&lt;br /&gt;
If the original appearance is preferred, TicksAngle must be set to PI/2.0f specifically.&lt;/p&gt;
&lt;p&gt;Files affected:-&lt;br /&gt;
NPlot\src\Axis.cs;&lt;br /&gt;
NPlot\demo\charp\src\PlotSurface2DDemo.cs&lt;br /&gt;
NPlot\demo\csharp\src\AxisTestForm.cs&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>