Smithplot with Latex Text Interpreter - Infinity symbol not correctly shown

4 visualizaciones (últimos 30 días)
Hi all,
I want to embed a Smith Chart (using smithplot) in my Latex Document. Therefore I set the default text, legend and tick label interpreter to latex.
set(0,'defaulttextinterpreter','latex')
set(0,'defaultAxesTickLabelInterpreter','latex');
set(0,'defaultLegendInterpreter','latex');
My problem is, that the infinity symbol is not drawn correctly, as shown in the image below.
The cause of this behaviour seems to be, that Matlab plots the infinity sign in latex mode as \infty, but it should be $\infty$. I didn't find a way to change the axes tick label for smithplot. This doesn't work as for an usual graph. Actually, I don't even need the infinity sign in my plot, so if anybody knows how to remove it, any help would be appreciated.
Thanks for your help,
Alex

Respuesta aceptada

Martijn Hoogelander
Martijn Hoogelander el 9 de Dic. de 2020
Hi Alexander,
After struggling with the same issue I have found a solution.
The problem lies in the following two things:
  1. The object associated with the Smith plot does not contain a handle to customize the tick labels
  2. The HandleVisibility property of the object corresponding to the '\infty' string is set to 'off', meaning you cannot access this object using the usual functions like get, gca, indObj, etc.
To resolve this, first add the following lines to your code:
r=groot;
r.ShowHiddenHandles = 1;
The groot object is the object on top of the hierarchy of all of your figures. Setting the ShowHiddenHandles property to 1 is equivalent to setting the HandleVisibility of all objects to 'on'.
Then, after generating your Smith chart, you can look for the object containing the '\infty' string and changing the string to '$\infty$'. Although not a very elegant solution, the following piece of code does achieve this:
figure;
smithplot(data);
smith = gca;
for i = 1:length(smith.Children)
if(strcmp(smith.Children(i).Tag, 'CircleTicks1'))
if(strcmp(smith.Children(i).String, '\infty'))
smith.Children(i).String = '$\infty$';
end
end
end
Note that I first look for the Children tagged with the 'CircleTicks1' string before looking for the 'infty' string. This is necessary as not all Children of the Axes object (such as the Lines) contain a String property.
How do you know you need the Objects of interest is equipped with the 'CircleTicks1' tag?
  1. After generating your Smith chart, click on Edit -> Axes Properties...
  2. A pop-up window appears, then click on the 'infty'string in your plot
  3. Scroll down to Identifiers and you will see that the object with the 'infty' string tagged with 'CircleTicks1'.
In the Parent/Child category above Identifiers, you can also find the HandleVisibility property.
I hope this helps.
Kind regards,
Martijn

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by