When I plot a figure and type greek letter in the title, it looks like
However, when I save the figure as EPS output, the eps file looks like
It's obviously that the Greek letter \xi_p disappears.
Anyone who knows what happened and solutions, please give me a reply.
It would be much grateful.
Best regards,
mike
First I would like to thank KiW for the help.
I found a solution that works with my MATLAB 2014b.
Solution by specifying the interpreter directly in the code
We can set the interpreter-property directly to latex when calling xlabel or title as shamalaima pointed out in a comment:
xlabel('$\xi_{\textrm{p}}$','Interpreter','latex');
title('$\xi_{\textrm{p}}$','Interpreter','latex');
Solution using the property editor
Another way to do it is by using the property editor as follows:
After making the figure, click the white arrow and click the title (or label).
In the Property Editor, change the Interpreter to latex.
After this, choose the Axes. We can now find the title editor in the left bottom side. Just write the title as you do in latex.
Mine would be $\xi_{_\textrm{p}}=1e$-$4a_{_\textrm{ho}}$ in the font of Times New Roman.
It works now in my EPS output.
Using EPS Viewer the symbol is not lost. As you can see in the picture that works perfectly fine. I used:
plot(x,y)
title('\xi _{P}=1e-4a _{ho}')
So I assume it could be a problem of the program you use to open your .EPS file
I think that the best solution is to set the latex interpreter as default:
set(0,'defaulttextinterpreter','latex')
but of course it depends case by case.
Here is a very simple MWE :
figure
x = 1:10;
plot(x)
title('mytitle','interpreter','none')
And the result with no title showing :
I am under Windows 7, Matlab R2015a. I do want the interpreter to be set to 'none' because I will be working with titles containing consecutive underscores - which would fail in Latex. And when I open the figure properties dialog and double-click on the title, it appears and is editable. Once I unselect it though, it disappears again. Help...
The problem here was that Matlab's default font was Helvetica, which is not available on my computer. So make sure to use a font available on your computer, by using the FontName argument if needed.
You can also set the default text font (here Courier) through :
set(0,'defaultTextFontName','Courier')
If I export my matlab figure as an eps using:
print('myfig','-depsc')
I then open it in another software, in my case Illustrator CS6.
The text appears ok, but what should be a single text box, say a legend entry, is actually multiple text boxes arranged so that it looks like one.
In the image below, the black text is what it looks like first, but I have also shown a copy of the same text, with each text box a different color.
If I want to edit any of this its very difficult as the space will then be messed up. Also if I change the font, the kerning gets messed up.
I have also tried using the text command to place text on the axis, and this also ends up in multiple text boxes.
Is there any way to fix this?
Am I missing something?
Just to be clear, I would like to fix matlab's eps, Not use a different software.
In Matlab 2011a I am plotting a line, and I use the parameter ("LineSmoothing", 1) to make the line look prettier, but it causes the Y and X axis to disappear.
Does someone know what is causing this, and more importantly, how it can be fixed?
I tried the opengl('OpenGLLineSmoothingBug',1) but it didn't change anything.
Thanks in advance!
The undocumented LineSmoothing property causes the figure to automatically switch to using the OpenGL renderer. And the bug you've shown in fact affects all OpenGL-rendererd figures (regardless of this property use).
Example: (tested on R2012a in WinXP)
plot(1:10,'o-'), box on
set(gcf, 'Renderer','opengl')
note how the top and right borders of the box disappear once you execute the second line.
There are some suggested workarounds.
I want to change Font Size for xlabel, ylabel, axis size, legend font size a.k.a everything at once, is this possible? By default, font is Helvetica 10.
Is there way to change this?
I want to use 'FontSize',14, for x or y labels.
Jonas's answer is good, but I had to modify it slightly to get every piece of text on the screen to change:
set(gca,'FontSize',30,'fontWeight','bold')
set(findall(gcf,'type','text'),'FontSize',30,'fontWeight','bold')
If you want to change font size for all the text in a figure, you can use findall to find all text handles, after which it's easy:
figureHandle = gcf;
%# make all text in the figure to size 14 and bold
set(findall(figureHandle,'type','text'),'fontSize',14,'fontWeight','bold')
It's possible to change default fonts, both for the axes and for other text, by adding the following lines to the startup.m file.
% Change default axes fonts.
set(0,'DefaultAxesFontName', 'Times New Roman')
set(0,'DefaultAxesFontSize', 14)
% Change default text fonts.
set(0,'DefaultTextFontname', 'Times New Roman')
set(0,'DefaultTextFontSize', 14)
If you don't know if you have a startup.m file, run
which startup
to find its location. If Matlab says there isn't one, run
userpath
to know where it should be placed.
If anyone was wondering how to change the font sizes without messing around with the Matlab default fonts, and change every font in a figure, I found this thread where suggests this:
set(findall(fig, '-property', 'FontSize'), 'FontSize', 10, 'fontWeight', 'bold')
findall is a pretty handy command and in the case above it really finds all the children who have a 'FontSize' property: axes lables, axes titles, pushbuttons, etc.
Hope it helps.
To change the title font size, use the following example
title('mytitle','FontSize',12);
to the change the graph axes label font size, do the following
axes('FontSize',24);
Jonas's answer does not change the font size of the axes.
Sergeyf's answer does not work when there are multiple subplots.
Here is a modification of their answers that works for me when I have multiple subplots:
set(findall(gcf,'type','axes'),'fontsize',30)
set(findall(gcf,'type','text'),'fontSize',30)
To change the default property for your entire MATLAB session, see the documentation on how default properties are handled.
As an example:
set(0,'DefaultAxesFontSize',22)
x=1:200; y=sin(x);
plot(x,y)
title('hello'); xlabel('x'); ylabel('sin(x)')