瀏覽代碼

fixed axis problem

Martin Thoma 13 年之前
父節點
當前提交
8a1b5b74ca
共有 1 個文件被更改,包括 33 次插入49 次删除
  1. 33 49
      tikz/sin(1:x)/sin(1:x).tex

+ 33 - 49
tikz/sin(1:x)/sin(1:x).tex

@@ -1,50 +1,34 @@
-    \documentclass{article}
-    \usepackage[pdftex,active,tightpage]{preview}
-    \setlength\PreviewBorder{2mm}
-      
-    \usepackage{pgfplots}
-    \usepackage{tikz}
-    \usetikzlibrary{arrows, positioning, calc, intersections}
-     
-    \begin{document}
+\documentclass{article}
+\usepackage[pdftex,active,tightpage]{preview}
+\setlength\PreviewBorder{2mm}
 
 
-    \begin{preview}
-    \begin{tikzpicture}
-        \begin{axis}[
-        axis x line=middle,
-        axis y line=middle,
-            width=15cm, height=15cm,     % size of the image
-            grid = major,
-            grid style={dashed, gray!30},
-            %xmode=log,log basis x=10, % <- doesn't work:
-            % ! Missing number, treated as zero.
-            % <to be read again> 
-            %                    p
-            % l.33 ..., red, thick,samples=500] {sin(deg(1/x))};
-            %                                                   
-            % ? 
-            % ! Emergency stop.
-            % <to be read again> 
-            %                    p
-            % l.33 ..., red, thick,samples=500] {sin(deg(1/x))};
-            %                                                   
-            % !  ==> Fatal error occurred, no output PDF file produced!
-            %ymode=log,log basis y=10,
-            xmin=-0.7000, % start the diagram at this x-coordinate
-            xmax=-0.0062, % end   the diagram at this x-coordinate
-            ymin=-1,      % start the diagram at this y-coordinate
-            ymax= 1,      % end   the diagram at this y-coordinate
-            axis background/.style={fill=white},
-            ylabel=y,
-            xlabel=x,
-            %xticklabels={,,},
-            %yticklabels={,,},
-            tick align=outside,
-            tension=0.08,
-            legend style={at={(0.1,0.95)}, anchor=north} ]
-          \addplot[domain=-0.700:-0.0062, red, thick,samples=500] {sin(deg(1/x))};
-            \legend{$\sin(\frac{1}{x})$}
-        \end{axis} 
-    \end{tikzpicture}
-    \end{preview}
-    \end{document}
+\usepackage{pgfplots}
+\usepackage{tikz}
+\usetikzlibrary{arrows, positioning, calc}
+
+\begin{document}
+\begin{preview}
+
+\begin{tikzpicture}
+    \begin{axis}[
+        %axis lines=middle,
+        xmode=log, % Logarithmic x axis
+        xmin=0.01, xmax=1, % Positive domain...
+        xticklabel=\pgfmathparse{exp(\tick)}\pgfmathprintnumber{\pgfmathresult},
+        xticklabel style={/pgf/number format/.cd,fixed}, % Use fixed point notation
+        width=15cm, height=8cm,     % size of the image
+        grid = major,
+        grid style={gray!30},
+        ymin=-1,      % start the diagram at this y-coordinate
+        ymax= 1,      % end   the diagram at this y-coordinate
+        axis background/.style={fill=white},
+        ylabel=y,
+        xlabel=x,
+        legend style={at={(0.9,0.95)}, anchor=north}
+     ]
+      \addplot[domain=0.01:1, red, thick,samples=2000] {-sin(deg(1/(x)))};
+      \legend{$\sin(\frac{1}{x})$}
+    \end{axis} 
+\end{tikzpicture}
+\end{preview}
+\end{document}