1
$\begingroup$

I'm a beginner. I've read a book about Mathematica and thought, I had learned a lot, but apparently…

I have a list with pairs of numbers like so, assigned to a variable "list":

   list = {{1, 1}, {2, 1}, {3, 2}, {4, 2}, {5, 4}, {6, 2}, {7, 6}}

How can I plot this list, when the first number of each pair is x, the second is y? It could look something like this:

enter image description here

Any help is greatly appreciated. Thank you.

$\endgroup$
11
  • 1
    $\begingroup$ You can use ListPlot $\endgroup$ Commented Sep 4, 2017 at 15:08
  • 1
    $\begingroup$ How did you create the plot that you are showing? $\endgroup$
    – Szabolcs
    Commented Sep 4, 2017 at 15:14
  • 1
    $\begingroup$ @Szabolcs DiscretePlot[EulerPhi[x], {x, 1, 7}] -- but it seems, DiscretePlot doesn't work on lists. $\endgroup$ Commented Sep 4, 2017 at 15:15
  • 1
    $\begingroup$ ListPlot[{{1, 1}, {2, 1}, {3, 2}, {4, 2}, {5, 4}, {6, 2}, {7, 6}}, Filling -> Axis] $\endgroup$ Commented Sep 4, 2017 at 15:16
  • 1
    $\begingroup$ @MarianStiehler I do not know but you can answer the question $\endgroup$ Commented Sep 4, 2017 at 15:21

1 Answer 1

2
$\begingroup$

Emad kareems solution worked just fine for me:

ListPlot[{{1, 1}, {2, 1}, {3, 2}, {4, 2}, {5, 4}, {6, 2}, {7, 6}}, Filling -> Axis]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.