embellishing_a_plot/quickref.tex
changeset 328 9ab73cbdd5a8
parent 235 80e4016d747a
equal deleted inserted replaced
327:28a54b57049d 328:9ab73cbdd5a8
     1 Creating a tuple:\\
     1 Plot with a specific color. Ex: RED :\\
     2 {\ex \lstinline|    t = (1, "hello", 2.5)|}
     2 {\ex \lstinline|    plot(x, f(x), "r")|}
     3 
     3 
     4 Accessing elements of tuples:\\
     4 Plot with a specific style. Ex: DASHED :\\
     5 {\ex \lstinline|    t[index] Ex: t[2]|}
     5 {\ex \lstinline|    plot(x, f(x), "--")|}
     6 
     6 
     7 Accessing slices of tuples:\\
     7 Plot with specific color and style. Ex: RED DASHED :\\
     8 {\ex \lstinline|    t[start:stop:step]|}
     8 {\ex \lstinline|    plot(x, f(x), "r--")|}
     9 
     9 
    10 Swapping values:\\
    10 Plot with a specific line thickness:\\
    11 {\ex \lstinline|    a, b = b, a|}
    11 {\ex \lstinline|    plot(x, f(x), linewidth=3)|}
       
    12 
       
    13 Adding title:\\
       
    14 {\ex \lstinline|    title("Plot of sin(x)")|}
       
    15 
       
    16 labelling the axes:\\
       
    17 {\ex \lstinline|    xlabel("x")|}
       
    18 {\ex \lstinline|    ylabel("f(x)")|}
       
    19 
       
    20 Adding annotations:\\
       
    21 {\ex \lstinline|    annotate("localmax", xy=(1, 2))|}
       
    22 
       
    23 Using LaTeX typesetting on any text:\\
       
    24 {\ex \lstinline|    title("Plot of $sin(x)$")|}
       
    25 
       
    26 Getting the axes limits:\\
       
    27 {\ex \lstinline|    xlim()|}
       
    28 {\ex \lstinline|    ylim()|}
       
    29 
       
    30 Setting the axes limits:\\
       
    31 {\ex \lstinline|    xlim(x_min, x_max)|}
       
    32 {\ex \lstinline|    ylim(y_min, y_max)|}
       
    33 
       
    34