Topic: Zoom so that axes are scaled differently but the grid is square

Is is possible to create a zoom feature or plugin that will adjust the window so that the x-axis and y-axis are scaled differently, but the grid-lines would still appear square? As if it were to be done on physical graph paper. For instance, if I wanted to scale my x-axis by 1s, and my y-axis by 2s, but still have the grid-lines square.

Re: Zoom so that axes are scaled differently but the grid is square

Yes, I believe it is possible to make a plugin that can do that. However It should be rather easy to do manually.

1. Select Zoom|Square to scale the axes equally.
2. In the Edit|Axes dialog under y-axis, you can now add *2 to Minimum and Maximum.
3. You may want to change the Tick unit and Grid unit to be twice the value as the x-axis.

This can of course be implemented in a plugin.

Post's attachments

Attachment icon Screen Shot 2017-09-25 at 24.19.35.png 101.09 kb, 407 downloads since 2017-09-24 

Re: Zoom so that axes are scaled differently but the grid is square

Thanks! This is very useful. How do you call the ZoomSquare function in a plugin? I was looking for it in the scripting documentation, and couldn't find it.

Thanks,
Marco

Re: Zoom so that axes are scaled differently but the grid is square

That was a good question. It actually took me some time to figure out. You can use to call Zoom|Square:

Graph.Form1.ZoomSquareAction.Execute()

Re: Zoom so that axes are scaled differently but the grid is square

Can anyone help write a plugin that would do Zoom so that the grid lines are square, by doing the following:

    Graph.Form1.ZoomSquareAction.Execute()
    Graph.Axes.yAxis.Max = Graph.Axes.yAxis.Max*Graph.Axes.yAxis.GridUnit/Graph.Axes.xAxis.GridUnit
    Graph.Axes.yAxis.Min = Graph.Axes.yAxis.Min*Graph.Axes.yAxis.GridUnit/Graph.Axes.xAxis.GridUnit
    Graph.Redraw()

I'm trying to modify the Circle plugin (with my limited coding skills) to do this, but I'm having no luck. I wish I knew how to create plugins beyond butchering the code of the included plugins.

Thanks!

Re: Zoom so that axes are scaled differently but the grid is square

This seems to just do the same as Zoom|Square. I have attached a plugin file that adds it to the Plugins menu.

Post's attachments

Attachment icon SpecialZoom.py 413 b, 642 downloads since 2017-12-06 

7 (edited by marcorainaldi 2018-02-20 16:54:07)

Re: Zoom so that axes are scaled differently but the grid is square

Thanks Ivan! I greatly appreciate your response! I hope that one day I can write Plugins as quickly as you do.

The plugin you created does something different than what Zoom Square does.

Example:
Set the axes settings to the following:
Xmin -10       Ymin -50
Xmax 10        Ymax 50
Tick Unit 1     Tick Unit 10
Grid Unit 1     Tick Unit 10
Show Gridlines   Show Gridlines

If you Zoom Square at this point, the resulting Graph won't be the same as if you run the Plugin at this point.

UPDATE: I've created a plugin that corrects for the situation described above. If you add this plugin to the plugin folder, you can press Ctrl+Shift+Q and the graph will be zoomed so that the grid-lines are square, using the current grid units.

Post's attachments

Attachment icon GridSquare.py 743 b, 598 downloads since 2018-02-20