使用情节内的子情节来放大情节!

使用情节内的子情节来放大情节!

我如何才能产生图中所示的这种缩放效果?这里再次绘制选定部分,新轴显示更多细节,而不仅仅是放大该部分。一种解决方案是在节点中生成单独的轴,然后再次绘制选定部分,就像在https://tex.stackexchange.com/a/42591/24167。但是,这种方法需要为新轴再次输入绘图点,这可能并不简单,并且如果复制和粘贴整个数据块,则在逐点绘制数据时,tikz 文件大小可能会显著增加。

使用tikz spy放大的部分,线宽增加,没有添加绘图细节。我想重新绘制选择,以便在放大的区域中获得更多波形细节。

是否有任何代码/包可用,具有类似的且易于使用的功能,可以tikz spy产生这种类型的缩放?

在此处输入图片描述

编辑: 梅威瑟:

\documentclass[]{article}

\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=newest}
\usepgfplotslibrary{units}
\usetikzlibrary{spy,backgrounds}
\usepackage{pgfplotstable}
\begin{document}


\begin{tikzpicture}

\begin{axis}
\addplot [
color=blue,
solid,
forget plot
]
coordinates {(1,-0.483783330986617)(2,-0.0340145593918096)(3,-0.436539522180039)(4,0.209777110368882)(5,0.859135420044728)(6,0.85161903717295)(7,1.55934912950599)(8,0.784047156239403)(9,-0.0792693910524122)(10,1.51723070777856)(11,1.40411965889846)(12,0.698986700228326)(13,1.05260397767063)(14,1.29723031913342)(15,1.15137784963834)(16,1.27812037219483)(17,0.946578586782951)(18,0.958318150506974)(19,0.981535539332581)(20,0.593435037539142)(21,1.43239361416853)(22,0.811029077471436)(23,1.02029755131029)(24,0.333489727091801)(25,0.168378017112723)(26,0.479114471344012)(27,0.326271147058235)(28,0.812917677609558)(29,0.481674812959686)(30,0.357325779724704)(31,-0.536395105252668)(32,-0.445451666510484)(33,-0.0769251588562435)(34,-0.394692291260873)(35,0.165251968372529)(36,0.0939410842571161)(37,-0.76215521666867)(38,-0.261803650146044)(39,-0.129586204410865)(40,-0.62840840652669)(41,-0.168924127696477)(42,-0.446602448770101)(43,-0.83052384153562)(44,-0.600880793103123)(45,-0.899767313148666)(46,-1.15964786754054)(47,-0.856539763806029)(48,-0.981675541618192)(49,-1.12830507985998)(50,-0.25051644785583)(51,-0.837305455241527)(52,0.208696378227061)(53,-0.950733595562766)(54,-0.54704626678199)(55,-0.0724920603515025)(56,0.46042541141183)(57,-0.42925983026122)(58,-0.78070557085291)(59,-0.0525245718275866)(60,-0.807376579142401)(61,-0.291700808122719)(62,0.0256573658235369)(63,0.612635303598783)(64,0.691405814766423)(65,0.204095429463616)(66,0.681113889563989)(67,0.276337752630281)(68,0.758563305598775)(69,1.34455733980387)(70,0.719690442645654)(71,0.608754456948268)(72,0.593653952861215)(73,1.13702517285714)(74,1.43362358662853)(75,1.78827195551751)(76,0.989537985806528)(77,1.05338260108987)(78,0.745460649186608)(79,1.64373793892591)(80,0.959178756948547)(81,0.780594953512541)(82,1.81442687142266)(83,1.22612427626548)(84,1.14113602979919)(85,0.396258658838045)(86,0.907991743167006)(87,0.871026667132155)(88,0.148019385955106)(89,0.410703075736867)(90,0.250149774622082)(91,0.530242048517334)(92,-0.179895231545825)(93,0.560065131748798)(94,0.738725310101912)(95,-0.196652928509654)(96,-0.177805433820475)(97,-0.069106615796877)(98,0.114821666222169)(99,-0.24872880189583)(100,-0.38520267397054)

};
\coordinate (pt) at (axis cs:30,0.7);
\end{axis}


\node[pin=10:{%
    \begin{tikzpicture}[trim axis left,trim axis right]
    \begin{axis}[
      xmin=27,xmax=30,
      ymin=0.6,ymax=0.7,
      line join=round,
      enlargelimits,width = 4cm
    ]
\addplot [
color=blue,
solid,
forget plot
]
coordinates{
 (1,-0.483783330986617)(2,-0.0340145593918096)(3,-0.436539522180039)(4,0.209777110368882)(5,0.859135420044728)(6,0.85161903717295)(7,1.55934912950599)(8,0.784047156239403)(9,-0.0792693910524122)(10,1.51723070777856)(11,1.40411965889846)(12,0.698986700228326)(13,1.05260397767063)(14,1.29723031913342)(15,1.15137784963834)(16,1.27812037219483)(17,0.946578586782951)(18,0.958318150506974)(19,0.981535539332581)(20,0.593435037539142)(21,1.43239361416853)(22,0.811029077471436)(23,1.02029755131029)(24,0.333489727091801)(25,0.168378017112723)(26,0.479114471344012)(27,0.326271147058235)(28,0.812917677609558)(29,0.481674812959686)(30,0.357325779724704)(31,-0.536395105252668)(32,-0.445451666510484)(33,-0.0769251588562435)(34,-0.394692291260873)(35,0.165251968372529)(36,0.0939410842571161)(37,-0.76215521666867)(38,-0.261803650146044)(39,-0.129586204410865)(40,-0.62840840652669)(41,-0.168924127696477)(42,-0.446602448770101)(43,-0.83052384153562)(44,-0.600880793103123)(45,-0.899767313148666)(46,-1.15964786754054)(47,-0.856539763806029)(48,-0.981675541618192)(49,-1.12830507985998)(50,-0.25051644785583)(51,-0.837305455241527)(52,0.208696378227061)(53,-0.950733595562766)(54,-0.54704626678199)(55,-0.0724920603515025)(56,0.46042541141183)(57,-0.42925983026122)(58,-0.78070557085291)(59,-0.0525245718275866)(60,-0.807376579142401)(61,-0.291700808122719)(62,0.0256573658235369)(63,0.612635303598783)(64,0.691405814766423)(65,0.204095429463616)(66,0.681113889563989)(67,0.276337752630281)(68,0.758563305598775)(69,1.34455733980387)(70,0.719690442645654)(71,0.608754456948268)(72,0.593653952861215)(73,1.13702517285714)(74,1.43362358662853)(75,1.78827195551751)(76,0.989537985806528)(77,1.05338260108987)(78,0.745460649186608)(79,1.64373793892591)(80,0.959178756948547)(81,0.780594953512541)(82,1.81442687142266)(83,1.22612427626548)(84,1.14113602979919)(85,0.396258658838045)(86,0.907991743167006)(87,0.871026667132155)(88,0.148019385955106)(89,0.410703075736867)(90,0.250149774622082)(91,0.530242048517334)(92,-0.179895231545825)(93,0.560065131748798)(94,0.738725310101912)(95,-0.196652928509654)(96,-0.177805433820475)(97,-0.069106615796877)(98,0.114821666222169)(99,-0.24872880189583)(100,-0.38520267397054)
  };  
    \end{axis}
    \end{tikzpicture}%
}] at (pt) {};
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

我可以确认 Pgfplots 只允许生成可能重叠的多个轴,就像您在示例中所做的那样。

简化语法开销的一种方法是定义一些宏,重新生成图及其所有样式选项和坐标。

请注意,即使如果pgfplots 会提供一些“子图”操作,它会做同样的事情。这意味着 pdf 文件的大小将和你尝试的一样大。

如果您认为 pgfplots 应该提供这样的功能,您可以在 sourceforge 上发布功能请求。就我个人而言,我并不完全确定我是否理解功能范围,即它应该做什么和不应该做什么。因此,如果您想发布功能请求,请详细说明这些细节。

相关内容