I have a question about creating an excel chart with two Y axes. Suppose I have the following data:           Horizontal Axis    Primary Vertical Axis    Secondary Vertical Axis Series 1     1                    0.5                         5.7              2                    0.2                         6.3              3                    0.3                         6.2              4                    0.8                         4.8              5                    0.4                         4.2  Series 2     1                    0.3                         5.1              2                    0.5                         7.2              3                    0.2                         6.4              4                    0.6                         6.1              5                    0.4                         4.9   I want to create a scatter plot with two lines from the data above, where the primary vertical axis data is read on the left side of the graph and the secondary vertical axis data is read on the right.   The only information I have found is how to insert entirely new series' for the information that will be read from the secondary axis, but this is not what I want to do. If I did that I would end up with 4 lines on the chart (2 for the primary axis and 2 for the secondary axis). Instead, I only want to have 2 lines on the chart that read from both the primary and secondary vertical axis at the same time. In other words, each line should be plotted as having two independent variables (one for each vertical axis).  Thanks
123968
How do you make a scatter graph with 2 Y axis (one on the left and one on the right)? I have 2 scatter graphs that I want to combine. I need to have 2 lines, both lines have the same dependent variable but have their own independent variable. Click the link "graph" below to get an idea of what I'm looking for.  (I'm using google sheets but I can also find a computer with Excel if needed)
48389
I'm trying to get two separate lists of figures. Ones are the figures containing some plots created using tikzpicture like:  \begin{figure}   \begin{tikzpicture}     \begin{axis}     ...     \end{axis}   \end{tikzpicture} \end{figure}   and the others are simple images. At result I need to have List of Figures and a List of Plots. How can I achieve it? Please give an example if possible.
106031
I'm doing a school project and I need to create a graph like this one. I created the graph but dont know how the add the vertical dashed red lines...        \begin{tikzpicture}[&gt;=latex]     \begin{axis}[             axis lines = middle,             xlabel = $t$,             ylabel = {$x(t)$},             xtick={-50,-40,...,50},             ytick={-2,-1,...,2},             xmin=-50.5,             xmax=50.5,             ymin=-2.5,             ymax=2.5,             width=155mm,             height=70mm,         ]         \addplot[             scatter,             domain=-50:50,             samples=120,             color=blue,         ]         {sin(180*x/12)+cos(180*x/8)};         \addplot[             only marks,             domain=-50:50,             samples=120,             color=red         ]         {sin(180*x/12)+cos(180*x/8)};     \end{axis} \end{tikzpicture}   This is the code that I have created and the graph.
38776
I'm making a ybar graph (vertical bars) where the y axis maximum reaches 150+, but a lot of values are 0's. I would like the final graph would not show a minimum bar in this 0 values, since we this values it can easily be mistaken with a low value (1,2, etc).  My code:   \documentclass{article}  % ---------------------------------- tikz  \usepackage{pgfplots}          % to print charts \pgfplotsset{compat=1.8}  \begin{document}  \begin{figure}   \centering   \begin{tikzpicture}     \begin{axis} [       % general       ybar,       scale only axis,       height=0.5\textwidth,       width=1.2\textwidth,       ylabel={# Dots},       nodes near coords,       xlabel={Variation},       xticklabel style={         rotate=90,         anchor=east,       },       enlarge x limits={abs value={3}},       ]       \addplot table [         x=grade,         y=value,       ] { grade   value -11 0 -10 0 -9  0 -8  0 -7  0 -6  0 -5  3 -4  1 -3  2 -2  15 -1  11 0   179 1   8 2   1 3   0 4   1 5   2 6   0 7   0 8   0 9   0 10  0 11  0       };     \end{axis}   \end{tikzpicture} \end{figure} \end{document}   My graph:
100410
How to configure axis on pgfplots? Similar for this.  \documentclass{article} \usepackage{tikz,pgfplots} \pagestyle{empty} \begin{document} \begin{tikzpicture}[&gt;=latex] %x axis \draw[-&gt;] (-5,0) -- (5,0) node[below] {$x$}; \foreach \x in {-4,...,-1,1,2,...,4} \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$}; %y axis \draw[-&gt;] (0,-5) -- (0,5) node[left] {$y$}; \foreach \y in {-4,...,-1,1,2,...,4} \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$}; \node[below left] at (0,0) {\footnotesize $0$}; \end{tikzpicture} \end{document}
89393
The following code is compiled by pgfplots to graph an exponential function and its inverse. I have some questions about the code, and I would like to modify some of the features of the graphs.  How is pgfplots instructed to draw grid lines 5 units apart? Why is the graph of the exponential function between the vertical lines x=-5 and x=3.8, I guess?  Why is the graph of the line y=x between the vertical lines x=-5 and x=5?  Why does the label for the logarithmic function interfere with the graph of the logarithmic function?  I would like the numbers on the axes to be in white nodes - so that the grid lines are not drawn over them.  The grid lines are drawn too high and too far to the right. I would like either the grid lines to be drawn a bit shorter or the axes to be drawn a bit longer.  The domain of the exponential function (that is graphed) should be from -6 to 4, and the domain of the linear function should be from -6 to 16.  \documentclass[10pt]{amsart} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings} \usepackage{tkz-euclide} \usetkzobj{all} \usepackage{pgfplots} \pgfplotsset{compat=1.11}    \begin{document} \begin{tikzpicture} \begin{axis}[grid=both,           xmax=18,ymax=17,           axis lines=middle,           restrict y to domain=-7:17,           enlargelimits] \addplot[dashed]{x} node[fill=white, above, right]{$y=x$}; \addplot[green]  {pow(2,x)} node[fill=white, above, right]{$y=2^x$}; \addplot[blue,domain=1/2^6:16,samples=100]  {log2(x)} node[fill=white, below] {$y=\log_2(x)$}; \end{axis} \end{tikzpicture}  \end{document}
98873
In pgfplots is it possible to have several plots in one datafile?  The goal is to add about 20 plots, which has different number of points and not the same x-value, to the same axis. (app. 350 points)    One posible solution is to have the plots in separate column, and then use loads of 'nan' because of the different x values:      x  p1   p2  P3  ...     1  3    nan nan ...     2  nan  5   nan ...     6  4    8   nan ...     8  7    nan nan ...     ...   I do not like this solution:o(    The  solution is nice: the different plots are separated in the datafile by two newlines, and they are selected by 'index'. Does something similar exist in pgfplots? or any other solution?
82361
Hello I have a Problem with the alignment of the y-axis in TikZ! The y-axis of the last plot isn't aligned to the other two plots! trim axis left doesn't work! Can somebody help me? Thanks!  \documentclass[svgnames,a4paper,ngerman,fontsize=12pt]{scrreprt} \usepackage{tikz} \usetikzlibrary{arrows} \usepackage{pgfplots}  \begin{document} \begin{figure}[!h]\centering  \begin{tikzpicture}[xscale=8,yscale=5] \draw [-&gt;, thick] (0,0) -- (0,0.5)node[left]{$U,I$}; \draw [-&gt;, thick] (0,0) -- (1.1,0)node[below]{$t$};  \draw [blue, ultra thick, rounded corners] (0,0.3)--(0.1,0.3)--(0.15,0.22)--(0.2,0.22)--(0.22,0.02)--(0.8,0.02)--(0.85,0.4)--(0.88,0.3)--(1,0.3)node[above,blue]{$u(t)$}; \draw [red, ultra thick, rounded corners] (0,0)--(0.1,0)--(0.18,0.4)--(0.2,0.3)--(0.83,0.3)--(0.85,0.0)--(1,0.0)node[above,red]{$i(t)$}; \end{tikzpicture}  \begin{tikzpicture}[xscale=8,yscale=5] \draw [-&gt;, thick] (0,0) -- (0,0.5)node[left]{$P$}; \draw [-&gt;, thick] (0,0) -- (1.1,0)node[below]{$t$};  \draw [orange, ultra thick, rounded corners] (0,0)--(0.1,0)--(0.15,0.4)--(0.22,0.05)--(0.8,0.05)--(0.85,0.3)--(0.9,0.0)--(1.0,0.0);  \end{tikzpicture} \begin{tikzpicture}[xscale=8,yscale=5] \draw [-&gt;, thick] (0,0) -- (0,0.5)node[left]{$E$}; \draw [-&gt;, thick] (0,0) -- (1.1,0)node[below]{$t$};  \draw[purple, ultra thick, rounded corners] (0,0)--(0.1,0)--(0.2,0.2)--(0.8,0.3)--(0.9,0.4)--(1,0.4); \draw[thick](0.1,-0.01)--(0.1,0.01); \draw[thick](0.2,-0.01)--(0.2,0.01); \draw (0.15,0)node[below]{$E_{on}$}; \draw[thick](0.8,-0.01)--(0.8,0.01); \draw[thick](0.9,-0.01)--(0.9,0.01); \draw (0.85,0)node[below]{$E_{off}$}; \draw[decorate,thick,decoration={brace, mirror}] (0.2,-0.01)--node[below]{xxx}(0.8,-0.01) ;  \end{tikzpicture} \caption{Plot}\label{fig:PvIGBT} \end{figure} \end{document}
108841
I have the data in 001.csv below that I want to plot. I need two plots: one showing the data and another one showing logarithmic regression. I have no problems plotting the line for the data (and also adding a linear regression line) but I just can't manage to get a logarithmic regression line in there. As far as I understand, I need to use gnuplot for this but unfortunately I can't make it work. Any help would be much much appreciated.  Cheers,  Cem  %%%%%%%%%%%%%%%%%%%%%% %This is my data:  \begin{filecontents}{001.csv}     1990 275     1991 187     1992 249     1993 177     1994 212     1995 303     1996 323     1997 364     1998 461     1999 427     2000 683     2001 553     2002 571     2003 682     2004 585     2005 608     2006 609     2007 643     2008 719     2009 545 \end{filecontents}  %%%%%%%%%%%%%%%%%%%%%% %This is my plot for the data:  \begin{tikzpicture} \begin{axis}[     axis on top=false, axis x line=middle, axis y line=middle,     xlabel={\footnotesize Year},     ylabel={\footnotesize Frequency count},     xmin=1975, xmax=2009,     ymin=0, ymax=900,     xtick={1980,1985,1990,1995,2000,2005,2009},     ytick={0,100,200,300,400,500,600,700,800},     legend pos=north east,     legend style={font=\fontsize{6}{5}\selectfont},     ymajorgrids=true,     xmajorgrids=true,     grid style=dashed,     /pgf/number format/.cd,     1000 sep={}     ]  \addplot[     smooth,tension=0.9,color=blue,mark=diamond         ] table {001.csv};  %Somewhere here I need a logarithmic regression line.  \end{axis} \end{tikzpicture}  %%%%%%%%%%%%%%%%%%%%%%
72997
I have the following code:  \begin{tikzpicture}     \begin{axis}    [         axis lines = {center},         width = {0.6\linewidth},         ylabel = {$y$},         xlabel = {$x$},         ytick distance = {2},         minor y tick num = {1}         ]      \addplot    [                 mark = none, domain= -3:4                 ]                 {abs(x)}; \end{axis} \end{tikzpicture}   That produces the following image, notice close to x=0that there's a strange "break" on the function's plot. What could be the cause? How do I get rid of that?    I noticed the problem also happens if I use a function with conditions say:  {x&lt;0 ? -x+5 : x-2};  On the area near x=0 a weird break happens.
2112
A chart with data in the range of 200,000 and small difference between max and min values, will be assigned a 10^5 multiplier to the entire axis. This results in the ticks becoming meaningless, since all become 2.   Example:-  \begin{tikzpicture} \begin{axis}   \addplot coordinates {   (100,200001)   (200,200003)   (300,200005)   };     \end{axis} \end{tikzpicture}   When this is plotted the y-axis has 5 ticks, all of which are 2. The y-axis has a multiplier of 10^5. This has effectively removed all information from the graph.  I may use the below to set the explicit value of the tick values but this does not implement change in the display "style" of the axis ticks.  ytick = {200000, 200005, 200010}   I have also tried increasing the precision of the tick label to 5. However this only results in the graph showing labels such as 2.00000, 2.00005, 2.00010 with a 10^5 axis multiplier.  yticklabel style={precision = 5,}   My question is "How do I remove/change this 10^5 multiplier, such that the y-axis ticks are displayed in the form 200000, 200005, 200010.
38530
Learning special relativity and working with Minkowski diagrams for a while now i am still trying to get my head around some oddity.   From my understanding time can often be seen as the dependent variable in those diagrams, so why put it to the vertical axis? What confuses me even more is the apparent convention to denote a point in space time $(t,x)$ even though $x$ is on the horizontal and $t$ is on the vertical axis, so the usual notation would be to refer to that vector as $(x, t)$.  Are there mostly historical reasons or why is it beneficial to use this notation and to violate usual conventions?
34187
I've two one column data files (A.txt and B.txt). To plot them together first I load dataA with  \pgfplotstableset{ create on use/dataA/.style={create col/copy column from table={A.txt}{0}} }   Then I put them together with  \begin{figure}[ht!] \begin{tikzpicture} \begin{axis}     \addplot table [x =dataA,y index=0,y expr=\thisrowno{0}*-1] {B.txt}; \end{axis} \end{tikzpicture} \end{figure}   I've no problem to change the sign of the data from B.txt as so can see above.... BUT:  How to do if I want to change the sign from the loaded table dataA??   Has anybody got a helpful idea or minimal example?  EDIT: A minimal example could look like this:  \documentclass{article} \usepackage{pgfplots, pgfplotstable} \usepackage{filecontents} \begin{filecontents}{A.txt} 2 3 4 5 3 5 \end{filecontents} \begin{filecontents}{B.txt} 5 4 3 2 5 5 \end{filecontents}  \pgfplotstableset{     create on use/dataA/.style={create col/copy column from table={A.txt}{0}} } \begin{document} \begin{tikzpicture} \begin{axis} \addplot table [x=dataA , y index=0 , y expr=\thisrowno{0}*-1] {B.txt}; \end{axis} \end{tikzpicture} \end{document}   The task is to change the sign in my figure environment of my 'dataA'.
115226
I have a file in the following format:  1043481872 1043481872 1043481872 1043481872 1043481873 1043481873 1043481873 1043481873 1043481874 1043481874 1043481874 1043481875   My question now boils down to a simple graph where the X axis is the unique values in the table and the Y axis would be the number of values of each of them. Eg 1043481874 would be x axis and 3 would be Y axis. If anyone could tell me how to write a bash script to plot this, it would be very helpful
110331
Please behold this MWE (compat is at 1.13, so by default the coordinates are in axis cs:):   \documentclass[border=10pt]{standalone} \usepackage{tikz} \usepackage{pgfplots}\pgfplotsset{compat=1.13} \begin{document}  \begin{tikzpicture}[     ]      \begin{axis}[         xmin=0, xmax=1500,            ymin=60, ymax=100,         axis y line* = right,         axis x line = none,         clip mode = individual,     ]         %\addplot [domain=0:1500] {97-x/150};         \addplot [domain=0:1500] {x/15};         \draw [green, &lt;-] (600, 93) -- ++(0,-1.5);         \draw [red,  &lt;-] (600, 93) -- (600, 93-1.5);     \end{axis} \end{tikzpicture} \end{document}   The two draw commands executes perfectly and they give the same arrow, so you really see just one:    If you now comment out the \addplot and use the previous one, i.e, like this:       \addplot [domain=0:1500] {97-x/150};     %\addplot [domain=0:1500] {x/15};   the relative coordinates \draw goes astray:     Where is my fault? Is that relative movements are not supposed to work in axis cs:? Why it depends on the previous plot?
33478
I'm trying to create a chart to compare the overlap of dates. Sort of a timeline with a bar chart that starts on the Onset Date and ends at the Offset date for each category.  I have included sample data below. For this data, I would have 5 bar charts going horizontal with dates on the X-axis. The Y-axis can be the Category type.  Been playing around with line and bar charts in excel but they just are not right. Any suggestions would be great!  Category    Onset     Offset B1        12/1/2014   3/1/2015 B2        10/1/2014   1/1/2015 B3        5/1/2014    1/1/2015 B4        6/1/2014    8/1/2014 B5        6/1/2014    10/1/2014
6157
I have monthly data, and I want to show ticks for, say, each quarter. Thus, instead of showing 12 ticks per year, I want to show 4. There is a very similar post , but the solution is to write the coordinates manually. That is not helpful for me, since my dataset is long. I have tried using the xtick={0,4,...,100} option, but that doesn't skip dates (see plot below).   My MWE is:  \documentclass[12pt]{article} \usepackage{graphicx} \usepackage{pgfplots,tikz} \RequirePackage{filecontents}  \begin{filecontents}{Data1.csv} Period,spot jun 15,1.93 jul 15,2.12 aug 15,2.23 sep 15,1.81 oct 15,1.76 nov 15,1.18 dec 15,1.12 jan 16,1.05 feb 16,1 mar 16,0.9 apr 16,0.75 may 16,1 jun 16,1.15  \end{filecontents}  \begin{document}  \begin{figure}     \centering     \pgfplotsset{table/col sep = comma}     \begin{tikzpicture}         \begin{axis}[             xticklabels from table={Data1.csv}{Period},             xtick={0,2,...,12},             enlarge x limits=0.02,             width=16cm,             height=8cm,             xticklabel style={rotate=45},             ]             \addplot+[smooth] table [x expr=\coordindex, y=spot, col sep = comma] {Data1.csv};         \end{axis}     \end{tikzpicture} \end{figure}  \end{document}