matlab2tikz generates empty tikz-File when creating polarplot
9 次查看(过去 30 天)
显示 更早的评论
Hallo all,
since several month I'm working with matlab2tikz and made good experiences. Right now, im trying to do a polarplot and convert it into a tikz-File to include it in Latex. The problem is, that matlab2tikz generates an empty tikz-File when creating a polarplot (see minimum example code). Does anyone have an idea how to solve the problem?
Kind regards
- Minimum example code, that does not work:
clear all
close all
theta = 0:0.01:2*pi;
rho = sin(2*theta).*cos(2*theta);
polarplot(theta,rho)
matlab2tikz('C:\Users\Name\Desktop\Polarplot.tikz', 'height', '5cm', 'width', '5cm');
- The file Polarplot.tikz without content looks like that:
% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
% http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
\begin{tikzpicture}
\end{tikzpicture}%
- The output from the matlab-console loosk like that:
*** (To disable info messages, pass ['showInfo', false] to matlab2tikz.)
*** (For all other options, type 'help matlab2tikz'.)
***
***
*** This is matlab2tikz v1.1.0.
***
*** The latest developments can be retrieved from our development branch.
*** You can find more documentation on our GitHub page and wiki.
*** If you encounter bugs or want a new feature, go to our issue tracker.
*** Please visit FileExchange to rate matlab2tikz or download the stable release.
***
*** You will need pgfplots version 1.3 or newer to compile the TikZ output.
0 个评论
回答(1 个)
Rohit
2023-3-21
The issue here is that when using the "polarplot" function in MATLAB, it generates a specific type of "PolarAxes" object that is not compatible with "matlab2tikz", resulting in the object not being translated properly.
However, there is a workaround possible: instead of using "polarplot", one can use the older "polar" syntax. "polar" creates a regular "Axes" object, which is then customized to resemble a polar plot.
Refer to below documentation links for these functions-
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!