Why can't I place a data cursor below a certain value on my plot?

8 次查看(过去 30 天)
I'm pretty new to Matlab, and struggling with something I don't quite understand. Basically, I'm using the code below to set up a function handle, substitute a value for one of the symbolic variables, then plot that function over the range 1x10^-7 to 1.
However, this gave me some issues and a plot that didn't look correct, so I bumped up the MeshDensity to 100,000 so that there would be more data points. I'm also using a logarithmic scale for the horizontal axis.
The issue is, when I try to place a cursor anywhere below x ~= 10^-2, the cursor shows up at x ~= 10^-2. At this point, I can drag it to the right to check larger points, but I can't drag it further left than x ~= 10^-2. Even when I set my range to [1e-7 1e-5] and plot, clicking to set a data cursor doesn't produce a visible cursor anywhere on the plot. The only thing that allows me to move the cursor along the whole range of my plot is not setting the x-axis to a log scale. Any ideas? Thanks in advance!
Edit: Something else I just noticed: the effective lower limit of my data cursor is at least somewhat tied to the size of the window containing my figure. The limit of x ~= 1e-2 decreases to 0.5e-2 when I decrease the window size of my figure. This remains the limit no matter how small I make the window though, and the limit of x ~= 1e-2 remains no matter how big I make the window.
syms T P lambda
mfp_eqn = @(P) k*T/(sqrt(2)*pi*d^2*P);
mfp_eqn = subs(mfp_eqn, T, 300);
fp = fplot(mfp_eqn, [1e-7, 1]);
fp.MeshDensity = 100000; % sets minimum number of data points
ylim([0 1e5]); % expands limits of vertical axis
set(gca,'xscale','log') % set pressure scale to logarithmic

采纳的回答

Renee Coetsee
Renee Coetsee 2017-4-3
I work in Technical Support at the MathWorks. This is a bug in the data cursor with logarithmic plots. The developers are aware of and are currently investigating this issue.
As a workaround, you can try the following:
plot(fp.XData,fp.YData)
This will create a standard plot and use the data cursor on that plot. The plot will not look correct (on my machine the line is at the bottom left corner of the axes) but you will be able to use the data cursor.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by