How do I generate a figure that matches what is shown in MATLAB documentation?
1 view (last 30 days)
Show older comments
Why do the plots I generate using the example code from MATLAB documentation not look the same as those displayed in the documentation? Using waterfall plot as an example, http://www.mathworks.com/help/matlab/ref/waterfall.html, the documentation says to enter 3 simple lines of code:
figure
[X,Y,Z] = peaks(30)
waterfall(X,Y,Z)
Doing this, the figure I get looks much different than the example shown. I have compared the fig, as well as a saved jpg, png, eps, and pdf with none of them displaying like the documentation figure. Here is png shown on the documentation webpage,
and here is the png saved from MATLAB R2013b (8.2.0.701) 64-bit (glnxa64),
The 6 most significant differences I see between these two are as follows (in order of priority).
- An axis box blocking the view of the plot
- There is aliasing shown in the lines rather making jagged rather than smooth lines# The grid lines show as harsh dots instead of as light lines
- Extra axis ticks are displayed along only the x- and y-axis
- The plotted x-axis covers the range from -3 to 3 with a label at each integer instead of from -4 to 4 with a label at every even integer
- The show a different color gradient
My ultimate question is how do I generate a figure that actually looks the same as those shown in the documentation? Perhaps there is a simple function MATLAB programmers use for this that I am missing. Are they manually changing each one of those differences?
Further, why does the documentation not actually display what the software renders? This has not been my experience using Mathematica or Python. This is not unique to the waterfall function; I also experience this using 'surf', 'scatter3', and even the most simple 'plot'.
1 Comment
Harry
on 4 Nov 2014
If it's any consolation, I get a bit of a cross between the two:
Regarding your point number 4, note that the axis limits change as you resize the figure window. Therefore, this could be a function of your computer's screen resolution and aspect ratio.
I'm pretty sure the figure in the Matlab documentation is genuine. I imagine these things differ between platforms.
Accepted Answer
the cyclist
on 4 Nov 2014
Edited: the cyclist
on 4 Nov 2014
I think the primary issue is the MATLAB version. In the latest version, MATLAB 2014b, MathWorks completely overhauled their graphics. I think this explains pretty much everything in your list. The online documentation naturally presents the latest version.
Here's what it looks like on my machine (with the latest version):
This page describes the new graphics in 2014b.
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!