https://uk.mathworks.com/matlabcentral/answers/questions?term=R2014bGraphicsMATLAB Answers — New Questions matching R2014bGraphics2019-06-21T08:33:01Ztag:uk.mathworks.com,2005:Question/1700802015-01-15T18:11:26Z2016-02-24T10:47:08ZMATLAB R2014b Graphics --> How to get thin lines (grid, curves, box,...)Hello,
I started to use the new graphics (2014b) and I see quite some interesting things.
However, I am disappointed to see that one of the most interesting aspects of the MATLAB graphs is gone :(
To be clear, I was very happy with the graphs having very thin lines (box, curves,...). It gave a very sophisticated look.
Now, even when I try to force the thickness of the lines and the box to very low values, I still get an ugly thick box and lines :(
The very thin grid lines I used to have are now very rough and thick...
Unless I am doing something wrong ?
Any solution for that ?
I raised the question in November 17th of last year without any answer so far:
http://blogs.mathworks.com/loren/2014/10/14/matlab-r2014b-graphics-part-2-using-graphics-objects/#comment-44544
Please look at the code below. Executed in 2014a or 2014b gives a huge difference in the precision and look of the graphs.
Thanks a lot.
if true
% Example of code
x=1:10;
plot(x,x.*x,'-o','Color', 'r','MarkerFaceColor',[1,0.69,0.39],'LineWidth',0.01);
set(gcf, 'Units', 'centimeters');
afFigurePosition = [0.1 18 10 7]; % [pos_x pos_y width_x width_y]
set(gcf, 'Position', afFigurePosition);
set(gcf, 'PaperPositionMode', 'auto');
grid on;
set(gcf, 'Renderer', 'painters');
resol='300';
print('-dmeta', ['-r' resol], '-painters', ['ExamplCurve_' resol '.emf']);
end
<</matlabcentral/answers/uploaded_files/23966/Example_2014a_2014b.png>>Samirhttps://uk.mathworks.com/matlabcentral/profile/authors/4385967-samirtag:uk.mathworks.com,2005:Question/2664592016-02-03T15:27:17Z2016-02-03T15:48:22ZDoes MATLAB R2014b require Graphics card to run fast.I am using MATLAB in my laptop with Intel® HD Graphics 3000.But it is running very slow.What could be the problem
My laptop specifications are 3rd Generation Intel® Core™ i5 Processor,Windows 10 64bit,8 GB ram,500 gb Hard disk with 50 gb of free space in C drive,Intel® HD Graphics 3000,2.50 Ghz CPU clock speed.
Hemanth Kumarhttps://uk.mathworks.com/matlabcentral/profile/authors/7611917-hemanth-kumartag:uk.mathworks.com,2005:Question/1578932014-08-27T04:00:00Z2014-10-08T17:46:06ZSummary of changes to graphics handles in MATLAB R2014b?In MATLAB R2014b, graphics handles are objects and not doubles. This article summarizes how you can work with graphics handles in MATLAB R2014b and later releases.MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1807062015-02-27T13:11:14Z2015-03-03T05:51:52ZWhat happend about my plotting styleAs I know that starting in R2014b, MATLAB graphics titles use a bold and slightly larger font for better visibility.
I am using R2014b, what happend to my plotting style?
The left is a example picture from help center, the right is my plotting. You can see the difference between the titles.
<</matlabcentral/answers/uploaded_files/26286/Untitled.png>>sheng liuhttps://uk.mathworks.com/matlabcentral/profile/authors/5853190-sheng-liutag:uk.mathworks.com,2005:Question/1624452014-11-12T19:54:44Z2015-04-07T17:33:49ZHow do I prevent LineWidth property from affecting line start and end point on plot?Using R2014b, when plotting a line with a large LineWidth, the data, as visualized in a figure, appears to extend beyond its true value. It appears that the LineWidth is being added to the front and back end of the line segment in addition to just affecting its width.
In R2014b,
plot([0 1],[1 1],'LineWidth',10)
appears to extend below 0 and beyond 1. http://imgur.com/YvAyiPX
In previous versions, the LineWidth did not affect the apparent start/end points of a line, and the above example would start and end (visually) at 0 and 1. Is there a way to ensure this for the R2014b graphics system?Matthttps://uk.mathworks.com/matlabcentral/profile/authors/940404-matttag:uk.mathworks.com,2005:Question/1603322014-10-27T23:53:04Z2019-06-21T08:33:01ZRGB values for 2014b default colorsHi guys,
I love the new default colors in 2014b. I would, however, be able to use then to color lines out of order sometimes. Any idea what their RGB values are?
thanks
-AlexAlexandre Laurinhttps://uk.mathworks.com/matlabcentral/profile/authors/3692664-alexandre-laurintag:uk.mathworks.com,2005:Question/1714532015-01-24T21:17:55Z2015-01-24T23:09:38Zhandle graphics in R2014I have an enormous amount of Matlab code that I use on a regular basis for data analysis, including plotting routines. I find that the graphics produced by R2014 are structured so differently from all the previous releases I have used (going back to 2003) that many of my graphics programs simply don't work. For example, 'findobj' fails to find the colorbar in a figure containing an 'imagesc' plot, and so my color scale adjusting program crashes. Another example: a program that formats data to spec and then plots waveforms produces extra empty figure windows. I don't have these problems in any previous release, so I have gone back to using R2013b. Any advice going forward? Just keep using R2013b until it's no longer supported, and then rewrite my entire code base (yuk!)?Danielhttps://uk.mathworks.com/matlabcentral/profile/authors/501078-danieltag:uk.mathworks.com,2005:Question/2132752015-04-23T23:19:37Z2015-04-24T15:20:56ZLinkaxes much slower in 2015aI'm upgrading from 2013a to the 2015a and I'm finding the handling of graphics on multiple axes is much slower.
For example, take the following simple code:
figure;
ax(1)=subplot(211);
imagesc(peaks(1000));
ax(2)=subplot(212);
imagesc(peaks(1000));
linkaxes(ax,'x');
tic;
for i=1:1000
xlim(xlim*.999);
drawnow;
end
toc
This takes ~10 seconds to run on 2013a and ~30 seconds to run on 2015a, even when turning of graphics smoothing and switching to painters.
I've run profiler and it says most of the time is being taken up LinkProp.processPostUpdate().
Any suggestions of what to do (other than not using linkaxes)?
Michaelhttps://uk.mathworks.com/matlabcentral/profile/authors/2621813-michaeltag:uk.mathworks.com,2005:Question/1699142015-01-14T12:51:17Z2016-06-05T11:52:36ZPlot style '--' in 2014bPlot styles like '--' and ':' are no longer working properly for me after I upgraded to 2014b. Specifically, if I plot a vector that has lots of elements, then it still shows up as a solid line even if I specify a different style. For example, this code yields the image following for me, where in the lower subplot you can see that the line looks like a solid line even though it is supposed to be dashed:
figure; hold on;
vectorlengths = [50 500];
titles = {'short vector' 'long vector'};
for i=1:2
x = linspace(0, 2*pi, vectorlengths(i));
y1 = sin(x);
y2 = cos(x);
subplot(2,1,i); plot(x, [y1;y2], '--', 'LineWidth', 2); title( titles(i) );
end;
<</matlabcentral/answers/uploaded_files/23856/img.png>>
It's not quite as simple as that---this problem also is affected by the slope of the line, so for more complicated squiggly lines the style actually changes at different points along the curve, as you can especially see from the green line in the center subplot of this figure and the red line in the left subplot:
<</matlabcentral/answers/uploaded_files/23857/fig2.png>>
What is causing this behavior, and how can I properly control the line styles? What I would like is a dashed line that stays dashed (which is the behavior I got in 2014a and earlier).
Thanks,
Steve
Stephen Politzer-Ahleshttps://uk.mathworks.com/matlabcentral/profile/authors/4698588-stephen-politzer-ahlestag:uk.mathworks.com,2005:Question/1578732014-10-08T16:47:17Z2015-05-05T23:02:44ZHow to get 2014b to render figures in retina resolution2014b finally updates MATLAB to work with computers that have been out since 2011, but figures themselves, or at least subplots of bar() and plot() don't render in retina resolution. They're all fuzzy! Is there some parameter I need to send to figure or plot or something to get it to look decent?Jordanhttps://uk.mathworks.com/matlabcentral/profile/authors/5215002-jordantag:uk.mathworks.com,2005:Question/2039182015-04-16T12:27:40Z2017-03-24T20:14:55ZSlow plotting performance starting from Matlab R2014b
I observed considerably worse performance of Matlab plot functions with versions R2014b and R2015a compared to earlier versions. Some of my interactive plots became almost unusable. For example, for one of my plots with 6 subplots and about 1000 data points each, the update of the plot is rather fast (<100ms) but then it takes about 30s until the plot is responsive and the command line is free. Using tic/toc and profiler I was not able to figure out where Matlab spends the time. It seems to be a problem related to the new graphics engine introduced in R2014b.
A small example (extreme case with many data points) shows how much slower plotting performs with R2014b/R2015a compared to R2013b in the case of many data points:
xx=randn( 1e7,1);
figure(1)
tic;
plot( xx, 'x');
drawnow;
toc
System 1:
* CPU: Intel Core i7-3930K
* GPU: Nvidia GeForce GTX580
* RAM: 64GB
* OS: Windows 7 Enterprise 64bit
* Matlab 64bit
* All drivers are up to date.
R2013b: Elapsed time is 2.207543 seconds.
R2014b: Elapsed time is 37.758890 seconds.
R2015a: Elapsed time is 35.490439 seconds.
System 2:
* CPU: Intel Core i5-2500K
* GPU: Intel HD Graphics 3000
* RAM: 32GB
* OS: Windows 7 Enterprise 64bit
* Matlab 64bit
* All drivers are up to date.
R2013b: Elapsed time is 2.402014 seconds.
R2014b: Elapsed time is 62.260723 seconds.
For the R2014b/R2015a version there is in addition this function execution time a time interval of several tens of seconds after plotting until Matlab is responsive. This time interval is negligible for the R2013b version.
Furthermore, I observed huge differences in memory consumption of Matlab. After executing the commands above, the Windows task manger shows following memory consumption values. Maybe this is related to the slow plotting performance.
R2013b: ~600 MB
R2014b: ~12 GB
R2015a: ~11 GB
Does anyone observe a similar behavior and know how to solve this problem? Klaus Ghttps://uk.mathworks.com/matlabcentral/profile/authors/6418064-klaus-gtag:uk.mathworks.com,2005:Question/1657872014-12-07T16:45:31Z2015-08-06T15:33:05ZHow can I get the pre-2014b behavior of hold on?I often make 2-d plots showing a comparison of cases with a parameter 'On" of 'Off'. So I'll have several curves for the first case and then another set, using dashed lines, for the second case.
%The code would be pre 2014b
plot(x,y_on)
hold on
plot(x,y_off,'--')
How can I get the same result in 2014b?Iram Weinsteinhttps://uk.mathworks.com/matlabcentral/profile/authors/1349457-iram-weinsteintag:uk.mathworks.com,2005:Question/1622572014-11-11T16:29:53Z2019-03-22T12:53:54ZProblem with 'Patch' graphics in 2014b - Splits in two along diagonalI'm using 'Patch' to replace the boxes in box plots to change the colour etc. Code is:
h = findobj(gca,'Tag','Box');
for x=1:length(h)
boxShade=patch(get(h(x),'XData'),get(h(x),'YData'), colours(x,:), 'linestyle', 'none');
uistack(boxShade,'bottom');
end
delete(h);
This worked fine until I updated to 2014b where now the Patches appear to split in two along the diagonal, with the median in front of one half and behind the other. Example cut from exported pdf:
<</matlabcentral/answers/uploaded_files/20887/Ave_1.jpg>>
I am using the painters renderer as I'm outputting vector pdfs.
Any ideas? I've seen some other talk that it's a bug from intersecting lines in a patch but there are no intersections here I believe as it's just a simple rectangle?
Any help greatly appreciated!
DavidDavidhttps://uk.mathworks.com/matlabcentral/profile/authors/2749754-davidtag:uk.mathworks.com,2005:Question/3110772016-11-07T17:59:20Z2016-11-07T18:21:41ZAfter developing a GUI programmatically in 2014b, why would I experience issues viewing the completed GUI in 2015b?I know that a large graphics update was implemented when transitioning from anything prior to 2014b to 2014b or newer but why would issues still arise when simply running a 2014b programmatically developed GUI in 2015b? I built the GUI without GUIDE and already found it useful to declare the Parent of each component I wanted to place in its respective container while also stacking the components in the order each would be placed on the figure window. When the GUI initialization script is ran, the figure window is built but only a handful of components actually appear in the figure window while the rest are "invisible" even after declaring visibility for each component. What other changes need to be made to build a working and completed 2014b GUI in 2015b?Tristan Loudenhttps://uk.mathworks.com/matlabcentral/profile/authors/7474189-tristan-loudentag:uk.mathworks.com,2005:Question/1748822015-02-03T13:39:52Z2015-02-06T14:29:02ZPixelated text in figures using text() functionHi,
The text() function when adding text to figures seems to me misbehaving. The text is noticeably pixelated when compared to all the other figure text, both on my monitor, and also when I print out to jpg, see
<</matlabcentral/answers/uploaded_files/24829/testPlot.jpg>>
Any hints about settings that could fix this? How do I make the text look more like the default figure text? The pixelation becomes glaringly ugly when projected onto a big screen. Hrefnahttps://uk.mathworks.com/matlabcentral/profile/authors/5659142-hrefnatag:uk.mathworks.com,2005:Question/1691112015-01-06T21:11:23Z2015-01-06T21:58:26Zhow to emulate "hold on" in 2014b*Edit:*
*This is apparently a duplicate of:* <http://www.mathworks.com/matlabcentral/answers/165787-how-can-i-get-the-pre-2014b-behavior-of-hold-on>
*I'd recommended continuing any discussion of this question there*
I noticed that hold on and hold all are now the same in 2014b and behave the same as the old "hold all" syntax used to. Is there an easy way of accomplishing the old "hold on" syntax in 2014b? Any thoughts as to why this was changed?
Test code:
subplot(2,1,1)
plot(1:10)
hold on
plot(20:30)
hold off
subplot(2,1,2)
plot(1:10)
hold all
plot(20:30)
hold off
Prior to 2014b these plots would look different, now they look the same.
Jim Hokansonhttps://uk.mathworks.com/matlabcentral/profile/authors/937359-jim-hokansontag:uk.mathworks.com,2005:Question/1605782014-10-29T14:39:04Z2015-01-15T14:20:37Zdrawnow slower in 2014b ?Hi,
I want to visualize data from a swarming simulation. For this sake, I generate textured surface objects, rotate and place them according to the data from the simulation. I also do an animation, where I manipulate the XData and YData properties of the surface objects and update the figure with drawnow. This all works fine. The problem is the following: The same code runs much faster with the older 2014a version of Matlab. Profiling the code, I realized that much more time is spent for drawnow in 2014b. The speed is relevant to me, since I want to do a real-time application.
The following example should be faster on 2014a than it is on 2014b:
%% Parameters
% texture size in pixels, height and width
px=800;
% angle pciture is rotated in every step
angle=0.2;
% number of updates, rotation steps
fr=100;
%% read a picture
% Choose any png file with transparency
[bc,~,ba]=imread('picture.png');
% Adjust the resolution
bc=imresize(bc,[px,px]);
ba=imresize(ba,[px,px]);
%% Plot surface object
% Object will occupy the region [-1,1]^2
Xr=[-1,1;-1,1];
Yr=[1,1;-1,-1];
% Generate surface object with texure and transparency data
figure(1)
obj=surface(Xr,Yr,zeros(2),...
'FaceColor','texturemap','Cdata',bc,...
'FaceAlpha','texturemap','AlphaData',ba,...
'EdgeColor','none');
axis([-1.5,1.5,-1.5,1.5]);
%% Animation
% Rotation matrix
rotMat=[cos(angle),-sin(angle);sin(angle),cos(angle)]';
% Most of the computing time is spent with calls to drawnow, as can be seen
% in the profile ( "run and time" )
tic;
for k=1:fr
% Get old position data
xx=get(obj,'XData');
yy=get(obj,'YData');
% Rotate them
P=[xx(:),yy(:)]*rotMat;
% set new position data
set(obj,'XData',reshape(P(:,1),[2 2]));
set(obj,'YData',reshape(P(:,2),[2 2]));
% only works in 2014b
%obj.XData=reshape(P(:,1),[2 2]);
%obj.YData=reshape(P(:,2),[2 2]);
% Update figure
drawnow;
end
time=toc
I have done some tests and it appears, that the computing time depends on the texture resolution. When I simulate this on my machine (iMac with Mac OS 10.7 Lion, Core 2 Duo 3 GHz) with different texture resolutions, I get the following computing times for the different Matlab versions:
<</matlabcentral/answers/uploaded_files/20160/untitled.png>>
I have also tried this on a Windows machine (Intel Core i7 860, 2.8 GHz) and observed the same behaviour. If you have read this far, thanks :-) I'm looking forward to your suggestions.Andreashttps://uk.mathworks.com/matlabcentral/profile/authors/2598488-andreastag:uk.mathworks.com,2005:Question/1577382014-10-07T04:00:00Z2015-01-30T13:00:50ZHow do I trigger ButtonDownFcn callback for an object with visible off in MATLAB R2014b?How do I trigger ButtonDownFcn callback for an object with visible off in MATLAB R2014b?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1614762014-11-05T18:44:23Z2014-11-05T18:50:47ZUipanel always on top in 2014b?In the old days, this code would stack the objects in order of creation.
f=figure('units','pixels','position',[200 200 600 600])
a1= axes('parent',f,'units','pixels','position',[20 20 200 200],'color',[1 1 0])
u = uipanel('units','pixels','position',[50 50 300 300],'backgroundcolor',[1 0 1])
a = axes('parent',f,'units','pixels','position',[200 200 200 200],'color',[0 1 1])
But in 2014b it puts the uipanel on top, and reflects this in the ordering of the get(f,'children').
furthermore,
set(f,'children',flipud(get(f,'children')))
Won't run when the figure contains a uipanel.
Am i correct that there is no longer any way to stack a uipanel underneath an axes? matt dashhttps://uk.mathworks.com/matlabcentral/profile/authors/939004-matt-dashtag:uk.mathworks.com,2005:Question/2448622015-09-24T14:34:33Z2015-09-28T13:36:10ZBar graph - how to add transparency in Matlab 2014bI would like to add transparency to my bar graph. However, any option which I have found in Matlab forum does not work in my Matlab version. Does anyone know how to add transparency in Matlab 2014b?Karolinahttps://uk.mathworks.com/matlabcentral/profile/authors/4786949-karolinatag:uk.mathworks.com,2005:Question/1577682014-08-25T04:00:00Z2014-10-08T03:01:04ZWhy is part of my graph cut off in MATLAB R2014b?I have a 3D surface that I am trying to plot in MATLAB R2014b. I noticed that a part of the surface is clipped off after I specified the limits for the z axis. This did not happen in MATLAB R2014a. Why is this so?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1577402014-10-07T04:00:00Z2014-10-07T22:01:03ZHow do I click an object below another object in MATLAB R2014b?How do I click an object below another object in MATLAB R2014b?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/2517622015-10-29T18:03:49Z2017-11-13T10:47:14Z2015b ghostscript not found - ps2pdf multi-page ps to pdfthe release notes for 2015b state that "MATLAB no longer ships with theGhostscript® library. Remove all instances of code that use ghostscript.m"
This breaks the our code which prints multi-page ps and then uses ps2pdf to convert to a multipage pdf. So far this is the only way we have found to get the SVG or vector graphics format into a multi-page pdf.
Unfortunately it is now broken, so what do you suggest we replace this with? Is there a way to do this with saveas now? Or can we somehow run the 2014b mex inside 2015b?
peter vincenthttps://uk.mathworks.com/matlabcentral/profile/authors/6853140-peter-vincenttag:uk.mathworks.com,2005:Question/1604532014-10-28T18:01:56Z2014-11-08T22:51:47ZMATLAB 2014b: patch() function not coloring the right regionI was using patch() function to plot some data and it doesn't appear to place to color in the correct region. If you view the figure below (in the bottom panel). You will see that the boundary where I set for the color filled in or totally ignored. The error occurs at 7PM, 11PM, 5AM, 7AM etc. The red stars indicates the points for the patch and the red dotted line indicates the boundary where the patch tool suppose to place the color.
<</matlabcentral/answers/uploaded_files/20102/tmp%20copy.jpg>>
However if you zoom in for a patch (2nd figure), the color placement became corrected. I did not do anything to the patch except using the ZOOM tool in on the figure to zoom in.
<</matlabcentral/answers/uploaded_files/20103/tmp%20copy%203.jpg>>
If someone has a solution and would like to share. I would appreciate your help. Thank you.
-San-Sanhttps://uk.mathworks.com/matlabcentral/profile/authors/734571-santag:uk.mathworks.com,2005:Question/1578882014-10-08T17:35:18Z2019-01-15T18:35:08ZFont problems when exporting as EPSI just upgraded to R2014b. When exporting figures via "print -depsc" the resulting EPS files have weird fonts embedded that are unreadable by Adobe Illustrator. Is there anything I can do to fix this? I want to go back to exporting with helvetic or arial font.Jeffhttps://uk.mathworks.com/matlabcentral/profile/authors/1081394-jefftag:uk.mathworks.com,2005:Question/1578802014-08-28T04:00:00Z2014-10-08T17:22:26ZWhy are some components missing or partially obscured in my apps in MATLAB R2014b?I have a figure which has a uipanel and an axes within the uipanel. In MATLAB R2014a, the figure appears as expected, but in MATLAB R2014b, the axis is no longer visible. I can only see the uipanel. Why is this so?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1368342014-06-21T08:16:45Z2017-02-20T17:55:32ZDetermine if using HG2How can I determine if MATLAB or the current figure is using the new graphics pipeline, HG2? I need a function
tf = ishg2(figure_handle)
which should be backwards compatible, say to MATLAB 7.0, and also account for the fact that people can choose which rendering pipeline to use (HG1 or HG2) in newer MATLAB releases, so simply checking version number is not sufficient.Oliver Woodfordhttps://uk.mathworks.com/matlabcentral/profile/authors/1073021-oliver-woodfordtag:uk.mathworks.com,2005:Question/1577632014-08-25T04:00:00Z2014-10-08T02:46:02ZHow do I make the graph title smaller in MATLAB R2014b?I am creating plots in MATLAB R2014b and I notice that the font for the title is bold and has a larger size compared to the font used for titles in MATLAB R2014a. Why is this so and how can I reduce the size of the font in the title?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/2332182015-08-11T10:53:32Z2015-08-11T15:20:11ZFrom 2014 to 2015 Matlab Versions I am now unable to display my annotation textbox in a uipanel. How can I display it on top of the uipanel?I used an annotation textbox which was displayed in a uipanel in version 2014 now in 2015 it can not be displayed in the uipanel. Is there a way of getting round this? I am also using a textbox becuase I need to display the text in a particular format(underscores). Using uicontrol you are unable to do this. Also the annotation textbox you are unable to specify Parent it is not part of the properties list. Ranjit Kaurhttps://uk.mathworks.com/matlabcentral/profile/authors/6580933-ranjit-kaurtag:uk.mathworks.com,2005:Question/1632132014-11-18T14:28:45Z2016-09-23T13:43:48ZMaking two different color maps in 2014bI'm trying to figure out how to use two different color maps in 2014b and use multiple color bars. Specifically I want to plot some image data and on top of that plot a set of contours.
Basically in the past I used <http://www.mathworks.com/matlabcentral/fileexchange/7943-freezecolors---unfreezecolors freezecolors> and <http://www.mathworks.com/matlabcentral/fileexchange/24371-colormap-and-colorbar-utilities--jul-2014- cbfreeze>. The same method behind freezecolors still works, changing the CData of your image to RGB values, but the colorbar is still a problem. CBfreeze doesn't seem to work any more because the colorbar objects are no long structs and now are specific objects.
I want to have separate colorbars for both the image data and contours but I can't seem to figure out the issue with the colorbars.
Thanks,
JohnJohnhttps://uk.mathworks.com/matlabcentral/profile/authors/3380939-johntag:uk.mathworks.com,2005:Question/1578912014-08-28T04:00:00Z2016-11-07T02:44:46ZWhat handle graphics objects have an empty 'Children' property in MATLAB R2014b?In MATLAB R2014a, I could access the individual children of a legend using the following command:
get(legendHandle,'Children')
When I execute the same comamnd in MALTAB R2014b, I get an empty array. Why is this so? What other graphics objects exhibit similar behavior?MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1576962014-10-07T17:02:14Z2014-10-22T23:00:26ZLine smoothing in MATLAB2014bHello!
So quick question about the new graphics system for matlab 2014b. I noticed that I do not get the nice smoothed (antialiased?) lines that I see on the website. I understand that this is related to the Opengl version but which version is required for this functionality.
Thanks in advance! Johanhttps://uk.mathworks.com/matlabcentral/profile/authors/2803359-johantag:uk.mathworks.com,2005:Question/1755972015-02-05T14:55:19Z2015-04-10T20:09:28ZPrinting image to file with Matlab 2014b: resolution issueI am using the print function to save figures containing large images (geographical data) as jpg or tif images:
figure(1);
imagesc(My_image);
print('-r600', '-djpeg', '-f1', 'My_image.jpg');
This used to work perfectly for years with previous Matlab versions. Now with Matlab 2014b, the image keeps the screen resolution whatever dpi (here 600) number is chosen: the number of pixel is behaving as expected, but the image itself keeps the same pixels as displayed on the screen, resulting only in very large squares (pixels) when using large dpi numbers. To be clear: the image is simply not resampled according to the dpi number, as it should be. The other figure information such as axes, text, colorbar, ... are behaving correctly.
I tried to change the renderer, it did not change anything.
I tested the exact same code on Matlab 2014a and it worked perfectly there: the image resolution followed the selected dpi number. I tested it on another computer and had the same issue with Matlab 2014b.
What is going on? How can I save my figures with the appropriate resolution?Christophehttps://uk.mathworks.com/matlabcentral/profile/authors/5581271-christophetag:uk.mathworks.com,2005:Question/1638492014-11-22T17:00:34Z2016-07-11T13:07:03ZAnnoying behavior saving eps figures in MATLAB 2014Life was good before I upgraded to MATLAB 2014. I had a script which plotted and saved multiple figures in .eps format. The file sizes were about 200k. I upgraded to MATLAB 2014, now the same script produces garbage: the figures have enormous white space page borders around them, plus the file sizes have exploded to 6 MB ea. I've spent hours reading these forums looking for solutions, and none of them work.
I'm running on 2013 MacBook Air with Yosemite. Leonardohttps://uk.mathworks.com/matlabcentral/profile/authors/3939773-leonardotag:uk.mathworks.com,2005:Question/1577622014-08-25T04:00:00Z2015-04-10T21:14:04ZWhy are plot lines colored differently in MATLAB R2014b compared to previous releases of MATLAB?I am trying to plot multiple lines using a single plot command. For example, the command that I use is :
plot(rand(5))
The line colors that I see in MATLAB R2014b are different from MATLAB R2014a. Why is that so?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1579902014-10-09T10:44:03Z2014-10-09T16:10:18ZHow do I move the legend box closer to the plot-edge? 2014b puts the legend box too far into the plot.Hi,
One of the big changes for me in version 2014b is that the legend box appears significantly further away from the plot edge, than it did in 2014a. Thus the legend box now obscures data it didn't just yesterday. :(
How can I decrease the buffer zone between the legend box and plot edge?
Yours,
- HrefnaHrefnahttps://uk.mathworks.com/matlabcentral/profile/authors/5659142-hrefnatag:uk.mathworks.com,2005:Question/1614992014-11-05T22:29:58Z2016-04-14T20:54:58ZBlank areas with fill and patch in 2014b
After updating to version 2014b, my code containing _fill_ or _patch_ functions does not work properly. Try this example:
poly=[
6.00 0.00
6.00 4.00
7.00 5.00
8.00 5.00
8.00 0.50
9.00 0.50
9.00 5.00
7.00 5.00
8.00 6.00
9.50 5.00
9.50 0.50
10.0 0.50
10.0 0.00
9.50 0.00
6.00 0.00];
fill(poly(:,1),poly(:,2),'r')
<</matlabcentral/answers/uploaded_files/20589/untitled.jpg>>
The internal area is not filled properly, and the problem seems related to polygons with holes. In Matlab 2014a everything was ok.damihttps://uk.mathworks.com/matlabcentral/profile/authors/4722655-damitag:uk.mathworks.com,2005:Question/1594322014-10-20T22:45:59Z2015-03-05T17:35:54ZR2014b How to disable graphics smoothing by defaultSince I plot data with the objective of information extraction, and not to hang it on wall and show everyone its beauty, I would like to set the GraphicsSmoothing setting to 'off' by default. Please help me out and tell me how I can disable this forever.Asad Alihttps://uk.mathworks.com/matlabcentral/profile/authors/1940069-asad-alitag:uk.mathworks.com,2005:Question/2322632015-08-04T06:44:54Z2015-11-24T07:51:46ZWhy does FaceAlpha affect ZData of different object? Hi,Im working with matlab 2015a in linux.
trying this code (with the slice grid ,x and y in the mat file attached)
if true
clear
clc
load('FaceAlpha.mat'); % Loading SliceGrid and X,Y parametrs
hold on; xlabel('X'), ylabel('Y'), zlabel('Z'); axis equal;
axis image;
plot(SliceGrid.x(X),SliceGrid.y(Y),'blue.');hold on;
h=[-8 -0.5 0.5 1]
v=[7 4 4 7];
fill_2=fill(h,v,'blue'); % Creating blue object
x=[0 -0.5 0.5 1]
y=[9 4 4 9];
fill_1=fill(x,y,'red');% Creating red object
t=[-2 -0.5 0.5 2]
z=[9 2 2 0];
fill_3=fill(t,z,'yellow'); % Creating yellow object
%%%%%%%%%%%%
%%%%%%%%%%%%
%%%%%%%%%%%%
set(fill_1,'FaceAlpha',0.5); % After this line everthing is ok.
set(fill_2, 'ZData', repmat(10, size(get(fill_2, 'XData')))); % After this line the outside blue plot is damaged
%%%%%%%%%%%% - as you can see in the above figure
%%%%%%%%%%%% if we omit the line -> set(fill_1,'FaceAlpha',0.5);
%%%%%%%%%%%% and leave the code with the ZData property, the outside blue plot doesn't damaged.
%%%%%%%%%%%% if we omit the line -> set(fill_2, 'ZData', repmat(10, size(get(fill_2, 'XData'))));
%%%%%%%%%%%% and leave the code with the FaceAlpha property, the outside blue plot doesn't damaged.
end
why and how does face alpha affect other object with ZData? and why are they doesn't work together? what is wrong?nad yahhttps://uk.mathworks.com/matlabcentral/profile/authors/6728380-nad-yahtag:uk.mathworks.com,2005:Question/2464612015-10-02T15:55:48Z2015-10-02T16:49:21Zhow can i get the default colormap to be JET in matlab 2014b?old colormap JET was better. how do I get it back?Leo Diazhttps://uk.mathworks.com/matlabcentral/profile/authors/1736605-leo-diaztag:uk.mathworks.com,2005:Question/1690152015-01-06T02:50:12Z2017-01-13T09:44:28ZR2014b tesselates contour plots when saving to epsWhen saving a contour plot to a vector format, the eps vector plot is "tesselated", i.e. it has dense triangular divisions along the fill of the contour.
This problem can be reproduced by
Z=peaks(50);
contourf(Z);
print(gcf,'-depsc','-painters','contours.eps');
Most viewers will show a white grid cut into many triangles on the figure. The file size is also very large (i.e. 532 KB vs 27 KB on previous versions). This makes a vector export of filled regions nearly useless in R2014b.
Running the same commands on previous versions results in a figure without tesselation. My operating system is OSX Yosemite 10.10.1.
John Hohttps://uk.mathworks.com/matlabcentral/profile/authors/2726735-john-hotag:uk.mathworks.com,2005:Question/1576872014-10-07T16:01:36Z2015-05-05T22:14:33ZUndefined function 'plus' for input arguments of type 'matlab.ui.Figure'.I get this error message when I run a script that was given to me on my data and may well have been written in an earlier version - I am working 2014b.
Any ideas? This is the full error message, but I haven't copied the script in as it's really quite long.
Undefined function 'plus' for input arguments of type 'matlab.ui.Figure'.
Error in PRL_analyseData>getNewFig (line 538)
hfig = varargin{1}+1;
Error in PRL_analyseData (line 160)
hfig = getNewFig(hfig,cmap);
Daisyhttps://uk.mathworks.com/matlabcentral/profile/authors/5726708-daisytag:uk.mathworks.com,2005:Question/1625442014-11-13T13:13:46Z2014-12-16T21:07:53Z2014b figure printing slowHey,
Printing figures is extremely slow in Matlab 2014b. Does anyone know when this problem can be expected solved? We are wondering whether or not to use 2014b in our development and as long as printing is so slow we cannot....Julianehttps://uk.mathworks.com/matlabcentral/profile/authors/2785297-julianetag:uk.mathworks.com,2005:Question/1614162014-11-05T12:30:06Z2014-12-08T19:33:40ZHow to do workaround MATLAB crash in set(gcf,'CurrentAxes',ax1)?Hi,
I have used matlab for a long time and always liked it. That to say until version 2014b. This version seems to have severe concurrency problems. I got this crash today:
Error using matlab.ui.Figure/set
Axes must be an existing child of figure.
Error in nrOfUEs (line 87)
set(gcf,'CurrentAxes',ax1);
Error in Throughput_stats (line 1071)
nrOfUEs(Stop, NrUE);
Error in femto_all_thrp (line 60)
Throughput_stats(...
87 set(gcf,'CurrentAxes',ax1);
But in debug mode right after this crash manually typing
K>> set(gcf,'CurrentAxes',ax1);
Does not give an error. There are a few possible causes to this problem, depending on what the error message really mean in matlab:
*1) The handle is not created*
This is however unlikely since the loop
while ~ishandle(ax1)
fprintf('waiting...\n');
end
is not triggered.
*2) The handle is modified in row 79 and is thus locked with a mutex lock or other preferred lock*
*3) The axes are modified, and thus not accessible*
There may (mostl likely) also be other possible issues with this. The question is
*Are there any workarounds to this problem?*
*My relevant code row 78-87*
78 % Link the x-axes (for zooming purpouse)
79 linkaxes([ax1 ax2], 'x');
81 % Set the original axes to be the current (in case you want to modify it or
82 % anythin)
83 while ~ishandle(ax1)
84 fprintf('waiting...\n');
85 end
87 set(gcf,'CurrentAxes',ax1);Patrik Ekhttps://uk.mathworks.com/matlabcentral/profile/authors/4360637-patrik-ektag:uk.mathworks.com,2005:Question/2502792015-10-22T08:26:27Z2019-04-04T08:23:18ZHow to make contour plots transparent - in matlab R2015a?Hi, how can I make several contourf plots which are transparent? I tried the facealpha but the contour class has no facealpha property. Is there another way to make the contourf plots transparent?ilupihttps://uk.mathworks.com/matlabcentral/profile/authors/7157747-ilupitag:uk.mathworks.com,2005:Question/2721462016-03-08T16:57:07Z2016-09-27T10:59:19Zerror using mouse scroll with zoom onI get the following error message under scrolling the mouse wheel with zoom on:
Error while evaluating Figure WindowScrollWheelFcn
Cell contents reference from a non-cell array object.
Error in matlab.graphics.interaction.hitAxes>removeAxesInOffscreenContainers (line 63)
Error in matlab.graphics.interaction.hitAxes (line 21)
Error in zoom>locFindAxes (line 2502)
Error in zoom>localButtonWheelFcn (line 737)
Error using waitfor
Error while evaluating Figure WindowScrollWheelFcn
The problem is cause by the parent of the axes, in my case an uitab object. If the parent is a figure, it works fine. I defined a figure 'WindowScrollWheelFcn', but the debugger doesn't reach the function. The error comes before.
hfig = figure(...
'WindowScrollWheelFcn',{@figScroll});
Is there a way to get this working on axes within a uitab? Or how can I disable mouse wheel gestures with zoom = on? I use Matlab R2014b.
Thank you for your help!
EDIT - Here is a small example who reproduces the error:
hfig = figure(1);
% Tab group
tabgp = uitabgroup(...
'Parent',hfig,...
'Position',[0 0 1 1]);
Tab1 = uitab(...
'Parent',tabgp,...
'Title','Plot');
axh = axes(...
'Parent',Tab1,...
'Units','normalized',...
'Position',[0.1 0.1 0.8 0.8]);
% plot
plot(axh,1:100,randn(100,1))
zoom(hfig,'on')
uiwait(hfig);
Sebastian Roehnhttps://uk.mathworks.com/matlabcentral/profile/authors/7798447-sebastian-roehntag:uk.mathworks.com,2005:Question/2607532015-12-17T16:33:12Z2015-12-17T19:37:21ZPlot error with axes handles with 2014/15bI've just upgraded to 2015b from 2013b and have found that the majority of the plotting routines that previously worked, now throw up a number of errors. It appears to be the way that the axes handle is being used.
In my code I call a function to create the GUI and then populate it with data which is in the GUI workspace.
% Function to create the GUI
[AxesPlot,ImportBut,AcceptBut, LimitTxt]=ImportMinMaxGUI;
% AxesPlot is the handle for the axes in the GUI.
Series = plot(AxesPlot,[MaxClip, MinClip]);
MaxClip and MinClip are two different arrays, MaxClip is constructed of MaxClip(i).X, and MaxClip(i).Y and MinClip is purely MinClip.X and MinClip.Y.
When I try and call this I have the following error:
Error using plot
A numeric or double convertible argument is expected
Error in ImportMinMaxFunc(line 118)
Series = plot(AxesPlot,[MaxClip, MinClip]);
However, I know it's not down to the input data as the following does work and creates a plot.
Series = plot([MaxClip, MinClip]);
The trouble is that I have numerous axes and need to put various pieces of data on different axes. I've noticed when I pause and debug that 'AxesPlot' is now an object rather than a double - do I need to refer to it differently when trying to plot to this axes?
Charlie Blackwallhttps://uk.mathworks.com/matlabcentral/profile/authors/7417788-charlie-blackwalltag:uk.mathworks.com,2005:Question/1644132014-11-26T17:53:38Z2016-04-22T16:44:34ZLegend line spacing in R2014bIn previous versions I was able to control (to some degree) the line spacing in figure legends by changing the PlotBoxAspectRatio property of the legend. I can't seem to do this in R2014b. Anyone know of a new way of doing this?
Basically I can't figure out how to make the legend smaller than some minimum that Matlab seems to determine automatically, and I disagree with how small looks reasonable.Scott Websterhttps://uk.mathworks.com/matlabcentral/profile/authors/3800433-scott-webstertag:uk.mathworks.com,2005:Question/2809952016-04-26T05:32:45Z2016-04-26T13:18:45ZhObject, eventdata and handles not return double in R2016aHi I am running a GUI program under R2016a and found the hObject, eventdata and handles are not return doubles as in R2014a before, which give me error 'Expected input to be one of these types: numeric, instead its type was matlab.ui.Figure' and 'error while evaluating UICotrol Callback'. Is there any way to let these functions return doubles as before, or alternate way to make the whole GUI work? Thanks very much. Tian Wanghttps://uk.mathworks.com/matlabcentral/profile/authors/7717403-tian-wangtag:uk.mathworks.com,2005:Question/1578632014-10-08T15:45:50Z2018-01-12T11:21:00ZChange grid Line WidthHi,
I used default axes line width as 1.5 in Matlab2014a and my grids were fine. When I increase the axes line width in Matlab2014b, it increases the grid line width and create a very ugly plot specially if I save it as eps or pdf.
How can I set axes line width to 1.5 and and grid line width to 0.5
Thank you
Farukhttps://uk.mathworks.com/matlabcentral/profile/authors/5220520-faruk