# Mathematica - Plot two 2D graphs with different command in one figure

1. Jan 26, 2010

### sugaku

Good day to all,

1) I find difficulty on putting two 2D graphs into one figure. If same command it is easy to do but i have different commands, the commands are listlineplot and plot.

ListLinePlot[{{0,0},{1/8,16/257},{2/8,12272/66049},{3/8,5201936/16974593},{4/8,1842434032/4362470401},{5/8,596058685456/1121154893057},{6/8,182299004202992/288136807515649},{7/8,53603412027842576/74051159531521793},{1,15297073205596295152/
19031147999601100801}}]

Plot[Sin[t],{t,0,1}]

2) Actually i prefer above listlineplot graph to be like a block pulse graph, i coulnd't find a command to plot that kind of graph.

I do appreciate if someone out there could advice me on these matters.

thanks and best regards...

2. Jan 27, 2010

### Hepth

perhaps this :

Code (Text):
data = {{0, 0}, {1/8, 16/257}, {2/8, 12272/66049}, {3/8,
5201936/16974593}, {4/8, 1842434032/4362470401}, {5/8,
596058685456/1121154893057}, {6/8,
182299004202992/288136807515649}, {7/8,
53603412027842576/74051159531521793}, {1,
15297073205596295152/19031147999601100801}};
a = Graphics[{EdgeForm[Black], Gray,
Table[{Rectangle[{data[[i - 1, 1]], 0}, {data[[i, 1]],
data[[i, 2]]}]}, {i, 2, Length[data]}]},
Frame -> True];
b = Plot[Sin[t], {t, 0, 1}];
Show[a, b, PlotRange -> {{0, 1}, {0, 1}}]

Basically I created a table of rectangles [xmin,ymin][xmax,ymax] using your data and overlayed it with the plot (Thats what Show is for, multiple graphics at once)

3. Jan 27, 2010

### sugaku

Good day, thank you Hepth, it works. I will figure out how can ListLinePlot data can be visualize as block pulse graph. If I use Matlab the data simply will visualize as block pulse graph.

thank you again.