Plotting fits over significantly larger axis ranges

9 views (last 30 days)
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 Comments
dpb
dpb on 9 Aug 2020
Edited: dpb on 11 Aug 2020
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
dpb on 10 Aug 2020
Edited: dpb on 13 Aug 2020
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.

Sign in to comment.

Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!