Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hi everyone,
A customer of mine recently encountered a question while using Mathcad Prime. They created a 2D plot using the Insert Chart function (as shown in the image below), but couldn't find a way to display the grid lines (both x and y) in the chart.
I’m not very familiar with the plotting settings in Mathcad Prime, so I’d appreciate any help. Is there a setting or option to enable axis grid lines in a chart?
Thanks in advance for your support!
Best regards,
Lan
Solved! Go to Solution.
The picture does not show a Chart Component (Ribbon Math - Chart Component) but rather a Prime native 2D-Plot (Ribbon Plots - Insert Plot - XY-Plot).
Unfortunately Prime's native plots are missing a lot of basic features like labels, second y-axis and ... grid lines.
Instead of adding the missing features PTC had decided to integrate a third party module which provides some of these features.
This module has its own sever drawbacks, though. Its badly integrated (Chart Component), extremely slow and awkward to handle, does not scale according to the windows zoom set (an issue when using high resolution with a small size monitor) and does not even support units (IMHO an absolute no-go for a Mathcad/Prime addon).
So your customer has two options: Either using the Chart component if it fits his needs or use one of the workarounds which were posted here in the forum a couple of times which create gridlines as an additional trace.
Some links:
https://community.ptc.com/t5/Mathcad/Grid-on-a-2D-Plot/m-p/672767/highlight/true#M190679
A third option would be to simulate grid lines by using the feature to manually add horizontal and vertical markers. As these would have to be added and formatted one by one this method would only be acceptable if a small number of lines suffices.
BTW, looking at the picture you posted I would strongly advise your customer to take advantage of a main feature of Prime and add units to his calculations.
The picture does not show a Chart Component (Ribbon Math - Chart Component) but rather a Prime native 2D-Plot (Ribbon Plots - Insert Plot - XY-Plot).
Unfortunately Prime's native plots are missing a lot of basic features like labels, second y-axis and ... grid lines.
Instead of adding the missing features PTC had decided to integrate a third party module which provides some of these features.
This module has its own sever drawbacks, though. Its badly integrated (Chart Component), extremely slow and awkward to handle, does not scale according to the windows zoom set (an issue when using high resolution with a small size monitor) and does not even support units (IMHO an absolute no-go for a Mathcad/Prime addon).
So your customer has two options: Either using the Chart component if it fits his needs or use one of the workarounds which were posted here in the forum a couple of times which create gridlines as an additional trace.
Some links:
https://community.ptc.com/t5/Mathcad/Grid-on-a-2D-Plot/m-p/672767/highlight/true#M190679
A third option would be to simulate grid lines by using the feature to manually add horizontal and vertical markers. As these would have to be added and formatted one by one this method would only be acceptable if a small number of lines suffices.
BTW, looking at the picture you posted I would strongly advise your customer to take advantage of a main feature of Prime and add units to his calculations.
Dear Werner_E
Thank you for your reply.
I tried adding two equations into a plot, and both curves display correctly. However, I noticed that one of the curves doesn’t respond to any style changes, such as dashed lines, color adjustments, or line thickness modifications.
Could you help me understand why this happens?
Might it be related to how the equation is defined, the data type, or units?
I’m currently using Mathcad Prime 10.
Thank you in advance for your support!
BR
Lan
Make number of plots <=5000, you can see the line style.
If 50000> you can see another change.
Dear ttokoro
ご指導いただき、誠にありがとうございました。心より感謝申し上げます。😍
Primes native plots suffer from three built-in limits which are per-trace limits.
0) Up to 5000 points you have full formatting options available
1) For traces with more than 5000 points you can't chose a symbol other than the dot and no lin style other than full line. And you will not be allowed to combine he two (plotting the points and connecting them. So you only have the choice between either the full line or plotting only dots (which usually looks like a continuous trace by using that many points).
2) For traces with more than 50000 points you additionally lose the option to set the lin width and you can't chose any symbol at all. Line style is full and line width is very small and nothing but the color can be changed
3) Prime refuses to plot traces with more than 2000000 points.
The help only mentions the third and first limits in passing and succinctly explains that the full formatting options are only available up to 5000 points. -> To Change the Number of Plotted Points
So carefully choose your range variable used for plotting. Usually 1000 points are more than enough.
In the attached sheet you can test the behaviour when the number of points per trace exceeds the various limits.
Dear Werner_E,
Thank you so much for your detailed explanation and for helping me understand the limitations of Mathcad Prime’s native plots.
Your breakdown of the point limits and formatting restrictions was extremely helpful, especially the part about the 5000-point threshold.
Thanks to your clear explanation, I now understand why I couldn't change the line style in my plot.
I truly appreciate the time and effort you put into writing this, and the attached sheet made things even clearer.
Thanks again — I learned a great deal from your response and truly appreciate your support!😊
Dear Werner_E
I’ve been studying the file you previously provided and have been experimenting on my own.
I chose to use a chart to visualize my calculations, but I have a question:
Is it possible to define Q as a variable, so that it can change based on user input or calculation results?
Once Q is set as a variable, is it still possible to generate the same type of line segment plot as shown in my attached file?
I’ve attached a document for your reference.
If you have an example or method for setting this up, I’d greatly appreciate your guidance.
Thank you in advance!
Best regards,
Lan
You can change Q anywhere.
Dear ttokoro
ご返信ありがとうございます。
Q が既に変数として定義されていることは理解しておりますが、私の目的は少し異なります。
同一グラフ内に、Q の異なる倍数(例:Q、3·Q、5·Q、7·Q、9·Q)を用いた複数の曲線を描画したいと考えています。
現在は、それぞれの曲線に対して (Y1、Y2、Y3 など) 個別に変数を定義し、手動でプロットに追加しています。
私の質問は、Q をベクトル値(例:0.1, 0.3, 0.5, 0.7, 0.9)として定義し、Mathcad Prime が対応するすべての曲線を自動的にプロットできるようにすることは可能でしょうか、という点です。
私のアプローチをご確認いただければ幸いです。
お忙しいところ恐れ入りますが、ご教示いただければ幸いです。
何卒よろしくお願い申し上げます。
I don't understand your question.
In your sheet Q actually IS defined as variable (you assigned it the value 0.2) and of course the plots will change accordingly if you change that value.
Using a global definition as suggested by ttokoro only has the effect that you could define Q even below the chart. And if, as you asked, Q is the result of calculations, then ALL 'variables' involved in those calculations would have to be defined globally as well.
Personally I try to avoid global definitions whenever possible because I have found that they often cause more problems than they solve. This is especially true since the way global definitions work in Prime has been changed compared to Mathcad.
According your chart you could spare some work because X1 to X5 refer to the very same range:
Dear Werner_E
Thank you for your reply. I realize that Q is already a variable in my sheet, but my goal is a bit different:
I would like to plot several curves in the same chart, each using a different multiple of Q (for example: Q, 3·Q, 5·Q, 7·Q, 9·Q).
Currently, I have to define separate variables (Y1, Y2, Y3, etc.) for each curve and add them manually to the plot.
My question is: Is it possible to define Q as a vector of values (e.g., {0.1, 0.3, 0.5, 0.7, 0.9}) and have Mathcad Prime automatically plot all corresponding curves without manually defining each Y?
Thank you in advance for your guidance!
You could define a vector of Q-values but you still would have to define the correct number of Y's (the number of Y's in the chart component can be lower than the number of entries in the Q-vector, but not larger).
But at least you won't have to edit the chart component's input area if you want to see different Q values - you just change the values the Q vector. You may add numbers in the vector of Q values, but the chart still will show just the first five traces.
There is an approach where you also can change the number of Q-values and the plot acts accordingly. This is the so called waterfall plot where you create a matrix of M-values for the y-axis, Each column represents one trace. The drawback here is that its considered just one trace and so all curves would share the same color:
The Chart component is able to handle this as well, just use
To get the curves plotted in different colors you would again have to define separate traces and you will have to add traces if you add entries in the vector of Q values.
Just for fun I added the peak positions.
Here a plot with 80 different Q-values in the range from 0.05 to 4
Prime 10 sheet attached
P.S.: We are far away from the original question and the thread title now. I'd suggest that for follow up questions you use a new thread. This also would attract a larger audience and could result in a wider range of different answers.