# Plotting two graphs together and doing manipulation

**URL:** <https://community.wolfram.com/t/plotting-two-graphs-together-and-doing-manipulation/13825>\
**Category:** Questions\
**Tags:** graphics-and-visualization\
**Created:** [March 22, 2019, 8:50pm UTC](https://community.wolfram.com/t/plotting-two-graphs-together-and-doing-manipulation/13825 "2019-03-22T20:50:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![camillus](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@camillus](https://community.wolfram.com/u/camillus)\
**Post date:** [March 22, 2019, 8:50pm UTC](https://community.wolfram.com/t/plotting-two-graphs-together-and-doing-manipulation/13825/1 "2019-03-22T20:50:22Z")

</div>

I need help in plotting two graphs together and doing some sort of manipulation.  
I have a sequence:

```
A=ListPlot[List, PlotRange -> {{0, 201}, {-0.01, 0.01}}]

```

, where

```
List=Table[a[n], {n, 200}] and a[n_]=(-1)^n/n^2

```

And I need two parallel lines which can be manipulated, so I have written sth like that, but I am not sure if it is correct:

```
B[z_] = Plot[{z,-z}, {x, 0, 200}, Filling -> {1 -> {2}}]

```

And I have written such a command to plot A and B and to be able to change values of ‘z’:

```
Manipulate[Show[A, B], {z, 0.000001, 0.02}]

```

But unfortunately, it doesn’t work. It drew only a Listplot and skipped B.  
Where did I make a mistake?

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [March 22, 2019, 9:51pm UTC](https://community.wolfram.com/t/plotting-two-graphs-together-and-doing-manipulation/13825/2 "2019-03-22T21:51:14Z")

</div>

Kamil,

There are several issues with the code. Study the difference between `=` and `:=` [here](https://reference.wolfram.com/language/tutorial/ImmediateAndDelayedDefinitions.html). Do not assign values to built-in symbols like [List](https://reference.wolfram.com/language/ref/List.html?q=List). It is best to start names with a lower case letter to avoid conflicts.

```
a[n_] := (-1)^n/n^2;

data = Table[a[n], {n, 200}];

plotA := ListPlot[data, PlotRange -> {{0, 201}, {-0.01, 0.01}}]

plotB[z_] := Plot[{z, -z}, {x, 0, 200}, Filling -> {1 -> {2}}]

Manipulate[Show[plotA, plotB[z]], {z, 0.000001, 0.02}]

```

 ![2716plot.png](https://global.discourse-cdn.com/wolfram/original/3X/f/0/f0372ece2e391aff44509b67f89472a2b937fc48.png)

---

<div class="post-metadata">

**Author:** ![camillus](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@camillus](https://community.wolfram.com/u/camillus)\
**Post date:** [March 22, 2019, 10:15pm UTC](https://community.wolfram.com/t/plotting-two-graphs-together-and-doing-manipulation/13825/3 "2019-03-22T22:15:02Z")

</div>

Thank you very much for your help 🙂
