Same scale for two axes

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

luckymichael wrote at 2012-06-05 23:49:

dear friends,

i would like to keep the two axes at the identical scale without changing the plot content. For example: I want to plot two points (1,1) and (3,3). but the width:height of the plot control is 4:3. I want to make the plot area as a square to suit the box. i am thinking to shrink the width of the plot area. Or manipulate the axes? or any other ideas? which method is it possible to achieve this? 

 

Thank you in advance for your help!

Michael


objo wrote at 2012-06-19 12:41:

If whitespace on the sides of the plot is ok: I think you could change the PlotMargins of the PlotModel when the size of the plot control changes.

Otherwise you could change the Minimum/Maximum of one the axes, based on the ActualMaximum/ActualMinimum of the other axis.


luckymichael wrote at 2012-08-18 02:34:

Thanks alot for the reply objo. I prefer to manipulate the axes. but the Minimum/Maximum seems to be ineffective after I drag the plot, no matter using the method

plot1.RefreshPlot(false);

or

plot1.RefreshPlot(true); 

now I manually compare the scales on X and Y axes and change the ActualMaximum/ActualMinimum of one of the axes before plotting. but because I need to plot some spatial features to be shown as a map. i need to keep the same scale all the time. I am struggling to keep the same scale on both axes when doing zooming. Do you have any suggestions?

Is it possible to implement a property setting the axes at same scale in the future. Thank you very much.


objo wrote at 2012-08-21 13:20:

PlotModel.PlotType = PlotType.Cartesian was intended to force axes to use the same scaling, can this be used?


luckymichael wrote at 2012-08-21 23:40:

Works great! Thanks a lot for this amazing tool!


amity2001 wrote at 2012-10-03 08:41:

Hello Luckymichael,

I have same problem, I want my plot as square as both axes are showing same scale.

Would you please share your steps or code with us?

Thanks in advanced.


luckymichael wrote at 2012-10-03 10:00:

i just do what objo suggest in his post