使用 matlab2tikz 進行 3D 圖形的軸對齊

使用 matlab2tikz 進行 3D 圖形的軸對齊

我試圖將多個 3D 圖形(在 matlab 中建立)包含到乳膠檔案中。

Matlab 中的原始 3D 圖形如下所示:

在此輸入影像描述

在創建這些數字的 .m 檔案中,我使用

ylabel('transformed W_t/D_t','VerticalAlignment','bottom')   
xlabel('\lambda_t','VerticalAlignment','bottom')

將 xlabel 和 ylabel 向上移動。

然後我用

 matlab2tikz('figure2a_2.tikz', 'height', '\figureheight', 'width', '\figurewidth','extraAxisOptions','zticklabel style={/pgf/number format/fixed}')

將檔案轉換為 .tikz 檔案。

在乳膠中,我跑

\documentclass[11pt]{article}
\usepackage{pgfplots, pgfplotstable}
\begin{document}
\begin{figure}[!htb]
\centering 
\newlength\figureheight 
\newlength\figurewidth 
\setlength\figureheight{5cm} 
\setlength\figurewidth{6cm}  
\input{Figure2a_2.tikz}
 \caption{{\bf Structure of model: capital can be invested in a bank sector and an equity sector.} An intermediary has the expertise to reallocate capital between the sectors and to monitor bank capital against bank crashes.}
\label{fig1} 
\end{figure}
\end{document}

並得到下圖: 在此輸入影像描述

問題是現在 xlabel 和 ylabel 距離 3d 圖太遠,我想將它們向上移動一點。這可行嗎?是否有一些選項值可以傳遞到matlab2tikz命令中?或者也許pgfplots在 .tex 檔案中編寫一些全域規範?

我已經嘗試解決這個問題幾個小時了,但沒有任何效果。非常感謝您的幫忙!

注意:我無法直接在 Latex 中使用繪圖,tikzpicture因為原始資料檔案需要許多操作,而我更喜歡在 matlab 中進行繪圖。

答案1

我已經弄清楚了這一點,只需使用:

 matlab2tikz('figure2a_2.tikz', 'height', '\figureheight', 'width', '\figurewidth','extraAxisOptions','zticklabel style={/pgf/number format/fixed},ylabel style={yshift=0.9em}');

進行轉換並有

\pgfplotsset{scaled z ticks=false}

在 .tex 檔案設定中。謝謝。

相關內容