Plotting fits over significantly larger axis ranges
8 次查看(过去 30 天)
显示 更早的评论
Hello,
I am encountering a strange behaviour of matlab, and couldn't find a way to force Matlab to do so.
Both graphs are fitting the excactly same fit, which i am polling from a structure.
The only difference is that for the graphs that look weird, I am plotting them over the axis [-2000 2000 -800 800], and then scale the figure back down to the actual xy-limits of the plotted data + margin on all sites [1 3 0.3 1.2]. The picture above is zoomed out a bit to see that the graphs are plotted outside the axis that I plotted the "finer" graphs over.
My current idea is that matlab obviously optimises the weird graphs shown above to look right on the axes you define:
Sadly, that would suggest that there is no way of optimise the plot over larger distances, and that I will have to adjust the factor for the first sketch down a lot, to get it to look properly again.
Or is there a method to force matlab to not simplify?
Thank you & stay healty.
Claudius Appel
3 个评论
dpb
2020-8-9
编辑:dpb
2020-8-11
Well, let's just see...
>> hAx=axes; hAx.Units="pixels"
hAx =
Axes with properties:
XLim: [0 1.00]
YLim: [0 1.00]
XScale: 'linear'
YScale: 'linear'
GridLineStyle: '-'
Position: [73.80 47.20 434.00 342.30]
Units: 'pixels'
Show all properties
>>
OK, a default axes on the system here is 434 pixels high, not quite half the full screen height...what fraction of a pixel is the range of your expanded axis--
>> 2/4.5E5 * 434
ans =
0.0019
>>
or, still in the noise of a thousandth of one pixel for the whole axis to be represented -- some 500 of them will fit in a single pixel, iow.
The scale of one pixel is roughly
>> round(4.5E5/434)
ans =
1037
>>
So any detail smaller than a difference of 1037 is indistinguishable.
dpb
2020-8-10
编辑:dpb
2020-8-13
BTW, you can always try
hAx=gca; % get current axes handle (if you didn't save it)
hAx.XScale='log'; hAx.YScale='log'; % Use log-log on large scale
will allocate same fraction of the axes space to each decade of data...(*)
The more normal way in such a case if the detail is significant is to use an inset axes like the city map on the state map in the road atlas.
(*) Of course, the (-)ive x-axis won't show on default log axis; there is a FEX submittal that mirrors the negative axis for the purpose but I don't recall the specific submission otomh.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!