<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 22: Axis Ticks drawn at wrong angle </title><link>https://sourceforge.net/p/nplot/bugs/22/</link><description>Recent changes to 22: Axis Ticks drawn at wrong angle </description><atom:link href="https://sourceforge.net/p/nplot/bugs/22/feed.rss" rel="self"/><language>en</language><lastBuildDate>Mon, 23 Jun 2008 11:03:33 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/nplot/bugs/22/feed.rss" rel="self" type="application/rss+xml"/><item><title>Axis Ticks drawn at wrong angle </title><link>https://sourceforge.net/p/nplot/bugs/22/</link><description>&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;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">hywel thomas</dc:creator><pubDate>Mon, 23 Jun 2008 11:03:33 -0000</pubDate><guid>https://sourceforge.netc35b1726975175b5fd90e08ad44beb80e020f0af</guid></item></channel></rss>