Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hello!
Does anybody know how to change the units (from m to mm, m^2 to mm^2) in the chart component graph?
Please, take a look at the attached file.
Best regards,
Sergey
Solved! Go to Solution.
No, the native Prime plot does not support a second y-axis (you may make two separate plots) as it also does not support grid lines (workarounds for this have been posted in the forum a couple of times as Luc already wrote) and also does not offer labels or a legend (PTC had suggested to use manually placed text regions for this - yes, honestly!).
PTC has promised to improve the quality and functionality of Primes native plots in future version, we will see what this promise is worth.
Nonetheless for me, too, the Chart component is not an acceptable alternative as it dos not support units as Luc already wrote, is extremely slow and awkward to use and it does not respect the scale factor set in Windows and so the component is rather useless if a small display with a hight 4k resolution is used.
This means that neither of the two options for creating plots is really satisfactory and you have to choose what for you is the lesser of two evils.
See some suggestions in the attached P10 file
Yes: by not using the chart component. It is a badly integrated third party component, unaware of units. So it will just take the default (SI) units.
If you want to control units in a graph, use the native graphing possibilities (Plot menu). And if you want/need a grid in that graph, use one of the many utilities posted here on this forum.
If you insist on using the chart component, divide your X and Y variables by the desired units.
Success!
Luc
Hello Luc.
Is it possible to plot in Mathcad with 2 Y-axes? Would you show some example if possible?
Where do I find more information about the grid on the native Mathcad plot?
Sergey
No, the native Prime plot does not support a second y-axis (you may make two separate plots) as it also does not support grid lines (workarounds for this have been posted in the forum a couple of times as Luc already wrote) and also does not offer labels or a legend (PTC had suggested to use manually placed text regions for this - yes, honestly!).
PTC has promised to improve the quality and functionality of Primes native plots in future version, we will see what this promise is worth.
Nonetheless for me, too, the Chart component is not an acceptable alternative as it dos not support units as Luc already wrote, is extremely slow and awkward to use and it does not respect the scale factor set in Windows and so the component is rather useless if a small display with a hight 4k resolution is used.
This means that neither of the two options for creating plots is really satisfactory and you have to choose what for you is the lesser of two evils.
See some suggestions in the attached P10 file
Thank you!
How would you use vector instead of vector index?
Would you create 30x1 vector instead?
I tried range variable but it won't work.
Best regards,
Sergey
What you try there indeed does not work with a range:
It runs without error with a vector:
But I think you are looking for this result:
That is, you need to vectorise the expression.
Success!
Luc
You probably misunderstood what i wrote in the file. I meant that it is not necessary to use the vector index "i" after you already created the vector.
For creating the vector "stroke" you can use the range variable "i" as you did, but when you calculate A and Q the index can be omitted, but you will have to vectorize (the arrow over the expression) the calculation so that Prime knows you want the calculation to be done for each element of the vector(s) and don't use vector multiplication.
Vectorization is mandatory in the calculation of A because the expression in the parenthesis is a vector and the expression after it is a vector as well. So Prime would apply vector multiplication resulting in one single scalar value.
Vectorization would not be necessary in case of the calculation of Q but I consider it good habit (and it avoids mistakes) to always explicitly vectorize calculations when a calculations should be applied to the elements of a vector and not the vector itself.
There is nothing wrong with the way you created your vector "stroke" using a range variable "i" to index its elements, but there are also other ways to create a vector.
You could use programming and a for-loop
Actually that's quite similar to the range approach as basically a range is sort of an implicit loop and not a data structure.
You may also use the "matrix" function as Luc suggested
or using the "max" function as Luc did
Or you may use a range and turn it into a vector. In Prime 10 you have to use a user-function to do so, in Prime 11 a function "vec" is already built-in:
Benefit of the methods shown is that you don't need to define an extra global variable (the range "i").
So chose your weapons ... 😉
I really like the "vec" function and the way it converts range variable into the vector. I think it is the to do it as I see it.
In the input section of your Chart Component, just divide your expressions by the units you wish to be displayed. The only caveat is plotting temperatures in °F or °C, where you must use these units raised to the -1 power. Everything else can be expressed as a full unit inverse (i.e. lb/BTU) or 1 divided by the expression. This is exactly how the plot tool worked in Legacy Mathcad. Unfortunately, the Chart Component doesn't have the nice units fields that the native plot tool was given in Mathcad Primes, but the Chart Component allows many more plot features and formatting and is worth getting used to.
