Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I created several calculation sheet where I have to constantly adjust the graph grid settings to make the document presentable. I would like to calculate those settings automatically. Is this possible?
Sevastien,
The limits on a graph do not have to be numbers, they can be set using variables, or equations. So can the markers.
Sometimes I will create a vector of the values of a function using range variables and then use the max and min functions to get the limits (plus a little). This can be written as a program and then the function just placed in the limit placeholders on the graph.
Sometimes I will actually plot the vector of values rather than let Mathcad select the number of points, then I can increase accuracy or decrease to save time, depending on what I need.
The grid lines cannot be programmed. You can draw your own gridlines, but its a little more work.
If you want to do more than this, perhaps you could post an example of your calculations.
Wayne
Good suggestion, I could draw the line myself. But then that will show in the legend... not very clean in the end product I hope there is a better way.
I thought I posted this, but I guess not.
Attached is a file from Richard Jackson, from a discussion about plotting a grid or a structure on a graph.
This will result in only one trace in the Legend. That will give you a place to note the increment, so it might work to your advantage.
Yes, you are right that is cleaner like this, true.
How about through Scripting can we access the graph option parameters?
I don't know how, and from past discussions on this, I have not seen anyone present or even suggest how. I suppose that the information must be in the XML file, so If you are so inclined, and have the skills, I would guess that it could be done, but not by me. (Need to summon Richard or Phillip, or Stewart, or resurrect Tom)
If you pursue, please keep us informed
Wayne
How about through Scripting can we access the graph option parameters?
Unfortunately, no. Not even via the regions XML, because the XML of only math regions can be accessed through scripting, and a graph is not a math region.
A few alternatives to the worksheet Wayne uploaded.
Mike
Sebastien Billaut wrote:
I created several calculation sheet where I have to constantly adjust the graph grid settings to make the document presentable. I would like to calculate those settings automatically. Is this possible?
Up to a point.
The attached graph will rescale the ordinate and abcissa when the plot values change. You can also program and recalculate the markers. Grid spacings is a "bridge too far!"
Thanks for your answer, but yes I am talking about the number of grid lines. I am already using variables to adjust everything else markers and boundaries....
I was wondering if this graph setting could be access through programming.
Thanks for your answer, but yes I am talking about the number of grid lines. I am already using variables to adjust everything else markers and boundaries....
I was wondering if this graph setting could be access through programming.
It can't be done with programming. To be honest I believe it would take too much effort to get it working and don't know if it can actually be done.
Mike
Hello!
See also the topic "Plotting a Grid or a Structure on a Graph": http://communities.ptc.com/message/164979